diff options
author | Javier Jardón <jjardon@gnome.org> | 2010-07-02 17:49:18 +0200 |
---|---|---|
committer | Javier Jardón <jjardon@gnome.org> | 2010-07-13 19:40:49 +0200 |
commit | 978a031b76c3f6c06b52bdba87c8d26e41b2be48 (patch) | |
tree | 1d9ab689c1e4d74f6845c6a19f5772726511b3f2 /gtk/gtkarrow.c | |
parent | e2b8112fd89eb0f6c824bcf6937a4ec8e493bca7 (diff) | |
download | gtk+-978a031b76c3f6c06b52bdba87c8d26e41b2be48.tar.gz |
Use accessor functions to access GtkMisc
Diffstat (limited to 'gtk/gtkarrow.c')
-rw-r--r-- | gtk/gtkarrow.c | 30 |
1 files changed, 17 insertions, 13 deletions
diff --git a/gtk/gtkarrow.c b/gtk/gtkarrow.c index b3cba00560..7da60bf82c 100644 --- a/gtk/gtkarrow.c +++ b/gtk/gtkarrow.c @@ -176,6 +176,7 @@ static void gtk_arrow_init (GtkArrow *arrow) { GtkArrowPriv *priv; + gint xpad, ypad; arrow->priv = G_TYPE_INSTANCE_GET_PRIVATE (arrow, GTK_TYPE_ARROW, @@ -184,8 +185,9 @@ gtk_arrow_init (GtkArrow *arrow) gtk_widget_set_has_window (GTK_WIDGET (arrow), FALSE); - GTK_WIDGET (arrow)->requisition.width = MIN_ARROW_SIZE + GTK_MISC (arrow)->xpad * 2; - GTK_WIDGET (arrow)->requisition.height = MIN_ARROW_SIZE + GTK_MISC (arrow)->ypad * 2; + gtk_misc_get_padding (GTK_MISC (arrow), &xpad, &ypad); + GTK_WIDGET (arrow)->requisition.width = MIN_ARROW_SIZE + xpad * 2; + GTK_WIDGET (arrow)->requisition.height = MIN_ARROW_SIZE + ypad * 2; priv->arrow_type = GTK_ARROW_RIGHT; priv->shadow_type = GTK_SHADOW_OUT; @@ -276,32 +278,34 @@ gtk_arrow_expose (GtkWidget *widget, gint width, height; gint x, y; gint extent; - gfloat xalign; + gint xpad, ypad; + gfloat xalign, yalign; GtkArrowType effective_arrow_type; gfloat arrow_scaling; gtk_widget_style_get (widget, "arrow-scaling", &arrow_scaling, NULL); - width = widget->allocation.width - misc->xpad * 2; - height = widget->allocation.height - misc->ypad * 2; + gtk_misc_get_padding (misc, &xpad, &ypad); + gtk_misc_get_alignment (misc, &xalign, &yalign); + + width = widget->allocation.width - xpad * 2; + height = widget->allocation.height - ypad * 2; extent = MIN (width, height) * arrow_scaling; effective_arrow_type = priv->arrow_type; - if (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_LTR) - xalign = misc->xalign; - else - { - xalign = 1.0 - misc->xalign; + if (gtk_widget_get_direction (widget) != GTK_TEXT_DIR_LTR) + { + xalign = 1.0 - xalign; if (priv->arrow_type == GTK_ARROW_LEFT) effective_arrow_type = GTK_ARROW_RIGHT; else if (priv->arrow_type == GTK_ARROW_RIGHT) effective_arrow_type = GTK_ARROW_LEFT; } - x = floor (widget->allocation.x + misc->xpad + x = floor (widget->allocation.x + xpad + ((widget->allocation.width - extent) * xalign)); - y = floor (widget->allocation.y + misc->ypad - + ((widget->allocation.height - extent) * misc->yalign)); + y = floor (widget->allocation.y + ypad + + ((widget->allocation.height - extent) * yalign)); shadow_type = priv->shadow_type; |