GtkCellRenderer

Name

GtkCellRenderer -- 

Synopsis


#include <gtk/gtk.h>


enum        GtkCellRendererState;
struct      GtkCellRenderer;
void        gtk_cell_renderer_get_size      (GtkCellRenderer *cell,
                                             GtkWidget *widget,
                                             GdkRectangle *cell_area,
                                             gint *x_offset,
                                             gint *y_offset,
                                             gint *width,
                                             gint *height);
void        gtk_cell_renderer_render        (GtkCellRenderer *cell,
                                             GdkWindow *window,
                                             GtkWidget *widget,
                                             GdkRectangle *background_area,
                                             GdkRectangle *cell_area,
                                             GdkRectangle *expose_area,
                                             GtkCellRendererState flags);
gboolean    gtk_cell_renderer_event         (GtkCellRenderer *cell,
                                             GdkEvent *event,
                                             GtkWidget *widget,
                                             gchar *path,
                                             GdkRectangle *background_area,
                                             GdkRectangle *cell_area,
                                             GtkCellRendererState flags);

Description

Details

enum GtkCellRendererState

typedef enum
{
  GTK_CELL_RENDERER_SELECTED    = 1 << 0,
  GTK_CELL_RENDERER_PRELIT      = 1 << 1,
  GTK_CELL_RENDERER_INSENSITIVE = 1 << 2,
  /* this flag means the cell is in the sort column/row */
  GTK_CELL_RENDERER_SORTED      = 1 << 3
} GtkCellRendererState;


struct GtkCellRenderer

struct GtkCellRenderer
{
  GtkObject parent;

  gfloat xalign;
  gfloat yalign;

  gint width;
  gint height;

  guint16 xpad;
  guint16 ypad;

  guint can_activate : 1;
  guint visible : 1;
  guint is_expander : 1;
  guint is_expanded : 1;
};


gtk_cell_renderer_get_size ()

void        gtk_cell_renderer_get_size      (GtkCellRenderer *cell,
                                             GtkWidget *widget,
                                             GdkRectangle *cell_area,
                                             gint *x_offset,
                                             gint *y_offset,
                                             gint *width,
                                             gint *height);

Obtains the width and height needed to render the cell. Used by view widgets to determine the appropriate size for the cell_area passed to gtk_cell_renderer_render(). If cell_area is not NULL, fills in the x and y offsets (if set) of the cell relative to this location.

cell : a GtkCellRenderer
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


gtk_cell_renderer_render ()

void        gtk_cell_renderer_render        (GtkCellRenderer *cell,
                                             GdkWindow *window,
                                             GtkWidget *widget,
                                             GdkRectangle *background_area,
                                             GdkRectangle *cell_area,
                                             GdkRectangle *expose_area,
                                             GtkCellRendererState flags);

Invokes the virtual render function of the GtkCellRenderer. The three passed-in rectangles are areas of window. Most renderers will draw to cell_area; the xalign, yalign, xpad, and ypad fields of the GtkCellRenderer 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 tile to cover the entire window. Cell renderers can use the background_area to draw custom expanders, for example. expose_area is a clip rectangle.

cell : a GtkCellRenderer
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 rendering


gtk_cell_renderer_event ()

gboolean    gtk_cell_renderer_event         (GtkCellRenderer *cell,
                                             GdkEvent *event,
                                             GtkWidget *widget,
                                             gchar *path,
                                             GdkRectangle *background_area,
                                             GdkRectangle *cell_area,
                                             GtkCellRendererState flags);

Passes an event to the cell renderer for possible processing. Some cell renderers may use events; for example, GtkCellRendererToggle toggles when it gets a mouse click.

cell : a GtkCellRenderer
event : a GdkEvent
widget : widget that received the event
path : widget-dependent string representation of the event location; e.g. for GtkTreeView, a string representation of GtkTreePath
background_area : background area as passed to gtk_cell_renderer_render()
cell_area : cell area as passed to gtk_cell_renderer_render()
flags : render flags
Returns : TRUE if the event was consumed/handled