summaryrefslogtreecommitdiff
path: root/gtk/gtkcheckbutton.c
diff options
context:
space:
mode:
authorCosimo Cecchi <cosimoc@gnome.org>2014-05-02 01:40:26 +0200
committerCosimo Cecchi <cosimoc@gnome.org>2014-05-09 11:02:42 -0700
commitc20e8b0b4947fd33b2edf9b8ace38aae8cef1e55 (patch)
treee93474860eaea2131d905562a2b046ed7978c71e /gtk/gtkcheckbutton.c
parent99f0776f198f33b582afb12a4ad54e8bf49d4c49 (diff)
downloadgtk+-c20e8b0b4947fd33b2edf9b8ace38aae8cef1e55.tar.gz
checkbutton: support CSS paddings and borders
We need this since we just removed focus-padding.
Diffstat (limited to 'gtk/gtkcheckbutton.c')
-rw-r--r--gtk/gtkcheckbutton.c28
1 files changed, 24 insertions, 4 deletions
diff --git a/gtk/gtkcheckbutton.c b/gtk/gtkcheckbutton.c
index 90255617ae..cce9591af8 100644
--- a/gtk/gtkcheckbutton.c
+++ b/gtk/gtkcheckbutton.c
@@ -255,6 +255,25 @@ _gtk_check_button_get_props (GtkCheckButton *check_button,
}
static void
+get_padding_and_border (GtkWidget *widget,
+ GtkBorder *border)
+{
+ GtkStyleContext *context;
+ GtkStateFlags state;
+ GtkBorder tmp;
+
+ context = gtk_widget_get_style_context (widget);
+ state = gtk_widget_get_state_flags (widget);
+
+ gtk_style_context_get_padding (context, state, border);
+ gtk_style_context_get_border (context, state, &tmp);
+ border->top += tmp.top;
+ border->right += tmp.right;
+ border->bottom += tmp.bottom;
+ border->left += tmp.left;
+}
+
+static void
gtk_check_button_get_full_border (GtkCheckButton *check_button,
GtkBorder *border,
gint *indicator)
@@ -262,6 +281,7 @@ gtk_check_button_get_full_border (GtkCheckButton *check_button,
int focus_width, indicator_size, indicator_spacing, indicator_extra, border_width;
GtkWidget *child;
+ get_padding_and_border (GTK_WIDGET (check_button), border);
border_width = gtk_container_get_border_width (GTK_CONTAINER (check_button));
gtk_widget_style_get (GTK_WIDGET (check_button),
"focus-line-width", &focus_width,
@@ -270,10 +290,10 @@ gtk_check_button_get_full_border (GtkCheckButton *check_button,
NULL);
child = gtk_bin_get_child (GTK_BIN (check_button));
- border->left = border_width + focus_width;
- border->right = border_width + focus_width;
- border->top = border_width + focus_width;
- border->bottom = border_width + focus_width;
+ border->left += border_width + focus_width;
+ border->right += border_width + focus_width;
+ border->top += border_width + focus_width;
+ border->bottom += border_width + focus_width;
indicator_extra = indicator_size + 2 * indicator_spacing;
if (child && gtk_widget_get_visible (child))