[gtk+] sizegroup: Handle hfw in size groups
- From: Benjamin Otte <otte src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] sizegroup: Handle hfw in size groups
- Date: Sun, 4 Nov 2012 14:35:51 +0000 (UTC)
commit 9f6067a8043129ddcc0e223111d3b5a79c7b8100
Author: Benjamin Otte <otte redhat com>
Date: Fri Nov 2 00:33:42 2012 +0100
sizegroup: Handle hfw in size groups
gtk/gtksizegroup-private.h | 1 +
gtk/gtksizegroup.c | 19 ++++++++++++++++---
gtk/gtksizerequest.c | 1 +
3 files changed, 18 insertions(+), 3 deletions(-)
---
diff --git a/gtk/gtksizegroup-private.h b/gtk/gtksizegroup-private.h
index dc813cd..59ef781 100644
--- a/gtk/gtksizegroup-private.h
+++ b/gtk/gtksizegroup-private.h
@@ -39,6 +39,7 @@ typedef enum
void _gtk_size_group_bump_requisition (GtkWidget *widget,
GtkSizeGroupMode mode,
+ gint for_size,
gint *minimum,
gint *natural);
void _gtk_size_group_queue_resize (GtkWidget *widget,
diff --git a/gtk/gtksizegroup.c b/gtk/gtksizegroup.c
index 594e90a..3385e04 100644
--- a/gtk/gtksizegroup.c
+++ b/gtk/gtksizegroup.c
@@ -630,6 +630,7 @@ gtk_size_group_get_widgets (GtkSizeGroup *size_group)
static void
compute_dimension (GtkWidget *widget,
GtkSizeGroupMode mode,
+ gint for_size,
gint *minimum, /* in-out */
gint *natural) /* in-out */
{
@@ -654,9 +655,19 @@ compute_dimension (GtkWidget *widget,
else
{
if (mode == GTK_SIZE_GROUP_HORIZONTAL)
- gtk_widget_get_preferred_width (tmp_widget, &min_dimension, &nat_dimension);
+ {
+ if (for_size < 0)
+ gtk_widget_get_preferred_width (tmp_widget, &min_dimension, &nat_dimension);
+ else
+ gtk_widget_get_preferred_width_for_height (tmp_widget, for_size, &min_dimension, &nat_dimension);
+ }
else
- gtk_widget_get_preferred_height (tmp_widget, &min_dimension, &nat_dimension);
+ {
+ if (for_size < 0)
+ gtk_widget_get_preferred_height (tmp_widget, &min_dimension, &nat_dimension);
+ else
+ gtk_widget_get_preferred_height_for_width (tmp_widget, for_size, &min_dimension, &nat_dimension);
+ }
}
min_result = MAX (min_result, min_dimension);
@@ -676,6 +687,7 @@ compute_dimension (GtkWidget *widget,
* @widget: a #GtkWidget
* @mode: either %GTK_SIZE_GROUP_HORIZONTAL or %GTK_SIZE_GROUP_VERTICAL, depending
* on the dimension in which to bump the size.
+ * @for_size: Size to request minimum and natural size for
* @minimum: a pointer to the widget's minimum size
* @natural: a pointer to the widget's natural size
*
@@ -689,6 +701,7 @@ compute_dimension (GtkWidget *widget,
void
_gtk_size_group_bump_requisition (GtkWidget *widget,
GtkSizeGroupMode mode,
+ gint for_size,
gint *minimum,
gint *natural)
{
@@ -698,7 +711,7 @@ _gtk_size_group_bump_requisition (GtkWidget *widget,
_gtk_widget_set_sizegroup_bumping (widget, TRUE);
if (_gtk_widget_get_sizegroups (widget))
- compute_dimension (widget, mode, minimum, natural);
+ compute_dimension (widget, mode, for_size, minimum, natural);
_gtk_widget_set_sizegroup_bumping (widget, FALSE);
}
diff --git a/gtk/gtksizerequest.c b/gtk/gtksizerequest.c
index 0a9b1ba..c0e461f 100644
--- a/gtk/gtksizerequest.c
+++ b/gtk/gtksizerequest.c
@@ -469,6 +469,7 @@ compute_size_for_orientation (GtkWidget *widget,
*/
_gtk_size_group_bump_requisition (widget,
orientation,
+ for_size,
&min_size,
&nat_size);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]