aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLarry Ewing <lewing@helixcode.com>2000-08-17 02:46:39 +0800
committerLarry Ewing <lewing@src.gnome.org>2000-08-17 02:46:39 +0800
commit224c97090305d7fbe20d76d50001118a4ade959b (patch)
tree6ee7ea84086cac4cb5619f52028ace0b9de98a66
parent3fe16616273837ac06323c703e4b0c7152e1abaa (diff)
downloadgsoc2013-evolution-224c97090305d7fbe20d76d50001118a4ade959b.tar
gsoc2013-evolution-224c97090305d7fbe20d76d50001118a4ade959b.tar.gz
gsoc2013-evolution-224c97090305d7fbe20d76d50001118a4ade959b.tar.bz2
gsoc2013-evolution-224c97090305d7fbe20d76d50001118a4ade959b.tar.lz
gsoc2013-evolution-224c97090305d7fbe20d76d50001118a4ade959b.tar.xz
gsoc2013-evolution-224c97090305d7fbe20d76d50001118a4ade959b.tar.zst
gsoc2013-evolution-224c97090305d7fbe20d76d50001118a4ade959b.zip
get rid of COLOR_TEXT. (struct _EIconBarItem): add pixbuf member to hold
2000-08-16 Larry Ewing <lewing@helixcode.com> * e-icon-bar.h (enum): get rid of COLOR_TEXT. (struct _EIconBarItem): add pixbuf member to hold unmodified pixbuf. * e-icon-bar.c (e_icon_bar_style_set): update the image and the colors based on the new style. (e_icon_bar_add_item): store the full alpha pixbuf so that we can update the background color if the style changes. Use the style colors where appropriate. (e_icon_bar_on_editing_stopped): revert to style colors. (e_icon_bar_on_editing_started): use style fg instead of COLOR_TEXT. * e-shortcut-bar.c (e_shortcut_bar_add_group): add an #ifndef E_USE_STYLES around the call to e_shortcut_bar_set_canvas_style to allow people to test out the style stuff that is in progress. svn path=/trunk/; revision=4856
-rw-r--r--widgets/shortcut-bar/ChangeLog19
-rw-r--r--widgets/shortcut-bar/e-icon-bar.c54
-rw-r--r--widgets/shortcut-bar/e-icon-bar.h5
-rw-r--r--widgets/shortcut-bar/e-shortcut-bar.c2
4 files changed, 75 insertions, 5 deletions
diff --git a/widgets/shortcut-bar/ChangeLog b/widgets/shortcut-bar/ChangeLog
index 5019955680..69edec4a37 100644
--- a/widgets/shortcut-bar/ChangeLog
+++ b/widgets/shortcut-bar/ChangeLog
@@ -1,3 +1,22 @@
+2000-08-16 Larry Ewing <lewing@helixcode.com>
+
+ * e-icon-bar.h (enum): get rid of COLOR_TEXT.
+ (struct _EIconBarItem): add pixbuf member to hold unmodified
+ pixbuf.
+
+ * e-icon-bar.c (e_icon_bar_style_set): update the image and the
+ colors based on the new style.
+ (e_icon_bar_add_item): store the full alpha pixbuf so that we can
+ update the background color if the style changes. Use the style
+ colors where appropriate.
+ (e_icon_bar_on_editing_stopped): revert to style colors.
+ (e_icon_bar_on_editing_started): use style fg instead of
+ COLOR_TEXT.
+
+ * e-shortcut-bar.c (e_shortcut_bar_add_group): add an #ifndef
+ E_USE_STYLES around the call to e_shortcut_bar_set_canvas_style to
+ allow people to test out the style stuff that is in progress.
+
2000-07-16 Damon Chaplin <damon@helixcode.com>
* e-shortcut-model.[hc]: new files implementing a simple model for
diff --git a/widgets/shortcut-bar/e-icon-bar.c b/widgets/shortcut-bar/e-icon-bar.c
index 832506201d..11cf2c14b6 100644
--- a/widgets/shortcut-bar/e-icon-bar.c
+++ b/widgets/shortcut-bar/e-icon-bar.c
@@ -127,6 +127,7 @@ static void e_icon_bar_ensure_edited_item_visible (EIconBar *icon_bar);
static void e_icon_bar_update_highlight (EIconBar *icon_bar);
static void e_icon_bar_vadjustment_value_changed (GtkAdjustment *adjustment,
EIconBar *icon_bar);
+static void e_icon_bar_style_set (GtkWidget *widget, GtkStyle *previous_style);
enum
{
@@ -208,6 +209,7 @@ e_icon_bar_class_init (EIconBarClass *class)
widget_class->focus_out_event = e_icon_bar_focus_out;
widget_class->drag_motion = e_icon_bar_drag_motion;
widget_class->drag_leave = e_icon_bar_drag_leave;
+ widget_class->style_set = e_icon_bar_style_set;
ecanvas_class->reflow = e_icon_bar_reflow;
@@ -248,8 +250,8 @@ e_icon_bar_init (EIconBar *icon_bar)
colormap = gtk_widget_get_colormap (GTK_WIDGET (icon_bar));
icon_bar->colors[E_ICON_BAR_COLOR_TEXT].red = 65535;
- icon_bar->colors[E_ICON_BAR_COLOR_TEXT].green = 65535;
- icon_bar->colors[E_ICON_BAR_COLOR_TEXT].blue = 65535;
+ icon_bar->colors[E_ICON_BAR_COLOR_TEXT].green = 0;
+ icon_bar->colors[E_ICON_BAR_COLOR_TEXT].blue = 0;
icon_bar->colors[E_ICON_BAR_COLOR_EDITING_TEXT].red = 0;
icon_bar->colors[E_ICON_BAR_COLOR_EDITING_TEXT].green = 0;
@@ -569,6 +571,46 @@ rgb_from_gdk_color (GdkColor *color)
return a;
}
+static void
+e_icon_bar_style_set (GtkWidget *widget, GtkStyle *previous_style) {
+ EIconBar *icon_bar;
+ EIconBarItem *item;
+ gint item_num;
+ GdkPixbuf *flattened;
+ GtkStyle *style = widget->style;
+ GdkColormap *colormap;
+
+ colormap = gtk_widget_get_colormap (widget);
+ gdk_color_alloc (colormap, &style->fg [GTK_STATE_NORMAL]);
+
+ icon_bar = E_ICON_BAR (widget);
+
+ for (item_num = 0; item_num < icon_bar->items->len; item_num++) {
+
+ item = &g_array_index (icon_bar->items,
+ EIconBarItem, item_num);
+
+ flattened = flatten_alpha (item->pixbuf,
+ rgb_from_gdk_color (&style->bg [GTK_STATE_NORMAL]));
+
+ gnome_canvas_item_set(item->image,
+ "GnomeCanvasPixbuf::pixbuf", flattened ? flattened : item->pixbuf,
+ NULL);
+ gnome_canvas_item_set (item->text,
+ "font_gdk", style->font,
+ "fill_color_gdk", &style->fg [GTK_STATE_NORMAL],
+ NULL);
+
+ if (flattened)
+ /* the canvas item holds the reference now */
+ gdk_pixbuf_unref (flattened);
+
+ }
+
+ e_icon_bar_recalc_item_positions (icon_bar);
+}
+
+
/**
* e_icon_bar_add_item:
* @icon_bar: An #EIconBar.
@@ -617,7 +659,7 @@ e_icon_bar_add_item (EIconBar *icon_bar,
item.text = gnome_canvas_item_new (GNOME_CANVAS_GROUP (GNOME_CANVAS (icon_bar)->root),
e_text_get_type (),
"font_gdk", font,
- "fill_color_gdk", &icon_bar->colors[E_ICON_BAR_COLOR_TEXT],
+ "fill_color_gdk", &style->fg [GTK_STATE_NORMAL],
"use_ellipsis", TRUE,
"anchor", anchor,
"editable", TRUE,
@@ -636,6 +678,9 @@ e_icon_bar_add_item (EIconBar *icon_bar,
GTK_SIGNAL_FUNC (e_icon_bar_on_item_event),
icon_bar);
+ item.pixbuf = image;
+ gdk_pixbuf_ref (image);
+
flattened = flatten_alpha (image,
rgb_from_gdk_color (&style->bg [GTK_STATE_NORMAL]));
@@ -735,6 +780,7 @@ e_icon_bar_remove_item (EIconBar *icon_bar,
gtk_object_destroy (GTK_OBJECT (item->text));
gtk_object_destroy (GTK_OBJECT (item->image));
+ gdk_pixbuf_unref (item->pixbuf);
g_array_remove_index (icon_bar->items, item_num);
@@ -1401,7 +1447,7 @@ e_icon_bar_on_editing_stopped (EIconBar *icon_bar,
/* Reset the fg & bg colors. */
gnome_canvas_item_set (item,
- "fill_color_gdk", &icon_bar->colors[E_ICON_BAR_COLOR_TEXT],
+ "fill_color_gdk", &(GTK_WIDGET(icon_bar)->style->fg [GTK_STATE_NORMAL]),
NULL);
if (icon_bar->edit_rect_item) {
diff --git a/widgets/shortcut-bar/e-icon-bar.h b/widgets/shortcut-bar/e-icon-bar.h
index 72d64ad890..90d9f5a2cf 100644
--- a/widgets/shortcut-bar/e-icon-bar.h
+++ b/widgets/shortcut-bar/e-icon-bar.h
@@ -45,6 +45,10 @@ struct _EIconBarItem
GnomeCanvasItem *text;
GnomeCanvasItem *image;
+ /* This holds the original pixbuf so that we can blend
+ to the background if the style changes */
+ GdkPixbuf *pixbuf;
+
/* This is user data attached to the item, e.g. a URL. */
gpointer data;
GtkDestroyNotify destroy;
@@ -73,7 +77,6 @@ typedef enum
/* These index our colors array. */
typedef enum
{
- E_ICON_BAR_COLOR_TEXT,
E_ICON_BAR_COLOR_EDITING_TEXT,
E_ICON_BAR_COLOR_EDITING_RECT,
E_ICON_BAR_COLOR_EDITING_RECT_OUTLINE,
diff --git a/widgets/shortcut-bar/e-shortcut-bar.c b/widgets/shortcut-bar/e-shortcut-bar.c
index 20e0336fcb..a7d7f76aba 100644
--- a/widgets/shortcut-bar/e-shortcut-bar.c
+++ b/widgets/shortcut-bar/e-shortcut-bar.c
@@ -387,7 +387,9 @@ e_shortcut_bar_add_group (EShortcutBar *shortcut_bar,
GTK_SIGNAL_FUNC (e_shortcut_bar_on_drag_end),
shortcut_bar);
+#ifndef E_USE_STYLES
e_shortcut_bar_set_canvas_style (shortcut_bar, group->icon_bar);
+#endif
button = gtk_button_new ();
label = e_clipped_label_new (group_name);