-
-/* This function is lifted verbatim from the Gtk2.10.6 library */
-
-void
-_psppire_button_box_child_requisition (GtkWidget *widget,
- int *nvis_children,
- int *nvis_secondaries,
- int *width,
- int *height)
-{
- GtkButtonBox *bbox;
- GtkBoxChild *child;
- 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 = bbox->child_min_width != GTK_BUTTONBOX_DEFAULT
- ? bbox->child_min_width : width_default;
- child_min_height = bbox->child_min_height !=GTK_BUTTONBOX_DEFAULT
- ? bbox->child_min_height : height_default;
- ipad_x = bbox->child_ipad_x != GTK_BUTTONBOX_DEFAULT
- ? bbox->child_ipad_x : ipad_x_default;
- ipad_y = bbox->child_ipad_y != GTK_BUTTONBOX_DEFAULT
- ? bbox->child_ipad_y : ipad_y_default;
-
- nchildren = 0;
- nsecondaries = 0;
- children = GTK_BOX(bbox)->children;
- needed_width = child_min_width;
- needed_height = child_min_height;
- ipad_w = ipad_x * 2;
- ipad_h = ipad_y * 2;
-
- while (children)
- {
- child = children->data;
- children = children->next;
-
- if (GTK_WIDGET_VISIBLE (child->widget))
- {
- nchildren += 1;
- gtk_widget_size_request (child->widget, &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;
- if (child->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;
-}
-
-