gtk-0.12.2: Binding to the Gtk+ graphical user interface library.

Portability | portable (depends on GHC)
Stability | provisional
Maintainer | gtk2hs-users@lists.sourceforge.net

Graphics.UI.Gtk.ModelView.CellLayout

Contents

- Detail
- Class Hierarchy
- Types
- Methods

Description

An interface for packing cells

- Module available since Gtk+ version 2.4

Synopsis

- class GObjectClass o => CellLayoutClass o
- toCellLayout :: CellLayoutClass o => o -> CellLayout
- cellLayoutPackStart :: (CellLayoutClass self, CellRendererClass cell) => self -> cell -> Bool -> IO ()
- cellLayoutPackEnd :: (CellLayoutClass self, CellRendererClass cell) => self -> cell -> Bool -> IO ()
- cellLayoutReorder :: (CellLayoutClass self, CellRendererClass cell) => self -> cell -> Int -> IO ()
- cellLayoutClear :: CellLayoutClass self => self -> IO ()
- cellLayoutClearAttributes :: (CellLayoutClass self, CellRendererClass cell) => self -> cell -> IO ()
- cellLayoutGetCells :: CellLayoutClass self => self -> IO [CellRenderer]
- cellLayoutAddColumnAttribute :: (CellLayoutClass self, CellRendererClass cell) => self -> cell -> ReadWriteAttr cell a v -> ColumnId row v -> IO ()
- cellLayoutSetAttributes :: (CellLayoutClass self, CellRendererClass cell, TreeModelClass (model row), TypedTreeModelClass model) => self -> cell -> model row -> (row -> [AttrOp cell]) -> IO ()
- cellLayoutSetAttributeFunc :: (CellLayoutClass self, CellRendererClass cell, TreeModelClass model) => self -> cell -> model -> (TreeIter -> IO ()) -> IO ()

# Detail

`CellLayout` is an interface which is implemented by all objects which provide a `TreeViewColumn` API for packing cells, setting attributes and data funcs.

# Class Hierarchy

     | Interface CellLayout
     | +----TreeViewColumn
     | +----CellView
     | +----IconView
     | +----EntryCompletion
     | +----ComboBox
     | +----ComboBoxEntry

# Types

class GObjectClass o => CellLayoutClass o

Instances

CellLayoutClass EntryCompletion |
CellLayoutClass CellLayout |
CellLayoutClass TreeViewColumn |
CellLayoutClass CellView |
CellLayoutClass IconView |
CellLayoutClass IconView |
CellLayoutClass ComboBoxEntry |
CellLayoutClass ComboBox |

toCellLayout :: CellLayoutClass o => o -> CellLayout

# Methods

cellLayoutPackStart

Arguments

:: (CellLayoutClass self, CellRendererClass cell) |
=> self |
-> cell | `cell` - A `CellRenderer`.
-> Bool | `expand` - `True` if `cell` is to be given extra space allocated to `cellLayout`.
-> IO () |

Packs the `cell` into the beginning of the cell layout. If `expand` is `False`, then the `cell` is allocated no more space than it needs. Any unused space is divided evenly between cells for which `expand` is `True`.

Note that reusing the same cell renderer is not supported.

cellLayoutPackEnd

Arguments

:: (CellLayoutClass self, CellRendererClass cell) |
=> self |
-> cell | `cell` - A `CellRenderer`.
-> Bool | `expand` - `True` if `cell` is to be given extra space allocated to `cellLayout`.
-> IO () |

Adds the `cell` to the end of `cellLayout`. If `expand` is `False`, then the `cell` is allocated no more space than it needs. Any unused space is divided evenly between cells for which `expand` is `True`.

Note that reusing the same cell renderer is not supported.

cellLayoutReorder

Arguments

:: (CellLayoutClass self, CellRendererClass cell) |
=> self |
-> cell | `cell` - A `CellRenderer` to reorder.
-> Int | `position` - New position to insert `cell` at.
-> IO () |

Re-inserts `cell` at `position`. Note that `cell` has already to be packed into `cellLayout` for this to function properly.

cellLayoutClear :: CellLayoutClass self => self -> IO ()

Remove all renderers from the cell layout.

cellLayoutClearAttributes

Arguments

:: (CellLayoutClass self, CellRendererClass cell) |
=> self |
-> cell | `cell` - A `CellRenderer` to clear the attribute mapping on.
-> IO () |

Clears all existing attributes previously set with `cellLayoutSetAttributes`.

cellLayoutGetCells

Arguments

:: CellLayoutClass self |
=> self |
-> IO [CellRenderer] | returns a list of cell renderers

Returns the cell renderers which have been added to `cellLayout`.

- Available since Gtk+ version 2.12

cellLayoutAddColumnAttribute

Arguments

:: (CellLayoutClass self, CellRendererClass cell) |
=> self |
-> cell | `cell` - A `CellRenderer`.
-> ReadWriteAttr cell a v | `attribute` - An attribute of a renderer.
-> ColumnId row v | `column` - The virtual column of the model from which to retrieve the attribute.
-> IO () |

Adds an attribute mapping to the renderer `cell`. The `column` is the `ColumnId` of the model to get a value from, and the `attribute` is the parameter on `cell` to be set from the value. So for example if column 2 of the model contains strings, you could have the "text" attribute of a `CellRendererText` get its values from column 2.

cellLayoutSetAttributes

Arguments

:: (CellLayoutClass self, CellRendererClass cell, TreeModelClass (model row), TypedTreeModelClass model) |
=> self |
-> cell | `cell` - A `CellRenderer`.
-> model row | `model` - A model containing rows of type `row`.
-> (row -> [AttrOp cell]) | Function to set attributes on the cell renderer.
-> IO () |

Specify how a row of the `model` defines the attributes of the `CellRenderer` `cell`. This is a convenience wrapper around `cellLayoutSetAttributeFunc` in that it sets the cells of the `cell` with the data retrieved from the model.

- Note on using `Graphics.UI.Gtk.ModelView.TreeModelSort.TreeModelSort` and `Graphics.UI.Gtk.ModelView.TreeModelFilter.TreeModelFilter`: These two models wrap another model, the so-called child model, instead of storing their own data. This raises the problem that the data of cell renderers must be set using the child model, while the `TreeIter`s that the view works with refer to the model that encapsulates the child model. For convenience, this function transparently translates an iterator to the child model before extracting the data using e.g. `Graphics.UI.Gtk.TreeModel.TreeModelSort.treeModelSortConvertIterToChildIter`. Hence, it is possible to install the encapsulating model in the view and to pass the child model to this function.

cellLayoutSetAttributeFunc

Arguments

:: (CellLayoutClass self, CellRendererClass cell, TreeModelClass model) |
=> self |
-> cell | `cell` - A `CellRenderer`.
-> model | `model` - A model from which to draw data.
-> (TreeIter -> IO ()) | Function to set attributes on the cell renderer.
-> IO () |

Install a function that looks up a row in the model and sets the attributes of the `CellRenderer` `cell` using the row's content.