-- | If the items in the UIState module are the only state you need in your -- program, then it is sufficient to import this module and start with the -- defaultBasicState. -- -- [@Author@] Jeff Heard -- -- [@Copyright@] © 2008 Renaissance Computing Institute -- module Graphics.Rendering.Thingie.BasicUIState where import qualified Graphics.Rendering.Thingie.UIState as U import Graphics.Rendering.Thingie.Primitives import qualified Graphics.UI.Gtk as Gtk -- The most basic implementation of a UIState data BasicUIState = BasicUIState { mousePosition :: Point2D , mouseLeftButtonDown :: Bool , mouseRightButtonDown :: Bool , mouseMiddleButtonDown :: Bool , mouseWheel :: Int , keyCtrl :: Bool , keyShift :: Bool , keyAlt :: Bool , key :: U.Key , drawing :: Maybe Gtk.Widget , sizeX :: Double , sizeY :: Double } instance U.UIState BasicUIState where mousePosition = mousePosition mouseLeftButtonDown = mouseLeftButtonDown mouseRightButtonDown = mouseRightButtonDown mouseMiddleButtonDown = mouseMiddleButtonDown mouseWheel = mouseWheel keyCtrl = keyCtrl keyShift = keyShift keyAlt = keyAlt key = key drawing = drawing sizeX = sizeX sizeY = sizeY setMousePosition p a = a{ mousePosition = p } setMouseLeftButtonDown p a = a{ mouseLeftButtonDown = p } setMouseRightButtonDown p a = a{ mouseRightButtonDown = p } setMouseMiddleButtonDown p a = a{ mouseMiddleButtonDown = p } setMouseWheel p a = a{ mouseWheel = p } setKeyCtrl p a = a{ keyCtrl = p } setKeyShift p a = a{ keyShift = p } setKeyAlt p a = a{ keyAlt = p } setKey p a = a{ key = p } setDrawing p a = a{ drawing = p } setSizeX p a = a{ sizeX = p } setSizeY p a = a{ sizeY = p } -- This is the default state you should pass to the interactive function. defaultBasicUIState = BasicUIState (Point2D 0 0) False False False 0 False False False (U.Character '\0') Nothing 800 600