Package: gtk

Class gtk-cell-layout

Superclasses

g-object, common-lisp:standard-object, common-lisp:t

Documented Subclasses

Direct Slots

None

Details

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

One of the notable features provided by implementations of the gtk-cell-layout interface 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 the function gtk-cell-layout-add-attribute, 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 the function gtk-cell-layout-set-cell-data-func that is called to determine the value of the attribute for each cell that is rendered.

GtkCellLayouts as GtkBuildable

Implementations of the gtk-cell-layout interface which also implement the gtk-buildable interface accept gtk-cell-renderer objects as <child> elements in UI definitions. They support a custom <attributes> element for their children, which can contain multiple <attribute> elements. Each <attribute> element has a name attribute which specifies a property of the cell renderer. The content of the element is the attribute value.

Example: A UI definition fragment specifying attributes
<object class="GtkCellView">
  <child>
    <object class="GtkCellRendererText"/>
    <attributes>
      <attribute name="text">0</attribute>
    </attributes>
  </child>
</object>    
Furthermore for implementations of the gtk-cell-layout interface that use a gtk-cell-area object to lay out cells, all gtk-cell-layout objects in GTK+ use a gtk-cell-area object, cell properties can also be defined in the format by specifying the custom <cell-packing> attribute which can contain multiple <property> elements defined in the normal way.

Example: A UI definition fragment specifying cell properties
<object class="GtkTreeViewColumn">
  <child>
    <object class="GtkCellRendererText"/>
    <cell-packing>
      <property name="align">True</property>
      <property name="expand">False</property>
    </cell-packing>
  </child>
</object>    
 

Inherited Slot Access Functions

See also

2021-3-13