Reference Manual

Main Page | Namespace List | Class Hierarchy | Alphabetical List | Compound List | File List | Namespace Members | Compound Members | File Members

# Inti::Gtk::CellRenderer Class Reference

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

`#include <inti/gtk/cellrenderer.h>`

Inheritance diagram for Inti::Gtk::CellRenderer:

List of all members.

## Public Member Functions

Constructors

- virtual ~CellRenderer ()
    Destructor.

Accessors

- GtkCellRenderer * gtk_cell_renderer () const
    Get a pointer to the GtkCellRenderer structure.
- GtkCellRendererClass * gtk_cell_renderer_class () const
    Get a pointer to the GtkCellRendererClass structure.
- operator GtkCellRenderer * () const
    Conversion operator; safely converts a CellRenderer to a GtkCellRenderer pointer.
- void get_fixed_size (int *width, int *height)
    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.
- Pointer< 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.

Property Proxies

- const ModePropertyProxy prop_mode ()
    Editable mode of the CellRenderer (CellRendererMode : Read / Write).
- const VisiblePropertyProxy prop_visible ()
    Display the cell (bool : Read / Write).
- const XAlignPropertyProxy prop_xalign ()
    The x-align (float : Read / Write).
- const YAlignPropertyProxy prop_yalign ()
    The y-align (float : Read / Write).
- const XPadPropertyProxy prop_xpad ()
    The xpad (unsigned int : Read / Write).
- const YPadPropertyProxy prop_ypad ()
    The ypad (unsigned int : Read / Write).
- const WidthPropertyProxy prop_width ()
    The fixed width (int : Read / Write).
- const HeightPropertyProxy prop_height ()
    The fixed height (int : Read / Write).
- const IsExpanderPropertyProxy prop_is_expander ()
    The row has children (bool : Read / Write).
- const IsExpandedPropertyProxy prop_is_expanded ()
    The row is an expander row, and is expanded (bool : Read / Write).
- const CellBackgroundPropertyProxy prop_cell_background ()
    The cell background color as a string (String : Write).
- const CellBackgroundGdkPropertyProxy prop_cell_background_gdk ()
    The cell background color as a Gdk::Color (Pointer<Gdk::Color> : Read / Write).
- const CellBackgroundSetPropertyProxy prop_cell_background_set ()
    Whether this tag affects the cell background color (bool : Read / Write).

## Protected Member Functions

Constructors

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

## 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 Inti. They are the CellRendererText, CellRendererPixbuf and CellRendererToggle. It is relatively easy to write a custom renderer.

## Constructor & Destructor Documentation

Inti::Gtk::CellRenderer::CellRenderer | ( | GtkCellRenderer * | cell,
|  | bool | reference = false
| ) | `[explicit, protected]`

  | Construct a new CellRenderer from an existing GtkCellRenderer. Parameters:
  cell | A pointer to a GtkCellRenderer.
  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 Inti::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 | Render 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 Inti::Gtk::CellRenderer::get_fixed_size | ( | int * | width,
|  | int * | height
| ) |

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

Pointer<CellEditable> Inti::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 | Render flags
Returns: A new CellEditable or null.

The documentation for this class was generated from the following file:

- cellrenderer.h

Main Page - Footer