ergtkcellrendererborder.c File Reference

#include <glib.h>
#include "ergtk_log.h"
#include "ergtkcellrendererborder.h"
Include dependency graph for ergtkcellrendererborder.c:

Go to the source code of this file.

Data Structures

struct  erGtkCellRendererBorderPrivate

Enumerations

enum  prop_t {
  PROP_NOT_USED = 0, PROP_BORDER_WIDTH, PROP_BORDER_OFFSET, PROP_BORDER_COLOR,
  NUM_PROPS, PROP_NOT_USED = 0, PROP_FONT, PROP_HEIGHT,
  PROP_TEXT, PROP_COLOR, NUM_PROPS, PROP_NOT_USED = 0,
  PROP_NAVIGATE_MODE, NUM_PROPS
}

Functions

static void get_property_impl (GObject *object, guint param_id, GValue *value, GParamSpec *pspec)
static void set_property_impl (GObject *object, guint param_id, const GValue *value, GParamSpec *pspec)
static void render_impl (GtkCellRenderer *cell, GdkWindow *window, GtkWidget *widget, GdkRectangle *bg_area, GdkRectangle *cell_area, GdkRectangle *expose_area, guint flags)
static void ergtk_cell_renderer_border_class_init (erGtkCellRendererBorderClass *klass)
static void ergtk_cell_renderer_border_init (erGtkCellRendererBorder *thiz)
static void ergtk_cell_renderer_border_finalize (GObject *obj)
GType ergtk_cell_renderer_border_get_type (void)
 Returns the GObject type of an erGtkCellRendererBorder.
GtkCellRenderer * ergtk_cell_renderer_border_new (void)
 Create a new erGtkCellRendererBorder object.

Variables

static const gchar * PROPNAME_BORDER_WIDTH = "border-width"
static const gchar * PROPNAME_BORDER_OFFSET = "border-offset"
static const gchar * PROPNAME_BORDER_COLOR = "border-color"
static GtkCellRendererTextClass * g_parent_class = NULL

Enumeration Type Documentation

enum prop_t

Copyright (C) 2009 iRex Technologies B.V. All rights reserved.

Enumerator:
PROP_NOT_USED 
PROP_BORDER_WIDTH 
PROP_BORDER_OFFSET 
PROP_BORDER_COLOR 
NUM_PROPS 
PROP_NOT_USED 
PROP_FONT 
PROP_HEIGHT 
PROP_TEXT 
PROP_COLOR 
NUM_PROPS 
PROP_NOT_USED 
PROP_NAVIGATE_MODE 
NUM_PROPS 

Definition at line 47 of file ergtkcellrendererborder.c.

00048         {
00049             PROP_NOT_USED = 0,      // not sure whether param_id zero is allowed
00050             PROP_BORDER_WIDTH,      // border width in pixels
00051             PROP_BORDER_OFFSET,     // border offset from boundaries in pixels
00052             PROP_BORDER_COLOR,      // border colour as a string
00053             NUM_PROPS
00054         } prop_t;


Function Documentation

static void ergtk_cell_renderer_border_class_init ( erGtkCellRendererBorderClass klass  )  [static]

Definition at line 151 of file ergtkcellrendererborder.c.

References ergtk_cell_renderer_border_finalize(), g_parent_class, get_property_impl(), PROP_BORDER_COLOR, PROP_BORDER_OFFSET, PROP_BORDER_WIDTH, PROPNAME_BORDER_COLOR, PROPNAME_BORDER_OFFSET, PROPNAME_BORDER_WIDTH, render_impl(), and set_property_impl().

Referenced by ergtk_cell_renderer_border_get_type().

