Added GtkCellRendererState flags to GtkCellArea->event/render() methods

This commit is contained in:
Tristan Van Berkom 2010-11-01 12:39:00 +09:00
parent 9c4eb3d431
commit 54004237be
3 changed files with 115 additions and 103 deletions

View File

@ -628,11 +628,12 @@ gtk_cell_area_forall (GtkCellArea *area,
}
gint
gtk_cell_area_event (GtkCellArea *area,
GtkCellAreaIter *iter,
GtkWidget *widget,
GdkEvent *event,
const GdkRectangle *cell_area)
gtk_cell_area_event (GtkCellArea *area,
GtkCellAreaIter *iter,
GtkWidget *widget,
GdkEvent *event,
const GdkRectangle *cell_area,
GtkCellRendererState flags)
{
GtkCellAreaClass *class;
@ -645,7 +646,7 @@ gtk_cell_area_event (GtkCellArea *area,
class = GTK_CELL_AREA_GET_CLASS (area);
if (class->event)
return class->event (area, iter, widget, event, cell_area);
return class->event (area, iter, widget, event, cell_area, flags);
g_warning ("GtkCellAreaClass::event not implemented for `%s'",
g_type_name (G_TYPE_FROM_INSTANCE (area)));
@ -653,11 +654,12 @@ gtk_cell_area_event (GtkCellArea *area,
}
void
gtk_cell_area_render (GtkCellArea *area,
GtkCellAreaIter *iter,
GtkWidget *widget,
cairo_t *cr,
const GdkRectangle *cell_area)
gtk_cell_area_render (GtkCellArea *area,
GtkCellAreaIter *iter,
GtkWidget *widget,
cairo_t *cr,
const GdkRectangle *cell_area,
GtkCellRendererState flags)
{
GtkCellAreaClass *class;
@ -670,7 +672,7 @@ gtk_cell_area_render (GtkCellArea *area,
class = GTK_CELL_AREA_GET_CLASS (area);
if (class->render)
class->render (area, iter, widget, cr, cell_area);
class->render (area, iter, widget, cr, cell_area, flags);
else
g_warning ("GtkCellAreaClass::render not implemented for `%s'",
g_type_name (G_TYPE_FROM_INSTANCE (area)));

View File

@ -83,12 +83,14 @@ struct _GtkCellAreaClass
GtkCellAreaIter *iter,
GtkWidget *widget,
GdkEvent *event,
const GdkRectangle *cell_area);
const GdkRectangle *cell_area,
GtkCellRendererState flags);
void (* render) (GtkCellArea *area,
GtkCellAreaIter *iter,
GtkWidget *widget,
cairo_t *cr,
const GdkRectangle *cell_area);
const GdkRectangle *cell_area,
GtkCellRendererState flags);
/* Geometry */
GtkCellAreaIter *(* create_iter) (GtkCellArea *area);
@ -142,23 +144,25 @@ struct _GtkCellAreaClass
GType gtk_cell_area_get_type (void) G_GNUC_CONST;
/* Basic methods */
void gtk_cell_area_add (GtkCellArea *area,
GtkCellRenderer *renderer);
void gtk_cell_area_remove (GtkCellArea *area,
GtkCellRenderer *renderer);
void gtk_cell_area_forall (GtkCellArea *area,
GtkCellCallback callback,
gpointer callback_data);
gint gtk_cell_area_event (GtkCellArea *area,
GtkCellAreaIter *iter,
GtkWidget *widget,
GdkEvent *event,
const GdkRectangle *cell_area);
void gtk_cell_area_render (GtkCellArea *area,
GtkCellAreaIter *iter,
GtkWidget *widget,
cairo_t *cr,
const GdkRectangle *cell_area);
void gtk_cell_area_add (GtkCellArea *area,
GtkCellRenderer *renderer);
void gtk_cell_area_remove (GtkCellArea *area,
GtkCellRenderer *renderer);
void gtk_cell_area_forall (GtkCellArea *area,
GtkCellCallback callback,
gpointer callback_data);
gint gtk_cell_area_event (GtkCellArea *area,
GtkCellAreaIter *iter,
GtkWidget *widget,
GdkEvent *event,
const GdkRectangle *cell_area,
GtkCellRendererState flags);
void gtk_cell_area_render (GtkCellArea *area,
GtkCellAreaIter *iter,
GtkWidget *widget,
cairo_t *cr,
const GdkRectangle *cell_area,
GtkCellRendererState flags);
/* Geometry */
GtkCellAreaIter *gtk_cell_area_create_iter (GtkCellArea *area);

View File

@ -31,71 +31,73 @@
/* GObjectClass */
static void gtk_cell_area_box_finalize (GObject *object);
static void gtk_cell_area_box_dispose (GObject *object);
static void gtk_cell_area_box_set_property (GObject *object,
guint prop_id,
const GValue *value,
GParamSpec *pspec);
static void gtk_cell_area_box_get_property (GObject *object,
guint prop_id,
GValue *value,
GParamSpec *pspec);
static void gtk_cell_area_box_finalize (GObject *object);
static void gtk_cell_area_box_dispose (GObject *object);
static void gtk_cell_area_box_set_property (GObject *object,
guint prop_id,
const GValue *value,
GParamSpec *pspec);
static void gtk_cell_area_box_get_property (GObject *object,
guint prop_id,
GValue *value,
GParamSpec *pspec);
/* GtkCellAreaClass */
static void gtk_cell_area_box_add (GtkCellArea *area,
GtkCellRenderer *renderer);
static void gtk_cell_area_box_remove (GtkCellArea *area,
GtkCellRenderer *renderer);
static void gtk_cell_area_box_forall (GtkCellArea *area,
GtkCellCallback callback,
gpointer callback_data);
static gint gtk_cell_area_box_event (GtkCellArea *area,
GtkCellAreaIter *iter,
GtkWidget *widget,
GdkEvent *event,
const GdkRectangle *cell_area);
static void gtk_cell_area_box_render (GtkCellArea *area,
GtkCellAreaIter *iter,
GtkWidget *widget,
cairo_t *cr,
const GdkRectangle *cell_area);
static void gtk_cell_area_box_add (GtkCellArea *area,
GtkCellRenderer *renderer);
static void gtk_cell_area_box_remove (GtkCellArea *area,
GtkCellRenderer *renderer);
static void gtk_cell_area_box_forall (GtkCellArea *area,
GtkCellCallback callback,
gpointer callback_data);
static gint gtk_cell_area_box_event (GtkCellArea *area,
GtkCellAreaIter *iter,
GtkWidget *widget,
GdkEvent *event,
const GdkRectangle *cell_area,
GtkCellRendererState flags);
static void gtk_cell_area_box_render (GtkCellArea *area,
GtkCellAreaIter *iter,
GtkWidget *widget,
cairo_t *cr,
const GdkRectangle *cell_area,
GtkCellRendererState flags);
static void gtk_cell_area_box_set_cell_property (GtkCellArea *area,
GtkCellRenderer *renderer,
guint prop_id,
const GValue *value,
GParamSpec *pspec);
static void gtk_cell_area_box_get_cell_property (GtkCellArea *area,
GtkCellRenderer *renderer,
guint prop_id,
GValue *value,
GParamSpec *pspec);
static void gtk_cell_area_box_set_cell_property (GtkCellArea *area,
GtkCellRenderer *renderer,
guint prop_id,
const GValue *value,
GParamSpec *pspec);
static void gtk_cell_area_box_get_cell_property (GtkCellArea *area,
GtkCellRenderer *renderer,
guint prop_id,
GValue *value,
GParamSpec *pspec);
static GtkCellAreaIter *gtk_cell_area_box_create_iter (GtkCellArea *area);
static GtkSizeRequestMode gtk_cell_area_box_get_request_mode (GtkCellArea *area);
static void gtk_cell_area_box_get_preferred_width (GtkCellArea *area,
GtkCellAreaIter *iter,
GtkWidget *widget,
gint *minimum_width,
gint *natural_width);
static void gtk_cell_area_box_get_preferred_height (GtkCellArea *area,
GtkCellAreaIter *iter,
GtkWidget *widget,
gint *minimum_height,
gint *natural_height);
static void gtk_cell_area_box_get_preferred_height_for_width (GtkCellArea *area,
GtkCellAreaIter *iter,
GtkWidget *widget,
gint width,
gint *minimum_height,
gint *natural_height);
static void gtk_cell_area_box_get_preferred_width_for_height (GtkCellArea *area,
GtkCellAreaIter *iter,
GtkWidget *widget,
gint height,
gint *minimum_width,
gint *natural_width);
static GtkCellAreaIter *gtk_cell_area_box_create_iter (GtkCellArea *area);
static GtkSizeRequestMode gtk_cell_area_box_get_request_mode (GtkCellArea *area);
static void gtk_cell_area_box_get_preferred_width (GtkCellArea *area,
GtkCellAreaIter *iter,
GtkWidget *widget,
gint *minimum_width,
gint *natural_width);
static void gtk_cell_area_box_get_preferred_height (GtkCellArea *area,
GtkCellAreaIter *iter,
GtkWidget *widget,
gint *minimum_height,
gint *natural_height);
static void gtk_cell_area_box_get_preferred_height_for_width (GtkCellArea *area,
GtkCellAreaIter *iter,
GtkWidget *widget,
gint width,
gint *minimum_height,
gint *natural_height);
static void gtk_cell_area_box_get_preferred_width_for_height (GtkCellArea *area,
GtkCellAreaIter *iter,
GtkWidget *widget,
gint height,
gint *minimum_width,
gint *natural_width);
/* GtkCellLayoutIface */
static void gtk_cell_area_box_cell_layout_init (GtkCellLayoutIface *iface);
@ -751,11 +753,12 @@ gtk_cell_area_box_forall (GtkCellArea *area,
}
static gint
gtk_cell_area_box_event (GtkCellArea *area,
GtkCellAreaIter *iter,
GtkWidget *widget,
GdkEvent *event,
const GdkRectangle *cell_area)
gtk_cell_area_box_event (GtkCellArea *area,
GtkCellAreaIter *iter,
GtkWidget *widget,
GdkEvent *event,
const GdkRectangle *cell_area,
GtkCellRendererState flags)
{
@ -763,11 +766,12 @@ gtk_cell_area_box_event (GtkCellArea *area,
}
static void
gtk_cell_area_box_render (GtkCellArea *area,
GtkCellAreaIter *iter,
GtkWidget *widget,
cairo_t *cr,
const GdkRectangle *cell_area)
gtk_cell_area_box_render (GtkCellArea *area,
GtkCellAreaIter *iter,
GtkWidget *widget,
cairo_t *cr,
const GdkRectangle *cell_area,
GtkCellRendererState flags)
{
GtkCellAreaBox *box = GTK_CELL_AREA_BOX (area);
GtkCellAreaBoxPrivate *priv = box->priv;
@ -800,9 +804,11 @@ gtk_cell_area_box_render (GtkCellArea *area,
*/
gtk_cell_area_inner_cell_area (area, &background_area, &inner_area);
/* XXX We have to do some per-cell considerations for the 'flags'
* for focus handling */
gtk_cell_renderer_render (cell->renderer, cr, widget,
&background_area, &inner_area,
/* flags */0);
flags);
}