From: Duncan C. <dun...@us...> - 2005-03-24 17:31:10
|
Update of /cvsroot/gtk2hs/gtk2hs/gtk/Graphics/UI/Gtk/Layout In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17311/gtk/Graphics/UI/Gtk/Layout Modified Files: Alignment.chs.pp AspectFrame.chs Expander.chs.pp Fixed.chs HBox.chs HButtonBox.chs HPaned.chs Layout.chs Notebook.chs.pp Table.chs VBox.chs VButtonBox.chs VPaned.chs Log Message: Documentation changes and code formatting changes. Index: Fixed.chs =================================================================== RCS file: /cvsroot/gtk2hs/gtk2hs/gtk/Graphics/UI/Gtk/Layout/Fixed.chs,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- Fixed.chs 25 Feb 2005 22:53:41 -0000 1.4 +++ Fixed.chs 24 Mar 2005 17:30:59 -0000 1.5 @@ -27,7 +27,7 @@ -- A container which allows you to position widgets at fixed coordinates -- module Graphics.UI.Gtk.Layout.Fixed ( --- * Description +-- * Detail -- -- | The 'Fixed' widget is a container which can place child widgets at fixed -- positions and with fixed sizes, given in pixels. 'Fixed' performs no @@ -85,12 +85,16 @@ fixedPut, fixedMove, fixedSetHasWindow, - fixedGetHasWindow + fixedGetHasWindow, + +-- * Properties + fixedHasWindow ) 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#} @@ -103,40 +107,70 @@ -- | Creates a new 'Fixed' container. -- fixedNew :: IO Fixed -fixedNew = makeNewObject mkFixed $ liftM castPtr $ - {#call unsafe fixed_new#} +fixedNew = + makeNewObject mkFixed $ + liftM (castPtr :: Ptr Widget -> Ptr Fixed) $ + {# call unsafe fixed_new #} -------------------- -- Methods -- | Adds a widget to a 'Fixed' container at the given position. -- -fixedPut :: (FixedClass obj, WidgetClass widget) => obj - -> widget -> (Int, Int) -> IO () -fixedPut obj widget (x, y) = - {#call fixed_put#} (toFixed obj) (toWidget widget) - (fromIntegral x) (fromIntegral y) +fixedPut :: (FixedClass self, WidgetClass widget) => self + -> widget -- ^ @widget@ - the widget to add. + -> (Int, Int) -- ^ @(x,y)@ - the horizontal and vertical position to place + -- the widget at. + -> IO () +fixedPut self widget (x, y) = + {# call fixed_put #} + (toFixed self) + (toWidget widget) + (fromIntegral x) + (fromIntegral y) -- | Moves a child of a 'Fixed' container to the given position. -- -fixedMove :: (FixedClass obj, WidgetClass widget) => obj - -> widget -> (Int, Int) -> IO () -fixedMove obj widget (x, y) = - {#call fixed_move#} (toFixed obj) (toWidget widget) - (fromIntegral x) (fromIntegral y) +fixedMove :: (FixedClass self, WidgetClass widget) => self + -> widget -- ^ @widget@ - the child widget. + -> (Int, Int) -- ^ @(x,y)@ - the horizontal and vertical position to move the + -- widget to. + -> IO () +fixedMove self widget (x, y) = + {# call fixed_move #} + (toFixed self) + (toWidget widget) + (fromIntegral x) + (fromIntegral y) --- | Sets whether the 'Fixed' widget is created with a separate "DrawWindow" for +-- | Sets whether the 'Fixed' widget is created with a separate 'DrawWindow' for -- its window or not. (By default, it will be created with no separate --- "DrawWindow"). This function must be called while the widget is not realized, +-- 'DrawWindow'). This function must be called while the 'Fixed' is not realized, -- for instance, immediately after the window is created. -- -fixedSetHasWindow :: FixedClass obj => obj -> Bool -> IO () -fixedSetHasWindow obj hasWindow = - {#call fixed_set_has_window#} (toFixed obj) (fromBool hasWindow) +-- This function was added to provide an easy migration path for older +-- applications which may expect 'Fixed' to have a separate window. +-- +fixedSetHasWindow :: FixedClass self => self -> Bool -> IO () +fixedSetHasWindow self hasWindow = + {# call fixed_set_has_window #} + (toFixed self) + (fromBool hasWindow) --- | Gets whether the 'Fixed' container has its own "DrawWindow". See --- 'fixedSetHasWindow'. +-- | Gets whether the 'Fixed' has its own 'DrawWindow'. See 'fixedSetHasWindow'. -- -fixedGetHasWindow :: FixedClass obj => obj -> IO Bool -fixedGetHasWindow obj = liftM toBool $ - {#call unsafe fixed_get_has_window#} (toFixed obj) +fixedGetHasWindow :: FixedClass self => self -> IO Bool +fixedGetHasWindow self = + liftM toBool $ + {# call unsafe fixed_get_has_window #} + (toFixed self) + +-------------------- +-- Properties + +-- | \'hasWindow\' property. See 'fixedGetHasWindow' and 'fixedSetHasWindow' +-- +fixedHasWindow :: FixedClass self => Attr self Bool +fixedHasWindow = Attr + fixedGetHasWindow + fixedSetHasWindow Index: Notebook.chs.pp =================================================================== RCS file: /cvsroot/gtk2hs/gtk2hs/gtk/Graphics/UI/Gtk/Layout/Notebook.chs.pp,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- Notebook.chs.pp 13 Mar 2005 19:34:34 -0000 1.4 +++ Notebook.chs.pp 24 Mar 2005 17:31:00 -0000 1.5 @@ -29,10 +29,10 @@ -- Stability : provisional -- Portability : portable (depends on GHC) -- --- A tabbed notebook container. +-- A tabbed notebook container -- module Graphics.UI.Gtk.Layout.Notebook ( --- * Description +-- * Detail -- -- | The 'Notebook' widget is a 'Container' whose children are pages that can [...1060 lines suppressed...] notebookGetShowBorder notebookSetShowBorder @@ -708,7 +882,7 @@ -- -- Default value: @False@ -- -notebookScrollable :: Attr Notebook Bool +notebookScrollable :: NotebookClass self => Attr self Bool notebookScrollable = Attr notebookGetScrollable notebookSetScrollable @@ -716,7 +890,7 @@ -- | \'currentPage\' property. See 'notebookGetCurrentPage' and -- 'notebookSetCurrentPage' -- -notebookCurrentPage :: Attr Notebook Int +notebookCurrentPage :: NotebookClass self => Attr self Int notebookCurrentPage = Attr notebookGetCurrentPage notebookSetCurrentPage Index: HButtonBox.chs =================================================================== RCS file: /cvsroot/gtk2hs/gtk2hs/gtk/Graphics/UI/Gtk/Layout/HButtonBox.chs,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- HButtonBox.chs 25 Feb 2005 01:11:34 -0000 1.2 +++ HButtonBox.chs 24 Mar 2005 17:31:00 -0000 1.3 @@ -27,7 +27,7 @@ -- A container for arranging buttons horizontally -- module Graphics.UI.Gtk.Layout.HButtonBox ( --- * Description +-- * Detail -- -- | A button box should be used to provide a consistent layout of buttons -- throughout your application. The layout\/spacing can be altered by the @@ -78,8 +78,10 @@ -------------------- -- Constructors --- | +-- | Creates a new horizontal button box. -- hButtonBoxNew :: IO HButtonBox -hButtonBoxNew = makeNewObject mkHButtonBox $ - liftM castPtr {#call unsafe hbutton_box_new#} +hButtonBoxNew = + makeNewObject mkHButtonBox $ + liftM (castPtr :: Ptr Widget -> Ptr HButtonBox) $ + {# call unsafe hbutton_box_new #} Index: HBox.chs =================================================================== RCS file: /cvsroot/gtk2hs/gtk2hs/gtk/Graphics/UI/Gtk/Layout/HBox.chs,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- HBox.chs 25 Feb 2005 01:11:34 -0000 1.3 +++ HBox.chs 24 Mar 2005 17:30:59 -0000 1.4 @@ -24,11 +24,10 @@ -- Stability : provisional -- Portability : portable (depends on GHC) -- --- This is a special version of 'Box'. This widget shows its child --- widgets in a horizontal line. +-- A horizontal container box -- module Graphics.UI.Gtk.Layout.HBox ( --- * Description +-- * Detail -- -- | 'HBox' is a container that organizes child widgets into a single row. -- @@ -47,6 +46,7 @@ -- | +----'Box' -- | +----HBox -- | +----'Combo' +-- | +----'FileChooserButton' -- | +----'Statusbar' -- @ @@ -71,12 +71,17 @@ -------------------- -- Constructors --- | --- Create a container that shows several children horizontally. If --- @homogeneous@ --- is set all children will be allotted the same amount of space. There will be --- @spacing@ pixel between each two children. +-- | Creates a new 'HBox'. -- -hBoxNew :: Bool -> Int -> IO HBox -hBoxNew homogeneous spacing = makeNewObject mkHBox $ liftM castPtr $ - {#call unsafe hbox_new#} (fromBool homogeneous) (fromIntegral spacing) +hBoxNew :: + Bool -- ^ @homogeneous@ - @True@ if all children are to be given equal + -- space allotments. + -> Int -- ^ @spacing@ - the number of pixels to place by default between + -- children. + -> IO HBox +hBoxNew homogeneous spacing = + makeNewObject mkHBox $ + liftM (castPtr :: Ptr Widget -> Ptr HBox) $ + {# call unsafe hbox_new #} + (fromBool homogeneous) + (fromIntegral spacing) Index: AspectFrame.chs =================================================================== RCS file: /cvsroot/gtk2hs/gtk2hs/gtk/Graphics/UI/Gtk/Layout/AspectFrame.chs,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- AspectFrame.chs 25 Feb 2005 01:11:34 -0000 1.3 +++ AspectFrame.chs 24 Mar 2005 17:30:59 -0000 1.4 @@ -24,10 +24,10 @@ -- Stability : provisional -- Portability : portable (depends on GHC) -- --- A frame that constrains its child to a particular aspect ratio. +-- A frame that constrains its child to a particular aspect ratio -- module Graphics.UI.Gtk.Layout.AspectFrame ( --- * Description +-- * Detail -- -- | The 'AspectFrame' is useful when you want pack a widget so that it can -- resize but always retains the same aspect ratio. For instance, one might be @@ -72,26 +72,49 @@ -------------------- -- Constructors --- | Create an AspectFrame widget. --- --- * If ratio is not given, the aspect ratio is taken from the child widget. +-- | Create a new 'AspectFrame'. -- --- * The frame may be augmented with a label which can be set by --- @frameSetLabel@. +-- The frame may be augmented with a label which can be set by @frameSetLabel@. -- -aspectFrameNew :: Float -> Float -> Maybe Float -> IO AspectFrame -aspectFrameNew xalign yalign ratio = makeNewObject mkAspectFrame $ - liftM castPtr $ {#call unsafe aspect_frame_new#} nullPtr (realToFrac xalign) - (realToFrac yalign) (maybe 0.0 realToFrac ratio) (fromBool $ isNothing ratio) +aspectFrameNew :: + Float -- ^ @xalign@ - Horizontal alignment of the child within + -- the allocation of the 'AspectFrame'. This ranges from 0.0 + -- (left aligned) to 1.0 (right aligned) + -> Float -- ^ @yalign@ - Vertical alignment of the child within the + -- allocation of the 'AspectFrame'. This ranges from 0.0 + -- (left aligned) to 1.0 (right aligned) + -> Maybe Float -- ^ @ratio@ - The desired aspect ratio. If @Nothing@ the + -- aspect ratio is taken from the requistion of the child. + -> IO AspectFrame +aspectFrameNew xalign yalign ratio = + makeNewObject mkAspectFrame $ + liftM (castPtr :: Ptr Widget -> Ptr AspectFrame) $ + {# call unsafe aspect_frame_new #} + nullPtr + (realToFrac xalign) + (realToFrac yalign) + (maybe 0.0 realToFrac ratio) + (fromBool $ isNothing ratio) -------------------- -- Methods --- | Change the space use behaviour of an --- 'AspectFrame'. +-- | Set parameters for an existing 'AspectFrame'. -- -aspectFrameSet :: AspectFrameClass af => af -> Float -> Float -> Maybe Float -> - IO () -aspectFrameSet af xalign yalign ratio = {#call aspect_frame_set#} - (toAspectFrame af) (realToFrac xalign) (realToFrac yalign) - (maybe 0.0 realToFrac ratio) (fromBool $ isNothing ratio) +aspectFrameSet :: AspectFrameClass self => self + -> Float -- ^ @xalign@ - Horizontal alignment of the child within the + -- allocation of the 'AspectFrame'. This ranges from 0.0 (left + -- aligned) to 1.0 (right aligned) + -> Float -- ^ @yalign@ - Vertical alignment of the child within the + -- allocation of the 'AspectFrame'. This ranges from 0.0 (left + -- aligned) to 1.0 (right aligned) + -> Maybe Float -- ^ @ratio@ - The desired aspect ratio. If @Nothing@ the + -- aspect ratio is taken from the requistion of the child. + -> IO () +aspectFrameSet self xalign yalign ratio = + {# call aspect_frame_set #} + (toAspectFrame self) + (realToFrac xalign) + (realToFrac yalign) + (maybe 0.0 realToFrac ratio) + (fromBool $ isNothing ratio) Index: Alignment.chs.pp =================================================================== RCS file: /cvsroot/gtk2hs/gtk2hs/gtk/Graphics/UI/Gtk/Layout/Alignment.chs.pp,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- Alignment.chs.pp 25 Feb 2005 01:11:34 -0000 1.3 +++ Alignment.chs.pp 24 Mar 2005 17:30:59 -0000 1.4 @@ -27,7 +27,7 @@ -- A widget which controls the alignment and size of its child -- module Graphics.UI.Gtk.Layout.Alignment ( --- * Description +-- * Detail -- -- | The 'Alignment' widget controls the alignment and size of its child -- widget. It has four settings: xscale, yscale, xalign, and yalign. @@ -81,48 +81,103 @@ -------------------- -- Constructors --- | Create an alignment widget. This widget tells --- its child widget how to use the given space. +-- | Creates a new 'Alignment'. -- -alignmentNew :: Float -> Float -> Float -> Float -> IO Alignment -alignmentNew yscale xalign yalign xscale = makeNewObject mkAlignment $ - liftM castPtr $ {#call unsafe alignment_new#} (realToFrac xalign) - (realToFrac yalign) (realToFrac xscale) (realToFrac yscale) +alignmentNew :: + Float -- ^ @xalign@ - the horizontal alignment of the child widget, + -- from 0 (left) to 1 (right). + -> Float -- ^ @yalign@ - the vertical alignment of the child widget, + -- from 0 (top) to 1 (bottom). + -> Float -- ^ @xscale@ - the amount that the child widget expands + -- horizontally to fill up unused space, from 0 to 1. A value + -- of 0 indicates that the child widget should never expand. A + -- value of 1 indicates that the child widget will expand to + -- fill all of the space allocated for the 'Alignment'. + -> Float -- ^ @yscale@ - the amount that the child widget expands + -- vertically to fill up unused space, from 0 to 1. The values + -- are similar to @xscale@. + -> IO Alignment +alignmentNew xalign yalign xscale yscale = + makeNewObject mkAlignment $ + liftM (castPtr :: Ptr Widget -> Ptr Alignment) $ + {# call unsafe alignment_new #} + (realToFrac xalign) + (realToFrac yalign) + (realToFrac xscale) + (realToFrac yscale) -------------------- -- Methods --- | Change the space use behaviour of an 'Alignment'. +-- | Sets the 'Alignment' values. -- -alignmentSet :: AlignmentClass al => al -> Float -> Float -> Float -> Float -> - IO () -alignmentSet al xalign yalign xscale yscale = {#call alignment_set#} - (toAlignment al) (realToFrac xalign) (realToFrac yalign) - (realToFrac xscale) (realToFrac yscale) +alignmentSet :: AlignmentClass self => self + -> Float -- ^ @xalign@ - the horizontal alignment of the child widget, from 0 + -- (left) to 1 (right). + -> Float -- ^ @yalign@ - the vertical alignment of the child widget, from 0 + -- (top) to 1 (bottom). + -> Float -- ^ @xscale@ - the amount that the child widget expands + -- horizontally to fill up unused space, from 0 to 1. A value of 0 + -- indicates that the child widget should never expand. A value of 1 + -- indicates that the child widget will expand to fill all of the + -- space allocated for the 'Alignment'. + -> Float -- ^ @yscale@ - the amount that the child widget expands vertically + -- to fill up unused space, from 0 to 1. The values are similar to + -- @xscale@. + -> IO () +alignmentSet self xalign yalign xscale yscale = + {# call alignment_set #} + (toAlignment self) + (realToFrac xalign) + (realToFrac yalign) + (realToFrac xscale) + (realToFrac yscale) #if GTK_CHECK_VERSION(2,4,0) --- | Sets the padding on the different sides of the widget. +-- | Sets the padding on the different sides of the widget. The padding adds +-- blank space to the sides of the widget. For instance, this can be used to +-- indent the child widget towards the right by adding padding on the left. -- -alignmentSetPadding :: AlignmentClass al => al -> Int -> Int -> Int -> Int -> - IO () -alignmentSetPadding al top bottom left right = - {# call gtk_alignment_set_padding #} (toAlignment al) - (fromIntegral top) (fromIntegral bottom) - (fromIntegral left) (fromIntegral right) +-- * Available since Gtk version 2.4 +-- +alignmentSetPadding :: AlignmentClass self => self + -> Int -- ^ @paddingTop@ - the padding at the top of the widget + -> Int -- ^ @paddingBottom@ - the padding at the bottom of the widget + -> Int -- ^ @paddingLeft@ - the padding at the left of the widget + -> Int -- ^ @paddingRight@ - the padding at the right of the widget. + -> IO () +alignmentSetPadding self paddingTop paddingBottom paddingLeft paddingRight = + {# call gtk_alignment_set_padding #} + (toAlignment self) + (fromIntegral paddingTop) + (fromIntegral paddingBottom) + (fromIntegral paddingLeft) + (fromIntegral paddingRight) --- | Gets the padding on the different sides of the widget. +-- | Gets the padding on the different sides of the widget. See +-- 'alignmentSetPadding'. -- -alignmentGetPadding :: AlignmentClass al => al -> IO (Int, Int, Int, Int) -alignmentGetPadding al = - alloca $ \topPtr -> alloca $ \bottomPtr -> - alloca $ \leftPtr -> alloca $ \rightPtr -> do - {# call gtk_alignment_get_padding #} (toAlignment al) - topPtr bottomPtr leftPtr rightPtr +-- * Available since Gtk version 2.4 +-- +alignmentGetPadding :: AlignmentClass self => self + -> IO (Int, Int, Int, Int) -- ^ @(paddingTop, paddingBottom, paddingLeft, + -- paddingRight)@ - the padding at the top, + -- bottom, left and right of the widget. +alignmentGetPadding self = + alloca $ \topPtr -> + alloca $ \bottomPtr -> + alloca $ \leftPtr -> + alloca $ \rightPtr -> do + {# call gtk_alignment_get_padding #} + (toAlignment self) + topPtr + bottomPtr + leftPtr + rightPtr top <- peek topPtr bottom <- peek bottomPtr left <- peek leftPtr right <- peek rightPtr return (fromIntegral top, fromIntegral bottom ,fromIntegral left, fromIntegral right) - #endif Index: VPaned.chs =================================================================== RCS file: /cvsroot/gtk2hs/gtk2hs/gtk/Graphics/UI/Gtk/Layout/VPaned.chs,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- VPaned.chs 25 Feb 2005 01:11:34 -0000 1.3 +++ VPaned.chs 24 Mar 2005 17:31:00 -0000 1.4 @@ -24,10 +24,10 @@ -- Stability : provisional -- Portability : portable (depends on GHC) -- --- A container with two panes arranged vertically. +-- A container with two panes arranged vertically -- module Graphics.UI.Gtk.Layout.VPaned ( --- * Description +-- * Detail -- -- | The VPaned widget is a container widget with two children arranged -- vertically. The division between the two panes is adjustable by the user by @@ -65,7 +65,10 @@ -------------------- -- Constructors --- | +-- | Create a new 'VPaned' -- vPanedNew :: IO VPaned -vPanedNew = makeNewObject mkVPaned $ liftM castPtr {#call unsafe vpaned_new#} +vPanedNew = + makeNewObject mkVPaned $ + liftM (castPtr :: Ptr Widget -> Ptr VPaned) $ + {# call unsafe vpaned_new #} Index: Layout.chs =================================================================== RCS file: /cvsroot/gtk2hs/gtk2hs/gtk/Graphics/UI/Gtk/Layout/Layout.chs,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- Layout.chs 13 Mar 2005 19:34:34 -0000 1.4 +++ Layout.chs 24 Mar 2005 17:31:00 -0000 1.5 @@ -27,7 +27,7 @@ -- Infinite scrollable area containing child widgets and\/or custom drawing -- module Graphics.UI.Gtk.Layout.Layout ( --- * Description +-- * Detail -- -- | 'Layout' is similar to 'DrawingArea' in that it's a \"blank slate\" and -- doesn't do anything but paint a blank background by default. It's different @@ -87,81 +87,148 @@ -------------------- -- Constructors --- | Create a new layout widget. +-- | Creates a new 'Layout'. Unless you have a specific adjustment you'd like +-- the layout to use for scrolling, pass @Nothing@ for @hadjustment@ and +-- @vadjustment@. -- -layoutNew :: Maybe Adjustment -> Maybe Adjustment -> IO Layout -layoutNew vAdj hAdj = makeNewObject mkLayout $ liftM castPtr $ - {#call unsafe layout_new#} (fromMAdj hAdj) (fromMAdj vAdj) - where - fromMAdj :: Maybe Adjustment -> Adjustment - fromMAdj = fromMaybe $ mkAdjustment nullForeignPtr +layoutNew :: + Maybe Adjustment -- ^ @hadjustment@ - horizontal scroll adjustment, or + -- @Nothing@ + -> Maybe Adjustment -- ^ @vadjustment@ - vertical scroll adjustment, or + -- @Nothing@ + -> IO Layout +layoutNew hadjustment vadjustment = + makeNewObject mkLayout $ + liftM (castPtr :: Ptr Widget -> Ptr Layout) $ + {# call unsafe layout_new #} + (fromMaybe (Adjustment nullForeignPtr) hadjustment) + (fromMaybe (Adjustment nullForeignPtr) vadjustment) -------------------- -- Methods --- | Insert a widget into the layout container. +-- | Adds @childWidget@ to @layout@, at position @(x,y)@. @layout@ becomes +-- the new parent container of @childWidget@. -- -layoutPut :: (LayoutClass l, WidgetClass w) => l -> w -> Int -> Int -> IO () -layoutPut l widget x y = {#call layout_put#} (toLayout l) (toWidget widget) - (fromIntegral x) (fromIntegral y) +layoutPut :: (LayoutClass self, WidgetClass childWidget) => self + -> childWidget -- ^ @childWidget@ - child widget + -> Int -- ^ @x@ - X position of child widget + -> Int -- ^ @y@ - Y position of child widget + -> IO () +layoutPut self childWidget x y = + {# call layout_put #} + (toLayout self) + (toWidget childWidget) + (fromIntegral x) + (fromIntegral y) --- | Move an existing widget within the container. +-- | Moves a current child of @layout@ to a new position. -- -layoutMove :: (LayoutClass l, WidgetClass w) => l -> w -> Int -> Int -> IO () -layoutMove l widget x y = {#call layout_move#} (toLayout l) (toWidget widget) - (fromIntegral x) (fromIntegral y) +layoutMove :: (LayoutClass self, WidgetClass childWidget) => self + -> childWidget -- ^ @childWidget@ - a current child of @layout@ + -> Int -- ^ @x@ - X position to move to + -> Int -- ^ @y@ - Y position to move to + -> IO () +layoutMove self childWidget x y = + {# call layout_move #} + (toLayout self) + (toWidget childWidget) + (fromIntegral x) + (fromIntegral y) --- | Set the size of the layout widget. +-- | Sets the size of the scrollable area of the layout. -- -layoutSetSize :: LayoutClass l => l -> Int -> Int -> IO () -layoutSetSize l width height = {#call layout_set_size#} (toLayout l) - (fromIntegral width) (fromIntegral height) +layoutSetSize :: LayoutClass self => self + -> Int -- ^ @width@ - width of entire scrollable area + -> Int -- ^ @height@ - height of entire scrollable area + -> IO () +layoutSetSize self width height = + {# call layout_set_size #} + (toLayout self) + (fromIntegral width) + (fromIntegral height) --- | Get the size of the layout widget. +-- | Gets the size that has been set on the layout, and that determines the +-- total extents of the layout's scrollbar area. See 'layoutSetSize'. -- -layoutGetSize :: LayoutClass l => l -> IO (Int, Int) -layoutGetSize l = - alloca $ \widthPtr -> alloca $ \heightPtr -> do - {#call unsafe layout_get_size#} (toLayout l) widthPtr heightPtr +layoutGetSize :: LayoutClass self => self + -> IO (Int, Int) -- ^ @(width, height)@ +layoutGetSize self = + alloca $ \widthPtr -> + alloca $ \heightPtr -> do + {# call unsafe layout_get_size #} + (toLayout self) + widthPtr + heightPtr width <-peek widthPtr height <- peek heightPtr return (fromIntegral width, fromIntegral height) --- | Retrieve the horizontal 'Adjustment' object from the layout. +-- | This function should only be called after the layout has been placed in a +-- 'ScrolledWindow' or otherwise configured for scrolling. It returns the +-- 'Adjustment' used for communication between the horizontal scrollbar and +-- @layout@. -- -layoutGetHAdjustment :: LayoutClass l => l -> IO Adjustment -layoutGetHAdjustment l = makeNewObject mkAdjustment $ - {#call unsafe layout_get_hadjustment#} (toLayout l) +-- See 'ScrolledWindow', 'Scrollbar', 'Adjustment' for details. +-- +layoutGetHAdjustment :: LayoutClass self => self + -> IO Adjustment -- ^ returns horizontal scroll adjustment +layoutGetHAdjustment self = + makeNewObject mkAdjustment $ + {# call unsafe layout_get_hadjustment #} + (toLayout self) --- | Retrieve the vertical 'Adjustment' object from the layout. +-- | This function should only be called after the layout has been placed in a +-- 'ScrolledWindow' or otherwise configured for scrolling. It returns the +-- 'Adjustment' used for communication between the vertical scrollbar and +-- @layout@. -- -layoutGetVAdjustment :: LayoutClass l => l -> IO Adjustment -layoutGetVAdjustment l = makeNewObject mkAdjustment $ - {#call unsafe layout_get_vadjustment#} (toLayout l) +-- See 'ScrolledWindow', 'Scrollbar', 'Adjustment' for details. +-- +layoutGetVAdjustment :: LayoutClass self => self + -> IO Adjustment -- ^ returns vertical scroll adjustment +layoutGetVAdjustment self = + makeNewObject mkAdjustment $ + {# call unsafe layout_get_vadjustment #} + (toLayout self) --- | Set the horizontal adjustment object. +-- | Sets the horizontal scroll adjustment for the layout. -- -layoutSetHAdjustment :: LayoutClass l => l -> Adjustment -> IO () -layoutSetHAdjustment l adj = {#call layout_set_hadjustment#} (toLayout l) adj +-- See 'ScrolledWindow', 'Scrollbar', 'Adjustment' for details. +-- +layoutSetHAdjustment :: LayoutClass self => self + -> Adjustment -- ^ @adjustment@ - new scroll adjustment + -> IO () +layoutSetHAdjustment self adjustment = + {# call layout_set_hadjustment #} + (toLayout self) + adjustment --- | Set the vertical adjustment object. +-- | Sets the vertical scroll adjustment for the layout. -- -layoutSetVAdjustment :: LayoutClass l => l -> Adjustment -> IO () -layoutSetVAdjustment l adj = {#call layout_set_vadjustment#} (toLayout l) adj +-- See 'ScrolledWindow', 'Scrollbar', 'Adjustment' for details. +-- +layoutSetVAdjustment :: LayoutClass self => self + -> Adjustment -- ^ @adjustment@ - new scroll adjustment + -> IO () +layoutSetVAdjustment self adjustment = + {# call layout_set_vadjustment #} + (toLayout self) + adjustment -------------------- -- Properties -- | The 'Adjustment' for the horizontal position. -- -layoutHAdjustment :: Attr Layout Adjustment +layoutHAdjustment :: LayoutClass self => Attr self Adjustment layoutHAdjustment = Attr layoutGetHAdjustment layoutSetHAdjustment -- | The 'Adjustment' for the vertical position. -- -layoutVAdjustment :: Attr Layout Adjustment +layoutVAdjustment :: LayoutClass self => Attr self Adjustment layoutVAdjustment = Attr layoutGetVAdjustment layoutSetVAdjustment @@ -169,13 +236,10 @@ -------------------- -- Signals --- | In case the adjustments are --- replaced, this signal is emitted. +-- | In case the adjustments are replaced, this signal is emitted. -- -onSetScrollAdjustments, afterSetScrollAdjustments :: LayoutClass l => l ->(Adjustment -> Adjustment -> IO ()) -> - IO (ConnectId l) -onSetScrollAdjustments = - connect_OBJECT_OBJECT__NONE "set-scroll-adjustments" False -afterSetScrollAdjustments = - connect_OBJECT_OBJECT__NONE "set-scroll-adjustments" True - +onSetScrollAdjustments, afterSetScrollAdjustments :: LayoutClass self => self + -> (Adjustment -> Adjustment -> IO ()) + -> IO (ConnectId self) +onSetScrollAdjustments = connect_OBJECT_OBJECT__NONE "set-scroll-adjustments" False +afterSetScrollAdjustments = connect_OBJECT_OBJECT__NONE "set-scroll-adjustments" True Index: VBox.chs =================================================================== RCS file: /cvsroot/gtk2hs/gtk2hs/gtk/Graphics/UI/Gtk/Layout/VBox.chs,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- VBox.chs 25 Feb 2005 01:11:34 -0000 1.3 +++ VBox.chs 24 Mar 2005 17:31:00 -0000 1.4 @@ -24,11 +24,10 @@ -- Stability : provisional -- Portability : portable (depends on GHC) -- --- This is a special version of 'Box'. This widget shows its child widgets --- in a vertical line. +-- A vertical container box -- module Graphics.UI.Gtk.Layout.VBox ( --- * Description +-- * Detail -- -- | 'VBox' is a container that organizes child widgets into a single column. -- @@ -73,13 +72,17 @@ -------------------- -- Constructors --- | --- Create a container that shows several children vertically. --- --- * If @homogeneous@ --- is set all children will be allotted the same amount of space. There will be --- @spacing@ pixel between each two children. +-- | Creates a new 'VBox'. -- -vBoxNew :: Bool -> Int -> IO VBox -vBoxNew homogeneous spacing = makeNewObject mkVBox $ liftM castPtr $ - {#call unsafe vbox_new#} (fromBool homogeneous) (fromIntegral spacing) +vBoxNew :: + Bool -- ^ @homogeneous@ - @True@ if all children are to be given equal + -- space allotments. + -> Int -- ^ @spacing@ - the number of pixels to place by default between + -- children. + -> IO VBox +vBoxNew homogeneous spacing = + makeNewObject mkVBox $ + liftM (castPtr :: Ptr Widget -> Ptr VBox) $ + {# call unsafe vbox_new #} + (fromBool homogeneous) + (fromIntegral spacing) Index: Table.chs =================================================================== RCS file: /cvsroot/gtk2hs/gtk2hs/gtk/Graphics/UI/Gtk/Layout/Table.chs,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- Table.chs 13 Mar 2005 19:34:34 -0000 1.4 +++ Table.chs 24 Mar 2005 17:31:00 -0000 1.5 @@ -27,7 +27,7 @@ -- The table widget is a container in which widgets can be aligned in cells. -- module Graphics.UI.Gtk.Layout.Table ( --- * Description +-- * Detail -- -- | The 'Table' functions allow the programmer to arrange widgets in rows and -- columns, making it easy to align many widgets next to each other, @@ -100,116 +100,218 @@ -------------------- -- Constructors --- | Create a new table with the specified dimensions. --- Set @homogeneous@ to True if all cells should be of the same size. +-- | Used to create a new table widget. An initial size must be given by +-- specifying how many rows and columns the table should have, although this +-- can be changed later with 'tableResize'. @rows@ and @columns@ must both be +-- in the range 0 .. 65535. -- -tableNew :: Int -> Int -> Bool -> IO Table -tableNew rows columns homogeneous = makeNewObject mkTable $ liftM castPtr $ - {#call unsafe table_new#} (fromIntegral rows) (fromIntegral columns) - (fromBool homogeneous) +tableNew :: + Int -- ^ @rows@ - The number of rows the new table should have. + -> Int -- ^ @columns@ - The number of columns the new table should have. + -> Bool -- ^ @homogeneous@ - If set to @True@, all table cells are + -- resized to the size of the cell containing the largest widget. + -> IO Table +tableNew rows columns homogeneous = + makeNewObject mkTable $ + liftM (castPtr :: Ptr Widget -> Ptr Table) $ + {# call unsafe table_new #} + (fromIntegral rows) + (fromIntegral columns) + (fromBool homogeneous) -------------------- -- Methods -- | Change the dimensions of an already existing table. -- -tableResize :: TableClass tb => tb -> Int -> Int -> IO () -tableResize tb rows columns = {#call table_resize#} (toTable tb) - (fromIntegral rows) (fromIntegral columns) +tableResize :: TableClass self => self + -> Int -- ^ @rows@ - The new number of rows. + -> Int -- ^ @columns@ - The new number of columns. + -> IO () +tableResize self rows columns = + {# call table_resize #} + (toTable self) + (fromIntegral rows) + (fromIntegral columns) --- | Put a new widget in the table container. The widget should span the cells --- (leftAttach,topAttach) to (rightAttach,bottomAttach). Further formatting --- options have to be specified. +-- | Adds a widget to a table. The number of \'cells\' that a widget will +-- occupy is specified by @leftAttach@, @rightAttach@, @topAttach@ and +-- @bottomAttach@. These each represent the leftmost, rightmost, uppermost and +-- lowest column and row numbers of the table. (Columns and rows are indexed +-- from zero). -- -tableAttach :: (TableClass tb, WidgetClass w) => tb -> w -> Int -> Int -> - Int -> Int -> [AttachOptions] -> [AttachOptions] -> Int -> - Int -> IO () -tableAttach tb child leftAttach rightAttach topAttach bottomAttach xoptions - yoptions xpadding ypadding = {#call table_attach#} (toTable tb) - (toWidget child) (fromIntegral leftAttach) (fromIntegral rightAttach) - (fromIntegral topAttach) (fromIntegral bottomAttach) - ((fromIntegral.fromFlags) xoptions) ((fromIntegral.fromFlags) yoptions) - (fromIntegral xpadding) (fromIntegral ypadding) +tableAttach :: (TableClass self, WidgetClass child) => self + -> child -- ^ @child@ - The widget to add. + -> Int -- ^ @leftAttach@ - the column number to attach the left + -- side of a child widget to. + -> Int -- ^ @rightAttach@ - the column number to attach the right + -- side of a child widget to. + -> Int -- ^ @topAttach@ - the row number to attach the top of a + -- child widget to. + -> Int -- ^ @bottomAttach@ - the row number to attach the bottom + -- of a child widget to. + -> [AttachOptions] -- ^ @xoptions@ - Used to specify the properties of the + -- child widget when the table is resized. + -> [AttachOptions] -- ^ @yoptions@ - The same as xoptions, except this field + -- determines behaviour of vertical resizing. + -> Int -- ^ @xpadding@ - An integer value specifying the padding + -- on the left and right of the widget being added to the + -- table. + -> Int -- ^ @ypadding@ - The amount of padding above and below + -- the child widget. + -> IO () +tableAttach self child leftAttach rightAttach topAttach bottomAttach xoptions + yoptions xpadding ypadding = + {# call table_attach #} + (toTable self) + (toWidget child) + (fromIntegral leftAttach) + (fromIntegral rightAttach) + (fromIntegral topAttach) + (fromIntegral bottomAttach) + ((fromIntegral . fromFlags) xoptions) + ((fromIntegral . fromFlags) yoptions) + (fromIntegral xpadding) + (fromIntegral ypadding) --- | Put a new widget in the table container. As opposed to 'tableAttach' this --- function assumes default values for the packing options. +-- | As there are many options associated with 'tableAttach', this convenience +-- function provides the programmer with a means to add children to a table +-- with identical padding and expansion options. The values used for the +-- 'AttachOptions' are @['Expand', 'Fill']@, and the padding is set to 0. -- -tableAttachDefaults :: (TableClass tb, WidgetClass w) => tb -> w -> Int -> - Int -> Int -> Int -> IO () -tableAttachDefaults tb child leftAttach rightAttach topAttach bottomAttach = - {#call table_attach_defaults#} (toTable tb) (toWidget child) - (fromIntegral leftAttach) (fromIntegral rightAttach) - (fromIntegral topAttach) (fromIntegral bottomAttach) +tableAttachDefaults :: (TableClass self, WidgetClass widget) => self + -> widget -- ^ @widget@ - The child widget to add. + -> Int -- ^ @leftAttach@ - The column number to attach the left side of + -- the child widget to. + -> Int -- ^ @rightAttach@ - The column number to attach the right side of + -- the child widget to. + -> Int -- ^ @topAttach@ - The row number to attach the top of the child + -- widget to. + -> Int -- ^ @bottomAttach@ - The row number to attach the bottom of the + -- child widget to. + -> IO () +tableAttachDefaults self widget leftAttach rightAttach topAttach bottomAttach = + {# call table_attach_defaults #} + (toTable self) + (toWidget widget) + (fromIntegral leftAttach) + (fromIntegral rightAttach) + (fromIntegral topAttach) + (fromIntegral bottomAttach) --- | Set the amount of space (in pixels) between the specified row and its --- neighbours. +-- | Changes the space between a given table row and its surrounding rows. -- -tableSetRowSpacing :: TableClass tb => tb - -> Int -- ^ Row number, indexed from 0 - -> Int -- ^ Spacing size in pixels - -> IO () -tableSetRowSpacing tb row space = {#call table_set_row_spacing#} - (toTable tb) (fromIntegral row) (fromIntegral space) +tableSetRowSpacing :: TableClass self => self + -> Int -- ^ @row@ - row number whose spacing will be changed. + -> Int -- ^ @spacing@ - number of pixels that the spacing should take up. + -> IO () +tableSetRowSpacing self row spacing = + {# call table_set_row_spacing #} + (toTable self) + (fromIntegral row) + (fromIntegral spacing) --- | Get the amount of space (in pixels) between the specified row and the --- next row. +-- | Gets the amount of space between row @row@, and row @row@ + 1. See +-- 'tableSetRowSpacing'. -- -tableGetRowSpacing :: TableClass tb => tb -> Int -> IO Int -tableGetRowSpacing tb row = liftM fromIntegral $ - {#call unsafe table_get_row_spacing#} (toTable tb) (fromIntegral row) +tableGetRowSpacing :: TableClass self => self + -> Int -- ^ @row@ - a row in the table, 0 indicates the first row + -> IO Int -- ^ returns the row spacing +tableGetRowSpacing self row = + liftM fromIntegral $ + {# call unsafe table_get_row_spacing #} + (toTable self) + (fromIntegral row) --- | Set the amount of space (in pixels) between the specified column and --- its neighbours. +-- | Alters the amount of space between a given table column and the adjacent +-- columns. -- -tableSetColSpacing :: TableClass tb => tb -> Int -> Int -> IO () -tableSetColSpacing tb col space = {#call table_set_col_spacing#} - (toTable tb) (fromIntegral col) (fromIntegral space) +tableSetColSpacing :: TableClass self => self + -> Int -- ^ @column@ - the column whose spacing should be changed. + -> Int -- ^ @spacing@ - number of pixels that the spacing should take up. + -> IO () +tableSetColSpacing self column spacing = + {# call table_set_col_spacing #} + (toTable self) + (fromIntegral column) + (fromIntegral spacing) --- | Get the amount of space (in pixels) between the specified column and the --- next column. +-- | Gets the amount of space between column @col@, and column @col@ + 1. See +-- 'tableSetColSpacing'. -- -tableGetColSpacing :: TableClass tb => tb -> Int -> IO Int -tableGetColSpacing tb col = liftM fromIntegral $ - {#call unsafe table_get_col_spacing#} (toTable tb) (fromIntegral col) +tableGetColSpacing :: TableClass self => self + -> Int -- ^ @column@ - a column in the table, 0 indicates the first column + -> IO Int -- ^ returns the column spacing +tableGetColSpacing self column = + liftM fromIntegral $ + {# call unsafe table_get_col_spacing #} + (toTable self) + (fromIntegral column) --- | Set the amount of space between any two rows. +-- | Sets the space between every row in @table@ equal to @spacing@. -- -tableSetRowSpacings :: TableClass tb => tb -> Int -> IO () -tableSetRowSpacings tb space = {#call table_set_row_spacings#} - (toTable tb) (fromIntegral space) +tableSetRowSpacings :: TableClass self => self + -> Int -- ^ @spacing@ - the number of pixels of space to place between + -- every row in the table. + -> IO () +tableSetRowSpacings self spacing = + {# call table_set_row_spacings #} + (toTable self) + (fromIntegral spacing) -- | Gets the default row spacing for the table. This is the spacing that will --- be used for newly added rows. +-- be used for newly added rows. (See 'tableSetRowSpacings') -- -tableGetDefaultRowSpacing :: TableClass tb => tb -> IO Int -tableGetDefaultRowSpacing tb = liftM fromIntegral $ - {#call unsafe table_get_default_row_spacing#} (toTable tb) +tableGetDefaultRowSpacing :: TableClass self => self + -> IO Int -- ^ returns the default row spacing +tableGetDefaultRowSpacing self = + liftM fromIntegral $ + {# call unsafe table_get_default_row_spacing #} + (toTable self) --- | Set the amount of space between any two columns. +-- | Sets the space between every column in @table@ equal to @spacing@. -- -tableSetColSpacings :: TableClass tb => tb -> Int -> IO () -tableSetColSpacings tb space = {#call table_set_col_spacings#} - (toTable tb) (fromIntegral space) +tableSetColSpacings :: TableClass self => self + -> Int -- ^ @spacing@ - the number of pixels of space to place between + -- every column in the table. + -> IO () +tableSetColSpacings self spacing = + {# call table_set_col_spacings #} + (toTable self) + (fromIntegral spacing) -- | Gets the default column spacing for the table. This is the spacing that --- will be used for newly added columns. +-- will be used for newly added columns. (See 'tableSetColSpacings') -- -tableGetDefaultColSpacing :: TableClass tb => tb -> IO Int -tableGetDefaultColSpacing tb = liftM fromIntegral $ - {#call unsafe table_get_default_col_spacing#} (toTable tb) +tableGetDefaultColSpacing :: TableClass self => self + -> IO Int -- ^ returns the default column spacing +tableGetDefaultColSpacing self = + liftM fromIntegral $ + {# call unsafe table_get_default_col_spacing #} + (toTable self) --- | Make all cells the same size. +-- | Changes the homogenous property of table cells, ie. whether all cells are +-- an equal size or not. -- -tableSetHomogeneous :: TableClass tb => tb -> Bool -> IO () -tableSetHomogeneous tb hom = - {#call table_set_homogeneous#} (toTable tb) (fromBool hom) +tableSetHomogeneous :: TableClass self => self + -> Bool -- ^ @homogeneous@ - Set to @True@ to ensure all table cells are the + -- same size. Set to @False@ if this is not your desired behaviour. + -> IO () +tableSetHomogeneous self homogeneous = + {# call table_set_homogeneous #} + (toTable self) + (fromBool homogeneous) -- | Returns whether the table cells are all constrained to the same width and --- height. +-- height. (See 'tableSetHomogenous') -- -tableGetHomogeneous :: TableClass tb => tb -> IO Bool -tableGetHomogeneous tb = - liftM toBool $ {#call unsafe table_get_homogeneous#} (toTable tb) +tableGetHomogeneous :: TableClass self => self + -> IO Bool -- ^ returns @True@ if the cells are all constrained to the same + -- size +tableGetHomogeneous self = + liftM toBool $ + {# call unsafe table_get_homogeneous #} + (toTable self) -------------------- -- Properties @@ -218,7 +320,7 @@ -- -- Default value: @False@ -- -tableHomogeneous :: Attr Table Bool +tableHomogeneous :: TableClass self => Attr self Bool tableHomogeneous = Attr tableGetHomogeneous tableSetHomogeneous Index: Expander.chs.pp =================================================================== RCS file: /cvsroot/gtk2hs/gtk2hs/gtk/Graphics/UI/Gtk/Layout/Expander.chs.pp,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- Expander.chs.pp 13 Mar 2005 19:34:34 -0000 1.5 +++ Expander.chs.pp 24 Mar 2005 17:30:59 -0000 1.6 @@ -26,8 +26,10 @@ -- -- A container which can hide its child -- +-- * Module available since Gtk+ version 2.4 +-- module Graphics.UI.Gtk.Layout.Expander ( --- * Description +-- * Detail -- -- | A 'Expander' allows the user to hide or show its child by clicking on an -- expander triangle similar to the triangles used in a 'TreeView'. @@ -36,8 +38,6 @@ -- 'Bin'; you create the child widget and use 'containerAdd' to add it to the -- expander. When the expander is toggled, it will take care of showing and -- hiding the child automatically. --- --- * Module available since Gtk version 2.4 -- * Class Hierarchy -- | @@ -87,8 +87,6 @@ #endif ) where -#if GTK_CHECK_VERSION(2,4,0) - import Monad (liftM) import System.Glib.FFI @@ -100,74 +98,164 @@ {# context lib="gtk" prefix="gtk" #} +#if GTK_CHECK_VERSION(2,4,0) -------------------- -- Constructors +-- | Creates a new expander using @label@ as the text of the label. +-- expanderNew :: String -> IO Expander -expanderNew label = - makeNewObject mkExpander $ liftM castPtr $ - withUTFString label $ \strPtr -> - {# call gtk_expander_new #} strPtr +expanderNew label = + makeNewObject mkExpander $ + liftM (castPtr :: Ptr Widget -> Ptr Expander) $ + withUTFString label $ \labelPtr -> + {# call gtk_expander_new #} + labelPtr -expanderNewWithMnemonic :: String -> IO Expander +-- | Creates a new expander using @label@ as the text of the label. If +-- characters in @label@ are preceded by an underscore, they are underlined. If +-- you need a literal underscore character in a label, use \'__\' (two +-- underscores). The first underlined character represents a keyboard +-- accelerator called a mnemonic. Pressing Alt and that key activates the +-- button. +-- +expanderNewWithMnemonic :: + String -- ^ @label@ - the text of the label with an underscore in + -- front of the mnemonic character + -> IO Expander expanderNewWithMnemonic label = - makeNewObject mkExpander $ liftM castPtr $ - withUTFString label $ \strPtr -> - {# call gtk_expander_new_with_mnemonic #} strPtr + makeNewObject mkExpander $ + liftM (castPtr :: Ptr Widget -> Ptr Expander) $ + withUTFString label $ \labelPtr -> + {# call gtk_expander_new_with_mnemonic #} + labelPtr -------------------- -- Methods +-- | Sets the state of the expander. Set to @True@, if you want the child +-- widget to be revealed, and @False@ if you want the child widget to be +-- hidden. +-- expanderSetExpanded :: Expander -> Bool -> IO () -expanderSetExpanded expander expanded = - {# call gtk_expander_set_expanded #} expander (fromBool expanded) +expanderSetExpanded self expanded = + {# call gtk_expander_set_expanded #} + self + (fromBool expanded) +-- | Queries a 'Expander' and returns its current state. Returns @True@ if the +-- child widget is revealed. +-- +-- See 'expanderSetExpanded'. +-- expanderGetExpanded :: Expander -> IO Bool -expanderGetExpanded expander = liftM toBool $ - {# call gtk_expander_get_expanded #} expander +expanderGetExpanded self = + liftM toBool $ + {# call gtk_expander_get_expanded #} + self -expanderSetSpacing :: Expander -> Int -> IO () -expanderSetSpacing expander spacing = - {# call gtk_expander_set_spacing #} expander (fromIntegral spacing) +-- | Sets the spacing field of @expander@, which is the number of pixels to +-- place between expander and the child. +-- +expanderSetSpacing :: Expander -> Int + -> IO () +expanderSetSpacing self spacing = + {# call gtk_expander_set_spacing #} + self + (fromIntegral spacing) -expanderGetSpacing :: Expander -> IO Int -expanderGetSpacing expander = liftM fromIntegral $ - {# call gtk_expander_get_spacing #} expander +-- | Gets the value set by 'expanderSetSpacing'. +-- +expanderGetSpacing :: Expander + -> IO Int -- ^ returns spacing between the expander and child. +expanderGetSpacing self = + liftM fromIntegral $ + {# call gtk_expander_get_spacing #} + self +-- | Sets the text of the label of the expander to @label@. +-- +-- This will also clear any previously set labels. +-- expanderSetLabel :: Expander -> String -> IO () -expanderSetLabel expander label = - withUTFString label $ \strPtr -> - {# call gtk_expander_set_label #} expander strPtr +expanderSetLabel self label = + withUTFString label $ \labelPtr -> + {# call gtk_expander_set_label #} + self + labelPtr +-- | Fetches the text from the label of the expander, as set by +-- 'expanderSetLabel'. +-- expanderGetLabel :: Expander -> IO String -expanderGetLabel expander = do - strPtr <- {# call gtk_expander_get_label #} expander - peekUTFString strPtr +expanderGetLabel self = + {# call gtk_expander_get_label #} + self + >>= peekUTFString -expanderSetUseUnderline :: Expander -> Bool -> IO () -expanderSetUseUnderline expander useUnderline = - {# call gtk_expander_set_use_underline #} expander (fromBool useUnderline) +-- | If true, an underline in the text of the expander label indicates the +-- next character should be used for the mnemonic accelerator key. +-- +expanderSetUseUnderline :: Expander + -> Bool -- ^ @useUnderline@ - @True@ if underlines in the text indicate + -- mnemonics + -> IO () +expanderSetUseUnderline self useUnderline = + {# call gtk_expander_set_use_underline #} + self + (fromBool useUnderline) -expanderGetUseUnderline :: Expander -> IO Bool -expanderGetUseUnderline expander = liftM toBool $ - {# call gtk_expander_get_use_underline #} expander +-- | Returns whether an embedded underline in the expander label indicates a +-- mnemonic. See 'expanderSetUseUnderline'. +-- +expanderGetUseUnderline :: Expander + -> IO Bool -- ^ returns @True@ if an embedded underline in the expander + -- label indicates the mnemonic accelerator keys. +expanderGetUseUnderline self = + liftM toBool $ + {# call gtk_expander_get_use_underline #} + self -expanderSetUseMarkup :: Expander -> Bool -> IO () -expanderSetUseMarkup expander useMarkup = - {# call gtk_expander_set_use_markup #} expander (fromBool useMarkup) +-- | Sets whether the text of the label contains markup in Pango's text markup +-- language. See 'labelSetMarkup'. +-- +expanderSetUseMarkup :: Expander + -> Bool -- ^ @useMarkup@ - @True@ if the label's text should be parsed + -- for markup + -> IO () +expanderSetUseMarkup self useMarkup = + {# call gtk_expander_set_use_markup #} + self + (fromBool useMarkup) +-- | Returns whether the label's text is interpreted as marked up with the +-- Pango text markup language. See 'expanderSetUseMarkup'. +-- expanderGetUseMarkup :: Expander -> IO Bool -expanderGetUseMarkup expander = liftM toBool $ - {# call gtk_expander_get_use_markup #} expander +expanderGetUseMarkup self = + liftM toBool $ + {# call gtk_expander_get_use_markup #} + self -expanderSetLabelWidget :: WidgetClass widget => Expander -> widget -> IO () -expanderSetLabelWidget expander widget = - {# call gtk_expander_set_label_widget #} expander (toWidget widget) +-- | Set the label widget for the expander. This is the widget that will +-- appear embedded alongside the expander arrow. +-- +expanderSetLabelWidget :: WidgetClass labelWidget => Expander + -> labelWidget -- ^ @labelWidget@ - the new label widget + -> IO () +expanderSetLabelWidget self labelWidget = + {# call gtk_expander_set_label_widget #} + self + (toWidget labelWidget) -expanderGetLabelWidget :: Expander -> IO Widget -expanderGetLabelWidget expander = - makeNewObject mkWidget $ - {# call gtk_expander_get_label_widget #} expander +-- | Retrieves the label widget for the frame. See 'expanderSetLabelWidget'. +-- +expanderGetLabelWidget :: Expander + -> IO Widget -- ^ returns the label widget +expanderGetLabelWidget self = + makeNewObject mkWidget $ + {# call gtk_expander_get_label_widget #} + self -------------------- -- Properties @@ -221,9 +309,9 @@ -------------------- -- Signals -onActivate :: Expander -> IO () -> IO (ConnectId Expander) -afterActivate :: Expander -> IO () -> IO (ConnectId Expander) +onActivate, afterActivate :: Expander + -> IO () + -> IO (ConnectId Expander) onActivate = connect_NONE__NONE "activate" False afterActivate = connect_NONE__NONE "activate" True - #endif Index: HPaned.chs =================================================================== RCS file: /cvsroot/gtk2hs/gtk2hs/gtk/Graphics/UI/Gtk/Layout/HPaned.chs,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- HPaned.chs 25 Feb 2005 01:11:34 -0000 1.3 +++ HPaned.chs 24 Mar 2005 17:31:00 -0000 1.4 @@ -24,10 +24,10 @@ -- Stability : provisional -- Portability : portable (depends on GHC) -- --- A container with two panes arranged horizontally. +-- A container with two panes arranged horizontally -- module Graphics.UI.Gtk.Layout.HPaned ( --- * Description +-- * Detail -- -- | The HPaned widget is a container widget with two children arranged -- horizontally. The division between the two panes is adjustable by the user @@ -65,7 +65,10 @@ -------------------- -- Constructors --- | +-- | Create a new 'HPaned' -- hPanedNew :: IO HPaned -hPanedNew = makeNewObject mkHPaned $ liftM castPtr {#call unsafe hpaned_new#} +hPanedNew = + makeNewObject mkHPaned $ + liftM (castPtr :: Ptr Widget -> Ptr HPaned) $ + {# call unsafe hpaned_new #} Index: VButtonBox.chs =================================================================== RCS file: /cvsroot/gtk2hs/gtk2hs/gtk/Graphics/UI/Gtk/Layout/VButtonBox.chs,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- VButtonBox.chs 25 Feb 2005 01:11:34 -0000 1.2 +++ VButtonBox.chs 24 Mar 2005 17:31:00 -0000 1.3 @@ -27,7 +27,7 @@ -- A container for arranging buttons vertically -- module Graphics.UI.Gtk.Layout.VButtonBox ( --- * Description +-- * Detail -- -- | A button box should be used to provide a consistent layout of buttons -- throughout your application. The layout\/spacing can be altered by the @@ -78,8 +78,10 @@ -------------------- -- Constructors --- | +-- | Creates a new vertical button box. -- vButtonBoxNew :: IO VButtonBox -vButtonBoxNew = makeNewObject mkVButtonBox $ - liftM castPtr {#call unsafe vbutton_box_new#} +vButtonBoxNew = + makeNewObject mkVButtonBox $ + liftM (castPtr :: Ptr Widget -> Ptr VButtonBox) $ + {# call unsafe vbutton_box_new #} |