Next: , Previous: GtkTreeModelFilter, Up: Top


42 GtkCellLayout

An interface for packing cells

42.1 Overview

<gtk-cell-layout> is an interface to be implemented by all objects which want to provide a <gtk-tree-view-column-like> API for packing cells, setting attributes and data funcs.

One of the notable features provided by implementations of GtkCellLayout are attributes. Attributes let you set the properties in flexible ways. They can just be set to constant values like regular properties. But they can also be mapped to a column of the underlying tree model with gtk-cell-layout-set-attributes, which means that the value of the attribute can change from cell to cell as they are rendered by the cell renderer. Finally, it is possible to specify a function with gtk-cell-layout-set-cell-data-func that is called to determine the value of the attribute for each cell that is rendered.

42.2 Usage

— Class: <gtk-cell-layout>

Derives from <ginterface>.

This class defines no direct slots.

— Function: gtk-cell-layout-pack-start (self <gtk-cell-layout>) (cell <gtk-cell-renderer>) (expand bool)
— Method: pack-start

Packs the cell into the beginning of cell-layout. If expand is ‘#f’, then the cell is allocated no more space than it needs. Any unused space is divided evenly between cells for which expand is ‘#t’.

Note that reusing the same cell renderer is not supported.

cell-layout
A <gtk-cell-layout>.
cell
A <gtk-cell-renderer>.
expand
#t’ if cell is to be given extra space allocated to cell-layout.

Since 2.4

— Function: gtk-cell-layout-pack-end (self <gtk-cell-layout>) (cell <gtk-cell-renderer>) (expand bool)
— Method: pack-end

Adds the cell to the end of cell-layout. If expand is ‘#f’, then the cell is allocated no more space than it needs. Any unused space is divided evenly between cells for which expand is ‘#t’.

Note that reusing the same cell renderer is not supported.

cell-layout
A <gtk-cell-layout>.
cell
A <gtk-cell-renderer>.
expand
#t’ if cell is to be given extra space allocated to cell-layout.

Since 2.4

— Function: gtk-cell-layout-reorder (self <gtk-cell-layout>) (cell <gtk-cell-renderer>) (position int)
— Method: reorder

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

cell-layout
A <gtk-cell-layout>.
cell
A <gtk-cell-renderer> to reorder.
position
New position to insert cell at.

Since 2.4

— Function: gtk-cell-layout-clear (self <gtk-cell-layout>)
— Method: clear

Unsets all the mappings on all renderers on cell-layout and removes all renderers from cell-layout.

cell-layout
A <gtk-cell-layout>.

Since 2.4

— Function: gtk-cell-layout-add-attribute (self <gtk-cell-layout>) (cell <gtk-cell-renderer>) (attribute mchars) (column int)
— Method: add-attribute

Adds an attribute mapping to the list in cell-layout. The column is the column 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 <gtk-cell-renderer-text> get its values from column 2.

cell-layout
A <gtk-cell-layout>.
cell
A <gtk-cell-renderer>.
attribute
An attribute on the renderer.
column
The column position on the model to get the attribute from.

Since 2.4

— Function: gtk-cell-layout-clear-attributes (self <gtk-cell-layout>) (cell <gtk-cell-renderer>)
— Method: clear-attributes

Clears all existing attributes previously set with gtk-cell-layout-set-attributes.

cell-layout
A <gtk-cell-layout>.
cell
A <gtk-cell-renderer> to clear the attribute mapping on.

Since 2.4