{-# LINE 2 "./Graphics/UI/Gtk/Layout/Grid.chs" #-}
-- -*-haskell-*-
-- GIMP Toolkit (GTK) Widget Alignment
--
-- Author : Axel Simon
--
-- Created: 15 May 2001
--
-- Copyright (C) 1999-2005 Axel Simon
--
-- This library is free software; you can redistribute it and/or
-- modify it under the terms of the GNU Lesser General Public
-- License as published by the Free Software Foundation; either
-- version 2.1 of the License, or (at your option) any later version.
--
-- This library 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
-- Lesser General Public License for more details.
--
-- |
-- Maintainer : gtk2hs-users@lists.sourceforge.net
-- Stability : provisional
-- Portability : portable (depends on GHC)
--
-- A widget which controls the alignment and size of its child
--
module Graphics.UI.Gtk.Layout.Grid (
-- * Detail
--
-- | 'Grid' packs widgets into rows and columns.
--
-- * Class Hierarchy
-- |
-- @
-- | 'GObject'
-- | +----'Object'
-- | +----'Widget'
-- | +----'Container'
-- | +----Grid
-- @

-- * Types
  Grid,
  GridClass,
  castToGrid,
  gTypeGrid,
  toGrid,

-- * Constructors
  gridNew,

-- * Methods
  gridAttach,
  gridAttachNextTo,
  gridSetRowHomogeneous,
  gridGetRowHomogeneous,
  gridSetRowSpacing,
  gridGetRowSpacing,
  gridSetColumnHomogeneous,
  gridGetColumnHomogeneous,
  gridSetColumnSpacing,
  gridGetColumnSpacing,


  gridGetChildAt,
  gridInsertRow,
  gridInsertColumn,
  gridInsertNextTo,



  gridRemoveRow,
  gridRemoveColumn,
  gridGetBaselineRow,
  gridSetBaselineRow,
  gridGetRowBaselinePosition,
  gridSetRowBaselinePosition


 ) where

import Control.Monad (liftM)

import System.Glib.FFI
import Graphics.UI.Gtk.Abstract.Object (makeNewObject)
import Graphics.UI.Gtk.Types
{-# LINE 88 "./Graphics/UI/Gtk/Layout/Grid.chs" #-}
import Graphics.UI.Gtk.General.Enums (PositionType)


import Graphics.UI.Gtk.General.Enums (BaselinePosition)



{-# LINE 95 "./Graphics/UI/Gtk/Layout/Grid.chs" #-}

---------------------
-- Constructors

-- | Creates a new grid widget.
--
gridNew :: IO Grid
gridNew :: IO Grid
gridNew =
 (ForeignPtr Grid -> Grid, FinalizerPtr Grid)
-> IO (Ptr Grid) -> IO Grid
forall obj.
GObjectClass obj =>
(ForeignPtr obj -> obj, FinalizerPtr obj) -> IO (Ptr obj) -> IO obj
makeNewObject (ForeignPtr Grid -> Grid, FinalizerPtr Grid)
forall {a}. (ForeignPtr Grid -> Grid, FinalizerPtr a)
mkGrid (IO (Ptr Grid) -> IO Grid) -> IO (Ptr Grid) -> IO Grid
forall a b. (a -> b) -> a -> b
$
 (Ptr Widget -> Ptr Grid) -> IO (Ptr Widget) -> IO (Ptr Grid)
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM (Ptr Widget -> Ptr Grid
forall a b. Ptr a -> Ptr b
castPtr :: Ptr Widget -> Ptr Grid) (IO (Ptr Widget) -> IO (Ptr Grid))
-> IO (Ptr Widget) -> IO (Ptr Grid)
forall a b. (a -> b) -> a -> b
$
 IO (Ptr Widget)
gtk_grid_new
{-# LINE 106 "./Graphics/UI/Gtk/Layout/Grid.chs" #-}

---------------------
-- Methods

-- | Adds a widget to the grid. The position of child is determined by left and top.
-- the number of "cells" that child will occupy is determined by width and height.
--
gridAttach :: (GridClass self, WidgetClass child)
 => self -- ^ @self@ - the grid.
 -> child -- ^ @child@ - the widget to add.
 -> Int -- ^ @left@ - the column number of to attach the left side of child to.
 -> Int -- ^ @top@ - the row number to attach the top side of child to.
 -> Int -- ^ @width@ - the number of columns that child will span.
 -> Int -- ^ @height@ - the number of rows that child will span.
 -> IO ()
gridAttach :: forall self child.
(GridClass self, WidgetClass child) =>
self -> child -> Int -> Int -> Int -> Int -> IO ()
gridAttach self
self child
child Int
left Int
top Int
width Int
height =
 (\(Grid ForeignPtr Grid
arg1) (Widget ForeignPtr Widget
arg2) CInt
arg3 CInt
arg4 CInt
arg5 CInt
arg6 -> ForeignPtr Grid -> (Ptr Grid -> IO ()) -> IO ()
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr Grid
arg1 ((Ptr Grid -> IO ()) -> IO ()) -> (Ptr Grid -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr Grid
argPtr1 ->ForeignPtr Widget -> (Ptr Widget -> IO ()) -> IO ()
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr Widget
arg2 ((Ptr Widget -> IO ()) -> IO ()) -> (Ptr Widget -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr Widget
argPtr2 ->Ptr Grid -> Ptr Widget -> CInt -> CInt -> CInt -> CInt -> IO ()
gtk_grid_attach Ptr Grid
argPtr1 Ptr Widget
argPtr2 CInt
arg3 CInt
arg4 CInt
arg5 CInt
arg6)
{-# LINE 123 "./Graphics/UI/Gtk/Layout/Grid.chs" #-}
    (toGrid self)
    (child -> Widget
forall o. WidgetClass o => o -> Widget
toWidget child
child)
    (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
left)
    (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
top)
    (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
width)
    (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
height)

-- | Adds a widget to the grid. The widget is placed next to sibling , on the side
-- determined by side . When sibling is Nothing, the widget is placed in row (for
-- left or right placement) or column 0 (for top or bottom placement), at the end
-- indicated by side.
--
-- Attaching widgets labeled [1], [2], [3] with sibling == Nothing and side == GTK_POS_LEFT
-- yields a layout of 3[1].
--
gridAttachNextTo :: (GridClass self, WidgetClass child, WidgetClass sibling)
 => self -- ^ @self@ - the grid.
 -> child -- ^ @child@ - the widget to add
 -> Maybe sibling -- ^ @sib@ - the child of grid that child will be placed next to.
 -> PositionType -- ^ @pos@ - the side of the sibling that child is positioned next to.
 -> Int -- ^ @width@ - the number of columns that child will span.
 -> Int -- ^ @height@ - the number of rows that child will span.
 -> IO()
gridAttachNextTo :: forall self child sibling.
(GridClass self, WidgetClass child, WidgetClass sibling) =>
self
-> child -> Maybe sibling -> PositionType -> Int -> Int -> IO ()
gridAttachNextTo self
self child
child Maybe sibling
sib PositionType
pos Int
width Int
height =
 (\(Grid ForeignPtr Grid
arg1) (Widget ForeignPtr Widget
arg2) (Widget ForeignPtr Widget
arg3) CInt
arg4 CInt
arg5 CInt
arg6 -> ForeignPtr Grid -> (Ptr Grid -> IO ()) -> IO ()
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr Grid
arg1 ((Ptr Grid -> IO ()) -> IO ()) -> (Ptr Grid -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr Grid
argPtr1 ->ForeignPtr Widget -> (Ptr Widget -> IO ()) -> IO ()
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr Widget
arg2 ((Ptr Widget -> IO ()) -> IO ()) -> (Ptr Widget -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr Widget
argPtr2 ->ForeignPtr Widget -> (Ptr Widget -> IO ()) -> IO ()
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr Widget
arg3 ((Ptr Widget -> IO ()) -> IO ()) -> (Ptr Widget -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr Widget
argPtr3 ->Ptr Grid
-> Ptr Widget -> Ptr Widget -> CInt -> CInt -> CInt -> IO ()
gtk_grid_attach_next_to Ptr Grid
argPtr1 Ptr Widget
argPtr2 Ptr Widget
argPtr3 CInt
arg4 CInt
arg5 CInt
arg6)
{-# LINE 148 "./Graphics/UI/Gtk/Layout/Grid.chs" #-}
    (toGrid self)
    (child -> Widget
forall o. WidgetClass o => o -> Widget
toWidget child
child)
    (Widget -> (sibling -> Widget) -> Maybe sibling -> Widget
forall b a. b -> (a -> b) -> Maybe a -> b
maybe (ForeignPtr Widget -> Widget
Widget ForeignPtr Widget
forall a. ForeignPtr a
nullForeignPtr) sibling -> Widget
forall o. WidgetClass o => o -> Widget
toWidget Maybe sibling
sib)
    (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> CInt) -> Int -> CInt
forall a b. (a -> b) -> a -> b
$ PositionType -> Int
forall a. Enum a => a -> Int
fromEnum PositionType
pos)
    (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
width)
    (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
height)

-- | Sets whether all rows of grid will have the same height.
--
gridSetRowHomogeneous :: GridClass self
 => self -- ^ @self@ - the grid.
 -> Bool -- ^ @homogeneous@ - True to make row homogeneous.
 -> IO ()
gridSetRowHomogeneous :: forall self. GridClass self => self -> Bool -> IO ()
gridSetRowHomogeneous self
self Bool
homogeneous =
 (\(Grid ForeignPtr Grid
arg1) CInt
arg2 -> ForeignPtr Grid -> (Ptr Grid -> IO ()) -> IO ()
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr Grid
arg1 ((Ptr Grid -> IO ()) -> IO ()) -> (Ptr Grid -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr Grid
argPtr1 ->Ptr Grid -> CInt -> IO ()
gtk_grid_set_row_homogeneous Ptr Grid
argPtr1 CInt
arg2)
{-# LINE 163 "./Graphics/UI/Gtk/Layout/Grid.chs" #-}
    (toGrid self)
    (Bool -> CInt
forall a. Num a => Bool -> a
fromBool Bool
homogeneous)

-- | Returns whether all rows of grid have the same height.
--
gridGetRowHomogeneous :: GridClass self
 => self -- ^ @self@ - the grid.
 -> IO Bool -- ^ returns whether all rows of grid have same height.
gridGetRowHomogeneous :: forall self. GridClass self => self -> IO Bool
gridGetRowHomogeneous self
self =
 (CInt -> Bool) -> IO CInt -> IO Bool
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM CInt -> Bool
forall a. (Eq a, Num a) => a -> Bool
toBool (IO CInt -> IO Bool) -> IO CInt -> IO Bool
forall a b. (a -> b) -> a -> b
$
 (\(Grid ForeignPtr Grid
arg1) -> ForeignPtr Grid -> (Ptr Grid -> IO CInt) -> IO CInt
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr Grid
arg1 ((Ptr Grid -> IO CInt) -> IO CInt)
-> (Ptr Grid -> IO CInt) -> IO CInt
forall a b. (a -> b) -> a -> b
$ \Ptr Grid
argPtr1 ->Ptr Grid -> IO CInt
gtk_grid_get_row_homogeneous Ptr Grid
argPtr1)
{-# LINE 174 "./Graphics/UI/Gtk/Layout/Grid.chs" #-}
    (toGrid self)

-- | Sets the amount of space between rows of grid.
--
gridSetRowSpacing :: GridClass self
 => self -- ^ @self@ - the grid.
 -> Int -- ^ @spacing@ - the amount of space to insert between rows.
 -> IO ()
gridSetRowSpacing :: forall self. GridClass self => self -> Int -> IO ()
gridSetRowSpacing self
self Int
spacing =
 (\(Grid ForeignPtr Grid
arg1) CUInt
arg2 -> ForeignPtr Grid -> (Ptr Grid -> IO ()) -> IO ()
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr Grid
arg1 ((Ptr Grid -> IO ()) -> IO ()) -> (Ptr Grid -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr Grid
argPtr1 ->Ptr Grid -> CUInt -> IO ()
gtk_grid_set_row_spacing Ptr Grid
argPtr1 CUInt
arg2)
{-# LINE 184 "./Graphics/UI/Gtk/Layout/Grid.chs" #-}
    (toGrid self)
    (Int -> CUInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
spacing)

-- | Returns the amount of space between the rows of grid.
--
gridGetRowSpacing :: GridClass self
 => self -- ^ @self@ - the grid.
 -> IO Int -- ^ returns the spacing of grid.
gridGetRowSpacing :: forall self. GridClass self => self -> IO Int
gridGetRowSpacing self
self =
 (CUInt -> Int) -> IO CUInt -> IO Int
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM CUInt -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral (IO CUInt -> IO Int) -> IO CUInt -> IO Int
forall a b. (a -> b) -> a -> b
$
 (\(Grid ForeignPtr Grid
arg1) -> ForeignPtr Grid -> (Ptr Grid -> IO CUInt) -> IO CUInt
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr Grid
arg1 ((Ptr Grid -> IO CUInt) -> IO CUInt)
-> (Ptr Grid -> IO CUInt) -> IO CUInt
forall a b. (a -> b) -> a -> b
$ \Ptr Grid
argPtr1 ->Ptr Grid -> IO CUInt
gtk_grid_get_row_spacing Ptr Grid
argPtr1)
{-# LINE 195 "./Graphics/UI/Gtk/Layout/Grid.chs" #-}
    (toGrid self)

-- | Sets whether all columns of grid will have the same width.
--
gridSetColumnHomogeneous :: GridClass self
 => self -- ^ @self@ - the grid.
 -> Bool -- ^ @homogeneous@ - True to make columns homogeneous.
 -> IO ()
gridSetColumnHomogeneous :: forall self. GridClass self => self -> Bool -> IO ()
gridSetColumnHomogeneous self
self Bool
homogeneous =
 (\(Grid ForeignPtr Grid
arg1) CInt
arg2 -> ForeignPtr Grid -> (Ptr Grid -> IO ()) -> IO ()
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr Grid
arg1 ((Ptr Grid -> IO ()) -> IO ()) -> (Ptr Grid -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr Grid
argPtr1 ->Ptr Grid -> CInt -> IO ()
gtk_grid_set_column_homogeneous Ptr Grid
argPtr1 CInt
arg2)
{-# LINE 205 "./Graphics/UI/Gtk/Layout/Grid.chs" #-}
    (toGrid self)
    (Bool -> CInt
forall a. Num a => Bool -> a
fromBool Bool
homogeneous)

-- | Returns whether all columns of grid have the same width.
--
gridGetColumnHomogeneous :: GridClass self
 => self -- ^ @self@ - the grid.
 -> IO Bool -- ^ returns whether all columns of grid have the same width.
gridGetColumnHomogeneous :: forall self. GridClass self => self -> IO Bool
gridGetColumnHomogeneous self
self =
 (CInt -> Bool) -> IO CInt -> IO Bool
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM CInt -> Bool
forall a. (Eq a, Num a) => a -> Bool
toBool (IO CInt -> IO Bool) -> IO CInt -> IO Bool
forall a b. (a -> b) -> a -> b
$
 (\(Grid ForeignPtr Grid
arg1) -> ForeignPtr Grid -> (Ptr Grid -> IO CInt) -> IO CInt
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr Grid
arg1 ((Ptr Grid -> IO CInt) -> IO CInt)
-> (Ptr Grid -> IO CInt) -> IO CInt
forall a b. (a -> b) -> a -> b
$ \Ptr Grid
argPtr1 ->Ptr Grid -> IO CInt
gtk_grid_get_column_homogeneous Ptr Grid
argPtr1)
{-# LINE 216 "./Graphics/UI/Gtk/Layout/Grid.chs" #-}
    (toGrid self)

-- | Sets the amount of space between columns of grid.
--
gridSetColumnSpacing :: GridClass self
 => self -- ^ @self@ - the grid.
 -> Int -- ^ @spacing@ - the amount of space to insert between columns.
 -> IO ()
gridSetColumnSpacing :: forall self. GridClass self => self -> Int -> IO ()
gridSetColumnSpacing self
self Int
spacing =
 (\(Grid ForeignPtr Grid
arg1) CUInt
arg2 -> ForeignPtr Grid -> (Ptr Grid -> IO ()) -> IO ()
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr Grid
arg1 ((Ptr Grid -> IO ()) -> IO ()) -> (Ptr Grid -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr Grid
argPtr1 ->Ptr Grid -> CUInt -> IO ()
gtk_grid_set_column_spacing Ptr Grid
argPtr1 CUInt
arg2)
{-# LINE 226 "./Graphics/UI/Gtk/Layout/Grid.chs" #-}
    (toGrid self)
    (Int -> CUInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
spacing)

-- | Returns the amount of space between the columns of grid.
--
gridGetColumnSpacing :: GridClass self
 => self -- ^ @self@ - the grid.
 -> IO Int -- ^ returns the spacing of grid.
gridGetColumnSpacing :: forall self. GridClass self => self -> IO Int
gridGetColumnSpacing self
self =
 (CUInt -> Int) -> IO CUInt -> IO Int
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM CUInt -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral (IO CUInt -> IO Int) -> IO CUInt -> IO Int
forall a b. (a -> b) -> a -> b
$
 (\(Grid ForeignPtr Grid
arg1) -> ForeignPtr Grid -> (Ptr Grid -> IO CUInt) -> IO CUInt
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr Grid
arg1 ((Ptr Grid -> IO CUInt) -> IO CUInt)
-> (Ptr Grid -> IO CUInt) -> IO CUInt
forall a b. (a -> b) -> a -> b
$ \Ptr Grid
argPtr1 ->Ptr Grid -> IO CUInt
gtk_grid_get_column_spacing Ptr Grid
argPtr1)
{-# LINE 237 "./Graphics/UI/Gtk/Layout/Grid.chs" #-}
    (toGrid self)



-- | Gets the child of grid whose area covers the grid cell whose upper left corner is at
-- left , top .
--
gridGetChildAt :: GridClass self
 => self -- ^ @self@ - the grid.
 -> Int -- ^ @left@ - the left edge of the cell.
 -> Int -- ^ @top@ - the top edge of the cell.
 -> IO (Maybe Widget) -- ^ returns the child at the given position or Nothing.
gridGetChildAt :: forall self.
GridClass self =>
self -> Int -> Int -> IO (Maybe Widget)
gridGetChildAt self
self Int
left Int
top = do
 Ptr Widget
ptr <- (\(Grid ForeignPtr Grid
arg1) CInt
arg2 CInt
arg3 -> ForeignPtr Grid -> (Ptr Grid -> IO (Ptr Widget)) -> IO (Ptr Widget)
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr Grid
arg1 ((Ptr Grid -> IO (Ptr Widget)) -> IO (Ptr Widget))
-> (Ptr Grid -> IO (Ptr Widget)) -> IO (Ptr Widget)
forall a b. (a -> b) -> a -> b
$ \Ptr Grid
argPtr1 ->Ptr Grid -> CInt -> CInt -> IO (Ptr Widget)
gtk_grid_get_child_at Ptr Grid
argPtr1 CInt
arg2 CInt
arg3)
{-# LINE 251 "./Graphics/UI/Gtk/Layout/Grid.chs" #-}
           (self -> Grid
forall o. GridClass o => o -> Grid
toGrid self
self)
           (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
left)
           (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
top)
 if Ptr Widget
ptr Ptr Widget -> Ptr Widget -> Bool
forall a. Eq a => a -> a -> Bool
== Ptr Widget
forall a. Ptr a
nullPtr
    then Maybe Widget -> IO (Maybe Widget)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Maybe Widget
forall a. Maybe a
Nothing
    else (Widget -> Maybe Widget) -> IO Widget -> IO (Maybe Widget)
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM Widget -> Maybe Widget
forall a. a -> Maybe a
Just (IO Widget -> IO (Maybe Widget)) -> IO Widget -> IO (Maybe Widget)
forall a b. (a -> b) -> a -> b
$ (ForeignPtr Widget -> Widget, FinalizerPtr Widget)
-> IO (Ptr Widget) -> IO Widget
forall obj.
GObjectClass obj =>
(ForeignPtr obj -> obj, FinalizerPtr obj) -> IO (Ptr obj) -> IO obj
makeNewObject (ForeignPtr Widget -> Widget, FinalizerPtr Widget)
forall {a}. (ForeignPtr Widget -> Widget, FinalizerPtr a)
mkWidget (Ptr Widget -> IO (Ptr Widget)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Widget
ptr)

-- | Inserts a row at the specified position. Children which are attached at or below this
-- position are moved one row down. Children which span across this position are grown to
-- span the new row.
--
gridInsertRow :: GridClass self
 => self -- ^ @self@ - the grid.
 -> Int -- ^ @pos@ - the position to insert the row at.
 -> IO ()
gridInsertRow :: forall self. GridClass self => self -> Int -> IO ()
gridInsertRow self
self Int
pos =
 (\(Grid ForeignPtr Grid
arg1) CInt
arg2 -> ForeignPtr Grid -> (Ptr Grid -> IO ()) -> IO ()
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr Grid
arg1 ((Ptr Grid -> IO ()) -> IO ()) -> (Ptr Grid -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr Grid
argPtr1 ->Ptr Grid -> CInt -> IO ()
gtk_grid_insert_row Ptr Grid
argPtr1 CInt
arg2)
{-# LINE 268 "./Graphics/UI/Gtk/Layout/Grid.chs" #-}
    (toGrid self)
    (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
pos)

-- | Inserts a column at the specified position. Children which are attached at or to the
-- right of this position are moved one column to the right. Children which span across
-- this position are grown to span the new column
--
gridInsertColumn :: GridClass self
 => self -- ^ @self@ - the grid.
 -> Int -- ^ @pos@ - the positiion to insert the column at.
 -> IO ()
gridInsertColumn :: forall self. GridClass self => self -> Int -> IO ()
gridInsertColumn self
self Int
pos =
 (\(Grid ForeignPtr Grid
arg1) CInt
arg2 -> ForeignPtr Grid -> (Ptr Grid -> IO ()) -> IO ()
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr Grid
arg1 ((Ptr Grid -> IO ()) -> IO ()) -> (Ptr Grid -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr Grid
argPtr1 ->Ptr Grid -> CInt -> IO ()
gtk_grid_insert_column Ptr Grid
argPtr1 CInt
arg2)
{-# LINE 281 "./Graphics/UI/Gtk/Layout/Grid.chs" #-}
    (toGrid self)
    (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
pos)

-- | Inserts a row or column at the specified position. The new row or column is placed
-- next to sibling , on the side determined by side. If side is GTK_POS_TOP or
-- GTK_POS_BOTTOM, a row is inserted. If side is GTK_POS_LEFT of GTK_POS_RIGHT, a
-- column is inserted.
--
gridInsertNextTo :: (GridClass self, WidgetClass sibling)
 => self -- ^ @self@ - the grid.
 -> sibling -- ^ @sib@ - the child of grid that the new row or column will be placed next to.
 -> PositionType -- ^ @pos@ - the isde of the sibling that child is positioned next to.
 -> IO ()
gridInsertNextTo :: forall self sibling.
(GridClass self, WidgetClass sibling) =>
self -> sibling -> PositionType -> IO ()
gridInsertNextTo self
self sibling
sib PositionType
pos =
 (\(Grid ForeignPtr Grid
arg1) (Widget ForeignPtr Widget
arg2) CInt
arg3 -> ForeignPtr Grid -> (Ptr Grid -> IO ()) -> IO ()
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr Grid
arg1 ((Ptr Grid -> IO ()) -> IO ()) -> (Ptr Grid -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr Grid
argPtr1 ->ForeignPtr Widget -> (Ptr Widget -> IO ()) -> IO ()
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr Widget
arg2 ((Ptr Widget -> IO ()) -> IO ()) -> (Ptr Widget -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr Widget
argPtr2 ->Ptr Grid -> Ptr Widget -> CInt -> IO ()
gtk_grid_insert_next_to Ptr Grid
argPtr1 Ptr Widget
argPtr2 CInt
arg3)
{-# LINE 296 "./Graphics/UI/Gtk/Layout/Grid.chs" #-}
    (toGrid self)
    (sibling -> Widget
forall o. WidgetClass o => o -> Widget
toWidget sibling
sib)
    (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> CInt) -> Int -> CInt
forall a b. (a -> b) -> a -> b
$ PositionType -> Int
forall a. Enum a => a -> Int
fromEnum PositionType
pos)





-- | Removes a row from the grid. Children that are placed in this row are removed,
-- spanning children that overlap this row have their height reduced by one, and children
-- below the row are moved up.
--
gridRemoveRow :: GridClass self
 => self -- ^ @self@ - the grid.
 -> Int -- ^ @pos@ - the position of the row to remove.
 -> IO ()
gridRemoveRow :: forall self. GridClass self => self -> Int -> IO ()
gridRemoveRow self
self Int
pos =
 (\(Grid ForeignPtr Grid
arg1) CInt
arg2 -> ForeignPtr Grid -> (Ptr Grid -> IO ()) -> IO ()
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr Grid
arg1 ((Ptr Grid -> IO ()) -> IO ()) -> (Ptr Grid -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr Grid
argPtr1 ->Ptr Grid -> CInt -> IO ()
gtk_grid_remove_row Ptr Grid
argPtr1 CInt
arg2)
{-# LINE 314 "./Graphics/UI/Gtk/Layout/Grid.chs" #-}
    (toGrid self)
    (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
pos)

-- | Removes a column from the grid. Children that are placed in this column are removed,
-- spanning children that overlap this column have their width reduced by one, and
-- children after the column are moved to the left.
--
gridRemoveColumn :: GridClass self
 => self -- ^ @self@ - the grid.
 -> Int -- ^ @pos@ -the position of the column to remove.
 -> IO ()
gridRemoveColumn :: forall self. GridClass self => self -> Int -> IO ()
gridRemoveColumn self
self Int
pos =
 (\(Grid ForeignPtr Grid
arg1) CInt
arg2 -> ForeignPtr Grid -> (Ptr Grid -> IO ()) -> IO ()
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr Grid
arg1 ((Ptr Grid -> IO ()) -> IO ()) -> (Ptr Grid -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr Grid
argPtr1 ->Ptr Grid -> CInt -> IO ()
gtk_grid_remove_column Ptr Grid
argPtr1 CInt
arg2)
{-# LINE 327 "./Graphics/UI/Gtk/Layout/Grid.chs" #-}
    (toGrid self)
    (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
pos)

-- | Returns which row defines the global baseline of grid.
--
gridGetBaselineRow :: GridClass self
 => self -- ^ @self@ - the grid.
 -> IO Int -- ^ returns the row index defining the global baseline.
gridGetBaselineRow :: forall self. GridClass self => self -> IO Int
gridGetBaselineRow self
self =
 (CInt -> Int) -> IO CInt -> IO Int
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM CInt -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral (IO CInt -> IO Int) -> IO CInt -> IO Int
forall a b. (a -> b) -> a -> b
$
 (\(Grid ForeignPtr Grid
arg1) -> ForeignPtr Grid -> (Ptr Grid -> IO CInt) -> IO CInt
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr Grid
arg1 ((Ptr Grid -> IO CInt) -> IO CInt)
-> (Ptr Grid -> IO CInt) -> IO CInt
forall a b. (a -> b) -> a -> b
$ \Ptr Grid
argPtr1 ->Ptr Grid -> IO CInt
gtk_grid_get_baseline_row Ptr Grid
argPtr1)
{-# LINE 338 "./Graphics/UI/Gtk/Layout/Grid.chs" #-}
    (toGrid self)

-- | Sets which row defines the global baseline for the entire grid. Each row in
-- the grid can have its own local baseline, but only one of those is global,
-- meaning it will be the baseline in the parent of the grid.
--
gridSetBaselineRow :: GridClass self
 => self -- ^ @self@ - the grid.
 -> Int -- ^ @row@ - the row index.
 -> IO ()
gridSetBaselineRow :: forall self. GridClass self => self -> Int -> IO ()
gridSetBaselineRow self
self Int
row =
 (\(Grid ForeignPtr Grid
arg1) CInt
arg2 -> ForeignPtr Grid -> (Ptr Grid -> IO ()) -> IO ()
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr Grid
arg1 ((Ptr Grid -> IO ()) -> IO ()) -> (Ptr Grid -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr Grid
argPtr1 ->Ptr Grid -> CInt -> IO ()
gtk_grid_set_baseline_row Ptr Grid
argPtr1 CInt
arg2)
{-# LINE 350 "./Graphics/UI/Gtk/Layout/Grid.chs" #-}
    (toGrid self)
    (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
row)

-- | Returns the baseline position of row as set by gridSetRowBaselinePosition
-- or the default value BASELINE_POSITION_CENTER
--
gridGetRowBaselinePosition :: GridClass self
 => self -- ^ @self@ - the grid.
 -> Int -- ^ @row@ - a row index.
 -> IO BaselinePosition -- ^ returns the baseline position of row.
gridGetRowBaselinePosition :: forall self. GridClass self => self -> Int -> IO BaselinePosition
gridGetRowBaselinePosition self
self Int
row =
 (CInt -> BaselinePosition) -> IO CInt -> IO BaselinePosition
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM (Int -> BaselinePosition
forall a. Enum a => Int -> a
toEnum (Int -> BaselinePosition)
-> (CInt -> Int) -> CInt -> BaselinePosition
forall b c a. (b -> c) -> (a -> b) -> a -> c
. CInt -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral) (IO CInt -> IO BaselinePosition) -> IO CInt -> IO BaselinePosition
forall a b. (a -> b) -> a -> b
$
 (\(Grid ForeignPtr Grid
arg1) CInt
arg2 -> ForeignPtr Grid -> (Ptr Grid -> IO CInt) -> IO CInt
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr Grid
arg1 ((Ptr Grid -> IO CInt) -> IO CInt)
-> (Ptr Grid -> IO CInt) -> IO CInt
forall a b. (a -> b) -> a -> b
$ \Ptr Grid
argPtr1 ->Ptr Grid -> CInt -> IO CInt
gtk_grid_get_row_baseline_position Ptr Grid
argPtr1 CInt
arg2)
{-# LINE 363 "./Graphics/UI/Gtk/Layout/Grid.chs" #-}
    (toGrid self)
    (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
row)

-- | Sets how the baseline should be positioned on row of the grid, in case that row
-- is assigned more space than is requested.
--
gridSetRowBaselinePosition :: GridClass self
 => self -- ^ @self@ - the grid.
 -> Int -- ^ @row@ - a row index.
 -> BaselinePosition -- ^ @pos@ - a BaselinePosition.
 -> IO ()
gridSetRowBaselinePosition :: forall self.
GridClass self =>
self -> Int -> BaselinePosition -> IO ()
gridSetRowBaselinePosition self
self Int
row BaselinePosition
pos =
 (\(Grid ForeignPtr Grid
arg1) CInt
arg2 CInt
arg3 -> ForeignPtr Grid -> (Ptr Grid -> IO ()) -> IO ()
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr Grid
arg1 ((Ptr Grid -> IO ()) -> IO ()) -> (Ptr Grid -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr Grid
argPtr1 ->Ptr Grid -> CInt -> CInt -> IO ()
gtk_grid_set_row_baseline_position Ptr Grid
argPtr1 CInt
arg2 CInt
arg3)
{-# LINE 376 "./Graphics/UI/Gtk/Layout/Grid.chs" #-}
    (toGrid self)
    (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
row)
    (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> CInt) -> Int -> CInt
forall a b. (a -> b) -> a -> b
$ BaselinePosition -> Int
forall a. Enum a => a -> Int
fromEnum BaselinePosition
pos)

foreign import ccall unsafe "gtk_grid_new"
  gtk_grid_new :: (IO (Ptr Widget))

foreign import ccall safe "gtk_grid_attach"
  gtk_grid_attach :: ((Ptr Grid) -> ((Ptr Widget) -> (CInt -> (CInt -> (CInt -> (CInt -> (IO ())))))))

foreign import ccall safe "gtk_grid_attach_next_to"
  gtk_grid_attach_next_to :: ((Ptr Grid) -> ((Ptr Widget) -> ((Ptr Widget) -> (CInt -> (CInt -> (CInt -> (IO ())))))))

foreign import ccall safe "gtk_grid_set_row_homogeneous"
  gtk_grid_set_row_homogeneous :: ((Ptr Grid) -> (CInt -> (IO ())))

foreign import ccall safe "gtk_grid_get_row_homogeneous"
  gtk_grid_get_row_homogeneous :: ((Ptr Grid) -> (IO CInt))

foreign import ccall safe "gtk_grid_set_row_spacing"
  gtk_grid_set_row_spacing :: ((Ptr Grid) -> (CUInt -> (IO ())))

foreign import ccall safe "gtk_grid_get_row_spacing"
  gtk_grid_get_row_spacing :: ((Ptr Grid) -> (IO CUInt))

foreign import ccall safe "gtk_grid_set_column_homogeneous"
  gtk_grid_set_column_homogeneous :: ((Ptr Grid) -> (CInt -> (IO ())))

foreign import ccall safe "gtk_grid_get_column_homogeneous"
  gtk_grid_get_column_homogeneous :: ((Ptr Grid) -> (IO CInt))

foreign import ccall safe "gtk_grid_set_column_spacing"
  gtk_grid_set_column_spacing :: ((Ptr Grid) -> (CUInt -> (IO ())))

foreign import ccall safe "gtk_grid_get_column_spacing"
  gtk_grid_get_column_spacing :: ((Ptr Grid) -> (IO CUInt))

foreign import ccall safe "gtk_grid_get_child_at"
  gtk_grid_get_child_at :: ((Ptr Grid) -> (CInt -> (CInt -> (IO (Ptr Widget)))))

foreign import ccall safe "gtk_grid_insert_row"
  gtk_grid_insert_row :: ((Ptr Grid) -> (CInt -> (IO ())))

foreign import ccall safe "gtk_grid_insert_column"
  gtk_grid_insert_column :: ((Ptr Grid) -> (CInt -> (IO ())))

foreign import ccall safe "gtk_grid_insert_next_to"
  gtk_grid_insert_next_to :: ((Ptr Grid) -> ((Ptr Widget) -> (CInt -> (IO ()))))

foreign import ccall safe "gtk_grid_remove_row"
  gtk_grid_remove_row :: ((Ptr Grid) -> (CInt -> (IO ())))

foreign import ccall safe "gtk_grid_remove_column"
  gtk_grid_remove_column :: ((Ptr Grid) -> (CInt -> (IO ())))

foreign import ccall safe "gtk_grid_get_baseline_row"
  gtk_grid_get_baseline_row :: ((Ptr Grid) -> (IO CInt))

foreign import ccall safe "gtk_grid_set_baseline_row"
  gtk_grid_set_baseline_row :: ((Ptr Grid) -> (CInt -> (IO ())))

foreign import ccall safe "gtk_grid_get_row_baseline_position"
  gtk_grid_get_row_baseline_position :: ((Ptr Grid) -> (CInt -> (IO CInt)))

foreign import ccall safe "gtk_grid_set_row_baseline_position"
  gtk_grid_set_row_baseline_position :: ((Ptr Grid) -> (CInt -> (CInt -> (IO ()))))