From: Duncan C. <dun...@us...> - 2005-03-13 19:35:13
|
Update of /cvsroot/gtk2hs/gtk2hs/gtk/Graphics/UI/Gtk/Abstract In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30354/gtk/Graphics/UI/Gtk/Abstract Modified Files: Box.chs ButtonBox.chs.pp Paned.chs.pp Range.chs Scale.chs Widget.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: Range.chs =================================================================== RCS file: /cvsroot/gtk2hs/gtk2hs/gtk/Graphics/UI/Gtk/Abstract/Range.chs,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- Range.chs 25 Feb 2005 22:53:41 -0000 1.4 +++ Range.chs 13 Mar 2005 19:34:32 -0000 1.5 @@ -66,6 +66,12 @@ rangeSetValue, rangeGetValue, +-- * Properties + rangeUpdatePolicy, + rangeAdjustment, + rangeInverted, + rangeValue, + -- * Signals onMoveSlider, afterMoveSlider @@ -74,6 +80,7 @@ import Monad (liftM) import System.Glib.FFI +import System.Glib.Attributes (Attr(..)) import Graphics.UI.Gtk.Abstract.Object (makeNewObject) {#import Graphics.UI.Gtk.Types#} {#import Graphics.UI.Gtk.Signals#} @@ -160,6 +167,41 @@ {#call range_set_range#} (toRange r) (realToFrac min) (realToFrac max) -------------------- +-- Properties + +-- | How the range should be updated on the screen. +-- +-- Default value: 'UpdateContinuous' +-- +rangeUpdatePolicy :: Attr Range UpdateType +rangeUpdatePolicy = Attr + rangeGetUpdatePolicy + rangeSetUpdatePolicy + +-- | The 'Adjustment' that contains the current value of this range object. +-- +rangeAdjustment :: Attr Range Adjustment +rangeAdjustment = Attr + rangeGetAdjustment + rangeSetAdjustment + +-- | Invert direction slider moves to increase range value. +-- +-- Default value: @False@ +-- +rangeInverted :: Attr Range Bool +rangeInverted = Attr + rangeGetInverted + rangeSetInverted + +-- | \'value\' property. See 'rangeGetValue' and 'rangeSetValue' +-- +rangeValue :: Attr Range Double +rangeValue = Attr + rangeGetValue + rangeSetValue + +-------------------- -- Signals -- | The slide has moved. The arguments give Index: ButtonBox.chs.pp =================================================================== RCS file: /cvsroot/gtk2hs/gtk2hs/gtk/Graphics/UI/Gtk/Abstract/ButtonBox.chs.pp,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- ButtonBox.chs.pp 25 Feb 2005 22:53:40 -0000 1.3 +++ ButtonBox.chs.pp 13 Mar 2005 19:34:32 -0000 1.4 @@ -70,13 +70,17 @@ buttonBoxSetLayout, buttonBoxSetChildSecondary, #if GTK_CHECK_VERSION(2,4,0) - buttonBoxGetChildSecondary + buttonBoxGetChildSecondary, #endif + +-- * Properties + buttonBoxLayout ) where import Monad (liftM) import System.Glib.FFI +import System.Glib.Attributes import Graphics.UI.Gtk.Abstract.Object (makeNewObject) {#import Graphics.UI.Gtk.Types#} {#import Graphics.UI.Gtk.Signals#} @@ -126,3 +130,16 @@ buttonBoxSetChildSecondary b w s = {#call gtk_button_box_set_child_secondary #} (toButtonBox b) (toWidget w) (fromBool s) + +-------------------- +-- Properties + +-- | How to layout the buttons in the box. Possible values are default, +-- spread, edge, start and end. +-- +-- Default value: 'ButtonboxDefaultStyle' +-- +buttonBoxLayout :: Attr ButtonBox ButtonBoxStyle +buttonBoxLayout = Attr + buttonBoxGetLayout + buttonBoxSetLayout Index: Box.chs =================================================================== RCS file: /cvsroot/gtk2hs/gtk2hs/gtk/Graphics/UI/Gtk/Abstract/Box.chs,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- Box.chs 25 Feb 2005 22:53:40 -0000 1.4 +++ Box.chs 13 Mar 2005 19:34:31 -0000 1.5 @@ -104,12 +104,17 @@ boxSetSpacing, boxReorderChild, boxQueryChildPacking, - boxSetChildPacking + boxSetChildPacking, + +-- * Properties + boxSpacing, + boxHomogeneous ) where import Monad (liftM) import System.Glib.FFI +import System.Glib.Attributes (Attr(..)) import Graphics.UI.Gtk.Abstract.Object (makeNewObject) {#import Graphics.UI.Gtk.Types#} {#import Graphics.UI.Gtk.Signals#} @@ -221,9 +226,31 @@ (toWidget w) (fromBool $ pack/=PackNatural) (fromBool $ pack==PackGrow) (fromIntegral pad) ((fromIntegral.fromEnum) pt) - -- | Retrieves the standard spacing between widgets. -- boxGetSpacing :: BoxClass b => b -> IO Int boxGetSpacing b = liftM fromIntegral $ {#call unsafe box_get_spacing#} (toBox b) + +-------------------- +-- Properties + +-- | The amount of space between children. +-- +-- Allowed values: >= 0 +-- +-- Default value: 0 +-- +boxSpacing :: Attr Box Int +boxSpacing = Attr + boxGetSpacing + boxSetSpacing + +-- | Whether the children should all be the same size. +-- +-- Default value: @False@ +-- +boxHomogeneous :: Attr Box Bool +boxHomogeneous = Attr + boxGetHomogeneous + boxSetHomogeneous Index: Widget.chs =================================================================== RCS file: /cvsroot/gtk2hs/gtk2hs/gtk/Graphics/UI/Gtk/Abstract/Widget.chs,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- Widget.chs 4 Mar 2005 22:10:44 -0000 1.5 +++ Widget.chs 13 Mar 2005 19:34:32 -0000 1.6 @@ -109,6 +109,10 @@ widgetSetDirection, -- General Setup. widgetGetDirection, +-- * Properties + widgetExtensionEvents, + widgetDirection, + -- * Signals Event(..), onButtonPress, @@ -186,8 +190,9 @@ import System.Glib.FFI import System.Glib.UTFString -import Graphics.UI.Gtk.Abstract.Object (makeNewObject) +import System.Glib.Attributes (Attr(..)) import System.Glib.GObject (makeNewGObject) +import Graphics.UI.Gtk.Abstract.Object (makeNewObject) {#import Graphics.UI.Gtk.Types#} {#import Graphics.UI.Gtk.Signals#} import Graphics.UI.Gtk.Gdk.Enums @@ -396,6 +401,25 @@ {#call widget_get_direction#} (toWidget w) -------------------- +-- Properties + +-- | The mask that decides what kind of extension events this widget gets. +-- +-- Default value: 'ExtensionEventsNone' +-- +widgetExtensionEvents :: Attr Widget [ExtensionMode] +widgetExtensionEvents = Attr + widgetGetExtensionEvents + widgetSetExtensionEvents + +-- | \'direction\' property. See 'widgetGetDirection' and 'widgetSetDirection' +-- +widgetDirection :: Attr Widget TextDirection +widgetDirection = Attr + widgetGetDirection + widgetSetDirection + +-------------------- -- Signals -- Because there are so many similar signals (those that take an Event and Index: Paned.chs.pp =================================================================== RCS file: /cvsroot/gtk2hs/gtk2hs/gtk/Graphics/UI/Gtk/Abstract/Paned.chs.pp,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- Paned.chs.pp 25 Feb 2005 22:53:41 -0000 1.4 +++ Paned.chs.pp 13 Mar 2005 19:34:32 -0000 1.5 @@ -76,16 +76,20 @@ panedPack1, panedPack2, panedSetPosition, - panedGetPosition + panedGetPosition, #if GTK_CHECK_VERSION(2,4,0) - ,panedGetChild1, - panedGetChild2 + panedGetChild1, + panedGetChild2, #endif + +-- * Properties + panedPosition ) where import Monad (liftM) import System.Glib.FFI +import System.Glib.Attributes (Attr(..)) import Graphics.UI.Gtk.Abstract.Object (makeNewObject) {#import Graphics.UI.Gtk.Types#} {#import Graphics.UI.Gtk.Signals#} @@ -146,3 +150,18 @@ panedGetChild2 p = makeNewObject mkWidget $ {#call unsafe paned_get_child2#} (toPaned p) #endif + +-------------------- +-- Properties + +-- | Position of paned separator in pixels (0 means all the way to the +-- left\/top). +-- +-- Allowed values: >= 0 +-- +-- Default value: 0 +-- +panedPosition :: Attr Paned Int +panedPosition = Attr + panedGetPosition + panedSetPosition Index: Scale.chs =================================================================== RCS file: /cvsroot/gtk2hs/gtk2hs/gtk/Graphics/UI/Gtk/Abstract/Scale.chs,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- Scale.chs 25 Feb 2005 22:53:41 -0000 1.4 +++ Scale.chs 13 Mar 2005 19:34:32 -0000 1.5 @@ -64,12 +64,18 @@ scaleGetDrawValue, PositionType(..), scaleSetValuePos, - scaleGetValuePos + scaleGetValuePos, + +-- * Properties + scaleDigits, + scaleDrawValue, + scaleValuePos ) where import Monad (liftM) import System.Glib.FFI +import System.Glib.Attributes (Attr(..)) import Graphics.UI.Gtk.Abstract.Object (makeNewObject) {#import Graphics.UI.Gtk.Types#} {#import Graphics.UI.Gtk.Signals#} @@ -116,3 +122,34 @@ scaleGetValuePos s = liftM (toEnum.fromIntegral) $ {#call unsafe scale_get_value_pos#} (toScale s) +-------------------- +-- Properties + +-- | The number of decimal places that are displayed in the value. +-- +-- Allowed values: [-1,64] +-- +-- Default value: 1 +-- +scaleDigits :: Attr Scale Int +scaleDigits = Attr + scaleGetDigits + scaleSetDigits + +-- | Whether the current value is displayed as a string next to the slider. +-- +-- Default value: @False@ +-- +scaleDrawValue :: Attr Scale Bool +scaleDrawValue = Attr + scaleGetDrawValue + scaleSetDrawValue + +-- | The position in which the current value is displayed. +-- +-- Default value: 'PosLeft' +-- +scaleValuePos :: Attr Scale PositionType +scaleValuePos = Attr + scaleGetValuePos + scaleSetValuePos |