[gtk+] checkbutton: support CSS paddings and borders
- From: Cosimo Cecchi <cosimoc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] checkbutton: support CSS paddings and borders
- Date: Fri, 9 May 2014 18:06:20 +0000 (UTC)
commit c20e8b0b4947fd33b2edf9b8ace38aae8cef1e55
Author: Cosimo Cecchi <cosimoc gnome org>
Date: Fri May 2 01:40:26 2014 +0200
checkbutton: support CSS paddings and borders
We need this since we just removed focus-padding.
gtk/gtkcheckbutton.c | 28 ++++++++++++++++++++++++----
1 files changed, 24 insertions(+), 4 deletions(-)
---
diff --git a/gtk/gtkcheckbutton.c b/gtk/gtkcheckbutton.c
index 9025561..cce9591 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))
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]