From: Duncan C. <dun...@us...> - 2004-08-03 02:59:04
|
Update of /cvsroot/gtk2hs/gtk2hs/gtk/buttons In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29523/gtk/buttons Modified Files: ToggleButton.chs RadioButton.chs Log Message: Add missing functions. Also tidy up documentation a bit. Exclude deprecated and internal radio_menu_item and toolbar functions. Index: RadioButton.chs =================================================================== RCS file: /cvsroot/gtk2hs/gtk2hs/gtk/buttons/RadioButton.chs,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- RadioButton.chs 23 May 2004 15:48:35 -0000 1.5 +++ RadioButton.chs 3 Aug 2004 02:58:25 -0000 1.6 @@ -41,8 +41,15 @@ castToRadioButton, radioButtonNew, radioButtonNewWithLabel, + radioButtonNewWithMnemonic, radioButtonNewJoinGroup, - radioButtonNewJoinGroupWithLabel + radioButtonNewJoinGroupWithLabel, + radioButtonNewJoinGroupWithMnemonic, + + -- * Compatibilty aliases + radioButtonNewFromWidget, + radioButtonNewWithLabelFromWidget, + radioButtonNewWithMnemonicFromWidget ) where import Monad (liftM) @@ -56,23 +63,29 @@ -- methods --- | Create a new RadioButton widget with a new --- group. +-- | Create a new RadioButton widget with a new group. -- radioButtonNew :: IO RadioButton radioButtonNew = makeNewObject mkRadioButton $ liftM castPtr $ {#call unsafe radio_button_new#} nullPtr --- | Like 'RadioButton' but shows a --- label to the right of the button. +-- | Like 'radioButtonNew' but shows a label to the right of the button. -- radioButtonNewWithLabel :: String -> IO RadioButton radioButtonNewWithLabel lbl = withUTFString lbl $ \strPtr -> makeNewObject mkRadioButton $ liftM castPtr $ {#call unsafe radio_button_new_with_label#} nullPtr strPtr --- | Creates a new RadioButton and attaches it --- to the group of another radio button. +-- | Like 'radioButtonNew' but shows a label to the right of the button. +-- Underscores in the label string indicate the mnemonic for the menu item. +-- +radioButtonNewWithMnemonic :: String -> IO RadioButton +radioButtonNewWithMnemonic lbl = withUTFString lbl $ \strPtr -> + makeNewObject mkRadioButton $ liftM castPtr $ + {#call unsafe radio_button_new_with_mnemonic#} nullPtr strPtr + +-- | Creates a new RadioButton and attaches it to the group of another radio +-- button. -- -- * This function corresponds to gtk_radio_button_new_from_widget. The new -- name makes more sense because we do not handle any other grouping @@ -82,11 +95,27 @@ radioButtonNewJoinGroup rb = makeNewObject mkRadioButton $ liftM castPtr $ {#call radio_button_new_from_widget#} rb --- | Create a new RadioButton with a --- label and group. +-- | Create a new RadioButton with a label and group. -- radioButtonNewJoinGroupWithLabel :: RadioButton -> String -> IO RadioButton radioButtonNewJoinGroupWithLabel rb lbl = withUTFString lbl $ \strPtr -> makeNewObject mkRadioButton $ liftM castPtr $ {#call radio_button_new_with_label_from_widget#} rb strPtr +-- | Create a new RadioButton with a label and group. Underscores in the label +-- string indicate the mnemonic for the menu item. +-- +radioButtonNewJoinGroupWithMnemonic :: RadioButton -> String -> IO RadioButton +radioButtonNewJoinGroupWithMnemonic rb lbl = withUTFString lbl $ \strPtr -> + makeNewObject mkRadioButton $ liftM castPtr $ + {#call radio_button_new_with_mnemonic_from_widget#} rb strPtr + + +-- | Alias for 'radioButtonNewJoinGroup'. +radioButtonNewFromWidget = radioButtonNewJoinGroup + +-- | Alias for 'radioButtonNewJoinGroupWithLabel'. +radioButtonNewWithLabelFromWidget = radioButtonNewJoinGroupWithLabel + +-- | Alias for 'radioButtonNewJoinGroupWithMnemonic'. +radioButtonNewWithMnemonicFromWidget = radioButtonNewJoinGroupWithMnemonic Index: ToggleButton.chs =================================================================== RCS file: /cvsroot/gtk2hs/gtk2hs/gtk/buttons/ToggleButton.chs,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- ToggleButton.chs 23 May 2004 15:48:35 -0000 1.4 +++ ToggleButton.chs 3 Aug 2004 02:58:25 -0000 1.5 @@ -31,7 +31,9 @@ castToToggleButton, toggleButtonNew, toggleButtonNewWithLabel, + toggleButtonNewWithMnemonic, toggleButtonSetMode, + toggleButtonGetMode, toggleButtonToggled, toggleButtonGetActive, toggleButtonSetActive, @@ -59,50 +61,63 @@ {#call unsafe toggle_button_new#} --- | Create a toggleButton with a label in it. +-- | Create a ToggleButton with a label in it. -- toggleButtonNewWithLabel :: String -> IO ToggleButton toggleButtonNewWithLabel lbl = withUTFString lbl (\strPtr -> makeNewObject mkToggleButton $ liftM castPtr $ {#call unsafe toggle_button_new_with_label#} strPtr) +-- | Create a ToggleButton with a label in it. Underscores in label indicate the +-- mnemonic for the button. +-- +toggleButtonNewWithMnemonic :: String -> IO ToggleButton +toggleButtonNewWithMnemonic lbl = withUTFString lbl (\strPtr -> + makeNewObject mkToggleButton $ liftM castPtr $ + {#call unsafe toggle_button_new_with_mnemonic#} strPtr) --- | Determines whether or not the toggle button is --- drawn on screen. Set to True of the button should be invisible. +-- | Sets whether the button is displayed as a separate indicator and label. +-- You can call this function on a "CheckButton" or a "RadioButton" with @False@ +-- to make the button look like a normal button. -- toggleButtonSetMode :: ToggleButtonClass tb => tb -> Bool -> IO () -toggleButtonSetMode tb invisible = - {#call toggle_button_set_mode#} (toToggleButton tb) (fromBool invisible) +toggleButtonSetMode tb mode = + {#call toggle_button_set_mode#} (toToggleButton tb) (fromBool mode) --- | Emit the 'toggled' signal on the --- button. +-- | Retrieves whether the button is displayed as a separate indicator and +-- label. +-- +toggleButtonGetMode :: ToggleButtonClass tb => tb -> IO Bool +toggleButtonGetMode tb = + liftM toBool $ {#call unsafe toggle_button_get_mode#} (toToggleButton tb) + +-- | Emit the 'toggled' signal on the button. -- toggleButtonToggled :: ToggleButtonClass tb => tb -> IO () toggleButtonToggled tb = {#call toggle_button_toggled#} (toToggleButton tb) --- | Retrieve the current state of the button. --- Returns True if the button is depressed. +-- | Retrieve the current state of the button. Returns True if the button is +-- depressed. -- toggleButtonGetActive :: ToggleButtonClass tb => tb -> IO Bool toggleButtonGetActive tb = liftM toBool $ {#call unsafe toggle_button_get_active#} (toToggleButton tb) --- Sets the state of the ToggleButton. True means the button should be --- depressed. (EXPOTED) +-- | Sets the state of the ToggleButton. True means the button should be +-- depressed. -- toggleButtonSetActive :: ToggleButtonClass tb => Bool -> tb -> IO () toggleButtonSetActive active tb = {#call toggle_button_set_active#} (toToggleButton tb) (fromBool active) --- | Retrieve the inconsistent flag of the --- button. An inconsistent state only visually affects the button. It will be --- displayed in an \"in-between\" state. +-- | Retrieve the inconsistent flag of the button. An inconsistent state only +-- visually affects the button. It will be displayed in an \"in-between\" state. -- toggleButtonGetInconsistent :: ToggleButtonClass tb => tb -> IO Bool toggleButtonGetInconsistent tb = liftM toBool $ {#call unsafe toggle_button_get_inconsistent#} (toToggleButton tb) --- Sets the inconsistent flag of the ToggleButton. (EXPOTED) +-- | Sets the inconsistent flag of the ToggleButton. -- toggleButtonSetInconsistent :: ToggleButtonClass tb => Bool -> tb -> IO () toggleButtonSetInconsistent incon tb = @@ -111,8 +126,7 @@ -- signals --- | Whenever the state of the button is changed, the --- toggled signal is emitted. +-- | Whenever the state of the button is changed, the toggled signal is emitted. -- onToggled, afterToggled :: ButtonClass b => b -> IO () -> IO (ConnectId b) onToggled = connect_NONE__NONE "toggled" False |