From: Duncan C. <dun...@us...> - 2004-08-01 16:08:25
|
Update of /cvsroot/gtk2hs/gtk2hs/gtk/layout In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18039/gtk/layout Modified Files: Table.chs Layout.chs api.ignore Log Message: Add missing functions. Update api.ignore files with more deprecated functions. Also fix a couple typo bugs and tidy up some documentation. Index: Layout.chs =================================================================== RCS file: /cvsroot/gtk2hs/gtk2hs/gtk/layout/Layout.chs,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- Layout.chs 23 May 2004 16:02:58 -0000 1.6 +++ Layout.chs 1 Aug 2004 16:08:13 -0000 1.7 @@ -32,6 +32,7 @@ layoutPut, layoutMove, layoutSetSize, + layoutGetSize, layoutGetHAdjustment, layoutGetVAdjustment, layoutSetHAdjustment, @@ -80,15 +81,23 @@ layoutSetSize l width height = {#call layout_set_size#} (toLayout l) (fromIntegral width) (fromIntegral height) --- | Retrieve the horizontal 'Adjustment' --- object from the layout. +-- | Get the size of the layout widget. +-- +layoutGetSize :: LayoutClass l => l -> IO (Int, Int) +layoutGetSize l = + alloca $ \widthPtr -> alloca $ \heightPtr -> do + {#call unsafe layout_get_size#} (toLayout l) widthPtr heightPtr + width <-peek widthPtr + height <- peek heightPtr + return (fromIntegral width, fromIntegral height) + +-- | Retrieve the horizontal 'Adjustment' object from the layout. -- layoutGetHAdjustment :: LayoutClass l => l -> IO Adjustment layoutGetHAdjustment l = makeNewObject mkAdjustment $ {#call unsafe layout_get_hadjustment#} (toLayout l) --- | Retrieve the vertical 'Adjustment' --- object from the layout. +-- | Retrieve the vertical 'Adjustment' object from the layout. -- layoutGetVAdjustment :: LayoutClass l => l -> IO Adjustment layoutGetVAdjustment l = makeNewObject mkAdjustment $ Index: api.ignore =================================================================== RCS file: /cvsroot/gtk2hs/gtk2hs/gtk/layout/api.ignore,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- api.ignore 30 Jul 2004 16:46:56 -0000 1.1 +++ api.ignore 1 Aug 2004 16:08:13 -0000 1.2 @@ -2,3 +2,7 @@ #deprecated button box functions exclude gtk_[hv]button_box_[gs]et_spacing_default exclude gtk_[hv]button_box_[gs]et_layout_default + +#deprecated layout functions +exclude gtk_layout_thaw +exclude gtk_layout_freeze Index: Table.chs =================================================================== RCS file: /cvsroot/gtk2hs/gtk2hs/gtk/layout/Table.chs,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- Table.chs 23 May 2004 16:02:58 -0000 1.5 +++ Table.chs 1 Aug 2004 16:08:13 -0000 1.6 @@ -34,10 +34,15 @@ tableAttach, tableAttachDefaults, tableSetRowSpacing, + tableGetRowSpacing, tableSetColSpacing, + tableGetColSpacing, tableSetRowSpacings, + tableGetDefaultRowSpacing, tableSetColSpacings, - tableSetHomogeneous + tableGetDefaultColSpacing, + tableSetHomogeneous, + tableGetHomogeneous ) where import Monad (liftM) @@ -66,9 +71,9 @@ tableResize tb rows columns = {#call table_resize#} (toTable tb) (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. +-- | 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. -- tableAttach :: (TableClass tb, WidgetClass w) => tb -> w -> Int -> Int -> Int -> Int -> [AttachOptions] -> [AttachOptions] -> Int -> @@ -80,9 +85,8 @@ ((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. +-- | Put a new widget in the table container. As opposed to 'tableAttach' this +-- function assumes default values for the packing options. -- tableAttachDefaults :: (TableClass tb, WidgetClass w) => tb -> w -> Int -> Int -> Int -> Int -> IO () @@ -91,36 +95,72 @@ (fromIntegral leftAttach) (fromIntegral rightAttach) (fromIntegral topAttach) (fromIntegral bottomAttach) --- | Set the amount of space (in pixels) between the --- specified @row@ and its neighbours. +-- | Set the amount of space (in pixels) between the specified row and its +-- neighbours. -- -tableSetRowSpacing :: TableClass tb => tb -> Int -> Int -> IO () +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) --- | Set the amount of space (in pixels) between the --- specified column @col@ and its neighbours. +-- | Get the amount of space (in pixels) between the specified row and the +-- next row. +-- +tableGetRowSpacing :: TableClass tb => tb -> Int -> IO Int +tableGetRowSpacing tb row = liftM fromIntegral $ + {#call unsafe table_get_row_spacing#} (toTable tb) (fromIntegral row) + +-- | Set the amount of space (in pixels) between the specified column and +-- its neighbours. -- tableSetColSpacing :: TableClass tb => tb -> Int -> Int -> IO () tableSetColSpacing tb col space = {#call table_set_col_spacing#} (toTable tb) (fromIntegral col) (fromIntegral space) +-- | Get the amount of space (in pixels) between the specified column and the +-- next column. +-- +tableGetColSpacing :: TableClass tb => tb -> Int -> IO Int +tableGetColSpacing tb col = liftM fromIntegral $ + {#call unsafe table_get_col_spacing#} (toTable tb) (fromIntegral col) + -- | Set the amount of space between any two rows. -- tableSetRowSpacings :: TableClass tb => tb -> Int -> IO () tableSetRowSpacings tb space = {#call table_set_row_spacings#} (toTable tb) (fromIntegral space) --- | Set the amount of space between any two --- columns. +-- | Gets the default row spacing for the table. This is the spacing that will +-- be used for newly added rows. +-- +tableGetDefaultRowSpacing :: TableClass tb => tb -> IO Int +tableGetDefaultRowSpacing tb = liftM fromIntegral $ + {#call unsafe table_get_default_row_spacing#} (toTable tb) + +-- | Set the amount of space between any two columns. -- tableSetColSpacings :: TableClass tb => tb -> Int -> IO () tableSetColSpacings tb space = {#call table_set_col_spacings#} (toTable tb) (fromIntegral space) +-- | Gets the default column spacing for the table. This is the spacing that +-- will be used for newly added columns. +-- +tableGetDefaultColSpacing :: TableClass tb => tb -> IO Int +tableGetDefaultColSpacing tb = liftM fromIntegral $ + {#call unsafe table_get_default_col_spacing#} (toTable tb) + -- | Make all cells the same size. -- tableSetHomogeneous :: TableClass tb => tb -> Bool -> IO () tableSetHomogeneous tb hom = {#call table_set_homogeneous#} (toTable tb) (fromBool hom) +-- | Returns whether the table cells are all constrained to the same width and +-- height. +-- +tableGetHomogeneous :: TableClass tb => tb -> IO Bool +tableGetHomogeneous tb = + liftM toBool $ {#call unsafe table_get_homogeneous#} (toTable tb) |