{-# LANGUAGE CPP, RankNTypes, UndecidableInstances, GADTs, TypeSynonymInstances, FlexibleInstances, MultiParamTypeClasses, FlexibleContexts, ScopedTypeVariables #-} {-# OPTIONS_GHC -fno-warn-orphans #-} module Graphics.UI.FLTK.LowLevel.Pack ( -- * Hierarchy -- -- $hierarchy -- * Widget Functions -- -- $functions ) where #include "Fl_ExportMacros.h" #include "Fl_Types.h" #include "Fl_PackC.h" import C2HS hiding (cFromEnum, cFromBool, cToBool,cToEnum) import Graphics.UI.FLTK.LowLevel.Fl_Enumerations import Graphics.UI.FLTK.LowLevel.Fl_Types import Graphics.UI.FLTK.LowLevel.Utils import Graphics.UI.FLTK.LowLevel.Dispatch import Graphics.UI.FLTK.LowLevel.Hierarchy {# fun Fl_Pack_draw as draw'' { id `Ptr ()' } -> `()' #} instance (impl ~ ( IO ())) => Op (Draw ()) Pack orig impl where runOp _ _ pack = withRef pack $ \packPtr -> draw'' packPtr {#fun Fl_Pack_handle as packHandle' { id `Ptr ()', id `CInt' } -> `Int' #} instance (impl ~ (Event -> IO (Either UnknownEvent ()))) => Op (Handle ()) Pack orig impl where runOp _ _ pack event = withRef pack (\p -> packHandle' p (fromIntegral . fromEnum $ event)) >>= return . successOrUnknownEvent {# fun Fl_Pack_show as show' { id `Ptr ()' } -> `()' #} instance (impl ~ ( IO ())) => Op (ShowWidget ()) Pack orig impl where runOp _ _ pack = withRef pack $ \packPtr -> show' packPtr {# fun Fl_Pack_hide as hide' { id `Ptr ()' } -> `()' #} instance (impl ~ ( IO ())) => Op (Hide ()) Pack orig impl where runOp _ _ pack = withRef pack $ \packPtr -> hide' packPtr {# fun Fl_Pack_resize as resize' { id `Ptr ()',`Int',`Int',`Int',`Int' } -> `()' supressWarningAboutRes #} instance (impl ~ (Rectangle -> IO ())) => Op (Resize ()) Pack orig impl where runOp _ _ pack rectangle = withRef pack $ \packPtr -> do let (x_pos,y_pos,w_pos,h_pos) = fromRectangle rectangle resize' packPtr x_pos y_pos w_pos h_pos -- $hierarchy -- @ -- "Graphics.UI.FLTK.LowLevel.Base.Widget" -- | -- v -- "Graphics.UI.FLTK.LowLevel.Base.Group" -- | -- v -- "Graphics.UI.FLTK.LowLevel.Base.Pack" -- | -- v -- "Graphics.UI.FLTK.LowLevel.Pack" -- @ -- $functions -- @ -- draw :: 'Ref' 'Pack' -> 'IO' () -- -- handle :: 'Ref' 'Pack' -> 'Event' -> 'IO' ('Either' 'UnknownEvent' ()) -- -- hide :: 'Ref' 'Pack' -> 'IO' () -- -- resize :: 'Ref' 'Pack' -> 'Rectangle' -> 'IO' () -- -- showWidget :: 'Ref' 'Pack' -> 'IO' () -- @