From: Duncan C. <dun...@us...> - 2005-03-13 19:35:13
|
Update of /cvsroot/gtk2hs/gtk2hs/gtk/Graphics/UI/Gtk/Buttons In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30354/gtk/Graphics/UI/Gtk/Buttons Modified Files: Button.chs.pp ToggleButton.chs Log Message: Add properties. For the first round, just the easy properties that are implemented in terms of existing getter/setter functions and where there are no issues with NULL/Maybe types. Add Attributes file to glib package and modify Makefile.am accordingly. Index: Button.chs.pp =================================================================== RCS file: /cvsroot/gtk2hs/gtk2hs/gtk/Graphics/UI/Gtk/Buttons/Button.chs.pp,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- Button.chs.pp 25 Feb 2005 01:11:32 -0000 1.3 +++ Button.chs.pp 13 Mar 2005 19:34:32 -0000 1.4 @@ -85,6 +85,12 @@ buttonGetAlignment, #endif +-- * Properties + buttonUseUnderline, + buttonUseStock, + buttonFocusOnClick, + buttonRelief, + -- * Signals onButtonActivate, afterButtonActivate, @@ -104,6 +110,7 @@ import System.Glib.FFI import System.Glib.UTFString +import System.Glib.Attributes (Attr(..)) import Graphics.UI.Gtk.Abstract.Object (makeNewObject) {#import Graphics.UI.Gtk.Types#} {#import Graphics.UI.Gtk.Signals#} @@ -119,7 +126,6 @@ buttonNew :: IO Button buttonNew = makeNewObject mkButton $ liftM castPtr {#call unsafe button_new#} - -- | Create a button with a label in it. -- buttonNewWithLabel :: String -> IO Button @@ -271,6 +277,47 @@ #endif -------------------- +-- Properties + +-- | If set, an underline in the text indicates the next character should be +-- used for the mnemonic accelerator key. +-- +-- Default value: @False@ +-- +buttonUseUnderline :: Attr Button Bool +buttonUseUnderline = Attr + buttonGetUseUnderline + buttonSetUseUnderline + +-- | If set, the label is used to pick a stock item instead of being +-- displayed. +-- +-- Default value: @False@ +-- +buttonUseStock :: Attr Button Bool +buttonUseStock = Attr + buttonGetUseStock + buttonSetUseStock + +-- | Whether the button grabs focus when it is clicked with the mouse. +-- +-- Default value: @True@ +-- +buttonFocusOnClick :: Attr Button Bool +buttonFocusOnClick = Attr + buttonGetFocusOnClick + buttonSetFocusOnClick + +-- | The border relief style. +-- +-- Default value: 'ReliefNormal' +-- +buttonRelief :: Attr Button ReliefStyle +buttonRelief = Attr + buttonGetRelief + buttonSetRelief + +-------------------- -- Signals -- | The button has been depressed (but not Index: ToggleButton.chs =================================================================== RCS file: /cvsroot/gtk2hs/gtk2hs/gtk/Graphics/UI/Gtk/Buttons/ToggleButton.chs,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- ToggleButton.chs 25 Feb 2005 01:11:32 -0000 1.3 +++ ToggleButton.chs 13 Mar 2005 19:34:32 -0000 1.4 @@ -75,6 +75,11 @@ toggleButtonGetInconsistent, toggleButtonSetInconsistent, +-- * Properties + toggleButtonActive, + toggleButtonInconsistent, + toggleButtonMode, + -- * Signals onToggled, afterToggled @@ -84,6 +89,7 @@ import System.Glib.FFI import System.Glib.UTFString +import System.Glib.Attributes (Attr(..)) import Graphics.UI.Gtk.Abstract.Object (makeNewObject) {#import Graphics.UI.Gtk.Types#} {#import Graphics.UI.Gtk.Signals#} @@ -148,8 +154,8 @@ -- | Sets the state of the ToggleButton. True means the button should be -- depressed. -- -toggleButtonSetActive :: ToggleButtonClass tb => Bool -> tb -> IO () -toggleButtonSetActive active tb = +toggleButtonSetActive :: ToggleButtonClass tb => tb -> Bool -> IO () +toggleButtonSetActive tb active = {#call toggle_button_set_active#} (toToggleButton tb) (fromBool active) -- | Retrieve the inconsistent flag of the button. An inconsistent state only @@ -161,11 +167,39 @@ -- | Sets the inconsistent flag of the ToggleButton. -- -toggleButtonSetInconsistent :: ToggleButtonClass tb => Bool -> tb -> IO () -toggleButtonSetInconsistent incon tb = +toggleButtonSetInconsistent :: ToggleButtonClass tb => tb -> Bool -> IO () +toggleButtonSetInconsistent tb incon = {#call toggle_button_set_inconsistent#} (toToggleButton tb) (fromBool incon) -------------------- +-- Properties + +-- | If the toggle button should be pressed in or not. +-- +-- Default value: @False@ +-- +toggleButtonActive :: Attr ToggleButton Bool +toggleButtonActive = Attr + toggleButtonGetActive + toggleButtonSetActive + +-- | If the toggle button is in an \"in between\" state. +-- +-- Default value: @False@ +-- +toggleButtonInconsistent :: Attr ToggleButton Bool +toggleButtonInconsistent = Attr + toggleButtonGetInconsistent + toggleButtonSetInconsistent + +-- | \'mode\' property. See 'toggleButtonGetMode' and 'toggleButtonSetMode' +-- +toggleButtonMode :: Attr ToggleButton Bool +toggleButtonMode = Attr + toggleButtonGetMode + toggleButtonSetMode + +-------------------- -- Signals -- | Whenever the state of the button is changed, the toggled signal is emitted. |