GtkCellRenderer: GtkCellRenderer

Description Methods and Functions Hierarchy Detailed Description Structures Enums and Flags Signals Properties Author(s) References See Also

Description

An object for rendering a single cell on a GdkDrawable

Methods and Functions

gtkCellRendererGetSize(object, widget, cell.area = NULL)
gtkCellRendererRender(object, window, widget, background.area, cell.area, expose.area, flags)
gtkCellRendererActivate(object, event, widget, path, background.area, cell.area, flags)
gtkCellRendererStartEditing(object, event, widget, path, background.area, cell.area, flags)
gtkCellRendererEditingCanceled(object)
gtkCellRendererEditingCanceled(object)
gtkCellRendererStopEditing(object, canceled)
gtkCellRendererGetFixedSize(object)
gtkCellRendererSetFixedSize(object, width, height)
gtkCellRendererGetVisible(object)
gtkCellRendererSetVisible(object, visible)
gtkCellRendererGetSensitive(object)
gtkCellRendererSetSensitive(object, sensitive)
gtkCellRendererGetAlignment(object, xalign, yalign)
gtkCellRendererSetAlignment(object, xalign, yalign)
gtkCellRendererGetPadding(object, xpad, ypad)
gtkCellRendererSetPadding(object, xpad, ypad)

Hierarchy

1
2
3
4
5
6
7
8
9

Detailed Description

The GtkCellRenderer is a base class of a set of objects used for rendering a cell to a GdkDrawable. These objects are used primarily by the GtkTreeView widget, though they aren't tied to them in any specific way. It is worth noting that GtkCellRenderer is not a GtkWidget and cannot be treated as such.

The primary use of a GtkCellRenderer is for drawing a certain graphical elements on a GdkDrawable. Typically, one cell renderer is used to draw many cells on the screen. To this extent, it isn't expected that a CellRenderer keep any permanent state around. Instead, any state is set just prior to use using GObjects property system. Then, the cell is measured using gtkCellRendererGetSize. Finally, the cell is rendered in the correct location using gtkCellRendererRender.

There are a number of rules that must be followed when writing a new GtkCellRenderer. First and formost, it's important that a certain set of properties will always yield a cell renderer of the same size, barring a GtkStyle change. The GtkCellRenderer also has a number of generic properties that are expected to be honored by all children.

Beyond merely rendering a cell, cell renderers can optionally provide active user interface elements. A cell renderer can be activatable like GtkCellRendererToggle, which toggles when it gets activated by a mouse click, or it can be editable like GtkCellRendererText, which allows the user to edit the text using a GtkEntry. To make a cell renderer activatable or editable, you have to implement the activate or start.editing virtual functions, respectively.

Structures

GtkCellRenderer

undocumented

Enums and Flags

GtkCellRendererState

Tells how a cell is to be rendererd.

selected

The cell is currently selected, and probably has a selection colored background to render to.

prelit

The mouse is hovering over the cell.

insensitive

The cell is drawn in an insensitive manner

sorted

The cell is in a sorted row

focused

The cell is in the focus row.

GtkCellRendererMode

Identifies how the user can interact with a particular cell.

inert

The cell is just for display and cannot be interacted with. Note that this doesn't mean that eg. the row being drawn can't be selected – just that a particular element of it cannot be individually modified.

activatable

The cell can be clicked.

editable

The cell can be edited or otherwise modified.

Signals

editing-canceled(renderer, user.data)

This signal gets emitted when the user cancels the process of editing a cell. For example, an editable cell renderer could be written to cancel editing when the user presses Escape.

See also: gtkCellRendererStopEditing. Since 2.4

renderer

the object which received the signal

user.data

user data set when the signal handler was connected.

editing-started(renderer, editable, path, user.data)

This signal gets emitted when a cell starts to be edited. The intended use of this signal is to do special setup on editable, e.g. adding a GtkEntryCompletion or setting up additional columns in a GtkComboBox.

Note that GTK+ doesn't guarantee that cell renderers will continue to use the same kind of widget for editing in future releases, therefore you should check the type of editable before doing any specific setup, as in the following example:

text_editing_started <- function(cell, editable, path, data)
{
  checkPtrType(editable, "GtkEntry")
  ## ... create a GtkEntryCompletion
  editable$setCompletion(completion)
}

Since 2.6

renderer

the object which received the signal

editable

the GtkCellEditable

path

the path identifying the edited cell

user.data

user data set when the signal handler was connected.

Properties

cell-background [character : * : Write]

Cell background color as a string. Default value: NULL

cell-background-gdk [GdkColor : * : Read / Write]

Cell background color as a GdkColor.

cell-background-set [logical : Read / Write]

Whether this tag affects the cell background color. Default value: FALSE

editing [logical : Read]

Whether the cell renderer is currently in editing mode. Default value: FALSE

height [integer : Read / Write]

The fixed height. Allowed values: >= -1 Default value: -1

is-expanded [logical : Read / Write]

Row is an expander row, and is expanded. Default value: FALSE

is-expander [logical : Read / Write]

Row has children. Default value: FALSE

mode [GtkCellRendererMode : Read / Write]

Editable mode of the CellRenderer. Default value: GTK_CELL_RENDERER_MODE_INERT

sensitive [logical : Read / Write]

Display the cell sensitive. Default value: TRUE

visible [logical : Read / Write]

Display the cell. Default value: TRUE

width [integer : Read / Write]

The fixed width. Allowed values: >= -1 Default value: -1

xalign [numeric : Read / Write]

The x-align. Allowed values: [0,1] Default value: 0.5

xpad [numeric : Read / Write]

The xpad. Default value: 0

yalign [numeric : Read / Write]

The y-align. Allowed values: [0,1] Default value: 0.5

ypad [numeric : Read / Write]

The ypad. Default value: 0

Author(s)

Derived by RGtkGen from GTK+ documentation

References

https://developer.gnome.org/gtk2/stable/GtkCellRenderer.html

See Also

GtkCellRendererText GtkCellRendererPixbuf GtkCellRendererToggle


RGtk2 documentation built on Oct. 14, 2021, 5:08 p.m.

Related to GtkCellRenderer in RGtk2...