started referencing ui widgets by id via hashmap, WIP, does not compile

This commit is contained in:
tpajenka
2014-04-23 13:08:18 +02:00
parent 8e59e10b86
commit a9a97f7544
4 changed files with 138 additions and 148 deletions

26
src/UI/UIOperations.hs Normal file
View File

@ -0,0 +1,26 @@
module UI.UIOperations where
import Data.HashMap.Strict
import UI.UIBaseData
import UI.UIClasses
defaultUIState :: UIButtonState
defaultUIState = UIButtonState False False False False False False
--TODO
-- |The function 'isInside' tests whether a point is inside the widget or any child.
-- A screen position may be inside the bounding box of a widget but not considered part of the component.
-- The function returns all hit widgets that have no hit children or 'Nothing' if the point neither hits any
-- component nor the parent widget itself.
isInside :: ScreenUnit -- ^screen x coordinate
-> ScreenUnit -- ^screen y coordinate
-> UIId -- ^the parent widget
-> [UIId]
isInside x' y' wg =
case isInsideSelf x' y' wg of -- test inside parent's bounding box
False -> []
True -> case concat $ map (isInside x' y') (getChildren wg) of
[] -> [toGUIAny wg]
l -> l
--TODO: Priority queue?