1 2@c %start of fragment 3 4@node GtkCellRenderer 5@chapter GtkCellRenderer 6An object for rendering a single cell on a 7 8@section Overview 9The @code{<gtk-cell-renderer>} is a base class of a set of objects used for 10rendering a cell to a @code{<gdk-drawable>}. These objects are used primarily by 11the @code{<gtk-tree-view>} widget, though they aren't tied to them in any 12specific way. It is worth noting that @code{<gtk-cell-renderer>} is not a 13@code{<gtk-widget>} and cannot be treated as such. 14 15The primary use of a @code{<gtk-cell-renderer>} is for drawing a certain 16graphical elements on a @code{<gdk-drawable>}. Typically, one cell renderer is 17used to draw many cells on the screen. To this extent, it isn't expected that a 18CellRenderer keep any permanent state around. Instead, any state is set just 19prior to use using @code{<gobject>}s property system. Then, the cell is measured 20using @code{gtk-cell-renderer-get-size}. Finally, the cell is rendered in the 21correct location using @code{gtk-cell-renderer-render}. 22 23There are a number of rules that must be followed when writing a new 24@code{<gtk-cell-renderer>}. First and formost, it's important that a certain set 25of properties will always yield a cell renderer of the same size, barring a 26@code{<gtk-style>} change. The @code{<gtk-cell-renderer>} also has a number of 27generic properties that are expected to be honored by all children. 28 29Beyond merely rendering a cell, cell renderers can optionally provide active 30user interface elements. A cell renderer can be @dfn{activatable} like 31@code{<gtk-cell-renderer-toggle>}, which toggles when it gets activated by a 32mouse click, or it can be @dfn{editable} like @code{<gtk-cell-renderer-text>}, 33which allows the user to edit the text using a @code{<gtk-entry>}. To make a 34cell renderer activatable or editable, you have to implement the @var{activate} 35or @var{start-editing} virtual functions, respectively. 36 37@section Usage 38@include defuns-gtkcellrenderer.xml.texi 39 40@c %end of fragment 41