-
-/* This function was lifted verbatim from the Gtk2.10.6 library.
- But later modified to fit Gtk2.24
- */
-void
-_psppire_button_box_child_requisition (GtkWidget *widget,
- int *nvis_children,
- int *nvis_secondaries,
- int *width,
- int *height)
-{
- GtkButtonBox *bbox;
- GList *children;
- gint nchildren;
- gint nsecondaries;
- gint needed_width;
- gint needed_height;
- GtkRequisition child_requisition;
- gint ipad_w;
- gint ipad_h;
- gint width_default;
- gint height_default;
- gint ipad_x_default;
- gint ipad_y_default;
-
- gint child_min_width;
- gint child_min_height;
- gint ipad_x;
- gint ipad_y;
-
- g_return_if_fail (GTK_IS_BUTTON_BOX (widget));
-
- bbox = GTK_BUTTON_BOX (widget);
-
- gtk_widget_style_get (widget,
- "child-min-width", &width_default,
- "child-min-height", &height_default,
- "child-internal-pad-x", &ipad_x_default,
- "child-internal-pad-y", &ipad_y_default,
- NULL);
-
- child_min_width = width_default;
- child_min_height = height_default;
- ipad_x = ipad_x_default;
- ipad_y = ipad_y_default;
-
- nchildren = 0;
- nsecondaries = 0;
-
- needed_width = child_min_width;
- needed_height = child_min_height;
- ipad_w = ipad_x * 2;
- ipad_h = ipad_y * 2;
-
- children = gtk_container_get_children (GTK_CONTAINER (bbox));
- while (children)
- {
- GtkWidget *child = children->data;
- children = children->next;
-
- if (gtk_widget_get_visible (child))
- {
- gboolean is_secondary = FALSE;
- nchildren += 1;
- gtk_widget_get_preferred_size (child, NULL, &child_requisition);
-
- if (child_requisition.width + ipad_w > needed_width)
- needed_width = child_requisition.width + ipad_w;
- if (child_requisition.height + ipad_h > needed_height)
- needed_height = child_requisition.height + ipad_h;
-
- gtk_container_child_get (GTK_CONTAINER (bbox), child, "secondary", &is_secondary, NULL);
-
- if (is_secondary)
- nsecondaries++;
- }
- }
-
- if (nvis_children)
- *nvis_children = nchildren;
- if (nvis_secondaries)
- *nvis_secondaries = nsecondaries;
- if (width)
- *width = needed_width;
- if (height)
- *height = needed_height;
-}
-
-