00152 {
00153     GObjectClass         *object_class        = (GObjectClass *) klass;
00154     GtkCellRendererClass *cell_renderer_class = (GtkCellRendererClass *) klass;
00155 
00156     GParamSpec  *pspec;
00157 
00158     // remember parent class struct, needed for chaining up to parent class
00159     g_parent_class = g_type_class_peek_parent(klass);
00160 
00161     // overload some virtual methods
00162     cell_renderer_class->render = render_impl;
00163     object_class->get_property  = get_property_impl;
00164     object_class->set_property  = set_property_impl;
00165     object_class->finalize      = ergtk_cell_renderer_border_finalize;
00166 
00167     // reserve space for instance private data
00168     g_type_class_add_private (klass, sizeof(erGtkCellRendererBorderPrivate));
00169 
00170     // install custom properties
00171     //   border width
00172     pspec = g_param_spec_uint( PROPNAME_BORDER_WIDTH,
00173                                PROPNAME_BORDER_WIDTH,
00174                                "Border width in pixels",
00175                                0,      // min.
00176                                10,     // max.
00177                                1,      // default
00178                                G_PARAM_READWRITE | G_PARAM_CONSTRUCT );
00179     g_object_class_install_property( object_class, PROP_BORDER_WIDTH, pspec);
00180     //   border offset
00181     pspec = g_param_spec_uint( PROPNAME_BORDER_OFFSET,
00182                                PROPNAME_BORDER_OFFSET,
00183                                "Border width in pixels",
00184                                0,      // min.
00185                                10,     // max.
00186                                0,      // default
00187                                G_PARAM_READWRITE | G_PARAM_CONSTRUCT );
00188     g_object_class_install_property( object_class, PROP_BORDER_OFFSET, pspec);
00189     //   border colour
00190     pspec = g_param_spec_string( PROPNAME_BORDER_COLOR,
00191                                  PROPNAME_BORDER_COLOR,
00192                                  "Border colour as a string",
00193                                  "",        // default
00194                                  G_PARAM_READWRITE | G_PARAM_CONSTRUCT );
00195     g_object_class_install_property( object_class, PROP_BORDER_COLOR, pspec);
00196 }

Here is the call graph for this function:

Here is the caller graph for this function:

static void ergtk_cell_renderer_border_finalize ( GObject *  obj  )  [static]

Definition at line 214 of file ergtkcellrendererborder.c.

References erGtkCellRendererBorderPrivate::border_color, ERGTK_CELL_RENDERER_BORDER_GET_PRIVATE, g_parent_class, and IS_ERGTK_CELL_RENDERER_BORDER.

Referenced by ergtk_cell_renderer_border_class_init().

00215 {
00216     g_return_if_fail( IS_ERGTK_CELL_RENDERER_BORDER(obj) );
00217 
00218     erGtkCellRendererBorderPrivate *priv = ERGTK_CELL_RENDERER_BORDER_GET_PRIVATE(obj);
00219 
00220     // destroy instance data
00221     //   private
00222     g_free(priv->border_color);
00223     //   public: none
00224 
00225     // chain to parent class
00226     ((GObjectClass*)g_parent_class)->finalize( obj );
00227 }

Here is the caller graph for this function:

GType ergtk_cell_renderer_border_get_type ( void   ) 

Returns the GObject type of an erGtkCellRendererBorder.

---------------------------------------------------------------------------

Name : ergtk_cell_renderer_border_get_type

Parameters:
-- 
Returns:
The GObject type of an erGtkCellRendererBorder

--------------------------------------------------------------------------

Definition at line 120 of file ergtkcellrendererborder.c.

References ergtk_cell_renderer_border_class_init(), and ergtk_cell_renderer_border_init().

00121 {
00122     static GType class_type = 0;
00123 
00124     if (class_type == 0)
00125     {
00126         static const GTypeInfo class_info =
00127         {
00128             sizeof(erGtkCellRendererBorderClass),                   // class_size
00129             NULL,                                                   // base_init
00130             NULL,                                                   // base_finalize
00131             (GClassInitFunc) ergtk_cell_renderer_border_class_init, // class_init
00132             NULL,                                                   // class_finalize
00133             NULL,                                                   // class_data
00134             sizeof(erGtkCellRendererBorder),                        // instance_size
00135             0,                                                      // n_preallocs
00136             (GInstanceInitFunc) ergtk_cell_renderer_border_init,    // instance_init
00137             NULL                                                    // value_table
00138         };
00139 
00140         class_type = g_type_register_static( GTK_TYPE_CELL_RENDERER_TEXT,   // parent_type
00141                                              "erGtkCellRendererBorder",     // type_name
00142                                              &class_info,                   // info
00143                                              0 );                           // flags
00144     }
00145 
00146     return class_type;
00147 }

