diff options
author | Alexey Yakovenko <wakeroid@gmail.com> | 2010-03-14 11:34:39 +0100 |
---|---|---|
committer | Alexey Yakovenko <wakeroid@gmail.com> | 2010-03-14 11:34:39 +0100 |
commit | dfb9291c8aa6bae374276d5b4dcacbeb1df0de74 (patch) | |
tree | 12b2b33dd3fc85a33dc5bc2a8ed783f7e207efce /plugins | |
parent | 8c96fe77fdd34ee8b94f2cf60cd29db3c6c3d60f (diff) |
use style from real GtkButton widget when drawing listview header - fixes compatibility with Elfin2 theme, and possibly others
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/gtkui/ddblistview.c | 12 | ||||
-rw-r--r-- | plugins/gtkui/gtkui.c | 7 |
2 files changed, 12 insertions, 7 deletions
diff --git a/plugins/gtkui/ddblistview.c b/plugins/gtkui/ddblistview.c index ffd5c66e..b52022ef 100644 --- a/plugins/gtkui/ddblistview.c +++ b/plugins/gtkui/ddblistview.c @@ -56,6 +56,7 @@ // HACK!! extern GtkWidget *theme_treeview; +extern GtkWidget *theme_button; G_DEFINE_TYPE (DdbListview, ddb_listview, GTK_TYPE_TABLE); @@ -1888,7 +1889,8 @@ ddb_listview_header_render (DdbListview *ps) { const char *detail = "button"; // fill background - gtk_paint_box (widget->style, ps->backbuf_header, GTK_STATE_NORMAL, GTK_SHADOW_OUT, NULL, widget, detail, -10, -10, widget->allocation.width+20, widget->allocation.height+20); + //gdk_draw_rectangle (widget->window, widget->style->base_gc[GTK_STATE_NORMAL], TRUE, 0, 0, widget->allocation.width, widget->allocation.height); + gtk_paint_box (theme_button->style, ps->backbuf_header, GTK_STATE_NORMAL, GTK_SHADOW_OUT, NULL, widget, detail, -10, -10, widget->allocation.width+20, widget->allocation.height+20); gdk_draw_line (ps->backbuf_header, widget->style->mid_gc[GTK_STATE_NORMAL], 0, widget->allocation.height-1, widget->allocation.width, widget->allocation.height-1); draw_begin ((uintptr_t)ps->backbuf_header); x = -ps->hscrollpos; @@ -1916,7 +1918,7 @@ ddb_listview_header_render (DdbListview *ps) { int sort = c->sort_order; if (w > 0) { gtk_paint_vline (widget->style, ps->backbuf_header, GTK_STATE_NORMAL, NULL, NULL, NULL, 2, h-4, xx+w - 2); - GdkColor *gdkfg = &widget->style->fg[0]; + GdkColor *gdkfg = &theme_button->style->fg[0]; float fg[3] = {(float)gdkfg->red/0xffff, (float)gdkfg->green/0xffff, (float)gdkfg->blue/0xffff}; draw_set_fg_color (fg); int ww = w-10; @@ -1956,15 +1958,15 @@ ddb_listview_header_render (DdbListview *ps) { #endif // draw empty slot if (x < widget->allocation.width) { - gtk_paint_box (widget->style, ps->backbuf_header, GTK_STATE_ACTIVE, GTK_SHADOW_ETCHED_IN, NULL, widget, "button", x, 0, w, h); + gtk_paint_box (theme_button->style, ps->backbuf_header, GTK_STATE_ACTIVE, GTK_SHADOW_ETCHED_IN, NULL, widget, "button", x, 0, w, h); } x = ps->col_movepos; if (x >= widget->allocation.width) { break; } if (w > 0) { - gtk_paint_box (widget->style, ps->backbuf_header, GTK_STATE_SELECTED, GTK_SHADOW_OUT, NULL, widget, "button", x, 0, w, h); - GdkColor *gdkfg = &widget->style->fg[GTK_STATE_SELECTED]; + gtk_paint_box (theme_button->style, ps->backbuf_header, GTK_STATE_SELECTED, GTK_SHADOW_OUT, NULL, widget, "button", x, 0, w, h); + GdkColor *gdkfg = &theme_button->style->fg[GTK_STATE_SELECTED]; float fg[3] = {(float)gdkfg->red/0xffff, (float)gdkfg->green/0xffff, (float)gdkfg->blue/0xffff}; draw_set_fg_color (fg); draw_text (x + 5, h/2-draw_get_font_size()/2, c->width-10, 0, c->title); diff --git a/plugins/gtkui/gtkui.c b/plugins/gtkui/gtkui.c index df21ce02..07d7d693 100644 --- a/plugins/gtkui/gtkui.c +++ b/plugins/gtkui/gtkui.c @@ -62,19 +62,22 @@ GtkWidget *traymenu; // playlist theming GtkWidget *theme_treeview; +GtkWidget *theme_button; int disable_listview_theming = 0; // that must be called before gtk_init void gtkpl_init (void) { - //memcpy (colo_current, colo_system_gtk, sizeof (colo_current)); - //memcpy (colo_current, colo_dark_orange, sizeof (colo_current)); theme_treeview = gtk_tree_view_new (); GTK_WIDGET_UNSET_FLAGS (theme_treeview, GTK_CAN_FOCUS); gtk_widget_show (theme_treeview); GtkWidget *vbox1 = lookup_widget (mainwin, "vbox1"); gtk_box_pack_start (GTK_BOX (vbox1), theme_treeview, FALSE, FALSE, 0); gtk_tree_view_set_rules_hint (GTK_TREE_VIEW (theme_treeview), TRUE); + + theme_button = gtk_button_new (); + gtk_widget_show (theme_button); + gtk_box_pack_start (GTK_BOX (vbox1), theme_button, FALSE, FALSE, 0); } void |