diff options
author | Havoc Pennington <hp@pobox.com> | 2010-09-05 12:19:14 -0400 |
---|---|---|
committer | Havoc Pennington <hp@pobox.com> | 2010-09-12 21:47:10 -0400 |
commit | cd2a19a68dbd646ae120f110ef9a051fef7f49bf (patch) | |
tree | 48a7f781e5007eecd48c3c5155615c26b574c563 /gtk/gtksizegroup.c | |
parent | 9debfe243fcc1df5276109fe82b70ad98c380adf (diff) | |
download | gtk+-cd2a19a68dbd646ae120f110ef9a051fef7f49bf.tar.gz |
GtkWidget: add adjust_size_request adjust_size_allocation virtual funcs
Use these new methods to handle set_size_request (aka aux_info)
inside gtkwidget.c, instead of having external code mess with it.
The virtual functions can be used for other purposes in the
future. For example, GtkContainer::border_width could be
automatically implemented for all container subclasses.
Diffstat (limited to 'gtk/gtksizegroup.c')
-rw-r--r-- | gtk/gtksizegroup.c | 49 |
1 files changed, 10 insertions, 39 deletions
diff --git a/gtk/gtksizegroup.c b/gtk/gtksizegroup.c index 59ddc6e985..cc16476e81 100644 --- a/gtk/gtksizegroup.c +++ b/gtk/gtksizegroup.c @@ -666,35 +666,23 @@ static gint get_base_dimension (GtkWidget *widget, GtkSizeGroupMode mode) { - GtkWidgetAuxInfo *aux_info = _gtk_widget_get_aux_info (widget, FALSE); - if (mode == GTK_SIZE_GROUP_HORIZONTAL) { - if (aux_info && aux_info->width > 0) - return aux_info->width; - else - { - /* XXX Possibly we should be using natural values and not minimums here. */ - gint width; + /* XXX Possibly we should be using natural values and not minimums here. */ + gint width; - gtk_size_request_get_width (GTK_SIZE_REQUEST (widget), &width, NULL); + gtk_size_request_get_width (GTK_SIZE_REQUEST (widget), &width, NULL); - return width; - } + return width; } else { - if (aux_info && aux_info->height > 0) - return aux_info->height; - else - { - /* XXX Possibly we should be using natural values and not minimums here. */ - gint height; + /* XXX Possibly we should be using natural values and not minimums here. */ + gint height; - gtk_size_request_get_height (GTK_SIZE_REQUEST (widget), &height, NULL); + gtk_size_request_get_height (GTK_SIZE_REQUEST (widget), &height, NULL); - return height; - } + return height; } } @@ -801,31 +789,14 @@ _gtk_size_group_bump_requisition (GtkWidget *widget, if (!is_bumping (widget)) { - GtkWidgetAuxInfo *aux_info = - _gtk_widget_get_aux_info (widget, FALSE); - /* Avoid recursion here */ mark_bumping (widget, TRUE); if (get_size_groups (widget)) { - if (aux_info) - { - if (mode == GTK_SIZE_GROUP_HORIZONTAL) - result = compute_dimension (widget, mode, MAX (aux_info->width, widget_requisition)); - else - result = compute_dimension (widget, mode, MAX (aux_info->height, widget_requisition)); - } - else - result = compute_dimension (widget, mode, widget_requisition); - } - else if (aux_info) - { - if (mode == GTK_SIZE_GROUP_HORIZONTAL) - result = MAX (aux_info->width, widget_requisition); - else - result = MAX (aux_info->height, widget_requisition); + result = compute_dimension (widget, mode, widget_requisition); } + mark_bumping (widget, FALSE); } return result; |