1 /* GTK - The GIMP Toolkit
2 * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the
16 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17 * Boston, MA 02111-1307, USA.
19 * GtkLayout: Widget for scrolling of arbitrary-sized areas.
21 * Copyright Owen Taylor, 1998
25 * Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
26 * file for a list of people on the GTK+ Team. See the ChangeLog
27 * files for a list of changes. These files are distributed with
28 * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
31 #include "gdkconfig.h"
33 #include "gtklayout.h"
34 #include "gtksignal.h"
35 #include "gtkprivate.h"
37 #include "gtkmarshalers.h"
39 typedef struct _GtkLayoutChild GtkLayoutChild;
41 struct _GtkLayoutChild {
61 static void gtk_layout_class_init (GtkLayoutClass *class);
62 static void gtk_layout_get_property (GObject *object,
66 static void gtk_layout_set_property (GObject *object,
70 static void gtk_layout_init (GtkLayout *layout);
71 static void gtk_layout_finalize (GObject *object);
72 static void gtk_layout_realize (GtkWidget *widget);
73 static void gtk_layout_unrealize (GtkWidget *widget);
74 static void gtk_layout_map (GtkWidget *widget);
75 static void gtk_layout_size_request (GtkWidget *widget,
76 GtkRequisition *requisition);
77 static void gtk_layout_size_allocate (GtkWidget *widget,
78 GtkAllocation *allocation);
79 static gint gtk_layout_expose (GtkWidget *widget,
80 GdkEventExpose *event);
81 static void gtk_layout_remove (GtkContainer *container,
83 static void gtk_layout_forall (GtkContainer *container,
84 gboolean include_internals,
86 gpointer callback_data);
87 static void gtk_layout_set_adjustments (GtkLayout *layout,
90 static void gtk_layout_set_child_property (GtkContainer *container,
95 static void gtk_layout_get_child_property (GtkContainer *container,
100 static void gtk_layout_allocate_child (GtkLayout *layout,
101 GtkLayoutChild *child);
102 static void gtk_layout_adjustment_changed (GtkAdjustment *adjustment,
106 static GtkWidgetClass *parent_class = NULL;
112 * @hadjustment: horizontal scroll adjustment, or %NULL
113 * @vadjustment: vertical scroll adjustment, or %NULL
115 * Creates a new #GtkLayout. Unless you have a specific adjustment
116 * you'd like the layout to use for scrolling, pass %NULL for
117 * @hadjustment and @vadjustment.
119 * Return value: a new #GtkLayout
123 gtk_layout_new (GtkAdjustment *hadjustment,
124 GtkAdjustment *vadjustment)
128 layout = gtk_type_new (GTK_TYPE_LAYOUT);
130 gtk_layout_set_adjustments (layout, hadjustment, vadjustment);
132 return GTK_WIDGET (layout);
136 * gtk_layout_get_hadjustment:
137 * @layout: a #GtkLayout
139 * This function should only be called after the layout has been
140 * placed in a #GtkScrolledWindow or otherwise configured for
141 * scrolling. It returns the #GtkAdjustment used for communication
142 * between the horizontal scrollbar and @layout.
144 * See #GtkScrolledWindow, #GtkScrollbar, #GtkAdjustment for details.
146 * Return value: horizontal scroll adjustment
149 gtk_layout_get_hadjustment (GtkLayout *layout)
151 g_return_val_if_fail (GTK_IS_LAYOUT (layout), NULL);
153 return layout->hadjustment;
156 * gtk_layout_get_vadjustment:
157 * @layout: a #GtkLayout
159 * This function should only be called after the layout has been
160 * placed in a #GtkScrolledWindow or otherwise configured for
161 * scrolling. It returns the #GtkAdjustment used for communication
162 * between the vertical scrollbar and @layout.
164 * See #GtkScrolledWindow, #GtkScrollbar, #GtkAdjustment for details.
166 * Return value: vertical scroll adjustment
169 gtk_layout_get_vadjustment (GtkLayout *layout)
171 g_return_val_if_fail (GTK_IS_LAYOUT (layout), NULL);
173 return layout->vadjustment;
177 gtk_layout_set_adjustments (GtkLayout *layout,
181 gboolean need_adjust = FALSE;
183 g_return_if_fail (GTK_IS_LAYOUT (layout));
186 g_return_if_fail (GTK_IS_ADJUSTMENT (hadj));
188 hadj = GTK_ADJUSTMENT (gtk_adjustment_new (0.0, 0.0, 0.0, 0.0, 0.0, 0.0));
190 g_return_if_fail (GTK_IS_ADJUSTMENT (vadj));
192 vadj = GTK_ADJUSTMENT (gtk_adjustment_new (0.0, 0.0, 0.0, 0.0, 0.0, 0.0));
194 if (layout->hadjustment && (layout->hadjustment != hadj))
196 gtk_signal_disconnect_by_data (GTK_OBJECT (layout->hadjustment), layout);
197 gtk_object_unref (GTK_OBJECT (layout->hadjustment));
200 if (layout->vadjustment && (layout->vadjustment != vadj))
202 gtk_signal_disconnect_by_data (GTK_OBJECT (layout->vadjustment), layout);
203 gtk_object_unref (GTK_OBJECT (layout->vadjustment));
206 if (layout->hadjustment != hadj)
208 layout->hadjustment = hadj;
209 gtk_object_ref (GTK_OBJECT (layout->hadjustment));
210 gtk_object_sink (GTK_OBJECT (layout->hadjustment));
212 gtk_signal_connect (GTK_OBJECT (layout->hadjustment), "value_changed",
213 (GtkSignalFunc) gtk_layout_adjustment_changed,
218 if (layout->vadjustment != vadj)
220 layout->vadjustment = vadj;
221 gtk_object_ref (GTK_OBJECT (layout->vadjustment));
222 gtk_object_sink (GTK_OBJECT (layout->vadjustment));
224 gtk_signal_connect (GTK_OBJECT (layout->vadjustment), "value_changed",
225 (GtkSignalFunc) gtk_layout_adjustment_changed,
231 gtk_layout_adjustment_changed (NULL, layout);
235 gtk_layout_finalize (GObject *object)
237 GtkLayout *layout = GTK_LAYOUT (object);
239 gtk_object_unref (GTK_OBJECT (layout->hadjustment));
240 gtk_object_unref (GTK_OBJECT (layout->vadjustment));
242 G_OBJECT_CLASS (parent_class)->finalize (object);
246 * gtk_layout_set_hadjustment:
247 * @layout: a #GtkLayout
248 * @adjustment: new scroll adjustment
250 * Sets the horizontal scroll adjustment for the layout.
252 * See #GtkScrolledWindow, #GtkScrollbar, #GtkAdjustment for details.
256 gtk_layout_set_hadjustment (GtkLayout *layout,
257 GtkAdjustment *adjustment)
259 g_return_if_fail (GTK_IS_LAYOUT (layout));
261 gtk_layout_set_adjustments (layout, adjustment, layout->vadjustment);
262 g_object_notify (G_OBJECT (layout), "hadjustment");
266 * gtk_layout_set_vadjustment:
267 * @layout: a #GtkLayout
268 * @adjustment: new scroll adjustment
270 * Sets the vertical scroll adjustment for the layout.
272 * See #GtkScrolledWindow, #GtkScrollbar, #GtkAdjustment for details.
276 gtk_layout_set_vadjustment (GtkLayout *layout,
277 GtkAdjustment *adjustment)
279 g_return_if_fail (GTK_IS_LAYOUT (layout));
281 gtk_layout_set_adjustments (layout, layout->hadjustment, adjustment);
282 g_object_notify (G_OBJECT (layout), "vadjustment");
285 static GtkLayoutChild*
286 get_child (GtkLayout *layout,
291 children = layout->children;
294 GtkLayoutChild *child;
296 child = children->data;
297 children = children->next;
299 if (child->widget == widget)
308 * @layout: a #GtkLayout
309 * @child_widget: child widget
310 * @x: X position of child widget
311 * @y: Y position of child widget
313 * Adds @child_widget to @layout, at position (@x,@y).
314 * @layout becomes the new parent container of @child_widget.
318 gtk_layout_put (GtkLayout *layout,
319 GtkWidget *child_widget,
323 GtkLayoutChild *child;
325 g_return_if_fail (GTK_IS_LAYOUT (layout));
326 g_return_if_fail (GTK_IS_WIDGET (child_widget));
328 child = g_new (GtkLayoutChild, 1);
330 child->widget = child_widget;
334 layout->children = g_list_append (layout->children, child);
336 if (GTK_WIDGET_REALIZED (layout))
337 gtk_widget_set_parent_window (child->widget, layout->bin_window);
339 gtk_widget_set_parent (child_widget, GTK_WIDGET (layout));
343 gtk_layout_move_internal (GtkLayout *layout,
350 GtkLayoutChild *child;
352 g_return_if_fail (GTK_IS_LAYOUT (layout));
353 g_return_if_fail (GTK_IS_WIDGET (widget));
354 g_return_if_fail (widget->parent == GTK_WIDGET (layout));
356 child = get_child (layout, widget);
360 gtk_widget_freeze_child_notify (widget);
365 gtk_widget_child_notify (widget, "x");
371 gtk_widget_child_notify (widget, "y");
374 gtk_widget_thaw_child_notify (widget);
376 if (GTK_WIDGET_VISIBLE (widget) && GTK_WIDGET_VISIBLE (layout))
377 gtk_widget_queue_resize (GTK_WIDGET (widget));
382 * @layout: a #GtkLayout
383 * @child_widget: a current child of @layout
384 * @x: X position to move to
385 * @y: Y position to move to
387 * Moves a current child of @layout to a new position.
391 gtk_layout_move (GtkLayout *layout,
392 GtkWidget *child_widget,
396 g_return_if_fail (GTK_IS_LAYOUT (layout));
397 g_return_if_fail (GTK_IS_WIDGET (child_widget));
398 g_return_if_fail (child_widget->parent == GTK_WIDGET (layout));
400 gtk_layout_move_internal (layout, child_widget, TRUE, x, TRUE, y);
404 gtk_layout_set_adjustment_upper (GtkAdjustment *adj,
407 if (upper != adj->upper)
409 gdouble min = MAX (0., upper - adj->page_size);
410 gboolean value_changed = FALSE;
414 if (adj->value > min)
417 value_changed = TRUE;
420 gtk_signal_emit_by_name (GTK_OBJECT (adj), "changed");
422 gtk_signal_emit_by_name (GTK_OBJECT (adj), "value_changed");
427 * gtk_layout_set_size:
428 * @layout: a #GtkLayout
429 * @width: width of entire scrollable area
430 * @height: height of entire scrollable area
432 * Sets the size of the scrollable area of the layout.
436 gtk_layout_set_size (GtkLayout *layout,
442 g_return_if_fail (GTK_IS_LAYOUT (layout));
444 widget = GTK_WIDGET (layout);
446 g_object_freeze_notify (G_OBJECT (layout));
447 if (width != layout->width)
449 layout->width = width;
450 g_object_notify (G_OBJECT (layout), "width");
452 if (height != layout->height)
454 layout->height = height;
455 g_object_notify (G_OBJECT (layout), "height");
457 g_object_thaw_notify (G_OBJECT (layout));
459 gtk_layout_set_adjustment_upper (layout->hadjustment, layout->width);
460 gtk_layout_set_adjustment_upper (layout->vadjustment, layout->height);
462 if (GTK_WIDGET_REALIZED (layout))
464 width = MAX (width, widget->allocation.width);
465 height = MAX (height, widget->allocation.height);
466 gdk_window_resize (layout->bin_window, width, height);
471 * gtk_layout_get_size:
472 * @layout: a #GtkLayout
473 * @width: location to store the width set on @layout, or %NULL
474 * @height: location to store the height set on @layout, or %NULL
476 * Gets the size that has been set on the layout, and that determines
477 * the total extents of the layout's scrollbar area. See
478 * gtk_layout_set_size ().
481 gtk_layout_get_size (GtkLayout *layout,
485 g_return_if_fail (GTK_IS_LAYOUT (layout));
488 *width = layout->width;
490 *height = layout->height;
495 * @layout: a #GtkLayout
497 * This is a deprecated function, it doesn't do anything useful.
500 gtk_layout_freeze (GtkLayout *layout)
502 g_return_if_fail (GTK_IS_LAYOUT (layout));
504 layout->freeze_count++;
509 * @layout: a #GtkLayout
511 * This is a deprecated function, it doesn't do anything useful.
514 gtk_layout_thaw (GtkLayout *layout)
516 g_return_if_fail (GTK_IS_LAYOUT (layout));
518 if (layout->freeze_count)
519 if (!(--layout->freeze_count))
520 gtk_widget_draw (GTK_WIDGET (layout), NULL);
523 /* Basic Object handling procedures
526 gtk_layout_get_type (void)
528 static GtkType layout_type = 0;
532 static const GTypeInfo layout_info =
534 sizeof (GtkLayoutClass),
535 NULL, /* base_init */
536 NULL, /* base_finalize */
537 (GClassInitFunc) gtk_layout_class_init,
538 NULL, /* class_finalize */
539 NULL, /* class_data */
541 16, /* n_preallocs */
542 (GInstanceInitFunc) gtk_layout_init,
545 layout_type = g_type_register_static (GTK_TYPE_CONTAINER, "GtkLayout", &layout_info, 0);
552 gtk_layout_class_init (GtkLayoutClass *class)
554 GObjectClass *gobject_class;
555 GtkObjectClass *object_class;
556 GtkWidgetClass *widget_class;
557 GtkContainerClass *container_class;
559 gobject_class = (GObjectClass*) class;
560 object_class = (GtkObjectClass*) class;
561 widget_class = (GtkWidgetClass*) class;
562 container_class = (GtkContainerClass*) class;
564 parent_class = gtk_type_class (GTK_TYPE_CONTAINER);
566 gobject_class->set_property = gtk_layout_set_property;
567 gobject_class->get_property = gtk_layout_get_property;
568 gobject_class->finalize = gtk_layout_finalize;
570 container_class->set_child_property = gtk_layout_set_child_property;
571 container_class->get_child_property = gtk_layout_get_child_property;
573 gtk_container_class_install_child_property (container_class,
575 g_param_spec_int ("x",
577 _("X position of child widget"),
583 gtk_container_class_install_child_property (container_class,
585 g_param_spec_int ("y",
587 _("Y position of child widget"),
593 g_object_class_install_property (gobject_class,
595 g_param_spec_object ("hadjustment",
596 _("Horizontal adjustment"),
597 _("The GtkAdjustment for the horizontal position."),
601 g_object_class_install_property (gobject_class,
603 g_param_spec_object ("vadjustment",
604 _("Vertical adjustment"),
605 _("The GtkAdjustment for the vertical position."),
609 g_object_class_install_property (gobject_class,
611 g_param_spec_uint ("width",
613 _("The width of the layout."),
618 g_object_class_install_property (gobject_class,
620 g_param_spec_uint ("height",
622 _("The height of the layout."),
627 widget_class->realize = gtk_layout_realize;
628 widget_class->unrealize = gtk_layout_unrealize;
629 widget_class->map = gtk_layout_map;
630 widget_class->size_request = gtk_layout_size_request;
631 widget_class->size_allocate = gtk_layout_size_allocate;
632 widget_class->expose_event = gtk_layout_expose;
634 container_class->remove = gtk_layout_remove;
635 container_class->forall = gtk_layout_forall;
637 class->set_scroll_adjustments = gtk_layout_set_adjustments;
639 widget_class->set_scroll_adjustments_signal =
640 gtk_signal_new ("set_scroll_adjustments",
642 GTK_CLASS_TYPE (object_class),
643 GTK_SIGNAL_OFFSET (GtkLayoutClass, set_scroll_adjustments),
644 _gtk_marshal_VOID__OBJECT_OBJECT,
645 GTK_TYPE_NONE, 2, GTK_TYPE_ADJUSTMENT, GTK_TYPE_ADJUSTMENT);
649 gtk_layout_get_property (GObject *object,
654 GtkLayout *layout = GTK_LAYOUT (object);
658 case PROP_HADJUSTMENT:
659 g_value_set_object (value, layout->hadjustment);
661 case PROP_VADJUSTMENT:
662 g_value_set_object (value, layout->vadjustment);
665 g_value_set_uint (value, layout->width);
668 g_value_set_uint (value, layout->height);
671 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
677 gtk_layout_set_property (GObject *object,
682 GtkLayout *layout = GTK_LAYOUT (object);
686 case PROP_HADJUSTMENT:
687 gtk_layout_set_hadjustment (layout,
688 (GtkAdjustment*) g_value_get_object (value));
690 case PROP_VADJUSTMENT:
691 gtk_layout_set_vadjustment (layout,
692 (GtkAdjustment*) g_value_get_object (value));
695 gtk_layout_set_size (layout, g_value_get_uint (value),
699 gtk_layout_set_size (layout, layout->width,
700 g_value_get_uint (value));
703 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
709 gtk_layout_set_child_property (GtkContainer *container,
718 gtk_layout_move_internal (GTK_LAYOUT (container),
720 TRUE, g_value_get_int (value),
724 gtk_layout_move_internal (GTK_LAYOUT (container),
727 TRUE, g_value_get_int (value));
730 GTK_CONTAINER_WARN_INVALID_CHILD_PROPERTY_ID (container, property_id, pspec);
736 gtk_layout_get_child_property (GtkContainer *container,
742 GtkLayoutChild *layout_child;
744 layout_child = get_child (GTK_LAYOUT (container), child);
749 g_value_set_int (value, layout_child->x);
752 g_value_set_int (value, layout_child->y);
755 GTK_CONTAINER_WARN_INVALID_CHILD_PROPERTY_ID (container, property_id, pspec);
761 gtk_layout_init (GtkLayout *layout)
763 layout->children = NULL;
766 layout->height = 100;
768 layout->hadjustment = NULL;
769 layout->vadjustment = NULL;
771 layout->bin_window = NULL;
773 layout->scroll_x = 0;
774 layout->scroll_y = 0;
775 layout->visibility = GDK_VISIBILITY_PARTIAL;
777 layout->freeze_count = 0;
784 gtk_layout_realize (GtkWidget *widget)
788 GdkWindowAttr attributes;
789 gint attributes_mask;
791 g_return_if_fail (GTK_IS_LAYOUT (widget));
793 layout = GTK_LAYOUT (widget);
794 GTK_WIDGET_SET_FLAGS (layout, GTK_REALIZED);
796 attributes.window_type = GDK_WINDOW_CHILD;
797 attributes.x = widget->allocation.x;
798 attributes.y = widget->allocation.y;
799 attributes.width = widget->allocation.width;
800 attributes.height = widget->allocation.height;
801 attributes.wclass = GDK_INPUT_OUTPUT;
802 attributes.visual = gtk_widget_get_visual (widget);
803 attributes.colormap = gtk_widget_get_colormap (widget);
804 attributes.event_mask = GDK_VISIBILITY_NOTIFY_MASK;
806 attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP;
808 widget->window = gdk_window_new (gtk_widget_get_parent_window (widget),
809 &attributes, attributes_mask);
810 gdk_window_set_user_data (widget->window, widget);
814 attributes.width = MAX (layout->width, widget->allocation.width);
815 attributes.height = MAX (layout->height, widget->allocation.height);
816 attributes.event_mask = GDK_EXPOSURE_MASK | GDK_SCROLL_MASK |
817 gtk_widget_get_events (widget);
819 layout->bin_window = gdk_window_new (widget->window,
820 &attributes, attributes_mask);
821 gdk_window_set_user_data (layout->bin_window, widget);
823 widget->style = gtk_style_attach (widget->style, widget->window);
824 gtk_style_set_background (widget->style, widget->window, GTK_STATE_NORMAL);
825 gtk_style_set_background (widget->style, layout->bin_window, GTK_STATE_NORMAL);
827 tmp_list = layout->children;
830 GtkLayoutChild *child = tmp_list->data;
831 tmp_list = tmp_list->next;
833 gtk_widget_set_parent_window (child->widget, layout->bin_window);
838 gtk_layout_map (GtkWidget *widget)
843 g_return_if_fail (GTK_IS_LAYOUT (widget));
845 layout = GTK_LAYOUT (widget);
847 GTK_WIDGET_SET_FLAGS (widget, GTK_MAPPED);
849 tmp_list = layout->children;
852 GtkLayoutChild *child = tmp_list->data;
853 tmp_list = tmp_list->next;
855 if (GTK_WIDGET_VISIBLE (child->widget))
857 if (!GTK_WIDGET_MAPPED (child->widget))
858 gtk_widget_map (child->widget);
862 gdk_window_show (layout->bin_window);
863 gdk_window_show (widget->window);
867 gtk_layout_unrealize (GtkWidget *widget)
871 g_return_if_fail (GTK_IS_LAYOUT (widget));
873 layout = GTK_LAYOUT (widget);
875 gdk_window_set_user_data (layout->bin_window, NULL);
876 gdk_window_destroy (layout->bin_window);
877 layout->bin_window = NULL;
879 if (GTK_WIDGET_CLASS (parent_class)->unrealize)
880 (* GTK_WIDGET_CLASS (parent_class)->unrealize) (widget);
884 gtk_layout_size_request (GtkWidget *widget,
885 GtkRequisition *requisition)
890 g_return_if_fail (GTK_IS_LAYOUT (widget));
892 layout = GTK_LAYOUT (widget);
894 requisition->width = 0;
895 requisition->height = 0;
897 tmp_list = layout->children;
901 GtkLayoutChild *child = tmp_list->data;
902 GtkRequisition child_requisition;
904 tmp_list = tmp_list->next;
906 gtk_widget_size_request (child->widget, &child_requisition);
911 gtk_layout_size_allocate (GtkWidget *widget,
912 GtkAllocation *allocation)
917 g_return_if_fail (GTK_IS_LAYOUT (widget));
919 widget->allocation = *allocation;
921 layout = GTK_LAYOUT (widget);
923 tmp_list = layout->children;
927 GtkLayoutChild *child = tmp_list->data;
928 tmp_list = tmp_list->next;
930 gtk_layout_allocate_child (layout, child);
933 if (GTK_WIDGET_REALIZED (widget))
935 gdk_window_move_resize (widget->window,
936 allocation->x, allocation->y,
937 allocation->width, allocation->height);
939 gdk_window_resize (layout->bin_window,
940 MAX (layout->width, allocation->width),
941 MAX (layout->height, allocation->height));
944 layout->hadjustment->page_size = allocation->width;
945 layout->hadjustment->page_increment = allocation->width / 2;
946 layout->hadjustment->lower = 0;
947 layout->hadjustment->upper = MAX (allocation->width, layout->width);
948 gtk_signal_emit_by_name (GTK_OBJECT (layout->hadjustment), "changed");
950 layout->vadjustment->page_size = allocation->height;
951 layout->vadjustment->page_increment = allocation->height / 2;
952 layout->vadjustment->lower = 0;
953 layout->vadjustment->upper = MAX (allocation->height, layout->height);
954 gtk_signal_emit_by_name (GTK_OBJECT (layout->vadjustment), "changed");
958 gtk_layout_expose (GtkWidget *widget, GdkEventExpose *event)
962 g_return_val_if_fail (GTK_IS_LAYOUT (widget), FALSE);
964 layout = GTK_LAYOUT (widget);
966 if (event->window != layout->bin_window)
969 (* GTK_WIDGET_CLASS (parent_class)->expose_event) (widget, event);
977 gtk_layout_remove (GtkContainer *container,
982 GtkLayoutChild *child = NULL;
984 g_return_if_fail (GTK_IS_LAYOUT (container));
986 layout = GTK_LAYOUT (container);
988 tmp_list = layout->children;
991 child = tmp_list->data;
992 if (child->widget == widget)
994 tmp_list = tmp_list->next;
999 gtk_widget_unparent (widget);
1001 layout->children = g_list_remove_link (layout->children, tmp_list);
1002 g_list_free_1 (tmp_list);
1008 gtk_layout_forall (GtkContainer *container,
1009 gboolean include_internals,
1010 GtkCallback callback,
1011 gpointer callback_data)
1014 GtkLayoutChild *child;
1017 g_return_if_fail (GTK_IS_LAYOUT (container));
1018 g_return_if_fail (callback != NULL);
1020 layout = GTK_LAYOUT (container);
1022 tmp_list = layout->children;
1025 child = tmp_list->data;
1026 tmp_list = tmp_list->next;
1028 (* callback) (child->widget, callback_data);
1032 /* Operations on children
1036 gtk_layout_allocate_child (GtkLayout *layout,
1037 GtkLayoutChild *child)
1039 GtkAllocation allocation;
1040 GtkRequisition requisition;
1042 allocation.x = child->x;
1043 allocation.y = child->y;
1044 gtk_widget_get_child_requisition (child->widget, &requisition);
1045 allocation.width = requisition.width;
1046 allocation.height = requisition.height;
1048 gtk_widget_size_allocate (child->widget, &allocation);
1054 gtk_layout_adjustment_changed (GtkAdjustment *adjustment,
1059 widget = GTK_WIDGET (layout);
1061 if (layout->freeze_count)
1064 if (GTK_WIDGET_REALIZED (layout))
1066 gdk_window_move (layout->bin_window,
1067 - layout->hadjustment->value,
1068 - layout->vadjustment->value);
1070 gdk_window_process_updates (layout->bin_window, TRUE);