From: Duncan C. <dun...@us...> - 2004-07-30 16:39:04
|
Update of /cvsroot/gtk2hs/gtk2hs/gtk/menuComboToolbar In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10993/gtk/menuComboToolbar Modified Files: CheckMenuItem.chs Log Message: added missing functions, or functions that were new in gtk-2.4 removed a function that is no longer needed from general/Structs.hsc Index: CheckMenuItem.chs =================================================================== RCS file: /cvsroot/gtk2hs/gtk2hs/gtk/menuComboToolbar/CheckMenuItem.chs,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- CheckMenuItem.chs 23 May 2004 16:05:21 -0000 1.6 +++ CheckMenuItem.chs 30 Jul 2004 16:38:54 -0000 1.7 @@ -1,3 +1,4 @@ +{-# OPTIONS -cpp #-} -- -*-haskell-*- -- GIMP Toolkit (GTK) Widget CheckMenuItem -- @@ -23,16 +24,22 @@ -- -- This widget implements a 'MenuItem' with a check next to it. -- +#include <gtk/gtkversion.h> module CheckMenuItem( CheckMenuItem, CheckMenuItemClass, checkMenuItemNew, checkMenuItemNewWithLabel, + checkMenuItemNewWithMnemonic, checkMenuItemSetActive, checkMenuItemGetActive, checkMenuItemSetInconsistent, checkMenuItemGetInconsistent +#if GTK_CHECK_VERSION(2,4,0) + ,checkMenuItemGetDrawAsRadio, + checkMenuItemSetDrawAsRadio +#endif ) where import Monad (liftM) @@ -41,47 +48,70 @@ import Object (makeNewObject) {#import Hierarchy#} {#import Signal#} -import Structs (checkMenuItemGetActive) {#context lib="gtk" prefix="gtk" #} -- methods --- | Create a new 'MenuItem' with a check --- next to it. +-- | Create a new 'MenuItem' with a check next to it. -- checkMenuItemNew :: IO CheckMenuItem checkMenuItemNew = makeNewObject mkCheckMenuItem $ liftM castPtr $ {#call unsafe check_menu_item_new#} --- | Create a new 'CheckMenuItem' --- with a 'Label' inside. +-- | Create a new 'CheckMenuItem' with a 'Label' inside. -- checkMenuItemNewWithLabel :: String -> IO CheckMenuItem checkMenuItemNewWithLabel str = withUTFString str $ \strPtr -> makeNewObject mkCheckMenuItem $ liftM castPtr $ {#call unsafe check_menu_item_new_with_label#} strPtr +-- | Create a new 'CheckMenuItem' with a 'Label' inside. Underscores in the +-- label string indicate the mnemonic for the menu item. +-- +checkMenuItemNewWithMnemonic :: String -> IO CheckMenuItem +checkMenuItemNewWithMnemonic str = + withUTFString str $ \strPtr -> + makeNewObject mkCheckMenuItem $ liftM castPtr $ + {#call unsafe check_menu_item_new_with_mnemonic#} strPtr --- | Set the state of the menu item check. +-- | Sets the active state of the menu item's check box. -- checkMenuItemSetActive :: CheckMenuItemClass mi => mi -> Bool -> IO () checkMenuItemSetActive mi active = {#call check_menu_item_set_active#} (toCheckMenuItem mi) (fromBool active) --- | Set the state of the menu item check --- to \`inconsistent'. +-- | Returns whether the check menu item is active. +-- +checkMenuItemGetActive :: CheckMenuItemClass mi => mi -> IO Bool +checkMenuItemGetActive mi = + liftM toBool $ {#call unsafe check_menu_item_get_active#} (toCheckMenuItem mi) + +-- | Set the state of the menu item check to \`inconsistent'. -- checkMenuItemSetInconsistent :: CheckMenuItemClass mi => mi -> Bool -> IO () checkMenuItemSetInconsistent mi inconsistent = {#call check_menu_item_set_inconsistent#} (toCheckMenuItem mi) (fromBool inconsistent) --- | Query if the menu check is --- inconsistent (inbetween). +-- | Query if the menu check is inconsistent (inbetween). -- checkMenuItemGetInconsistent :: CheckMenuItemClass mi => mi -> IO Bool checkMenuItemGetInconsistent mi = liftM toBool $ {#call unsafe check_menu_item_get_inconsistent#} (toCheckMenuItem mi) +#if GTK_CHECK_VERSION(2,4,0) +-- | Sets whether the menu item is drawn like a 'RadioMenuItem'. +-- +checkMenuItemSetDrawAsRadio :: CheckMenuItemClass mi => mi -> Bool -> IO () +checkMenuItemSetDrawAsRadio mi asRadio = + {#call check_menu_item_set_draw_as_radio#} (toCheckMenuItem mi) + (fromBool asRadio) + +-- | Returns whether the menu item is drawn like a 'RadioMenuItem'. +-- +checkMenuItemGetDrawAsRadio :: CheckMenuItemClass mi => mi -> IO Bool +checkMenuItemGetDrawAsRadio mi = liftM toBool $ + {#call unsafe check_menu_item_get_draw_as_radio#} (toCheckMenuItem mi) +#endif |