Xfce Foundation Classes
Main Page  | IndexNamespace List  |  Alphabetical List  |  Class List  |  File List


Xfc::Gtk::CellRenderer Class Reference

A GtkCellRenderer C++ wrapper class. More...

#include <xfc/gtk/cellrenderer.hh>

Inheritance diagram for Xfc::Gtk::CellRenderer:

Xfc::Gtk::Object Xfc::G::Object Xfc::G::TypeInstance Xfc::Trackable Xfc::Gtk::CellRendererPixbuf Xfc::Gtk::CellRendererProgress Xfc::Gtk::CellRendererText Xfc::Gtk::CellRendererToggle Xfc::Gtk::CellRendererCombo List of all members.

Property Prototypes

Signal Prototypes

Public Member Functions

Accessors
Methods
Property Proxies
Signal Proxies

Protected Member Functions

Methods

Detailed Description

A GtkCellRenderer C++ wrapper class.

The purpose of the cell renderers is to provide extensibility to the widget and to allow multiple ways of rendering the same type of data. For example, consider how to render a bool variable. Should you render it as a string of "true" or "false", "On" or "Off", or should you render it as a checkbox?

The TreeView widget uses columns and cell renderers to display a model. Cell renderers are used to draw the data in the tree model in a certain way. There are three cell renderers that come with XFC. They are the CellRendererText, CellRendererPixbuf and CellRendererToggle. It is relatively easy to write a custom renderer.


Constructor & Destructor Documentation

Xfc::Gtk::CellRenderer::CellRenderer ( GtkCellRenderer *  cell,
bool  owns_reference = false 
) [explicit, protected]

Construct a new CellRenderer from an existing GtkCellRenderer.

Parameters:
cell A pointer to a GtkCellRenderer.
owns_reference Set false if the initial reference count is floating, set true if it's not.
The cell can be a newly created GtkCellRenderer or an existing GtkCellRenderer. (see G::Object::Object).

Xfc::Gtk::CellRenderer::CellRenderer ( GtkCellRenderer *  cell,
bool  owns_reference = false 
) [explicit, protected]

Construct a new CellRenderer from an existing GtkCellRenderer.

Parameters:
cell A pointer to a GtkCellRenderer.
owns_reference Set false if the initial reference count is floating, set true if it's not.
The cell can be a newly created GtkCellRenderer or an existing GtkCellRenderer. (see G::Object::Object).


Member Function Documentation

void Xfc::Gtk::CellRenderer::editing_canceled (  )  [protected]

Causes the cell renderer to emit the "editing-canceled" signal.

This method is for use only by implementations of cell renderers that need to notify the client program that an editing process was canceled and the changes were not committed.

void Xfc::Gtk::CellRenderer::get_fixed_size ( int *  width,
int *  height 
) const

Fills in width and height with the appropriate size of cell.

Parameters:
width Location to fill in with the fixed width of the widget, or null.
height Location to fill in with the fixed height of the widget, or null.

void Xfc::Gtk::CellRenderer::get_size ( const Widget widget,
const Gdk::Rectangle cell_area,
int *  x_offset,
int *  y_offset,
int *  width,
int *  height 
) const

Obtains the width and height needed to render the cell and sets the x and y offets (if set).

Parameters:
widget The widget the renderer is rendering to.
cell_area The area a cell will be allocated, or null
x_offset Location to return x offset of cell relative to cell_area, or null.
y_offset Location to return y offset of cell relative to cell_area, or null.
width Location to return width needed to render a cell, or null.
height Location to return height needed to render a cell, or null.
Used by view widgets to determine the appropriate size for the cell_area passed to render(). If cell_area is not null, fills in the x and y offsets (if set) of the cell relative to this location. Otherwise x_offset and y_offset are inorgred. Please note that the values set in width and height, as well as those in x_offset and y_offset are inclusive of the xpad and ypad properties.

void Xfc::Gtk::CellRenderer::render ( Gdk::Window window,
Widget widget,
const Gdk::Rectangle background_area,
const Gdk::Rectangle cell_area,
const Gdk::Rectangle expose_area,
CellRendererStateField  flags 
)

Invokes the virtual render function of the GtkCellRenderer.

Parameters:
window A GdkDrawable to draw to.
widget The widget owning window.
background_area Entire cell area (including tree expanders and maybe padding on the sides).
cell_area Area normally rendered by a cell renderer.
expose_area Area that actually needs updating.
flags The Gtk::CellRendererState flags that affect the rendering.
The three passed-in rectangles are areas of window. Most renderers will draw within cell_area; the xalign, yalign, xpad, and ypad properties of the CellRenderer should be honored with respect to cell_area. The 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 tile to cover the entire window. The expose_area is a clip rectangle.

bool Xfc::Gtk::CellRenderer::activate ( const Gdk::Event event,
Widget widget,
const String path,
const Gdk::Rectangle background_area,
const Gdk::Rectangle cell_area,
CellRendererStateField  flags 
)

Passes an activate event to the cell renderer for possible processing.

Parameters:
event A Gdk::Event.
widget Widget that received the event.
path Widget-dependent string representation of the event location; e.g. for TreeView, a string representation of TreePath.
background_area Background area as passed to render.
cell_area Cell area as passed to render().
flags The Gtk::CellRendererState flags.
Returns:
true if the event was handled.
Some cell renderers may use events; for example, CellRendererToggle toggles when it gets a mouse click.

CellEditable* Xfc::Gtk::CellRenderer::start_editing ( const Gdk::Event event,
Widget widget,
const String path,
const Gdk::Rectangle background_area,
const Gdk::Rectangle cell_area,
CellRendererStateField  flags 
)

Passes an activate event to the cell renderer for possible processing.

Parameters:
event A Gdk::Event.
widget Widget that received the event.
path Widget-dependent string representation of the event location; e.g. for TreeView, a string representation of TreePath.
background_area Background area as passed to render.
cell_area Cell area as passed to render().
flags The Gtk::CellRendererState flags.
Returns:
A new CellEditable or null.

void Xfc::Gtk::CellRenderer::set_fixed_size ( int  width,
int  height 
)

Sets the renderer size to be explicit, independent of the properties set.

Parameters:
width The width of the cell renderer, or -1.
height The height of the cell renderer, or -1.

void Xfc::Gtk::CellRenderer::stop_editing ( bool  canceled  ) 

Informs the cell renderer that the editing is stopped.

Parameters:
canceled Set to true if the editing has been canceled.
If canceled is true, the cell renderer will emit the "editing-canceled" signal. This method should be called by cell renderer implementations in response to the "editing-done" signal of Gtk::CellEditable.


Member Data Documentation

const EditingCanceledSignalType Xfc::Gtk::CellRenderer::editing_canceled_signal [static, protected]

Editing canceled signal (see signal_editing_canceled()).

Calls a slot with the signature:

< void function();
<

const EditingStartedSignalType Xfc::Gtk::CellRenderer::editing_started_signal [static, protected]

Editing started signal (see signal_editing_started()).

Calls a slot with the signature:

< void function(CellEditable *editable, const String& path);
< // cell_editable: The CellEditable
< // path: The path identifying the edited cell.
<


The documentation for this class was generated from the following file: Xfce Foundation Classes
Copyright © 2004-2005 The XFC Development Team XFC 4.3