summaryrefslogtreecommitdiff
path: root/gtk/gtkradiobutton.c
diff options
context:
space:
mode:
authorJavier Jardón <jjardon@gnome.org>2010-08-11 23:03:29 +0200
committerJavier Jardón <jjardon@gnome.org>2010-08-22 21:25:25 +0200
commitd52eb495296831ef805881ad5bf78ac62894fc3a (patch)
tree855c29cb38d82f2ccb5731a77e40c83454512ce3 /gtk/gtkradiobutton.c
parentc6f4e71a31eb541b91bd54924e17c6ca3b9ece3e (diff)
downloadgtk+-d52eb495296831ef805881ad5bf78ac62894fc3a.tar.gz
gtk/gtkradiobutton.c: use accessor functions to access GtkWidget
Diffstat (limited to 'gtk/gtkradiobutton.c')
-rw-r--r--gtk/gtkradiobutton.c40
1 files changed, 26 insertions, 14 deletions
diff --git a/gtk/gtkradiobutton.c b/gtk/gtkradiobutton.c
index 675c29a3d8..ebaa86cfcb 100644
--- a/gtk/gtkradiobutton.c
+++ b/gtk/gtkradiobutton.c
@@ -545,9 +545,12 @@ get_coordinates (GtkWidget *widget,
gint *x,
gint *y)
{
- *x = widget->allocation.x + widget->allocation.width / 2;
- *y = widget->allocation.y + widget->allocation.height / 2;
-
+ GtkAllocation allocation;
+
+ gtk_widget_get_allocation (widget, &allocation);
+ *x = allocation.x + allocation.width / 2;
+ *y = allocation.y + allocation.height / 2;
+
gtk_widget_translate_coordinates (widget, reference, *x, *y, x, y);
}
@@ -813,12 +816,15 @@ static void
gtk_radio_button_draw_indicator (GtkCheckButton *check_button,
GdkRectangle *area)
{
+ GtkAllocation allocation;
GtkWidget *widget;
GtkWidget *child;
GtkButton *button;
GtkToggleButton *toggle_button;
GtkStateType state_type;
GtkShadowType shadow_type;
+ GtkStyle *style;
+ GdkWindow *window;
gint x, y;
gint indicator_size, indicator_spacing;
gint focus_width;
@@ -835,16 +841,21 @@ gtk_radio_button_draw_indicator (GtkCheckButton *check_button,
border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));
+ style = gtk_widget_get_style (widget);
gtk_widget_style_get (widget,
"interior-focus", &interior_focus,
"focus-line-width", &focus_width,
"focus-padding", &focus_pad,
NULL);
+ window = gtk_widget_get_window (widget);
+
_gtk_check_button_get_props (check_button, &indicator_size, &indicator_spacing);
- x = widget->allocation.x + indicator_spacing + border_width;
- y = widget->allocation.y + (widget->allocation.height - indicator_size) / 2;
+ gtk_widget_get_allocation (widget, &allocation);
+
+ x = allocation.x + indicator_spacing + border_width;
+ y = allocation.y + (allocation.height - indicator_size) / 2;
child = gtk_bin_get_child (GTK_BIN (check_button));
if (!interior_focus || !(child && gtk_widget_get_visible (child)))
@@ -867,21 +878,22 @@ gtk_radio_button_draw_indicator (GtkCheckButton *check_button,
state_type = GTK_STATE_NORMAL;
if (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL)
- x = widget->allocation.x + widget->allocation.width - (indicator_size + x - widget->allocation.x);
+ x = allocation.x + allocation.width - (indicator_size + x - allocation.x);
if (gtk_widget_get_state (widget) == GTK_STATE_PRELIGHT)
{
GdkRectangle restrict_area;
GdkRectangle new_area;
-
- restrict_area.x = widget->allocation.x + border_width;
- restrict_area.y = widget->allocation.y + border_width;
- restrict_area.width = widget->allocation.width - (2 * border_width);
- restrict_area.height = widget->allocation.height - (2 * border_width);
-
+
+ restrict_area.x = allocation.x + border_width;
+ restrict_area.y = allocation.y + border_width;
+ restrict_area.width = allocation.width - (2 * border_width);
+ restrict_area.height = allocation.height - (2 * border_width);
+
if (gdk_rectangle_intersect (area, &restrict_area, &new_area))
{
- gtk_paint_flat_box (widget->style, widget->window, GTK_STATE_PRELIGHT,
+ gtk_paint_flat_box (style, window,
+ GTK_STATE_PRELIGHT,
GTK_SHADOW_ETCHED_OUT,
area, widget, "checkbutton",
new_area.x, new_area.y,
@@ -889,7 +901,7 @@ gtk_radio_button_draw_indicator (GtkCheckButton *check_button,
}
}
- gtk_paint_option (widget->style, widget->window,
+ gtk_paint_option (style, window,
state_type, shadow_type,
area, widget, "radiobutton",
x, y, indicator_size, indicator_size);