|
NAMEGtk2::CellRenderer - An object that renders a single cell onto a Gtk2::Gdk::DrawableDESCRIPTIONThe Gtk2::CellRenderer is the base class for objects which render cells onto drawables. These objects are used primarily by the Gtk2::TreeView, though they aren't tied to them in any specific way.Typically, one cell renderer is used to draw many cells onto the screen. Thus, the cell renderer doesn't keep state; instead, any state is set immediately prior to use through the object property system. The cell is measured with "get_size", and then renderered with "render". HIERARCHYGlib::Object +----Glib::InitiallyUnowned +----Gtk2::Object +----Gtk2::CellRenderer METHODSboolean = $cell->activate ($event, $widget, $path, $background_area, $cell_area, $flags)
(xalign, yalign) = $cell->get_alignmentSince: gtk+ 2.18$cell->set_alignment ($xalign, $yalign)
Since: gtk+ 2.18 $cell->editing_canceledSince: gtk+ 2.4(width, height) = $cell->get_fixed_sizeFetch the fixed size if $cell. Values of -1 mean "this dimension is not fixed."$cell->set_fixed_size ($width, $height)
Set the renderer's size explicitly, independent of object properties. A value of -1 means "don't use a fixed size for this dimension." (xpad, ypad) = $cell->get_paddingSince: gtk+ 2.18$cell->set_padding ($xpad, $ypad)
Since: gtk+ 2.18 $cell->render ($drawable, $widget, $background_area, $cell_area, $expose_area, $flags)
boolean = $cell->get_sensitiveSince: gtk+ 2.18$cell->set_sensitive ($sensitive)
Since: gtk+ 2.18 (x_offset, y_offset, width, height) = $cell->get_size ($widget, $cell_area)
celleditable or undef = $cell->start_editing ($event, $widget, $path, $background_area, $cell_area, $flags)
$cell->stop_editing ($canceled)
Since: gtk+ 2.6 boolean = $cell->get_visibleSince: gtk+ 2.18$cell->set_visible ($visible)
Since: gtk+ 2.18 PROPERTIES
SIGNALS
ENUMS AND FLAGSenum Gtk2::CellRendererMode
flags Gtk2::CellRendererState
DERIVING NEW CELL RENDERERSGtk+ provides three cell renderers: Gtk2::CellRendererText, Gtk2::CellRendererToggle, and Gtk2::CellRendererPixbuf. You may derive a new renderer from any of these, or directly from Gtk2::CellRenderer itself.There are a number of rules that must be followed when writing a new cell renderer. First and foremost, it's important that a certain set of properties always yields a cell of the same size, barring a Gtk2::Style change. The cell renderer also has a number of generic properties that are expected to be honored by all children. The new renderer must be a GObject, so you must follow the normal procedure for creating a new Glib::Object (i.e., either Glib::Object::Subclass or Glib::Type::register_object). The new subclass can customize the object's behavior by providing new implementations of these four methods:
Return Values:
This is called to calculate the size of the cell for display, taking into account the padding and alignment properties of the parent. This one will be called very often. If you need to know your cell's data, then get it from the appropriate object properties, which will be set accordingly before this method is called.
This is called to render the cell onto the screen. As with GET_SIZE, the data for the cell comes from object properties. In general, you'll want to make use of Gtk2::Style methods for drawing anything fancy. The three passed-in rectangles are areas of $drawable . Most renderers draw within $cell_area; the xalign, yalign, xpad, and ypad fields of the cell renderer should be honored with respect to $cell_area . $background_area includes the blank space around the cell, and also the area containing the tree expander; so the $background_area rectangles for all cells cover the entire $drawable. $expose_area is a clip rectangle.
This method is called when an event occurs on a cell. Implementing it is not mandatory. The return value should be TRUE if the event was consumed/handled.
For cells that are editable, this is called to put the cell into editing mode. If the return value is an object is a Gtk2::CellEditable, that widget will be used to edit the value; the calling code takes care of sizing, placing, and showing the editable, you just need to return it. If the return value is undef, the editing is aborted. Note: for backward compatibility, the bizarre and non-standard scheme used for this in 1.02x is still supported, but is deprecated and should not be used in new code, and since i don't want people to use it any more i will not document it here. SEE ALSOGtk2, Glib::Object, Glib::InitiallyUnowned, Gtk2::ObjectCOPYRIGHTCopyright (C) 2003-2011 by the gtk2-perl team.This software is licensed under the LGPL. See Gtk2 for a full notice.
Visit the GSP FreeBSD Man Page Interface. |