Update of /cvsroot/gtk2hs/gtk2hs/gtk/Graphics/UI/Gtk/Abstract In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24514/gtk/Graphics/UI/Gtk/Abstract Modified Files: Bin.chs Box.chs ButtonBox.chs.pp Misc.chs Paned.chs.pp Range.chs Scale.chs Scrollbar.hs Separator.hs Log Message: Documentation changes and code formatting changes. Index: Range.chs =================================================================== RCS file: /cvsroot/gtk2hs/gtk2hs/gtk/Graphics/UI/Gtk/Abstract/Range.chs,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- Range.chs 13 Mar 2005 19:34:32 -0000 1.5 +++ Range.chs 14 Mar 2005 23:55:07 -0000 1.6 @@ -74,7 +74,9 @@ -- * Signals onMoveSlider, - afterMoveSlider + afterMoveSlider, + onAdjustBounds, + afterAdjustBounds, ) where import Monad (liftM) @@ -91,80 +93,126 @@ -------------------- -- Methods --- | Extract the 'Adjustment' object. +-- | Get the 'Adjustment' which is the \"model\" object for 'Range'. See +-- 'rangeSetAdjustment' for details. -- -rangeGetAdjustment :: RangeClass r => r -> IO Adjustment -rangeGetAdjustment r = makeNewObject mkAdjustment $ - {#call unsafe range_get_adjustment#} (toRange r) +rangeGetAdjustment :: RangeClass self => self + -> IO Adjustment -- ^ returns a 'Adjustment' +rangeGetAdjustment self = + makeNewObject mkAdjustment $ + {# call unsafe range_get_adjustment #} + (toRange self) --- | Insert a new 'Adjustment' object. +-- | Sets the adjustment to be used as the \"model\" object for this range +-- widget. The adjustment indicates the current range value, the minimum and +-- maximum range values, the step\/page increments used for keybindings and +-- scrolling, and the page size. The page size is normally 0 for 'Scale' and +-- nonzero for 'Scrollbar', and indicates the size of the visible area of the +-- widget being scrolled. The page size affects the size of the scrollbar +-- slider. -- -rangeSetAdjustment :: RangeClass r => r -> Adjustment -> IO () -rangeSetAdjustment r adj = {#call range_set_adjustment#} (toRange r) adj +rangeSetAdjustment :: RangeClass self => self + -> Adjustment -- ^ @adjustment@ - a 'Adjustment' + -> IO () +rangeSetAdjustment self adjustment = + {# call range_set_adjustment #} + (toRange self) + adjustment --- | Get the update policy for the range widget. +-- | Gets the update policy of @range@. See 'rangeSetUpdatePolicy'. -- -rangeGetUpdatePolicy :: RangeClass r => r -> IO UpdateType -rangeGetUpdatePolicy r = liftM (toEnum.fromIntegral) $ - {#call unsafe range_get_update_policy#} (toRange r) +rangeGetUpdatePolicy :: RangeClass self => self + -> IO UpdateType -- ^ returns the current update policy +rangeGetUpdatePolicy self = + liftM (toEnum . fromIntegral) $ + {# call unsafe range_get_update_policy #} + (toRange self) --- | Set how the internal 'Adjustment' object is updated. --- --- * The value of 'UpdateType' determines how frequently value-changed --- signals are emitted on the internal 'Adjustment' object. +-- | Sets the update policy for the range. 'UpdateContinuous' means that +-- anytime the range slider is moved, the range value will change and the +-- value_changed signal will be emitted. 'UpdateDelayed' means that the value +-- will be updated after a brief timeout where no slider motion occurs, so +-- updates are spaced by a short time rather than continuous. +-- 'UpdateDiscontinuous' means that the value will only be updated when the +-- user releases the button and ends the slider drag operation. -- -rangeSetUpdatePolicy :: RangeClass r => r -> UpdateType -> IO () -rangeSetUpdatePolicy r up = {#call range_set_update_policy#} - (toRange r) ((fromIntegral.fromEnum) up) +rangeSetUpdatePolicy :: RangeClass self => self + -> UpdateType -- ^ @policy@ - update policy + -> IO () +rangeSetUpdatePolicy self policy = + {# call range_set_update_policy #} + (toRange self) + ((fromIntegral . fromEnum) policy) --- | Get the inverted flag (determines if the range is reversed). +-- | Gets the value set by 'rangeSetInverted'. -- -rangeGetInverted :: RangeClass r => r -> IO Bool -rangeGetInverted r = - liftM toBool $ {#call unsafe range_get_inverted#} (toRange r) +rangeGetInverted :: RangeClass self => self + -> IO Bool -- ^ returns @True@ if the range is inverted +rangeGetInverted self = + liftM toBool $ + {# call unsafe range_get_inverted #} + (toRange self) --- | Set the inverted flag. +-- | Ranges normally move from lower to higher values as the slider moves from +-- top to bottom or left to right. Inverted ranges have higher values at the +-- top or on the right rather than on the bottom or left. -- -rangeSetInverted :: RangeClass r => r -> Bool -> IO () -rangeSetInverted r inv = {#call range_set_inverted#} (toRange r) (fromBool inv) +rangeSetInverted :: RangeClass self => self + -> Bool -- ^ @setting@ - @True@ to invert the range + -> IO () +rangeSetInverted self setting = + {# call range_set_inverted #} + (toRange self) + (fromBool setting) -- | Gets the current value of the range. -- -rangeGetValue :: RangeClass r => r -> IO Double -rangeGetValue r = liftM realToFrac $ - {#call unsafe range_get_value#} (toRange r) +rangeGetValue :: RangeClass self => self + -> IO Double -- ^ returns current value of the range. +rangeGetValue self = + liftM realToFrac $ + {# call unsafe range_get_value #} + (toRange self) --- | Sets the current value of the range. The range emits the \"value_changed\" --- signal if the value changes. --- --- * If the value is outside the minimum or maximum range values, it will be --- clamped to fit inside them. +-- | Sets the current value of the range; if the value is outside the minimum +-- or maximum range values, it will be clamped to fit inside them. The range +-- emits the \"value_changed\" signal if the value changes. -- -rangeSetValue :: RangeClass r => r -> Double -> IO () -rangeSetValue r value = - {#call range_set_value#} (toRange r) (realToFrac value) +rangeSetValue :: RangeClass self => self + -> Double -- ^ @value@ - new value of the range + -> IO () +rangeSetValue self value = + {# call range_set_value #} + (toRange self) + (realToFrac value) --- | Sets the step and page sizes for the range. --- The step size is used when the --- user clicks the "Scrollbar" arrows or moves "Scale" via arrow keys. The +-- | Sets the step and page sizes for the range. The step size is used when +-- the user clicks the 'Scrollbar' arrows or moves 'Scale' via arrow keys. The -- page size is used for example when moving via Page Up or Page Down keys. -- -rangeSetIncrements :: RangeClass r => r - -> Double -- ^ step size - -> Double -- ^ page size - -> IO () -rangeSetIncrements r step page = - {#call range_set_increments#} (toRange r) (realToFrac step) (realToFrac page) +rangeSetIncrements :: RangeClass self => self + -> Double -- ^ @step@ - step size + -> Double -- ^ @page@ - page size + -> IO () +rangeSetIncrements self step page = + {# call range_set_increments #} + (toRange self) + (realToFrac step) + (realToFrac page) --- | Sets the allowable values in the 'Range', and clamps the range value to be --- between min and max. +-- | Sets the allowable values in the 'Range', and clamps the range value to +-- be between @min@ and @max@. (If the range has a non-zero page size, it is +-- clamped between @min@ and @max@ - page-size.) -- -rangeSetRange :: RangeClass r => r - -> Double -- ^ min - -> Double -- ^ max - -> IO () -rangeSetRange r min max = - {#call range_set_range#} (toRange r) (realToFrac min) (realToFrac max) +rangeSetRange :: RangeClass self => self + -> Double -- ^ @min@ - minimum range value + -> Double -- ^ @max@ - maximum range value + -> IO () +rangeSetRange self min max = + {# call range_set_range #} + (toRange self) + (realToFrac min) + (realToFrac max) -------------------- -- Properties @@ -204,10 +252,33 @@ -------------------- -- Signals --- | The slide has moved. The arguments give --- detailed information what happend. +-- | Emitted when the range value is changed either programmatically or by +-- user action. -- -onMoveSlider, afterMoveSlider :: RangeClass r => r -> (ScrollType -> IO ()) -> - IO (ConnectId r) -onMoveSlider = connect_ENUM__NONE "move-slider" False -afterMoveSlider = connect_ENUM__NONE "move-slider" True +onValueChanged, afterValueChanged :: RangeClass self => self + -> IO () + -> IO (ConnectId self) +onValueChanged = connect_NONE__NONE "value_changed" False +afterValueChanged = connect_NONE__NONE "value_changed" True + +-- | Emitted when the range is adjusted by user action. Note the value can be +-- outside the bounds of the range since it depends on the mouse position. +-- +-- Usually you should use 'onValueChanged' / 'afterValueChanged' instead. +-- +onAdjustBounds, afterAdjustBounds :: RangeClass self => self + -> (Double -> IO ()) + -> IO (ConnectId self) +onAdjustBounds = connect_DOUBLE__NONE "adjust_bounds" False +afterAdjustBounds = connect_DOUBLE__NONE "adjust_bounds" True + +-- | Emitted when the user presses a key (e.g. Page Up, Home, Right Arrow) to +-- move the slider. The 'ScrollType' parameter gives the key that was pressed. +-- +-- Usually you should use 'onValueChanged' / 'afterValueChanged' instead. +-- +onMoveSlider, afterMoveSlider :: RangeClass self => self + -> (ScrollType -> IO ()) + -> IO (ConnectId self) +onMoveSlider = connect_ENUM__NONE "move_slider" False +afterMoveSlider = connect_ENUM__NONE "move_slider" True Index: Bin.chs =================================================================== RCS file: /cvsroot/gtk2hs/gtk2hs/gtk/Graphics/UI/Gtk/Abstract/Bin.chs,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- Bin.chs 25 Feb 2005 22:53:40 -0000 1.4 +++ Bin.chs 14 Mar 2005 23:55:06 -0000 1.5 @@ -24,10 +24,10 @@ -- Stability : provisional -- Portability : portable (depends on GHC) -- --- This abstract widget implements a container with just one child. +-- A container with just one child -- module Graphics.UI.Gtk.Abstract.Bin ( --- * Description +-- * Detail -- -- | The 'Bin' widget is a container with just one child. It is not very -- useful itself, but it is useful for deriving subclasses, since it provides @@ -44,11 +44,11 @@ -- | +----'Widget' -- | +----'Container' -- | +----Bin +-- | +----'Window' -- | +----'Alignment' -- | +----'Frame' -- | +----'Button' -- | +----'Item' --- | +----'Window' -- | +----'ComboBox' -- | +----'EventBox' -- | +----'Expander' @@ -76,6 +76,11 @@ -------------------- -- Methods -binGetChild :: BinClass bin => bin -> IO Widget -binGetChild bin = - makeNewObject mkWidget $ {# call gtk_bin_get_child #} (toBin bin) +-- | Gets the child of the 'Bin' +-- +binGetChild :: BinClass self => self + -> IO Widget -- ^ returns the child of the 'Bin' +binGetChild self = + makeNewObject mkWidget $ + {# call gtk_bin_get_child #} + (toBin self) Index: Box.chs =================================================================== RCS file: /cvsroot/gtk2hs/gtk2hs/gtk/Graphics/UI/Gtk/Abstract/Box.chs,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- Box.chs 13 Mar 2005 19:34:31 -0000 1.5 +++ Box.chs 14 Mar 2005 23:55:07 -0000 1.6 @@ -24,11 +24,10 @@ -- Stability : provisional -- Portability : portable (depends on GHC) -- --- This abstract container class is instatiated by using HBox or VBox. It --- supplies all methods to add and remove children. +-- Base class for box containers -- module Graphics.UI.Gtk.Abstract.Box ( --- * Description +-- * Detail -- -- | 'Box' is an abstract widget which encapsulates functionallity for a -- particular kind of container, one that organizes a variable number of @@ -125,112 +124,195 @@ -------------------- -- Methods --- | Insert a widget at the beginning of the box --- container. +-- | Adds the @child@ widget to the box, packed with reference to the start of +-- the box. The +-- @child@ is packed after any other child packed with reference to the start +-- of the box. -- --- * The 'Packing' parameter determines how the child behaves in the --- horizontal or vertical way in an HBox or VBox, respectively. --- 'PackNatural' means the child is as big as it reqests. It will --- move to the left in an 'HBox' or to the top in an --- 'VBox' if there is more space availble. --- All children --- that have choosen 'PackRepel' for @p@ will be padded --- on both sides with --- additional space. 'PackGrow' will increase the size of the --- so that is covers the available space. +-- The 'Packing' parameter determines how the child behaves in the horizontal +-- or vertical way in an HBox or VBox, respectively. 'PackNatural' means the +-- child is as big as it reqests. It will move to the left in an 'HBox' or to +-- the top in an 'VBox' if there is more space availble. +-- All children packed with 'PackRepel' will be padded on both sides with +-- additional space. 'PackGrow' will increase the size of the so that is +-- covers the available space. -- -boxPackStart :: (BoxClass b, WidgetClass w) => b -> w -> Packing -> Int -> - IO () -boxPackStart b w p pad = {#call box_pack_start#} (toBox b) (toWidget w) - (fromBool $ p/=PackNatural) (fromBool $ p==PackGrow) (fromIntegral pad) +boxPackStart :: (BoxClass self, WidgetClass child) => self + -> child -- ^ @child@ - the 'Widget' to be added to the box. + -> Packing + -> Int -- ^ @padding@ - extra space in pixels to put between this child and + -- its neighbors, over and above the global amount specified by + -- spacing 'boxSetSpacing'. If @child@ + -- is a widget at one of the reference ends of @box@, then @padding@ + -- pixels are also put between @child@ and the reference edge of + -- @box@. + -> IO () +boxPackStart self child packing padding = + {# call box_pack_start #} + (toBox self) + (toWidget child) + (fromBool $ packing /= PackNatural) + (fromBool $ packing == PackGrow) + (fromIntegral padding) --- | Insert a widget at the end of the box container. +-- | Adds the @child@ widget to the box, packed with reference to the end of +-- the box. The +-- @child@ is packed after (away from end of) any other child packed with +-- reference to the end of the box. -- --- * See 'boxPackStart'. The option 'Natural' will --- move a child to the right in an 'HBox' or to the bottom in an --- 'VBox' if there is more space availble. +-- See 'boxPackStart' for a description of the 'Packing' parameter. Of course +-- for 'boxPackEnd' the 'PackNatural' option will move a child to the right in +-- an 'HBox' or to the bottom in an 'VBox' if there is more space availble. -- -boxPackEnd :: (BoxClass b, WidgetClass w) => b -> w -> Packing -> Int -> IO () -boxPackEnd b w p pad = {#call box_pack_end#} (toBox b) (toWidget w) - (fromBool $ p/=PackNatural) (fromBool $ p==PackGrow) (fromIntegral pad) +boxPackEnd :: (BoxClass self, WidgetClass child) => self + -> child -- ^ @child@ - the 'Widget' to be added to the box. + -> Packing + -> Int -- ^ @padding@ - extra space in pixels to put between this child and + -- its neighbors, over and above the global amount specified by + -- spacing 'boxSetSpacing'. If @child@ + -- is a widget at one of the reference ends of @box@, then @padding@ + -- pixels are also put between @child@ and the reference edge of + -- @box@. + -> IO () +boxPackEnd self child packing padding = + {# call box_pack_end #} + (toBox self) + (toWidget child) + (fromBool $ packing /= PackNatural) + (fromBool $ packing == PackGrow) + (fromIntegral padding) --- | Like 'boxPackStart' but uses the --- default parameters 'PackRepel' and 0 for padding. +-- | Like 'boxPackStart' but uses the default parameters 'PackRepel' and 0 for +-- padding. -- -boxPackStartDefaults :: (BoxClass b, WidgetClass w) => b -> w -> IO () -boxPackStartDefaults b w = - {#call box_pack_start_defaults#} (toBox b) (toWidget w) +boxPackStartDefaults :: (BoxClass self, WidgetClass widget) => self + -> widget -- ^ @widget@ - the 'Widget' to be added to the box. + -> IO () +boxPackStartDefaults self widget = + {# call box_pack_start_defaults #} + (toBox self) + (toWidget widget) --- | Like 'boxPackEnd' but uses the --- default parameters 'PackRepel' and 0 for padding. +-- | Like 'boxPackEnd' but uses the default parameters 'PackRepel' and 0 for +-- padding. -- -boxPackEndDefaults :: (BoxClass b, WidgetClass w) => b -> w -> IO () -boxPackEndDefaults b w = - {#call box_pack_end_defaults#} (toBox b) (toWidget w) +boxPackEndDefaults :: (BoxClass self, WidgetClass widget) => self + -> widget -- ^ @widget@ - the 'Widget' to be added to the box. + -> IO () +boxPackEndDefaults self widget = + {# call box_pack_end_defaults #} + (toBox self) + (toWidget widget) --- | Set if all children should be spread homogeneous --- within the box. +-- | Sets the homogeneous property, +-- controlling whether or not all children of the box are given equal space -- -boxSetHomogeneous :: BoxClass b => b -> Bool -> IO () -boxSetHomogeneous b homo = - {#call box_set_homogeneous#} (toBox b) (fromBool homo) +boxSetHomogeneous :: BoxClass self => self + -> Bool -- ^ @homogeneous@ - a boolean value, @True@ to create equal + -- allotments, @False@ for variable allotments. + -> IO () +boxSetHomogeneous self homogeneous = + {# call box_set_homogeneous #} + (toBox self) + (fromBool homogeneous) --- | Get whether the box is homogeneous. +-- | Returns whether the box is homogeneous (all children are the same size). +-- See 'boxSetHomogeneous'. -- -boxGetHomogeneous :: BoxClass b => b -> IO Bool -boxGetHomogeneous b = - liftM toBool $ {#call box_get_homogeneous#} (toBox b) +boxGetHomogeneous :: BoxClass self => self + -> IO Bool -- ^ returns @True@ if the box is homogeneous. +boxGetHomogeneous self = + liftM toBool $ + {# call box_get_homogeneous #} + (toBox self) -- | Set the standard spacing between two children. -- --- * This space is in addition to the padding parameter that is given for each --- child. +-- This space is in addition to the padding parameter that is given for each +-- child. -- -boxSetSpacing :: BoxClass b => b -> Int -> IO () -boxSetSpacing b spacing = - {#call box_set_spacing#} (toBox b) (fromIntegral spacing) +boxSetSpacing :: BoxClass self => self + -> Int -- ^ @spacing@ - the number of pixels to put between children. + -> IO () +boxSetSpacing self spacing = + {# call box_set_spacing #} + (toBox self) + (fromIntegral spacing) --- | Move @child@ to a new @position@ --- (counted from 0) in the box. +-- | Moves @child@ to a new @position@ in the list of @box@ children. The list +-- contains both widgets packed 'PackStart' as well as widgets packed +-- 'PackEnd', in the order that these widgets were added to the box. -- -boxReorderChild :: (BoxClass b, WidgetClass w) => b -> w -> Int -> IO () -boxReorderChild b w position = - {#call box_reorder_child#} (toBox b) (toWidget w) (fromIntegral position) +-- A widget's position in the box children list determines where the +-- widget is packed into the box. A child widget at some position in the list +-- will be packed just after all other widgets of the same packing type that +-- appear earlier in the list. +-- +boxReorderChild :: (BoxClass self, WidgetClass child) => self + -> child -- ^ @child@ - the 'Widget' to move. + -> Int -- ^ @position@ - the new position for @child@ in the children list + -- starting from 0. If negative, indicates the end of the list. + -> IO () +boxReorderChild self child position = + {# call box_reorder_child #} + (toBox self) + (toWidget child) + (fromIntegral position) --- | Query the packing parameter of a child. +-- | Returns information about how @child@ is packed into the box. -- --- * Returns information on the behaviour if free space is available --- (in 'Packing'), the additional padding for this widget and --- if the widget +-- Returns information on the behaviour if free space is available +-- (in 'Packing'), the additional padding for this widget and if the widget -- was inserted at the start or end of the container ('PackType'). -- -boxQueryChildPacking :: (BoxClass b, WidgetClass w) => b -> w -> - IO (Packing,Int,PackType) -boxQueryChildPacking b w = alloca $ \expandPtr -> alloca $ \fillPtr -> - alloca $ \paddingPtr -> alloca $ \packPtr -> do - {#call unsafe box_query_child_packing#} (toBox b) (toWidget w) - expandPtr fillPtr paddingPtr packPtr - expand <- liftM toBool $ peek expandPtr - fill <- liftM toBool $ peek fillPtr - padding <- liftM fromIntegral $ peek paddingPtr - pack <- liftM (toEnum.fromIntegral) $ peek packPtr - return (if fill then PackGrow else - (if expand then PackRepel else PackNatural), - padding,pack) +boxQueryChildPacking :: (BoxClass self, WidgetClass child) => self + -> child -- ^ @child@ - the 'Widget' of the child to query. + -> IO (Packing,Int,PackType) -- ^ @(packing, padding, packType)@ +boxQueryChildPacking self child = + alloca $ \expandPtr -> + alloca $ \fillPtr -> + alloca $ \paddingPtr -> + alloca $ \packPtr -> do + {# call unsafe box_query_child_packing #} + (toBox self) + (toWidget child) + expandPtr + fillPtr + paddingPtr + packPtr + expand <- liftM toBool $ peek expandPtr + fill <- liftM toBool $ peek fillPtr + padding <- liftM fromIntegral $ peek paddingPtr + pack <- liftM (toEnum.fromIntegral) $ peek packPtr + return (if fill then PackGrow else + (if expand then PackRepel else PackNatural), + padding,pack) --- | Set the packing parameter of a child. +-- | Sets the way @child@ is packed into the box. -- -boxSetChildPacking :: (BoxClass b, WidgetClass w) => b -> w -> Packing -> - Int -> PackType -> IO () -boxSetChildPacking b w pack pad pt = {#call box_set_child_packing#} (toBox b) - (toWidget w) (fromBool $ pack/=PackNatural) (fromBool $ pack==PackGrow) - (fromIntegral pad) ((fromIntegral.fromEnum) pt) +boxSetChildPacking :: (BoxClass self, WidgetClass child) => self + -> child -- ^ @child@ - the 'Widget' of the child to set. + -> Packing + -> Int -- ^ @padding@ + -> PackType -- ^ @packType@ + -> IO () +boxSetChildPacking self child packing padding packType = + {# call box_set_child_packing #} + (toBox self) + (toWidget child) + (fromBool $ packing /= PackNatural) + (fromBool $ packing == PackGrow) + (fromIntegral padding) + ((fromIntegral . fromEnum) packType) -- | Retrieves the standard spacing between widgets. -- -boxGetSpacing :: BoxClass b => b -> IO Int -boxGetSpacing b = - liftM fromIntegral $ {#call unsafe box_get_spacing#} (toBox b) +boxGetSpacing :: BoxClass self => self + -> IO Int -- ^ returns spacing between children +boxGetSpacing self = + liftM fromIntegral $ + {# call unsafe box_get_spacing #} + (toBox self) -------------------- -- Properties Index: ButtonBox.chs.pp =================================================================== RCS file: /cvsroot/gtk2hs/gtk2hs/gtk/Graphics/UI/Gtk/Abstract/ButtonBox.chs.pp,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- ButtonBox.chs.pp 13 Mar 2005 19:34:32 -0000 1.4 +++ ButtonBox.chs.pp 14 Mar 2005 23:55:07 -0000 1.5 @@ -27,7 +27,7 @@ -- Base class for 'HButtonBox' and 'VButtonBox' -- module Graphics.UI.Gtk.Abstract.ButtonBox ( --- * Description +-- * Detail -- -- | The primary purpose of this class is to keep track of the various -- properties of 'HButtonBox' and 'VButtonBox' widgets. @@ -91,45 +91,63 @@ -------------------- -- Methods --- | Retrieve the method being used to --- arrange the buttons in the button box +-- | Retrieves the method being used to arrange the buttons in the button box. -- -buttonBoxGetLayout :: ButtonBoxClass b => b -> IO ButtonBoxStyle -buttonBoxGetLayout b = liftM (toEnum . fromIntegral) $ - {#call gtk_button_box_get_layout#} (toButtonBox b) +buttonBoxGetLayout :: ButtonBoxClass self => self + -> IO ButtonBoxStyle +buttonBoxGetLayout self = + liftM (toEnum . fromIntegral) $ + {# call gtk_button_box_get_layout #} + (toButtonBox self) #if GTK_CHECK_VERSION(2,4,0) --- | Returns whether child should appear --- in a secondary group of children +-- | Returns whether @child@ should appear in a secondary group of children. -- --- * Since Gtk 2.4. -buttonBoxGetChildSecondary :: (ButtonBoxClass b, WidgetClass w) => b -> w -> IO Bool -buttonBoxGetChildSecondary b w = liftM toBool $ - {#call gtk_button_box_get_child_secondary#} (toButtonBox b) (toWidget w) +-- * Available since Gtk version 2.4 +-- +buttonBoxGetChildSecondary :: (ButtonBoxClass self, WidgetClass child) => self + -> child -- ^ @child@ - a child of the button box widget + -> IO Bool -- ^ returns whether @child@ should appear in a secondary group of + -- children. +buttonBoxGetChildSecondary self child = + liftM toBool $ + {# call gtk_button_box_get_child_secondary #} + (toButtonBox self) + (toWidget child) #endif --- | Changes the way buttons are arranged in their container +-- | Changes the way buttons are arranged in their container. -- -buttonBoxSetLayout :: ButtonBoxClass b => b -> ButtonBoxStyle -> IO () -buttonBoxSetLayout b l = - {#call gtk_button_box_set_layout#} (toButtonBox b) - ((fromIntegral . fromEnum) l) +buttonBoxSetLayout :: ButtonBoxClass self => self + -> ButtonBoxStyle -- ^ @layoutStyle@ - the new layout style. + -> IO () +buttonBoxSetLayout self layoutStyle = + {# call gtk_button_box_set_layout #} + (toButtonBox self) + ((fromIntegral . fromEnum) layoutStyle) --- | Sets whether child should appear in a secondary --- group of children. A typical use of a secondary child is the help button in a dialog. +-- | Sets whether @child@ should appear in a secondary group of children. A +-- typical use of a secondary child is the help button in a dialog. -- --- * This group appears after the other children if the style is 'ButtonboxStart', --- 'ButtonboxSpread' or 'ButtonboxEdge', and before the the other children if the --- style is 'ButtonboxEnd'. For horizontal button boxes, the definition of before\/after --- depends on direction of the widget (see 'widgetSetDirection'). If the style is --- 'buttonBoxStart' or 'buttonBoxEnd', then the secondary children are aligned at --- the other end of the button box from the main children. For the other styles, --- they appear immediately next to the main children. +-- This group appears after the other children if the style is +-- 'ButtonboxStart', 'ButtonboxSpread' or 'ButtonboxEdge', and before the the +-- other children if the style is 'ButtonboxEnd'. For horizontal button boxes, +-- the definition of before\/after depends on direction of the widget (see +-- 'widgetSetDirection'). If the style is 'ButtonboxStart' or 'ButtonboxEnd', +-- then the secondary children are aligned at the other end of the button box +-- from the main children. For the other styles, they appear immediately next +-- to the main children. -- -buttonBoxSetChildSecondary :: (ButtonBoxClass b, WidgetClass w) => b -> w -> Bool -> IO () -buttonBoxSetChildSecondary b w s = - {#call gtk_button_box_set_child_secondary #} (toButtonBox b) (toWidget w) - (fromBool s) +buttonBoxSetChildSecondary :: (ButtonBoxClass self, WidgetClass child) => self + -> child -- ^ @child@ - a child of the button box widget + -> Bool -- ^ @isSecondary@ - if @True@, the @child@ appears in a secondary + -- group of the button box. + -> IO () +buttonBoxSetChildSecondary self child isSecondary = + {# call gtk_button_box_set_child_secondary #} + (toButtonBox self) + (toWidget child) + (fromBool isSecondary) -------------------- -- Properties Index: Separator.hs =================================================================== RCS file: /cvsroot/gtk2hs/gtk2hs/gtk/Graphics/UI/Gtk/Abstract/Separator.hs,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- Separator.hs 12 Feb 2005 17:19:21 -0000 1.2 +++ Separator.hs 14 Mar 2005 23:55:07 -0000 1.3 @@ -24,13 +24,31 @@ -- Stability : provisional -- Portability : portable (depends on GHC) -- --- This widget is the base class for HSeparator and VSeparator. +-- Base class for 'HSeparator' and 'VSeparator' -- module Graphics.UI.Gtk.Abstract.Separator ( +-- * Detail +-- +-- | The 'Separator' widget is an abstract class, used only for deriving the +-- subclasses 'HSeparator' and 'VSeparator'. + +-- * Class Hierarchy +-- | +-- @ +-- | 'GObject' +-- | +----'Object' +-- | +----'Widget' +-- | +----Separator +-- | +----'HSeparator' +-- | +----'VSeparator' +-- @ + +-- * Types Separator, - SeparatorClass + SeparatorClass, + castToSeparator ) where -import Graphics.UI.Gtk.Types (Separator, SeparatorClass) +import Graphics.UI.Gtk.Types (Separator, SeparatorClass, castToSeparator) -- well this widget is very abstract! Index: Scrollbar.hs =================================================================== RCS file: /cvsroot/gtk2hs/gtk2hs/gtk/Graphics/UI/Gtk/Abstract/Scrollbar.hs,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- Scrollbar.hs 12 Feb 2005 17:19:21 -0000 1.2 +++ Scrollbar.hs 14 Mar 2005 23:55:07 -0000 1.3 @@ -24,12 +24,31 @@ -- Stability : provisional -- Portability : portable (depends on GHC) -- --- This is the abstract base class for HScrollbar and VScrollbar. +-- Base class for 'HScrollbar' and 'VScrollbar' -- module Graphics.UI.Gtk.Abstract.Scrollbar ( +-- * Detail +-- +-- | The 'Scrollbar' widget is an abstract base class for 'HScrollbar' and +-- 'VScrollbar'. It is not very useful in itself. + +-- * Class Hierarchy +-- | +-- @ +-- | 'GObject' +-- | +----'Object' +-- | +----'Widget' +-- | +----'Range' +-- | +----Scrollbar +-- | +----'HScrollbar' +-- | +----'VScrollbar' +-- @ + +-- * Types Scrollbar, - ScrollbarClass + ScrollbarClass, + castToScrollbar ) where -import Graphics.UI.Gtk.Types (Scrollbar, ScrollbarClass) +import Graphics.UI.Gtk.Types (Scrollbar, ScrollbarClass, castToScrollbar) Index: Misc.chs =================================================================== RCS file: /cvsroot/gtk2hs/gtk2hs/gtk/Graphics/UI/Gtk/Abstract/Misc.chs,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- Misc.chs 25 Feb 2005 22:53:40 -0000 1.4 +++ Misc.chs 14 Mar 2005 23:55:07 -0000 1.5 @@ -24,10 +24,10 @@ -- Stability : provisional -- Portability : portable (depends on GHC) -- --- A base class for widgets with alignments and padding. +-- Base class for widgets with alignments and padding -- module Graphics.UI.Gtk.Abstract.Misc ( --- * Description +-- * Detail -- -- | The 'Misc' widget is an abstract widget which is not useful itself, but -- is used to derive subclasses which have alignment and padding attributes. @@ -76,34 +76,61 @@ -------------------- -- Methods --- | Set the alignment of the widget. +-- | Sets the alignment of the widget. -- -miscSetAlignment :: MiscClass m => m -> Double -> Double -> IO () -miscSetAlignment misc xalign yalign = {#call misc_set_alignment#} - (toMisc misc) (realToFrac xalign) (realToFrac yalign) - --- | Get the alignment of the widget. +miscSetAlignment :: MiscClass self => self + -> Float -- ^ @xalign@ - the horizontal alignment, from 0 (left) to 1 + -- (right). + -> Float -- ^ @yalign@ - the vertical alignment, from 0 (top) to 1 (bottom). + -> IO () +miscSetAlignment self xalign yalign = + {# call misc_set_alignment #} + (toMisc self) + (realToFrac xalign) + (realToFrac yalign) + +-- | Gets the X and Y alignment of the widget within its allocation. See +-- 'miscSetAlignment'. -- -miscGetAlignment :: MiscClass m => m -> IO (Double, Double) -miscGetAlignment misc = - alloca $ \xalignPtr -> alloca $ \yalignPtr -> do - {#call unsafe misc_get_alignment#} (toMisc misc) xalignPtr yalignPtr +miscGetAlignment :: MiscClass self => self + -> IO (Double, Double) +miscGetAlignment self = + alloca $ \xalignPtr -> + alloca $ \yalignPtr -> do + {# call unsafe misc_get_alignment #} + (toMisc self) + xalignPtr + yalignPtr xalign <- peek xalignPtr yalign <- peek yalignPtr return (realToFrac xalign, realToFrac yalign) --- | Set the amount of space to add around the widget. +-- | Sets the amount of space to add around the widget. -- -miscSetPadding :: MiscClass m => m -> Int -> Int -> IO () -miscSetPadding misc xpad ypad = {#call misc_set_padding#} - (toMisc misc) (fromIntegral xpad) (fromIntegral ypad) +miscSetPadding :: MiscClass self => self + -> Int -- ^ @xpad@ - the amount of space to add on the left and right of + -- the widget, in pixels. + -> Int -- ^ @ypad@ - the amount of space to add on the top and bottom of + -- the widget, in pixels. + -> IO () +miscSetPadding self xpad ypad = + {# call misc_set_padding #} + (toMisc self) + (fromIntegral xpad) + (fromIntegral ypad) --- | Get the amount of space added around the widget. +-- | Gets the padding in the X and Y directions of the widget. See +-- 'miscSetPadding'. -- -miscGetPadding :: MiscClass m => m -> IO (Int, Int) -miscGetPadding misc = - alloca $ \xpadPtr -> alloca $ \ypadPtr -> do - {#call unsafe misc_get_padding#} (toMisc misc) xpadPtr ypadPtr +miscGetPadding :: MiscClass self => self + -> IO (Int, Int) +miscGetPadding self = + alloca $ \xpadPtr -> + alloca $ \ypadPtr -> do + {# call unsafe misc_get_padding #} + (toMisc self) + xpadPtr + ypadPtr xpad <- peek xpadPtr ypad <- peek ypadPtr return (fromIntegral xpad, fromIntegral ypad) Index: Paned.chs.pp =================================================================== RCS file: /cvsroot/gtk2hs/gtk2hs/gtk/Graphics/UI/Gtk/Abstract/Paned.chs.pp,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- Paned.chs.pp 13 Mar 2005 19:34:32 -0000 1.5 +++ Paned.chs.pp 14 Mar 2005 23:55:07 -0000 1.6 @@ -27,7 +27,7 @@ -- Base class for widgets with two adjustable panes -- module Graphics.UI.Gtk.Abstract.Paned ( --- * Description +-- * Detail -- -- | 'Paned' is the base class for widgets with two panes, arranged either -- horizontally ('HPaned') or vertically ('VPaned'). Child widgets are added to @@ -99,56 +99,100 @@ -------------------- -- Methods --- | Add a widget to the first (top or left) area. --- --- * The widget does not expand if 'Paned' expands. It does not shrink either. +-- | Adds a child to the top or left pane with default parameters. This is +-- equivalent to @'panedPack1' paned child False True@. -- -panedAdd1 :: (PanedClass p, WidgetClass w) => p -> w -> IO () -panedAdd1 p w = {#call paned_add1#} (toPaned p) (toWidget w) +panedAdd1 :: (PanedClass self, WidgetClass child) => self + -> child -- ^ @child@ - the child to add + -> IO () +panedAdd1 self child = + {# call paned_add1 #} + (toPaned self) + (toWidget child) --- | Add a widget to the second (bottom or right) area. --- --- * The widget does not expand if 'Paned' expands. But it does shrink. +-- | Adds a child to the bottom or right pane with default parameters. This is +-- equivalent to @'panedPack2' paned child True True@. -- -panedAdd2 :: (PanedClass p, WidgetClass w) => p -> w -> IO () -panedAdd2 p w = {#call paned_add2#} (toPaned p) (toWidget w) +panedAdd2 :: (PanedClass self, WidgetClass child) => self + -> child -- ^ @child@ - the child to add + -> IO () +panedAdd2 self child = + {# call paned_add2 #} + (toPaned self) + (toWidget child) --- | Add a widget to the first area and specify its resizing behaviour. +-- | Adds a child to the top or left pane. -- -panedPack1 :: (PanedClass p, WidgetClass w) => p -> w -> Bool -> Bool -> IO () -panedPack1 p w expand shrink = {#call paned_pack1#} - (toPaned p) (toWidget w) (fromBool expand) (fromBool shrink) +panedPack1 :: (PanedClass self, WidgetClass child) => self + -> child -- ^ @child@ - the child to add + -> Bool -- ^ @resize@ - should this child expand when the paned widget is + -- resized. + -> Bool -- ^ @shrink@ - can this child be made smaller than its requsition. + -> IO () +panedPack1 self child resize shrink = + {# call paned_pack1 #} + (toPaned self) + (toWidget child) + (fromBool resize) + (fromBool shrink) --- | Add a widget to the second area and specify its resizing behaviour. +-- | Adds a child to the bottom or right pane. -- -panedPack2 :: (PanedClass p, WidgetClass w) => p -> w -> Bool -> Bool -> IO () -panedPack2 p w expand shrink = {#call paned_pack2#} - (toPaned p) (toWidget w) (fromBool expand) (fromBool shrink) +panedPack2 :: (PanedClass self, WidgetClass child) => self + -> child -- ^ @child@ - the child to add + -> Bool -- ^ @resize@ - should this child expand when the paned widget is + -- resized. + -> Bool -- ^ @shrink@ - can this child be made smaller than its requsition. + -> IO () +panedPack2 self child resize shrink = + {# call paned_pack2 #} + (toPaned self) + (toWidget child) + (fromBool resize) + (fromBool shrink) --- | Set the gutter to the specified @position@ (in pixels). +-- | Sets the position of the divider between the two panes. -- -panedSetPosition :: PanedClass p => p -> Int -> IO () -panedSetPosition p position = - {#call paned_set_position#} (toPaned p) (fromIntegral position) +panedSetPosition :: PanedClass self => self + -> Int -- ^ @position@ - pixel position of divider, a negative value means + -- that the position is unset. + -> IO () +panedSetPosition self position = + {# call paned_set_position #} + (toPaned self) + (fromIntegral position) --- | Get the gutter position (in pixels). +-- | Obtains the position of the divider between the two panes. -- -panedGetPosition :: PanedClass p => p -> IO Int -panedGetPosition p = liftM fromIntegral $ - {#call unsafe paned_get_position#} (toPaned p) +panedGetPosition :: PanedClass self => self + -> IO Int -- ^ returns position of the divider +panedGetPosition self = + liftM fromIntegral $ + {# call unsafe paned_get_position #} + (toPaned self) #if GTK_CHECK_VERSION(2,4,0) -- | Obtains the first child of the paned widget. -- -panedGetChild1 :: PanedClass p => p -> IO Widget -panedGetChild1 p = - makeNewObject mkWidget $ {#call unsafe paned_get_child1#} (toPaned p) +-- * Available since Gtk version 2.4 +-- +panedGetChild1 :: PanedClass self => self + -> IO Widget -- ^ returns first child +panedGetChild1 self = + makeNewObject mkWidget $ + {# call unsafe paned_get_child1 #} + (toPaned self) -- | Obtains the second child of the paned widget. -- -panedGetChild2 :: PanedClass p => p -> IO Widget -panedGetChild2 p = - makeNewObject mkWidget $ {#call unsafe paned_get_child2#} (toPaned p) +-- * Available since Gtk version 2.4 +-- +panedGetChild2 :: PanedClass self => self + -> IO Widget -- ^ returns second child +panedGetChild2 self = + makeNewObject mkWidget $ + {# call unsafe paned_get_child2 #} + (toPaned self) #endif -------------------- Index: Scale.chs =================================================================== RCS file: /cvsroot/gtk2hs/gtk2hs/gtk/Graphics/UI/Gtk/Abstract/Scale.chs,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- Scale.chs 13 Mar 2005 19:34:32 -0000 1.5 +++ Scale.chs 14 Mar 2005 23:55:07 -0000 1.6 @@ -24,11 +24,10 @@ -- Stability : provisional -- Portability : portable (depends on GHC) -- --- This is the abstract base class for 'HScale' and 'VScale'. It implements --- the management of an adjustable value. +-- Base class for 'HScale' and 'VScale' -- module Graphics.UI.Gtk.Abstract.Scale ( --- * Description +-- * Detail -- -- | A 'Scale' is a slider control used to select a numeric value. To use it, -- you'll probably want to investigate the methods on its base class, 'Range', @@ -86,41 +85,69 @@ -------------------- -- Methods --- | Set the number of displayed digits after the comma. +-- | Sets the number of decimal places that are displayed in the value. Also +-- causes the value of the adjustment to be rounded off to this number of +-- digits, so the retrieved value matches the value the user saw. -- -scaleSetDigits :: ScaleClass s => s -> Int -> IO () -scaleSetDigits s prec = - {#call scale_set_digits#} (toScale s) (fromIntegral prec) +scaleSetDigits :: ScaleClass self => self + -> Int -- ^ @digits@ - the number of decimal places to display, e.g. use 1 + -- to display 1.0, 2 to display 1.00 etc. + -> IO () +scaleSetDigits self digits = + {# call scale_set_digits #} + (toScale self) + (fromIntegral digits) --- | Get the number of displayed digits after the comma. +-- | Gets the number of decimal places that are displayed in the value. -- -scaleGetDigits :: ScaleClass s => s -> IO Int -scaleGetDigits s = - liftM fromIntegral $ {#call unsafe scale_get_digits#} (toScale s) +scaleGetDigits :: ScaleClass self => self + -> IO Int -- ^ returns the number of decimal places that are displayed. +scaleGetDigits self = + liftM fromIntegral $ + {# call unsafe scale_get_digits #} + (toScale self) --- | Specify if the current value is to be drawn next to the slider. +-- | Specifies whether the current value is displayed as a string next to the +-- slider. -- -scaleSetDrawValue :: ScaleClass s => s -> Bool -> IO () -scaleSetDrawValue s draw = - {#call scale_set_draw_value#} (toScale s) (fromBool draw) +scaleSetDrawValue :: ScaleClass self => self + -> Bool -- ^ @drawValue@ - a boolean. + -> IO () +scaleSetDrawValue self drawValue = + {# call scale_set_draw_value #} + (toScale self) + (fromBool drawValue) --- | Returns whether the current value is drawn next to the slider. +-- | Returns whether the current value is displayed as a string next to the +-- slider. -- -scaleGetDrawValue :: ScaleClass s => s -> IO Bool -scaleGetDrawValue s = - liftM toBool $ {#call unsafe scale_get_draw_value#} (toScale s) +scaleGetDrawValue :: ScaleClass self => self + -> IO Bool -- ^ returns whether the current value is displayed as a string. +scaleGetDrawValue self = + liftM toBool $ + {# call unsafe scale_get_draw_value #} + (toScale self) --- | Specify where the value is to be displayed (relative to the slider). +-- | Sets the position in which the current value is displayed. -- -scaleSetValuePos :: ScaleClass s => s -> PositionType -> IO () -scaleSetValuePos s pos = - {#call scale_set_value_pos#} (toScale s) ((fromIntegral.fromEnum) pos) +scaleSetValuePos :: ScaleClass self => self + -> PositionType -- ^ @pos@ - the position in which the current value is + -- displayed. + -> IO () +scaleSetValuePos self pos = + {# call scale_set_value_pos #} + (toScale self) + ((fromIntegral . fromEnum) pos) -- | Gets the position in which the current value is displayed. -- -scaleGetValuePos :: ScaleClass s => s -> IO PositionType -scaleGetValuePos s = - liftM (toEnum.fromIntegral) $ {#call unsafe scale_get_value_pos#} (toScale s) +scaleGetValuePos :: ScaleClass self => self + -> IO PositionType -- ^ returns the position in which the current value is + -- displayed. +scaleGetValuePos self = + liftM (toEnum . fromIntegral) $ + {# call unsafe scale_get_value_pos #} + (toScale self) -------------------- -- Properties |