- return size_group->widgets;
-}
-
-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
- return widget->requisition.width;
- }
- else
- {
- if (aux_info && aux_info->height > 0)
- return aux_info->height;
- else
- return widget->requisition.height;
- }
-}
-
-static void
-do_size_request (GtkWidget *widget)
-{
- if (GTK_WIDGET_REQUEST_NEEDED (widget))
- {
- gtk_widget_ensure_style (widget);
- GTK_PRIVATE_UNSET_FLAG (widget, GTK_REQUEST_NEEDED);
- g_signal_emit_by_name (widget,
- "size-request",
- &widget->requisition);
- }
-}
-
-static gint
-compute_base_dimension (GtkWidget *widget,
- GtkSizeGroupMode mode)
-{
- do_size_request (widget);
-
- return get_base_dimension (widget, mode);
-}
-
-static gint
-compute_dimension (GtkWidget *widget,
- GtkSizeGroupMode mode)
-{
- GSList *widgets = NULL;
- GSList *groups = NULL;
- GSList *tmp_list;
- gint result = 0;
-
- add_widget_to_closure (widget, mode, &groups, &widgets);
-
- g_slist_foreach (widgets, (GFunc)mark_unvisited, NULL);
- g_slist_foreach (groups, (GFunc)mark_unvisited, NULL);
-
- g_slist_foreach (widgets, (GFunc)g_object_ref, NULL);
-
- if (!groups)
- {
- result = compute_base_dimension (widget, mode);
- }
- else
- {
- GtkSizeGroup *group = groups->data;
-
- if (mode == GTK_SIZE_GROUP_HORIZONTAL && group->have_width)
- result = group->requisition.width;
- else if (mode == GTK_SIZE_GROUP_VERTICAL && group->have_height)
- result = group->requisition.height;
- else
- {
- tmp_list = widgets;
- while (tmp_list)
- {
- GtkWidget *tmp_widget = tmp_list->data;
-
- gint dimension = compute_base_dimension (tmp_widget, mode);
-
- if (GTK_WIDGET_MAPPED (tmp_widget) || !group->ignore_hidden)
- {
- if (dimension > result)
- result = dimension;
- }
-
- tmp_list = tmp_list->next;
- }
-
- tmp_list = groups;
- while (tmp_list)
- {
- GtkSizeGroup *tmp_group = tmp_list->data;
-
- if (mode == GTK_SIZE_GROUP_HORIZONTAL)
- {
- tmp_group->have_width = TRUE;
- tmp_group->requisition.width = result;
- }
- else
- {
- tmp_group->have_height = TRUE;
- tmp_group->requisition.height = result;
- }
-
- tmp_list = tmp_list->next;
- }
- }
- }
-
- g_slist_foreach (widgets, (GFunc)g_object_unref, NULL);
-
- g_slist_free (widgets);
- g_slist_free (groups);
-
- return result;
-}
-
-static gint
-get_dimension (GtkWidget *widget,
- GtkSizeGroupMode mode)
-{
- GSList *widgets = NULL;
- GSList *groups = NULL;
- gint result = 0;
-
- add_widget_to_closure (widget, mode, &groups, &widgets);
-
- g_slist_foreach (widgets, (GFunc)mark_unvisited, NULL);
- g_slist_foreach (groups, (GFunc)mark_unvisited, NULL);
-
- if (!groups)
- {
- result = get_base_dimension (widget, mode);
- }
- else
- {
- GtkSizeGroup *group = groups->data;
-
- if (mode == GTK_SIZE_GROUP_HORIZONTAL && group->have_width)
- result = group->requisition.width;
- else if (mode == GTK_SIZE_GROUP_VERTICAL && group->have_height)
- result = group->requisition.height;
- }
-
- g_slist_free (widgets);
- g_slist_free (groups);
-
- return result;
-}
-
-static void
-get_fast_child_requisition (GtkWidget *widget,
- GtkRequisition *requisition)
-{
- GtkWidgetAuxInfo *aux_info = _gtk_widget_get_aux_info (widget, FALSE);
-
- *requisition = widget->requisition;
-
- if (aux_info)
- {
- if (aux_info->width > 0)
- requisition->width = aux_info->width;
- if (aux_info && aux_info->height > 0)
- requisition->height = aux_info->height;
- }
-}
-
-/**
- * _gtk_size_group_get_child_requisition:
- * @widget: a #GtkWidget
- * @requisition: location to store computed requisition.
- *
- * Retrieve the "child requisition" of the widget, taking account grouping
- * of the widget's requisition with other widgets.
- **/
-void
-_gtk_size_group_get_child_requisition (GtkWidget *widget,
- GtkRequisition *requisition)
-{
- initialize_size_group_quarks ();
-
- if (requisition)
- {
- if (get_size_groups (widget))
- {
- requisition->width = get_dimension (widget, GTK_SIZE_GROUP_HORIZONTAL);
- requisition->height = get_dimension (widget, GTK_SIZE_GROUP_VERTICAL);
-
- /* Only do the full computation if we actually have size groups */
- }
- else
- get_fast_child_requisition (widget, requisition);
- }
-}
-
-/**
- * _gtk_size_group_compute_requisition:
- * @widget: a #GtkWidget
- * @requisition: location to store computed requisition.
- *
- * Compute the requisition of a widget taking into account grouping of
- * the widget's requisition with other widgets.
- **/
-void
-_gtk_size_group_compute_requisition (GtkWidget *widget,
- GtkRequisition *requisition)
-{
- gint width;
- gint height;
-
- initialize_size_group_quarks ();
-
- if (get_size_groups (widget))
- {
- /* Only do the full computation if we actually have size groups */
-
- width = compute_dimension (widget, GTK_SIZE_GROUP_HORIZONTAL);
- height = compute_dimension (widget, GTK_SIZE_GROUP_VERTICAL);
-
- if (requisition)
- {
- requisition->width = width;
- requisition->height = height;
- }
- }
- else
- {
- do_size_request (widget);
-
- if (requisition)
- get_fast_child_requisition (widget, requisition);
- }