Xfce Foundation Classes
Main Page | Index | Namespace 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:

List of all members.

## Property Prototypes

- const ModePropertyType mode_property
    Editable mode of the CellRenderer (see property_mode()).
- const VisiblePropertyType visible_property
    Display the cell (see property_visible()).
- const SensitivePropertyType sensitive_property
    Display the cell sensitive(see property_sensitive()).
- const XAlignPropertyType xalign_property
    The x-align (see property_xalign()).
- const YAlignPropertyType yalign_property
    The y-align (see property_yalign()).
- const XPadPropertyType xpad_property
    The xpad (see property_xpad()).
- const YPadPropertyType ypad_property
    The ypad (see property_ypad()).
- const WidthPropertyType width_property
    The fixed height (see property_height()).
- const HeightPropertyType height_property
    The fixed height (see property_height()).
- const IsExpanderPropertyType is_expander_property
    The row has children (see property_is_expander()).
- const IsExpandedPropertyType is_expanded_property
    The row is an expander row, and is expanded (see property_is_expanded()).
- const CellBackgroundPropertyType cell_background_property
    The cell background color as a string (see property_cell_background()).
- const CellBackgroundGdkPropertyType cell_background_gdk_property
    The cell background color as a Gdk::Color (see property_cell_background_gdk()).
- const CellBackgroundSetPropertyType cell_background_set_property
    Whether this tag affects the cell background color (see property_cell_background_set()).

## Signal Prototypes

- const EditingCanceledSignalType editing_canceled_signal
    Editing canceled signal (see signal_editing_canceled()).
- const EditingStartedSignalType editing_started_signal
    Editing started signal (see signal_editing_started()).

## Public Member Functions

Constructors

- virtual ~CellRenderer ()
    Destructor.

Accessors

- GtkCellRenderer * gtk_cell_renderer () const
    Get a pointer to the GtkCellRenderer structure.
- operator GtkCellRenderer * () const
    Conversion operator; safely converts a CellRenderer to a GtkCellRenderer pointer.
- void get_fixed_size (int *width, int *height) const
    Fills in width and height with the appropriate size of cell.
- void 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).

Methods

- void 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.
- bool 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.
- CellEditable * 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.
- void set_fixed_size (int width, int height)
    Sets the renderer size to be explicit, independent of the properties set.
- void stop_editing (bool canceled)
    Informs the cell renderer that the editing is stopped.

Property Proxies

- const ModePropertyProxy property_mode ()
    Editable mode of the CellRenderer (CellRendererMode : Read / Write).
- const VisiblePropertyProxy property_visible ()
    Display the cell (bool : Read / Write).
- const SensitivePropertyProxy property_sensitive ()
    Display the cell sensitive (bool : Read / Write).
- const XAlignPropertyProxy property_xalign ()
    The x-align (float : Read / Write).
- const YAlignPropertyProxy property_yalign ()
    The y-align (float : Read / Write).
- const XPadPropertyProxy property_xpad ()
    The xpad (unsigned int : Read / Write).
- const YPadPropertyProxy property_ypad ()
    The ypad (unsigned int : Read / Write).
- const WidthPropertyProxy property_width ()
    The fixed width (int : Read / Write).
- const HeightPropertyProxy property_height ()
    The fixed height (int : Read / Write).
- const IsExpanderPropertyProxy property_is_expander ()
    The row has children (bool : Read / Write).
- const IsExpandedPropertyProxy property_is_expanded ()
    The row is an expander row, and is expanded (bool : Read / Write).
- const CellBackgroundPropertyProxy property_cell_background ()
    The cell background color as a string (String : Write).
- const CellBackgroundGdkPropertyProxy property_cell_background_gdk ()
    The cell background color as a Gdk::Color (Pointer<Gdk::Color> : Read / Write).
- const CellBackgroundSetPropertyProxy property_cell_background_set ()
    Whether this tag affects the cell background color (bool : Read / Write).

Signal Proxies

- const EditingCanceledSignalProxy signal_editing_canceled ()
    Connect to the editing_canceled_signal; emitted when the user cancels the process of editing a cell, such as pressing the Escape key.
- const EditingStartedSignalProxy signal_editing_started ()
    Connect to the editing_started_signal; emitted when a cell starts to be edited.

## Protected Member Functions

Constructors

- CellRenderer (GtkCellRenderer *cell, bool owns_reference=false)
    Construct a new CellRenderer from an existing GtkCellRenderer.

Methods

- void editing_canceled ()
    Causes the cell renderer to emit the "editing-canceled" signal.

## 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).

## Member Function Documentation

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.

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.

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.

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::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:

- cellrenderer.hh

Xfce Foundation Classes

Copyright © 2004-2005 The XFC Development Team | XFC 4.3