diff options
author | sahlberg <sahlberg@f5534014-38df-0310-8fa8-9805f1628bb7> | 2002-12-16 06:44:45 +0000 |
---|---|---|
committer | sahlberg <sahlberg@f5534014-38df-0310-8fa8-9805f1628bb7> | 2002-12-16 06:44:45 +0000 |
commit | a342634fb046f7ad80f9ad04c4af4e77c51a672e (patch) | |
tree | 6bf91e0a16684fff2f8b9bfc10deb5159a681a10 /gtk | |
parent | a72aa84b957a6c9f2a198a8066c1dea69e842740 (diff) |
From Ronald Henderson: support for colored graphs in io_stat also for the Gtk1 version.
git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@6786 f5534014-38df-0310-8fa8-9805f1628bb7
Diffstat (limited to 'gtk')
-rw-r--r-- | gtk/io_stat.c | 27 |
1 files changed, 24 insertions, 3 deletions
diff --git a/gtk/io_stat.c b/gtk/io_stat.c index 853d1ca851..1887db51a4 100644 --- a/gtk/io_stat.c +++ b/gtk/io_stat.c @@ -1,7 +1,7 @@ /* io_stat.c * io_stat 2002 Ronnie Sahlberg * - * $Id: io_stat.c,v 1.10 2002/12/05 22:19:24 sahlberg Exp $ + * $Id: io_stat.c,v 1.11 2002/12/16 06:44:45 sahlberg Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> @@ -159,6 +159,11 @@ typedef struct _io_stat_t { int count_type; } io_stat_t; +#if GTK_MAJOR_VERSION < 2 +GtkRcStyle *rc_style; +GdkColormap *colormap; +#endif + static void init_io_stat_window(io_stat_t *io); @@ -936,7 +941,11 @@ configure_event(GtkWidget *widget, GdkEventConfigure *event _U_) for(i=0;i<MAX_GRAPHS;i++){ io->graphs[i].gc=gdk_gc_new(io->pixmap); #if GTK_MAJOR_VERSION < 2 - /* XXX dont have a clue how to do this in gtk1 */ + colormap = gtk_widget_get_colormap (widget); + if (!gdk_color_alloc (colormap, &io->graphs[i].color)){ + g_warning ("Couldn't allocate color"); + } + gdk_gc_set_foreground(io->graphs[i].gc, &io->graphs[i].color); #else gdk_gc_set_rgb_fg_color(io->graphs[i].gc, &io->graphs[i].color); @@ -1474,7 +1483,19 @@ create_filter_box(io_stat_graph_t *gio, GtkWidget *box) gtk_widget_show(gio->color_button); #if GTK_MAJOR_VERSION < 2 - /* XXX dont have a clue how to do this in gtk1 */ + rc_style = gtk_rc_style_new (); + rc_style->bg[GTK_STATE_NORMAL] = gio->color; + rc_style->color_flags[GTK_STATE_NORMAL] |= GTK_RC_BG; + rc_style->bg[GTK_STATE_ACTIVE] = gio->color; + rc_style->color_flags[GTK_STATE_ACTIVE] |= GTK_RC_BG; + rc_style->bg[GTK_STATE_PRELIGHT] = gio->color; + rc_style->color_flags[GTK_STATE_PRELIGHT] |= GTK_RC_BG; + rc_style->bg[GTK_STATE_SELECTED] = gio->color; + rc_style->color_flags[GTK_STATE_SELECTED] |= GTK_RC_BG; + rc_style->bg[GTK_STATE_INSENSITIVE] = gio->color; + rc_style->color_flags[GTK_STATE_INSENSITIVE] |= GTK_RC_BG; + gtk_widget_modify_style (gio->color_button, rc_style); + gtk_rc_style_unref (rc_style); #else gtk_widget_modify_bg(gio->color_button, GTK_STATE_NORMAL, &gio->color); gtk_widget_modify_bg(gio->color_button, GTK_STATE_ACTIVE, &gio->color); |