Here is the call graph for this function:

static void ergtk_cell_renderer_border_init ( erGtkCellRendererBorder thiz  )  [static]

Definition at line 200 of file ergtkcellrendererborder.c.

References erGtkCellRendererBorderPrivate::border_color, ERGTK_CELL_RENDERER_BORDER_GET_PRIVATE, and IS_ERGTK_CELL_RENDERER_BORDER.

Referenced by ergtk_cell_renderer_border_get_type().

00201 {
00202     g_return_if_fail( IS_ERGTK_CELL_RENDERER_BORDER(thiz) );
00203 
00204     erGtkCellRendererBorderPrivate *priv = ERGTK_CELL_RENDERER_BORDER_GET_PRIVATE(thiz);
00205 
00206     // instance data
00207     //   public
00208     //   private
00209     priv->border_color = NULL;
00210 }

Here is the caller graph for this function:

GtkCellRenderer* ergtk_cell_renderer_border_new ( void   ) 

Create a new erGtkCellRendererBorder object.

---------------------------------------------------------------------------

Name : ergtk_cell_renderer_border_new

Parameters:
-- 
Returns:
Pointer to the newly created object, or NULL

--------------------------------------------------------------------------

Definition at line 231 of file ergtkcellrendererborder.c.

References ERGTK_CELL_RENDERER_BORDER_TYPE.

Referenced by create_back_listview(), create_contentview(), and create_settingsview().

00232 {
00233     erGtkCellRendererBorder        *thiz = (erGtkCellRendererBorder*) g_object_new(ERGTK_CELL_RENDERER_BORDER_TYPE, NULL);
00234     //erGtkCellRendererBorderPrivate *priv = ERGTK_CELL_RENDERER_BORDER_GET_PRIVATE(thiz);
00235 
00236     return (GtkCellRenderer*) thiz;
00237 }

Here is the caller graph for this function:

static void get_property_impl ( GObject *  object,
guint  param_id,
GValue *  value,
GParamSpec *  pspec 
) [static]

Definition at line 241 of file ergtkcellrendererborder.c.

References erGtkCellRendererBorderPrivate::border_color, erGtkCellRendererBorderPrivate::border_offset, erGtkCellRendererBorderPrivate::border_width, ERGTK_CELL_RENDERER_BORDER_GET_PRIVATE, IS_ERGTK_CELL_RENDERER_BORDER, PROP_BORDER_COLOR, PROP_BORDER_OFFSET, and PROP_BORDER_WIDTH.

Referenced by ergtk_cell_renderer_border_class_init().

00245 {
00246     g_return_if_fail( IS_ERGTK_CELL_RENDERER_BORDER(object) );
00247 
00248     erGtkCellRendererBorderPrivate *priv = ERGTK_CELL_RENDERER_BORDER_GET_PRIVATE(object);
00249 
00250     switch (param_id)
00251     {
00252         case PROP_BORDER_WIDTH:
00253             g_value_set_uint (value, priv->border_width);
00254             break;
00255 
00256         case PROP_BORDER_OFFSET:
00257             g_value_set_uint (value, priv->border_offset);
00258             break;
00259 
00260         case PROP_BORDER_COLOR:
00261             g_value_set_string (value, priv->border_color);
00262             break;
00263 
00264         default:
00265             G_OBJECT_WARN_INVALID_PROPERTY_ID(object, param_id, pspec);
00266     }
00267 }

Here is the caller graph for this function:

static void render_impl ( GtkCellRenderer *  cell,
GdkWindow *  window,
GtkWidget *  widget,
GdkRectangle *  bg_area,
GdkRectangle *  cell_area,
GdkRectangle *  expose_area,
guint  flags 
) [static]

