From: <kr_...@us...> - 2003-08-16 10:32:52
|
Update of /cvsroot/htoolkit/gio/src/Graphics/UI/GIO In directory sc8-pr-cvs1:/tmp/cvs-serv3981/gio/src/Graphics/UI/GIO Modified Files: ToolBar.hs Log Message: Added support for ToolRadioButton Index: ToolBar.hs =================================================================== RCS file: /cvsroot/htoolkit/gio/src/Graphics/UI/GIO/ToolBar.hs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ToolBar.hs 8 Jul 2003 20:36:26 -0000 1.1 --- ToolBar.hs 16 Aug 2003 09:59:41 -0000 1.2 *************** *** 17,20 **** --- 17,21 ---- , ToolButton, toolButtonAt, toolButton , ToolCheckButton, toolCheckButtonAt, toolCheckButton + , ToolRadioButton, toolRadioButtonAt, toolRadioButton, setToolRadioGroup , ToolLine, toolLineAt, toolLine , DockPlace(..) *************** *** 125,128 **** --- 126,174 ---- destroyWidget t = Lib.destroyToolItem (hcheck t) destroy = newEvent (Lib.getToolDestroyHandler . hcheck) (Lib.setToolDestroyHandler . hcheck) (Lib.setToolDestroyDefHandler . hcheck) + + -------------------------------------------------------------------- + -- ToolRadioButton + -------------------------------------------------------------------- + + data ToolRadioButton = ToolRadioButton {hradio :: ToolHandle} + + toolRadioButtonAt :: Maybe Int -> [Prop ToolRadioButton] -> ToolBar -> IO ToolRadioButton + toolRadioButtonAt pos props (ToolBar hwnd) = do + btn <- do hbtn <- Lib.insertToolRadioButton hwnd pos + return (ToolRadioButton hbtn) + set btn props + return btn + + toolRadioButton :: [Prop ToolRadioButton] -> ToolBar -> IO ToolRadioButton + toolRadioButton = toolRadioButtonAt Nothing + + instance Able ToolRadioButton where + enabled = newAttr (Lib.getToolButtonEnabled . hradio) (Lib.setToolButtonEnabled . hradio) + + instance Commanding ToolRadioButton where + command = + newEvent (Lib.getToolCommandHandler . hradio) (Lib.setToolCommandHandler . hradio) (Lib.setToolCommandDefHandler . hradio) + + instance HasIcon ToolRadioButton where + icon = newAttr (Lib.getToolButtonBitmap . hradio) (Lib.setToolButtonBitmap . hradio) + + instance Positioned ToolRadioButton where + pos = readAttr "pos" (Lib.getToolItemPos . hradio) + + instance ToolTip ToolRadioButton where + tooltip = newAttr (Lib.getToolButtonTip . hradio) (Lib.setToolButtonTip . hradio) + + instance Titled ToolRadioButton where + title = newAttr (Lib.getToolButtonText . hradio) (Lib.setToolButtonText . hradio) + + instance Checked ToolRadioButton where + checked = newAttr (Lib.getToolButtonChecked . hradio) (Lib.setToolButtonChecked . hradio) + + 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) -------------------------------------------------------------------- |