From: <kr_...@us...> - 2003-11-16 13:27:35
|
Update of /cvsroot/htoolkit/gio/src/Graphics/UI/GIO In directory sc8-pr-cvs1:/tmp/cvs-serv14763/src/Graphics/UI/GIO Modified Files: StatusBar.hs Types.hs Log Message: Added support for status bar indicators (Linux only). Index: StatusBar.hs =================================================================== RCS file: /cvsroot/htoolkit/gio/src/Graphics/UI/GIO/StatusBar.hs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** StatusBar.hs 16 Nov 2003 09:02:35 -0000 1.2 --- StatusBar.hs 16 Nov 2003 13:26:55 -0000 1.3 *************** *** 7,20 **** Stability : provisional Portability : portable ! Defines an API for status bar creation. A status bar is a horizontal band at the bottom of an application window ! in which the application can display various kinds of status information. -} ----------------------------------------------------------------------------------------- module Graphics.UI.GIO.StatusBar ! ( StatusBar, sb , pushStatusBarContext, popStatusBarContext, withStatus ) where --- 7,25 ---- Stability : provisional Portability : portable ! Defines an API for status bar creation. A status bar is a horizontal band at the bottom of an application window ! in which the application can display various kinds of status information. -} ----------------------------------------------------------------------------------------- module Graphics.UI.GIO.StatusBar ! ( -- * StatusBar ! StatusBar, sb , pushStatusBarContext, popStatusBarContext, withStatus + + -- * Indicator + , Indicator + , indicatorAt, indicator ) where *************** *** 22,25 **** --- 27,31 ---- import Graphics.UI.GIO.Types import Graphics.UI.GIO.Attributes + import Graphics.UI.GIO.Events import Control.Exception(bracket_) *************** *** 31,35 **** instance Visible StatusBar where visible = newAttr (\sb -> Lib.getStatusBarVisible) (\sb -> Lib.setStatusBarVisible) ! instance Titled StatusBar where title = newAttr (\sb -> Lib.getStatusBarTitle) (\sb -> Lib.setStatusBarTitle) --- 37,41 ---- instance Visible StatusBar where visible = newAttr (\sb -> Lib.getStatusBarVisible) (\sb -> Lib.setStatusBarVisible) ! instance Titled StatusBar where title = newAttr (\sb -> Lib.getStatusBarTitle) (\sb -> Lib.setStatusBarTitle) *************** *** 44,47 **** --- 50,54 ---- popStatusBarContext sb = Lib.popStatusBarContext + -- | Push a new status message onto the status bar stack and display it. withStatus :: StatusBar -> String -> IO a -> IO a withStatus sb title action = *************** *** 50,51 **** --- 57,89 ---- (popStatusBarContext sb) action + + + -------------------------------------------------------------------- + -- Status bar indicators + -------------------------------------------------------------------- + + newtype Indicator = Indicator IndicatorHandle + hindicator (Indicator h) = h + + indicatorAt :: Maybe Int -- ^ The position where to place the indicator or Nothing if you want to append it. + -> [Prop Indicator] -- ^ The setup of the indicator attributes + -> StatusBar -- ^ The statusbar (i.e. 'sb') + -> IO Indicator -- ^ The created indicator + indicatorAt pos props sb + = do ind <- do hindicator <- Lib.createIndicator pos + return (Indicator hindicator) + set ind props + return ind + + indicator :: [Prop Indicator] -> StatusBar -> IO Indicator + indicator = indicatorAt Nothing + + instance Titled Indicator where + title = newStdAttr hindicator Lib.getIndicatorTitle Lib.setIndicatorTitle + + instance Commanding Indicator where + command = newStdEvent hindicator Lib.getIndicatorCommandHandler Lib.setIndicatorCommandHandler Lib.setIndicatorCommandDefHandler + + instance Deadly Indicator where + destroyWidget m = Lib.destroyIndicator (hindicator m) + destroy = newStdEvent hindicator Lib.getIndicatorDestroyHandler Lib.setIndicatorDestroyHandler Lib.setIndicatorDestroyDefHandler Index: Types.hs =================================================================== RCS file: /cvsroot/htoolkit/gio/src/Graphics/UI/GIO/Types.hs,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** Types.hs 24 Aug 2003 19:02:45 -0000 1.17 --- Types.hs 16 Nov 2003 13:26:55 -0000 1.18 *************** *** 108,111 **** --- 108,112 ---- , MenuHandle , ToolHandle + , IndicatorHandle , FontHandle , BitmapHandle |