Definition at line 311 of file ergtkcellrendererborder.c.

References erGtkCellRendererBorderPrivate::border_offset, ERGTK_CELL_RENDERER_BORDER_GET_PRIVATE, and IS_ERGTK_CELL_RENDERER_BORDER.

Referenced by ergtk_cell_renderer_border_class_init().

00318 {
00319     g_return_if_fail( IS_ERGTK_CELL_RENDERER_BORDER(cell) );
00320 
00321     erGtkCellRendererBorder        *thiz = (erGtkCellRendererBorder *) cell;
00322     erGtkCellRendererBorderPrivate *priv = ERGTK_CELL_RENDERER_BORDER_GET_PRIVATE(thiz);
00323 
00324     gint border = priv->border_offset;
00325     gint x      = 0               + border;
00326     gint y      = bg_area->y      + border;
00327     gint w      = bg_area->x      + bg_area->width - (2 * border) - 1;
00328     gint h      = bg_area->height                  - (2 * border);
00329 
00330     gtk_paint_box( widget->style, 
00331                    window, 
00332                    GTK_STATE_NORMAL,
00333                    GTK_SHADOW_NONE, 
00334                    NULL, widget, "ergtkcellrendererborder", 
00335                    x, y, w, h );
00336 }

Here is the caller graph for this function:

static void set_property_impl ( GObject *  object,
guint  param_id,
const GValue *  value,
GParamSpec *  pspec 
) [static]

Definition at line 271 of file ergtkcellrendererborder.c.

References erGtkCellRendererBorderPrivate::border_color, erGtkCellRendererBorderPrivate::border_offset, erGtkCellRendererBorderPrivate::border_width, ERGTK_CELL_RENDERER_BORDER_GET_PRIVATE, IS_ERGTK_CELL_RENDERER_BORDER, LOGPRINTF, PROP_BORDER_COLOR, PROP_BORDER_OFFSET, and PROP_BORDER_WIDTH.

Referenced by ergtk_cell_renderer_border_class_init().

00275 {
00276     g_return_if_fail( IS_ERGTK_CELL_RENDERER_BORDER(object) );
00277 
00278     erGtkCellRendererBorderPrivate *priv = ERGTK_CELL_RENDERER_BORDER_GET_PRIVATE(object);
00279 
00280     guint        u;
00281     gchar        **cpp;
00282 
00283     switch (param_id)
00284     {
00285         case PROP_BORDER_WIDTH:
00286             u = g_value_get_uint(value);
00287             priv->border_width = u;
00288             LOGPRINTF("border-width set to [%u]", u);
00289             break;
00290 
00291         case PROP_BORDER_OFFSET:
00292             u = g_value_get_uint(value);
00293             priv->border_offset = u;
00294             LOGPRINTF("border-offset set to [%u]", u);
00295             break;
00296 
00297         case PROP_BORDER_COLOR:
00298             cpp = &(priv->border_color);
00299             g_free(*cpp);
00300             *cpp = g_strdup(g_value_get_string(value));
00301             LOGPRINTF("border-color set to [%s]", *cpp);
00302             break;
00303 
00304         default:
00305             G_OBJECT_WARN_INVALID_PROPERTY_ID(object, param_id, pspec);
00306     }
00307 }

Here is the caller graph for this function:


Variable Documentation

GtkCellRendererTextClass* g_parent_class = NULL [static]
const gchar* PROPNAME_BORDER_COLOR = "border-color" [static]

Definition at line 71 of file ergtkcellrendererborder.c.

Referenced by ergtk_cell_renderer_border_class_init().

const gchar* PROPNAME_BORDER_OFFSET = "border-offset" [static]

Definition at line 70 of file ergtkcellrendererborder.c.

Referenced by ergtk_cell_renderer_border_class_init().

const gchar* PROPNAME_BORDER_WIDTH = "border-width" [static]

Definition at line 69 of file ergtkcellrendererborder.c.

Referenced by ergtk_cell_renderer_border_class_init().

Generated by  doxygen 1.6.2-20100208