diff options
author | Felipe Erias Morandeira <femorandeira@igalia.com> | 2013-06-27 11:24:44 +0100 |
---|---|---|
committer | Philip Chimento <philip@endlessm.com> | 2013-07-04 21:57:00 -0700 |
commit | 299d62edc0f6abbee1ce97d5d703543c43d9e1cc (patch) | |
tree | 354d365fedf8354cf105b86aab65d0883650b687 /endless | |
parent | 7d4bf1586188dce6c8099504ee24da2c02e4cbf7 (diff) |
Styling of the border and text of the action button. A dark variant is available.
[endlessm/eos-sdk#104]
Diffstat (limited to 'endless')
-rw-r--r-- | endless/eosactionbutton.c | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/endless/eosactionbutton.c b/endless/eosactionbutton.c index 148cd2b..0540f5b 100644 --- a/endless/eosactionbutton.c +++ b/endless/eosactionbutton.c @@ -595,7 +595,7 @@ eos_action_button_draw (GtkWidget *widget, GtkAllocation allocation; GtkStyleContext *context; GtkStateFlags state; - gint width, height, border_width, border_height; + gint width, border_width, border_height, border_thickness; GtkBorder margin; context = gtk_widget_get_style_context (widget); @@ -615,28 +615,33 @@ eos_action_button_draw (GtkWidget *widget, x = 0; y = 0; width = allocation.width; - height = allocation.height; border_width = icon_sizes[priv->size].width; border_height = icon_sizes[priv->size].height; + border_thickness = icon_sizes[priv->size].border_width; cairo_save (cr); gtk_render_frame (context, cr, x + (width - border_width)/2, - margin.top, + y + margin.top, border_width, border_height); - if (gtk_widget_has_visible_focus (widget)) - { - gtk_render_focus (context, cr, - x, y, width, height); - } - // TODO is it really needed to restore and save the cairo_t here? cairo_restore (cr); cairo_save (cr); + // GTK+ tries to paint the background inside the border, we work around this + //because we want to draw the inset shadow over the border itself + gtk_render_background (context, cr, + x + (width - border_width)/2 - border_thickness, + y + margin.top - border_thickness, + border_width + 2*border_thickness, + border_height + 2*border_thickness); + + cairo_restore (cr); + cairo_save (cr); + // *** image gtk_widget_get_allocation (priv->icon_image, &allocation); |