gtk.CellLayout

gtk.CellLayout — an interface for packing cells

Synopsis

class gtk.CellLayout(gobject.GInterface):
    def pack_start(cell, expand=TRUE)
def pack_end(cell, expand=TRUE)
def clear()
def set_attributes(cell, ...)
def add_attribute(cell, attribute, column)
def set_cell_data_func(cell, func, func_data)
def clear_attributes(cell)
def reorder(cell, position)

Description

Note

This interface is available in PyGTK 2.4 and above.

gtk.CellLayout is an interface to be implemented by all objects that want to provide a gtk.TreeViewColumn-like API for packing cells, setting attributes and data funcs. The gtk.CellLayout interface is implemented by the gtk.ComboBoxEntry, gtk.ComboBox, gtk.EntryCompletion and gtk.TreeViewColumn widgets.

Methods

gtk.CellLayout.pack_start

    def pack_start(cell, expand=TRUE)
cell :A gtk.CellRenderer.
expand :if TRUE, the cell is to be given extra space that is allocated to the cell layout.

Note

This method is available in PyGTK 2.4 and above.

The pack_start() method packs the gtk.CellRenderer specified by cell into the beginning of the cell layout. If the optional parameter expand is FALSE, then cell is allocated no more space than it needs. Any unused space is divided evenly between cells for which expand is TRUE.

gtk.CellLayout.pack_end

    def pack_end(cell, expand=TRUE)
cell :A gtk.CellRenderer.
expand :if TRUE, the cell is to be given extra space that is allocated to the cell layout.

Note

This method is available in PyGTK 2.4 and above.

The pack_end() method adds the gtk.CellRenderer specified by cell to the end of the cell layout. If the optional parameter 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.

gtk.CellLayout.clear

    def clear()

Note

This method is available in PyGTK 2.4 and above.

The clear() method unsets all the attribute mappings on all cell renderers in the cell layout.

gtk.CellLayout.set_attributes

    def set_attributes(cell, ...)
cell :A gtk.CellRenderer.
... :Zero or more keyword-value arguments in the format attribute=column.

Note

This method is available in PyGTK 2.4 and above.

The set_attributes() method sets the attributes provided as a keyword argument list as the attributes of the gtk.CellRenderer specified by cell. The attributes should be supplied as keyword-value arguments in the format: attribute=column (e.g. text=0, background=1). All existing attributes are removed, and replaced with the new attributes.

gtk.CellLayout.add_attribute

    def add_attribute(cell, attribute, column)
cell :A gtk.CellRenderer.
attribute :An attribute on the renderer.
column :The column number in the model to get the attribute from.

Note

This method is available in PyGTK 2.4 and above.

The add_attribute() method adds an attribute mapping to the list in the cell layout. The column parameter is the column of the model to get a value from, and the attribute parameter is the attribute of 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.CellRendererText get its values from column 2.

gtk.CellLayout.set_cell_data_func

    def set_cell_data_func(cell, func, func_data)
cell :A gtk.CellRenderer.
func :The function to use.
func_data :The user data for func.

Note

This method is available in PyGTK 2.4 and above.

The set_cell_data_func() method sets the function (or method) specified by func to be used for setting the column value of the gtk.CellRenderer specified by cell instead of using the standard attribute mapping method. func may be None to remove the current function. The signature of func is:

    def celldatafunction(celllayout, cell, model, iter, user_data)
def celldatamethod(self, celllayout, cell, model, iter, user_data)

where celllayout is the gtk.CellLayout, cell is the gtk.CellRenderer for celllayout, model is the gtk.TreeModel and iter is the gtk.TreeIter pointing at the row.

gtk.CellLayout.clear_attributes

    def clear_attributes(cell)
cell :A gtk.CellRenderer to clear the attribute mapping on.

Note

This method is available in PyGTK 2.4 and above.

The clear_attributes() method clears all existing attribute mappings from the gtk.CellRenderer specified by cell previously set with the set_attributes() or add_attribute() methods.

gtk.CellLayout.reorder

    def reorder(cell, position)
cell :A gtk.CellRenderer to reorder.
position :New position to insert cell at.

Note

This method is available in PyGTK 2.4 and above.

The reorder() method re-inserts the gtk.CellRenderer specified by cell at position. Note that cell has to already be packed into cell_layout for this to function properly.