diff options
author | Kristian Rietveld <kris@gtk.org> | 2002-10-22 23:05:29 +0000 |
---|---|---|
committer | Kristian Rietveld <kristian@src.gnome.org> | 2002-10-22 23:05:29 +0000 |
commit | ecb42dc78969437f18569dfcdc70ddec61ac9121 (patch) | |
tree | 4536b725e30bfddebbff2338d1195f5b55b7cd90 /gtk/gtkstyle.c | |
parent | fbccc0848ded858cf6681050cc8c880fe9c91c00 (diff) | |
download | gdk-pixbuf-ecb42dc78969437f18569dfcdc70ddec61ac9121.tar.gz |
Another feature to create truly ugly TreeViews!: style properties for the
Wed Oct 23 01:03:43 2002 Kristian Rietveld <kris@gtk.org>
Another feature to create truly ugly TreeViews!: style properties
for the even/odd colors used for row hinting. (#71595, reported
by Owen Taylor).
* gtk/gtktreeview.c (gtk_tree_view_class_init): add even_row_color
and odd_row_color style properties.
* gtk/gtkstyle.c (get_darkened_gc): support darken_count == 0 case,
(gtk_default_draw_flat_box): rework cell coloring code to support
user-provided even/odd row colors.
Wed Oct 23 01:01:52 2002 Kristian Rietveld <kris@gtk.org>
Cache signal IDs to speed up signal emission. This is a good speedup
because GtkTreeModel emits a big number of signals.
* gtk/gtktreemodel.c (gtk_tree_model_base_init): save IDs returned
by g_signal_new,
(gtk_tree_model_row_changed): use g_signal_emit instead of
g_signal_emit_by_name,
(gtk_tree_model_row_inserted): ditto,
(gtk_tree_model_row_has_child_toggled): ditto,
(gtk_tree_model_row_deleted): ditto,
(gtk_tree_model_rows_reordered): ditto.
Wed Oct 23 00:56:15 2002 Kristian Rietveld <kris@gtk.org>
* gtk/gtktreeselection.c (model_changed): new function,
(gtk_tree_selection_selected_foreach): monitor changes in the model,
bail out if the model has been changed from the foreach func.
(#50263, reported by Havoc Pennington).
* gtk/gtktreeselection.c (_gtk_tree_selection_internal_select_node):
free anchor if applicable (#94868, reported and testcase provided by
Daniel Elstner).
Diffstat (limited to 'gtk/gtkstyle.c')
-rw-r--r-- | gtk/gtkstyle.c | 108 |
1 files changed, 98 insertions, 10 deletions
diff --git a/gtk/gtkstyle.c b/gtk/gtkstyle.c index 397532d68..692482ae9 100644 --- a/gtk/gtkstyle.c +++ b/gtk/gtkstyle.c @@ -3340,7 +3340,7 @@ get_darkened_gc (GdkWindow *window, gint darken_count) { GdkColor src = *color; - GdkColor shaded; + GdkColor shaded = *color; GdkGC *gc; gc = gdk_gc_new (window); @@ -3410,27 +3410,115 @@ gtk_default_draw_flat_box (GtkStyle *style, * for that row. */ - /* FIXME when we have style properties, clean this up. - */ - else if (!strcmp ("cell_even", detail) || !strcmp ("cell_odd", detail) || !strcmp ("cell_even_ruled", detail)) { - gc1 = style->base_gc[state_type]; + GdkColor *color = NULL; + + gtk_widget_style_get (widget, + "even_row_color", &color, + NULL); + + if (color) + { + freeme = get_darkened_gc (window, color, 0); + gc1 = freeme; + + gdk_color_free (color); + } + else + gc1 = style->base_gc[state_type]; } + else if (!strcmp ("cell_odd_ruled", detail)) + { + GdkColor *color; + + gtk_widget_style_get (widget, + "odd_row_color", &color, + NULL); + + if (color) + { + freeme = get_darkened_gc (window, color, 0); + gc1 = freeme; + + gdk_color_free (color); + } + else + { + gtk_widget_style_get (widget, + "even_row_color", &color, + NULL); + + if (color) + { + freeme = get_darkened_gc (window, color, 1); + gdk_color_free (color); + } + else + freeme = get_darkened_gc (window, &style->base[state_type], 1); + gc1 = freeme; + } + } else if (!strcmp ("cell_even_sorted", detail) || !strcmp ("cell_odd_sorted", detail) || - !strcmp ("cell_odd_ruled", detail) || !strcmp ("cell_even_ruled_sorted", detail)) { - freeme = get_darkened_gc (window, &style->base[state_type], 1); - gc1 = freeme; + GdkColor *color = NULL; + + if (!strcmp ("cell_odd_sorted", detail)) + gtk_widget_style_get (widget, + "odd_row_color", &color, + NULL); + else + gtk_widget_style_get (widget, + "even_row_color", &color, + NULL); + + if (color) + { + freeme = get_darkened_gc (window, color, 1); + gc1 = freeme; + + gdk_color_free (color); + } + else + { + freeme = get_darkened_gc (window, &style->base[state_type], 1); + gc1 = freeme; + } } else if (!strcmp ("cell_odd_ruled_sorted", detail)) { - freeme = get_darkened_gc (window, &style->base[state_type], 2); - gc1 = freeme; + GdkColor *color = NULL; + + gtk_widget_style_get (widget, + "odd_row_color", &color, + NULL); + + if (color) + { + freeme = get_darkened_gc (window, color, 1); + gc1 = freeme; + + gdk_color_free (color); + } + else + { + gtk_widget_style_get (widget, + "even_row_color", &color, + NULL); + + if (color) + { + freeme = get_darkened_gc (window, color, 2); + gdk_color_free (color); + } + else + freeme = get_darkened_gc (window, &style->base[state_type], 2); + gc1 = freeme; + } } else gc1 = style->bg_gc[state_type]; |