From: Duncan C. <dun...@us...> - 2005-01-08 15:23:48
|
Update of /cvsroot/gtk2hs/gtk2hs/gtk/Graphics/UI/Gtk/Layout In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv770/gtk/Graphics/UI/Gtk/Layout Added Files: Layout.chs Table.chs VBox.chs VButtonBox.chs VPaned.chs Log Message: hierarchical namespace conversion --- NEW FILE: VPaned.chs --- -- -*-haskell-*- -- GIMP Toolkit (GTK) Widget VPaned -- -- Author : Axel Simon -- -- Created: 15 May 2001 -- -- Version $Revision: 1.1 $ from $Date: 2005/01/08 15:23:39 $ -- -- Copyright (c) 1999..2002 Axel Simon -- -- This file is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 2 of the License, or -- (at your option) any later version. -- -- This file is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -- -- | -- module Graphics.UI.Gtk.Layout.VPaned ( VPaned, VPanedClass, castToVPaned, vPanedNew ) where import Monad (liftM) import System.Glib.FFI import Graphics.UI.Gtk.Abstract.Object (makeNewObject) {#import Graphics.UI.Gtk.Types#} {#import Graphics.UI.Gtk.Signals#} {# context lib="gtk" prefix="gtk" #} -- methods -- | -- vPanedNew :: IO VPaned vPanedNew = makeNewObject mkVPaned $ liftM castPtr {#call unsafe vpaned_new#} --- NEW FILE: Layout.chs --- -- -*-haskell-*- -- GIMP Toolkit (GTK) Widget Layout -- -- Author : Axel Simon -- -- Created: 15 May 2001 -- -- Version $Revision: 1.1 $ from $Date: 2005/01/08 15:23:39 $ -- -- Copyright (c) 1999..2002 Axel Simon -- -- This file is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 2 of the License, or -- (at your option) any later version. -- -- This file is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -- -- | -- -- A layout widget can hold several widgets at arbitrary positions. -- module Graphics.UI.Gtk.Layout.Layout ( Layout, LayoutClass, castToLayout, layoutNew, layoutPut, layoutMove, layoutSetSize, layoutGetSize, layoutGetHAdjustment, layoutGetVAdjustment, layoutSetHAdjustment, layoutSetVAdjustment, onSetScrollAdjustments, afterSetScrollAdjustments ) where import Maybe (fromMaybe) import Monad (liftM) import System.Glib.FFI import Graphics.UI.Gtk.Abstract.Object (makeNewObject) {#import Graphics.UI.Gtk.Types#} {#import Graphics.UI.Gtk.Signals#} {# context lib="gtk" prefix="gtk" #} -- methods -- | Create a new layout widget. -- 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 -- | Insert a widget into the layout container. -- 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) -- | Move an existing widget within the container. -- 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) -- | Set the size of the layout widget. -- layoutSetSize :: LayoutClass l => l -> Int -> Int -> IO () layoutSetSize l width height = {#call layout_set_size#} (toLayout l) (fromIntegral width) (fromIntegral height) -- | 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. -- layoutGetVAdjustment :: LayoutClass l => l -> IO Adjustment layoutGetVAdjustment l = makeNewObject mkAdjustment $ {#call unsafe layout_get_vadjustment#} (toLayout l) -- | Set the horizontal adjustment object. -- layoutSetHAdjustment :: LayoutClass l => l -> Adjustment -> IO () layoutSetHAdjustment l adj = {#call layout_set_hadjustment#} (toLayout l) adj -- | Set the vertical adjustment object. -- layoutSetVAdjustment :: LayoutClass l => l -> Adjustment -> IO () layoutSetVAdjustment l adj = {#call layout_set_vadjustment#} (toLayout l) adj -- signals -- | 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 --- NEW FILE: VBox.chs --- -- -*-haskell-*- -- GIMP Toolkit (GTK) Widget VBox -- -- Author : Axel Simon -- -- Created: 15 May 2001 -- -- Version $Revision: 1.1 $ from $Date: 2005/01/08 15:23:39 $ -- -- Copyright (c) 1999..2002 Axel Simon -- -- This file is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 2 of the License, or -- (at your option) any later version. -- -- This file is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -- -- | -- -- This is a special version of 'Box'. -- This widget shows its child widgets -- in a vertical line. -- module Graphics.UI.Gtk.Layout.VBox ( VBox, VBoxClass, castToVBox, vBoxNew ) where import Monad (liftM) import System.Glib.FFI import Graphics.UI.Gtk.Abstract.Object (makeNewObject) {#import Graphics.UI.Gtk.Types#} {#import Graphics.UI.Gtk.Signals#} {# context lib="gtk" prefix="gtk" #} -- methods -- | -- 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. -- vBoxNew :: Bool -> Int -> IO VBox vBoxNew homogeneous spacing = makeNewObject mkVBox $ liftM castPtr $ {#call unsafe vbox_new#} (fromBool homogeneous) (fromIntegral spacing) --- NEW FILE: VButtonBox.chs --- -- -*-haskell-*- -- GIMP Toolkit (GTK) Widget VButtonBox -- -- Author : Matthew Walton -- -- Created: 28 April 2004 -- -- Version $Revision: 1.1 $ from $Date: 2005/01/08 15:23:39 $ -- -- Copyright (c) 2004 Matthew Walton -- -- This file is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 2 of the License, or -- (at your option) any later version. -- -- This file is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -- -- | -- module Graphics.UI.Gtk.Layout.VButtonBox ( VButtonBox, VButtonBoxClass, castToVButtonBox, vButtonBoxNew ) where import Monad (liftM) import System.Glib.FFI import Graphics.UI.Gtk.Abstract.Object (makeNewObject) {#import Graphics.UI.Gtk.Types#} {#import Graphics.UI.Gtk.Signals#} {# context lib="gtk" prefix="gtk" #} --methods -- | -- vButtonBoxNew :: IO VButtonBox vButtonBoxNew = makeNewObject mkVButtonBox $ liftM castPtr {#call unsafe vbutton_box_new#} --- NEW FILE: Table.chs --- -- -*-haskell-*- -- GIMP Toolkit (GTK) Widget Table -- -- Author : Axel Simon -- -- Created: 15 May 2001 -- -- Version $Revision: 1.1 $ from $Date: 2005/01/08 15:23:39 $ -- -- Copyright (c) 1999..2002 Axel Simon -- -- This file is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 2 of the License, or -- (at your option) any later version. -- -- This file is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -- -- | -- -- The table widget is a container in which widgets can be aligned in cells. -- module Graphics.UI.Gtk.Layout.Table ( Table, TableClass, castToTable, tableNew, tableResize, AttachOptions(..), tableAttach, tableAttachDefaults, tableSetRowSpacing, tableGetRowSpacing, tableSetColSpacing, tableGetColSpacing, tableSetRowSpacings, tableGetDefaultRowSpacing, tableSetColSpacings, tableGetDefaultColSpacing, tableSetHomogeneous, tableGetHomogeneous ) where import Monad (liftM) import System.Glib.FFI import Graphics.UI.Gtk.Abstract.Object (makeNewObject) {#import Graphics.UI.Gtk.Types#} {#import Graphics.UI.Gtk.Signals#} import Graphics.UI.Gtk.General.Enums (AttachOptions(..), fromFlags) {# context lib="gtk" prefix="gtk" #} -- methods -- | Create a new table with the specified dimensions. -- Set @homogeneous@ to True if all cells should be of the same size. -- tableNew :: Int -> Int -> Bool -> IO Table tableNew rows columns homogeneous = makeNewObject mkTable $ liftM castPtr $ {#call unsafe table_new#} (fromIntegral rows) (fromIntegral columns) (fromBool homogeneous) -- | 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) -- | 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 -> 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) -- | 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 () tableAttachDefaults tb child leftAttach rightAttach topAttach bottomAttach = {#call table_attach_defaults#} (toTable tb) (toWidget child) (fromIntegral leftAttach) (fromIntegral rightAttach) (fromIntegral topAttach) (fromIntegral bottomAttach) -- | Set the amount of space (in pixels) between the specified row and its -- neighbours. -- 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) -- | 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) -- | 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) |