aboutsummaryrefslogtreecommitdiffstats
path: root/widgets
diff options
context:
space:
mode:
authorChristopher James Lahey <clahey@ximian.com>2002-03-16 07:16:01 +0800
committerChris Lahey <clahey@src.gnome.org>2002-03-16 07:16:01 +0800
commit88a322f15d8ce9c152cce75630b302b8b3ca1c08 (patch)
tree6aaa3c7ba15024c4f3e1fe1d47aea1c3f6746484 /widgets
parentf8f95421a6e00884da54c9da66d6c0b0edc00e29 (diff)
downloadgsoc2013-evolution-88a322f15d8ce9c152cce75630b302b8b3ca1c08.tar.gz
gsoc2013-evolution-88a322f15d8ce9c152cce75630b302b8b3ca1c08.tar.zst
gsoc2013-evolution-88a322f15d8ce9c152cce75630b302b8b3ca1c08.zip
Check for a style_set signal on all the contained GnomeCanvasItems.
2002-03-15 Christopher James Lahey <clahey@ximian.com> * gal/widgets/e-canvas.c (e_canvas_style_set): Check for a style_set signal on all the contained GnomeCanvasItems. From gal/e-table/ChangeLog: 2002-03-15 Christopher James Lahey <clahey@ximian.com> * e-cell-toggle.c: Clear the pixmap cache in e_cell_style_set. * e-cell.c, e-cell.h (e_cell_style_set): Added this virtual method. * e-table-item.c, e-table-item.h: Call e_cell_style_set in out style_set signal. svn path=/trunk/; revision=16180
Diffstat (limited to 'widgets')
-rw-r--r--widgets/misc/e-canvas.c30
-rw-r--r--widgets/table/e-cell-toggle.c16
-rw-r--r--widgets/table/e-cell.c7
-rw-r--r--widgets/table/e-cell.h5
-rw-r--r--widgets/table/e-table-item.c23
-rw-r--r--widgets/table/e-table-item.h1
6 files changed, 82 insertions, 0 deletions
diff --git a/widgets/misc/e-canvas.c b/widgets/misc/e-canvas.c
index 0b9c00261a..7afdd21073 100644
--- a/widgets/misc/e-canvas.c
+++ b/widgets/misc/e-canvas.c
@@ -44,6 +44,9 @@ static gint e_canvas_focus_in (GtkWidget *widget,
static gint e_canvas_focus_out (GtkWidget *widget,
GdkEventFocus *event);
+static void e_canvas_style_set (GtkWidget *widget,
+ GtkStyle *previous_style);
+
static int emit_event (GnomeCanvas *canvas, GdkEvent *event);
static GnomeCanvasClass *parent_class = NULL;
@@ -101,6 +104,7 @@ e_canvas_class_init (ECanvasClass *klass)
widget_class->button_release_event = e_canvas_button;
widget_class->focus_in_event = e_canvas_focus_in;
widget_class->focus_out_event = e_canvas_focus_out;
+ widget_class->style_set = e_canvas_style_set;
widget_class->realize = e_canvas_realize;
widget_class->unrealize = e_canvas_unrealize;
@@ -667,6 +671,32 @@ e_canvas_focus_out (GtkWidget *widget, GdkEventFocus *event)
}
static void
+ec_style_set_recursive (GnomeCanvasItem *item, GtkStyle *previous_style)
+{
+ guint signal_id = gtk_signal_lookup ("style_set", GTK_OBJECT_TYPE (item));
+ if (signal_id >= 1) {
+ GtkSignalQuery *query = gtk_signal_query (signal_id);
+ if (query->return_val == GTK_TYPE_NONE && query->nparams == 1 && query->params[0] == GTK_TYPE_STYLE) {
+ gtk_signal_emit (GTK_OBJECT (item), signal_id, previous_style);
+ }
+ g_free (query);
+ }
+
+ if (GNOME_IS_CANVAS_GROUP (item) ) {
+ GList *items = GNOME_CANVAS_GROUP (item)->item_list;
+ for (; items; items = items->next)
+ ec_style_set_recursive (items->data, previous_style);
+ }
+}
+
+static void
+e_canvas_style_set (GtkWidget *widget, GtkStyle *previous_style)
+{
+ ec_style_set_recursive (GNOME_CANVAS_ITEM (gnome_canvas_root (GNOME_CANVAS (widget))), previous_style);
+}
+
+
+static void
e_canvas_realize (GtkWidget *widget)
{
gint width, height;
diff --git a/widgets/table/e-cell-toggle.c b/widgets/table/e-cell-toggle.c
index a42d7dbd1a..0961b077ba 100644
--- a/widgets/table/e-cell-toggle.c
+++ b/widgets/table/e-cell-toggle.c
@@ -322,6 +322,21 @@ etog_max_width (ECellView *ecell_view, int model_col, int view_col)
}
static void
+etog_style_set (ECellView *ecell_view, GtkStyle *previous_style)
+{
+ ECellToggle *toggle = E_CELL_TOGGLE (ecell_view->ecell);
+ ECellToggleView *toggle_view = (ECellToggleView *) ecell_view;
+ int i;
+
+ for (i = 0; i < toggle->n_states * CACHE_SEQ_COUNT; i++) {
+ if (toggle_view->pixmap_cache[i]) {
+ gdk_pixmap_unref (toggle_view->pixmap_cache[i]);
+ toggle_view->pixmap_cache[i] = NULL;
+ }
+ }
+}
+
+static void
etog_destroy (GtkObject *object)
{
ECellToggle *etog = E_CELL_TOGGLE (object);
@@ -353,6 +368,7 @@ e_cell_toggle_class_init (GtkObjectClass *object_class)
ecc->event = etog_event;
ecc->height = etog_height;
ecc->max_width = etog_max_width;
+ ecc->style_set = etog_style_set;
parent_class = gtk_type_class (PARENT_TYPE);
}
diff --git a/widgets/table/e-cell.c b/widgets/table/e-cell.c
index 729207b32f..b440370fb3 100644
--- a/widgets/table/e-cell.c
+++ b/widgets/table/e-cell.c
@@ -489,4 +489,11 @@ e_cell_get_bg_color(ECellView *ecell_view, int row)
else
return NULL;
}
+
+void
+e_cell_style_set(ECellView *ecell_view, GtkStyle *previous_style)
+{
+ if (ECVIEW_EC_CLASS(ecell_view)->style_set)
+ ECVIEW_EC_CLASS(ecell_view)->style_set (ecell_view, previous_style);
+}
diff --git a/widgets/table/e-cell.h b/widgets/table/e-cell.h
index d0f0f196a3..bc04f32f58 100644
--- a/widgets/table/e-cell.h
+++ b/widgets/table/e-cell.h
@@ -113,6 +113,8 @@ typedef struct {
int (*max_width_by_row) (ECellView *ecell_view, int model_col, int view_col, int row);
void (*show_tooltip) (ECellView *ecell_view, int model_col, int view_col, int row, int col_width, ETableTooltip *tooltip);
gchar *(*get_bg_color) (ECellView *ecell_view, int row);
+
+ void (*style_set) (ECellView *ecell_view, GtkStyle *previous_style);
} ECellClass;
GtkType e_cell_get_type (void);
@@ -172,6 +174,9 @@ void e_cell_show_tooltip (ECellView *ecell_view,
ETableTooltip *tooltip);
gchar *e_cell_get_bg_color (ECellView *ecell_view,
int row);
+void e_cell_style_set (ECellView *ecell_view,
+ GtkStyle *previous_style);
+
void e_cell_focus (ECellView *ecell_view,
int model_col,
int view_col,
diff --git a/widgets/table/e-table-item.c b/widgets/table/e-table-item.c
index 3ecc547a04..754234868e 100644
--- a/widgets/table/e-table-item.c
+++ b/widgets/table/e-table-item.c
@@ -69,6 +69,7 @@ enum {
CLICK,
KEY_PRESS,
START_DRAG,
+ STYLE_SET,
LAST_SIGNAL
};
@@ -2756,6 +2757,19 @@ eti_event (GnomeCanvasItem *item, GdkEvent *e)
}
static void
+eti_style_set (ETableItem *eti, GtkStyle *previous_style)
+{
+ if (eti->cell_views_realized) {
+ int i;
+ int n_cells = eti->n_cells;
+
+ for (i = 0; i < n_cells; i++) {
+ e_cell_style_set (eti->cell_views[i], previous_style);
+ }
+ }
+}
+
+static void
eti_class_init (GtkObjectClass *object_class)
{
GnomeCanvasItemClass *item_class = (GnomeCanvasItemClass *) object_class;
@@ -2781,6 +2795,7 @@ eti_class_init (GtkObjectClass *object_class)
eti_class->click = NULL;
eti_class->key_press = NULL;
eti_class->start_drag = NULL;
+ eti_class->style_set = eti_style_set;
gtk_object_add_arg_type ("ETableItem::ETableHeader", E_TABLE_HEADER_TYPE,
GTK_ARG_WRITABLE, ARG_TABLE_HEADER);
@@ -2868,6 +2883,14 @@ eti_class_init (GtkObjectClass *object_class)
e_marshal_INT__INT_INT_POINTER,
GTK_TYPE_INT, 3, GTK_TYPE_INT, GTK_TYPE_INT, GTK_TYPE_GDK_EVENT);
+ eti_signals [STYLE_SET] =
+ gtk_signal_new ("style_set",
+ GTK_RUN_LAST,
+ E_OBJECT_CLASS_TYPE (object_class),
+ GTK_SIGNAL_OFFSET (ETableItemClass, style_set),
+ gtk_marshal_NONE__POINTER,
+ GTK_TYPE_NONE, 1, GTK_TYPE_STYLE);
+
E_OBJECT_CLASS_ADD_SIGNALS (object_class, eti_signals, LAST_SIGNAL);
}
diff --git a/widgets/table/e-table-item.h b/widgets/table/e-table-item.h
index 272753effe..793379b837 100644
--- a/widgets/table/e-table-item.h
+++ b/widgets/table/e-table-item.h
@@ -177,6 +177,7 @@ typedef struct {
gint (*click) (ETableItem *eti, int row, int col, GdkEvent *event);
gint (*key_press) (ETableItem *eti, int row, int col, GdkEvent *event);
gint (*start_drag) (ETableItem *eti, int row, int col, GdkEvent *event);
+ void (*style_set) (ETableItem *eti, GtkStyle *previous_style);
} ETableItemClass;
GtkType e_table_item_get_type (void);