From: Duncan C. <dun...@us...> - 2005-04-02 19:08:15
|
Update of /cvsroot/gtk2hs/gtk2hs/gtk/Graphics/UI/Gtk/Buttons In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11862/gtk/Graphics/UI/Gtk/Buttons Modified Files: Button.chs.pp CheckButton.chs ToggleButton.chs RadioButton.chs Log Message: Minor changes. Attributes and casts. For RadioButton, code formatting changes. Index: RadioButton.chs =================================================================== RCS file: /cvsroot/gtk2hs/gtk2hs/gtk/Graphics/UI/Gtk/Buttons/RadioButton.chs,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- RadioButton.chs 25 Feb 2005 01:11:32 -0000 1.3 +++ RadioButton.chs 2 Apr 2005 19:08:01 -0000 1.4 @@ -30,10 +30,10 @@ -- Stability : provisional -- Portability : portable (depends on GHC) -- --- A choice from multiple check buttons. +-- A choice from multiple check buttons -- module Graphics.UI.Gtk.Buttons.RadioButton ( --- * Description +-- * Detail -- -- | A single radio button performs the same basic function as a -- 'CheckButton', as its position in the object hierarchy reflects. It is only @@ -97,23 +97,34 @@ -- | Create a new RadioButton widget with a new group. -- radioButtonNew :: IO RadioButton -radioButtonNew = makeNewObject mkRadioButton $ liftM castPtr $ - {#call unsafe radio_button_new#} nullPtr +radioButtonNew = + makeNewObject mkRadioButton $ + liftM (castPtr :: Ptr Widget -> Ptr RadioButton) $ + {# call unsafe radio_button_new #} + nullPtr -- | 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 +radioButtonNewWithLabel label = + makeNewObject mkRadioButton $ + liftM (castPtr :: Ptr Widget -> Ptr RadioButton) $ + withUTFString label $ \labelPtr -> + {# call unsafe radio_button_new_with_label #} + nullPtr + labelPtr -- | 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 +radioButtonNewWithMnemonic label = + makeNewObject mkRadioButton $ + liftM (castPtr :: Ptr Widget -> Ptr RadioButton) $ + withUTFString label $ \labelPtr -> + {# call unsafe radio_button_new_with_mnemonic #} + nullPtr + labelPtr -- | Creates a new RadioButton and attaches it to the group of another radio -- button. @@ -123,23 +134,34 @@ -- mechanism. -- radioButtonNewJoinGroup :: RadioButton -> IO RadioButton -radioButtonNewJoinGroup rb = makeNewObject mkRadioButton $ liftM castPtr $ - {#call radio_button_new_from_widget#} rb +radioButtonNewJoinGroup rb = + makeNewObject mkRadioButton $ + liftM (castPtr :: Ptr Widget -> Ptr RadioButton) $ + {# call radio_button_new_from_widget #} + rb -- | 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 +radioButtonNewJoinGroupWithLabel rb label = + makeNewObject mkRadioButton $ + liftM (castPtr :: Ptr Widget -> Ptr RadioButton) $ + withUTFString label $ \labelPtr -> + {# call radio_button_new_with_label_from_widget #} + rb + labelPtr -- | 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 +radioButtonNewJoinGroupWithMnemonic rb label = + makeNewObject mkRadioButton $ + liftM (castPtr :: Ptr Widget -> Ptr RadioButton) $ + withUTFString label $ \labelPtr -> + {# call radio_button_new_with_mnemonic_from_widget #} + rb + labelPtr -- | Alias for 'radioButtonNewJoinGroup'. Index: CheckButton.chs =================================================================== RCS file: /cvsroot/gtk2hs/gtk2hs/gtk/Graphics/UI/Gtk/Buttons/CheckButton.chs,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- CheckButton.chs 15 Mar 2005 19:47:47 -0000 1.4 +++ CheckButton.chs 2 Apr 2005 19:08:01 -0000 1.5 @@ -77,7 +77,8 @@ -- checkButtonNew :: IO CheckButton checkButtonNew = - makeNewObject mkCheckButton $ liftM castPtr $ + makeNewObject mkCheckButton $ + liftM (castPtr :: Ptr Widget -> Ptr CheckButton) $ {# call unsafe check_button_new #} -- | Creates a new 'CheckButton' with a 'Label' to the right of it. @@ -86,7 +87,8 @@ String -- ^ @label@ - the text for the check button. -> IO CheckButton checkButtonNewWithLabel label = - makeNewObject mkCheckButton $ liftM castPtr $ + makeNewObject mkCheckButton $ + liftM (castPtr :: Ptr Widget -> Ptr CheckButton) $ withUTFString label $ \labelPtr -> {# call unsafe check_button_new_with_label #} labelPtr @@ -100,7 +102,8 @@ -- in front of the mnemonic character -> IO CheckButton checkButtonNewWithMnemonic label = - makeNewObject mkCheckButton $ liftM castPtr $ + makeNewObject mkCheckButton $ + liftM (castPtr :: Ptr Widget -> Ptr CheckButton) $ withUTFString label $ \labelPtr -> {# call unsafe check_button_new_with_mnemonic #} labelPtr Index: ToggleButton.chs =================================================================== RCS file: /cvsroot/gtk2hs/gtk2hs/gtk/Graphics/UI/Gtk/Buttons/ToggleButton.chs,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- ToggleButton.chs 15 Mar 2005 19:47:47 -0000 1.5 +++ ToggleButton.chs 2 Apr 2005 19:08:01 -0000 1.6 @@ -104,7 +104,8 @@ -- toggleButtonNew :: IO ToggleButton toggleButtonNew = - makeNewObject mkToggleButton $ liftM castPtr $ + makeNewObject mkToggleButton $ + liftM (castPtr :: Ptr Widget -> Ptr ToggleButton) $ {# call unsafe toggle_button_new #} -- | Creates a new toggle button with a text label. @@ -114,7 +115,8 @@ -- placed in the toggle button. -> IO ToggleButton toggleButtonNewWithLabel label = - makeNewObject mkToggleButton $ liftM castPtr $ + makeNewObject mkToggleButton $ + liftM (castPtr :: Ptr Widget -> Ptr ToggleButton) $ withUTFString label $ \labelPtr -> {# call unsafe toggle_button_new_with_label #} labelPtr @@ -128,7 +130,8 @@ -- in front of the mnemonic character -> IO ToggleButton toggleButtonNewWithMnemonic label = - makeNewObject mkToggleButton $ liftM castPtr $ + makeNewObject mkToggleButton $ + liftM (castPtr :: Ptr Widget -> Ptr ToggleButton) $ withUTFString label $ \labelPtr -> {# call unsafe toggle_button_new_with_mnemonic #} labelPtr @@ -176,8 +179,7 @@ -- | Queries a 'ToggleButton' and returns its current state. Returns @True@ if -- the toggle button is pressed in and @False@ if it is raised. -- -toggleButtonGetActive :: ToggleButtonClass self => self - -> IO Bool +toggleButtonGetActive :: ToggleButtonClass self => self -> IO Bool toggleButtonGetActive self = liftM toBool $ {# call unsafe toggle_button_get_active #} @@ -229,7 +231,7 @@ -- -- Default value: @False@ -- -toggleButtonActive :: Attr ToggleButton Bool +toggleButtonActive :: ToggleButtonClass self => Attr self Bool toggleButtonActive = Attr toggleButtonGetActive toggleButtonSetActive @@ -238,14 +240,14 @@ -- -- Default value: @False@ -- -toggleButtonInconsistent :: Attr ToggleButton Bool +toggleButtonInconsistent :: ToggleButtonClass self => Attr self Bool toggleButtonInconsistent = Attr toggleButtonGetInconsistent toggleButtonSetInconsistent -- | \'mode\' property. See 'toggleButtonGetMode' and 'toggleButtonSetMode' -- -toggleButtonMode :: Attr ToggleButton Bool +toggleButtonMode :: ToggleButtonClass self => Attr self Bool toggleButtonMode = Attr toggleButtonGetMode toggleButtonSetMode Index: Button.chs.pp =================================================================== RCS file: /cvsroot/gtk2hs/gtk2hs/gtk/Graphics/UI/Gtk/Buttons/Button.chs.pp,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- Button.chs.pp 15 Mar 2005 19:47:31 -0000 1.5 +++ Button.chs.pp 2 Apr 2005 19:08:00 -0000 1.6 @@ -126,7 +126,8 @@ -- buttonNew :: IO Button buttonNew = - makeNewObject mkButton $ liftM castPtr $ + makeNewObject mkButton $ + liftM (castPtr :: Ptr Widget -> Ptr Button) $ {# call unsafe button_new #} -- | Creates a 'Button' widget with a 'Label' child containing the given text. @@ -135,7 +136,8 @@ String -- ^ @label@ - The text you want the 'Label' to hold. -> IO Button buttonNewWithLabel label = - makeNewObject mkButton $ liftM castPtr $ + makeNewObject mkButton $ + liftM (castPtr :: Ptr Widget -> Ptr Button) $ withUTFString label $ \labelPtr -> {# call unsafe button_new_with_label #} labelPtr @@ -151,7 +153,8 @@ -- front of the mnemonic character -> IO Button buttonNewWithMnemonic label = - makeNewObject mkButton $ liftM castPtr $ + makeNewObject mkButton $ + liftM (castPtr :: Ptr Widget -> Ptr Button) $ withUTFString label $ \labelPtr -> {# call unsafe button_new_with_mnemonic #} labelPtr @@ -165,7 +168,8 @@ String -- ^ @stockId@ - the name of the stock item -> IO Button buttonNewFromStock stockId = - makeNewObject mkButton $ liftM castPtr $ + makeNewObject mkButton $ + liftM (castPtr :: Ptr Widget -> Ptr Button) $ withUTFString stockId $ \stockIdPtr -> throwIfNull "buttonNewFromStock: Invalid stock identifier." $ {# call unsafe button_new_from_stock #} @@ -340,7 +344,7 @@ (toButton self) -- | Sets the alignment of the child. This has no effect unless the child --- derives from 'Misc' 'Aligment'. +-- derives from 'Misc' or 'Aligment'. -- -- * Available since Gtk version 2.4 -- @@ -361,7 +365,7 @@ -- * Available since Gtk version 2.4 -- buttonGetAlignment :: ButtonClass self => self - -> IO (Float, Float) -- ^ @(xalign,yalign)@ - horizontal and vertical + -> IO (Float, Float) -- ^ @(xalign, yalign)@ - horizontal and vertical -- alignment buttonGetAlignment self = alloca $ \xalignPtr -> @@ -383,7 +387,7 @@ -- -- Default value: @False@ -- -buttonUseUnderline :: Attr Button Bool +buttonUseUnderline :: ButtonClass self => Attr self Bool buttonUseUnderline = Attr buttonGetUseUnderline buttonSetUseUnderline @@ -393,7 +397,7 @@ -- -- Default value: @False@ -- -buttonUseStock :: Attr Button Bool +buttonUseStock :: ButtonClass self => Attr self Bool buttonUseStock = Attr buttonGetUseStock buttonSetUseStock @@ -402,7 +406,7 @@ -- -- Default value: @True@ -- -buttonFocusOnClick :: Attr Button Bool +buttonFocusOnClick :: ButtonClass self => Attr self Bool buttonFocusOnClick = Attr buttonGetFocusOnClick buttonSetFocusOnClick @@ -411,7 +415,7 @@ -- -- Default value: 'ReliefNormal' -- -buttonRelief :: Attr Button ReliefStyle +buttonRelief :: ButtonClass self => Attr self ReliefStyle buttonRelief = Attr buttonGetRelief buttonSetRelief |