From: <kr_...@us...> - 2003-08-17 18:15:12
|
Update of /cvsroot/htoolkit/gio/src/Graphics/UI/GIO In directory sc8-pr-cvs1:/tmp/cvs-serv6679/gio/src/Graphics/UI/GIO Modified Files: Menu.hs ToolBar.hs Log Message: Add support for ToolDropDownButton Index: Menu.hs =================================================================== RCS file: /cvsroot/htoolkit/gio/src/Graphics/UI/GIO/Menu.hs,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** Menu.hs 17 Aug 2003 16:45:07 -0000 1.11 --- Menu.hs 17 Aug 2003 18:15:09 -0000 1.12 *************** *** 25,28 **** --- 25,30 ---- -- ** Menu separator , MenuLine, menulineAt, menuline + -- * internal + , hmenu ) where Index: ToolBar.hs =================================================================== RCS file: /cvsroot/htoolkit/gio/src/Graphics/UI/GIO/ToolBar.hs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** ToolBar.hs 16 Aug 2003 09:59:41 -0000 1.2 --- ToolBar.hs 17 Aug 2003 18:15:09 -0000 1.3 *************** *** 18,21 **** --- 18,22 ---- , ToolCheckButton, toolCheckButtonAt, toolCheckButton , ToolRadioButton, toolRadioButtonAt, toolRadioButton, setToolRadioGroup + , ToolDropDownButton, toolDropDownButtonAt, toolDropDownButton , ToolLine, toolLineAt, toolLine , DockPlace(..) *************** *** 25,28 **** --- 26,30 ---- import Graphics.UI.GIO.Events import Graphics.UI.GIO.Types + import Graphics.UI.GIO.Menu import qualified Graphics.UI.Port as Lib import Graphics.UI.Port(DockPlace(..)) *************** *** 167,174 **** instance Deadly ToolRadioButton where destroyWidget t = Lib.destroyToolItem (hradio t) ! destroy = newEvent (Lib.getToolDestroyHandler . hradio) (Lib.setToolDestroyHandler . hradio) (Lib.setToolDestroyDefHandler . hradio) setToolRadioGroup :: [ToolRadioButton] -> IO () setToolRadioGroup btns = Lib.setToolRadioGroup (map hradio btns) -------------------------------------------------------------------- --- 169,211 ---- instance Deadly ToolRadioButton where destroyWidget t = Lib.destroyToolItem (hradio t) ! destroy = newEvent (Lib.getToolDestroyHandler . hradio) (Lib.setToolDestroyHandler . hradio) (Lib.setToolDestroyDefHandler . hradio) setToolRadioGroup :: [ToolRadioButton] -> IO () setToolRadioGroup btns = Lib.setToolRadioGroup (map hradio btns) + + -------------------------------------------------------------------- + -- ToolDropDownButton + -------------------------------------------------------------------- + + data ToolDropDownButton = ToolDropDownButton {hdropdown :: ToolHandle} + + toolDropDownButtonAt :: Maybe Int -> Menu -> [Prop ToolDropDownButton] -> ToolBar -> IO ToolDropDownButton + toolDropDownButtonAt pos menu props (ToolBar hwnd) = do + btn <- do hbtn <- Lib.insertToolDropDownButton hwnd (hmenu menu) pos + return (ToolDropDownButton hbtn) + set btn props + return btn + + toolDropDownButton :: Menu -> [Prop ToolDropDownButton] -> ToolBar -> IO ToolDropDownButton + toolDropDownButton = toolDropDownButtonAt Nothing + + instance Able ToolDropDownButton where + enabled = newAttr (Lib.getToolButtonEnabled . hdropdown) (Lib.setToolButtonEnabled . hdropdown) + + instance HasIcon ToolDropDownButton where + icon = newAttr (Lib.getToolButtonBitmap . hdropdown) (Lib.setToolButtonBitmap . hdropdown) + + instance Positioned ToolDropDownButton where + pos = readAttr "pos" (Lib.getToolItemPos . hdropdown) + + instance ToolTip ToolDropDownButton where + tooltip = newAttr (Lib.getToolButtonTip . hdropdown) (Lib.setToolButtonTip . hdropdown) + + instance Titled ToolDropDownButton where + title = newAttr (Lib.getToolButtonText . hdropdown) (Lib.setToolButtonText . hdropdown) + + instance Deadly ToolDropDownButton where + destroyWidget t = Lib.destroyToolItem (hdropdown t) + destroy = newEvent (Lib.getToolDestroyHandler . hdropdown) (Lib.setToolDestroyHandler . hdropdown) (Lib.setToolDestroyDefHandler . hdropdown) -------------------------------------------------------------------- |