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/.
33 #undef GTK_DISABLE_DEPRECATED
35 #include "gtklayout.h"
37 #include "gdkconfig.h"
39 #include "gtkprivate.h"
41 #include "gtkmarshalers.h"
42 #include "gtkscrollable.h"
45 typedef struct _GtkLayoutChild GtkLayoutChild;
47 struct _GtkLayoutPrivate
53 GtkAdjustment *hadjustment;
54 GtkAdjustment *vadjustment;
58 GdkVisibilityState visibility;
59 GdkWindow *bin_window;
69 struct _GtkLayoutChild {
89 static void gtk_layout_get_property (GObject *object,
93 static void gtk_layout_set_property (GObject *object,
97 static void gtk_layout_finalize (GObject *object);
98 static void gtk_layout_realize (GtkWidget *widget);
99 static void gtk_layout_unrealize (GtkWidget *widget);
100 static void gtk_layout_map (GtkWidget *widget);
101 static void gtk_layout_size_request (GtkWidget *widget,
102 GtkRequisition *requisition);
103 static void gtk_layout_size_allocate (GtkWidget *widget,
104 GtkAllocation *allocation);
105 static gint gtk_layout_draw (GtkWidget *widget,
107 static void gtk_layout_add (GtkContainer *container,
109 static void gtk_layout_remove (GtkContainer *container,
111 static void gtk_layout_forall (GtkContainer *container,
112 gboolean include_internals,
113 GtkCallback callback,
114 gpointer callback_data);
115 static void gtk_layout_set_child_property (GtkContainer *container,
120 static void gtk_layout_get_child_property (GtkContainer *container,
125 static void gtk_layout_allocate_child (GtkLayout *layout,
126 GtkLayoutChild *child);
127 static void gtk_layout_adjustment_changed (GtkAdjustment *adjustment,
129 static void gtk_layout_style_set (GtkWidget *widget,
130 GtkStyle *old_style);
132 static void gtk_layout_set_hadjustment_values (GtkLayout *layout);
133 static void gtk_layout_set_vadjustment_values (GtkLayout *layout);
135 G_DEFINE_TYPE_WITH_CODE (GtkLayout, gtk_layout, GTK_TYPE_CONTAINER,
136 G_IMPLEMENT_INTERFACE (GTK_TYPE_SCROLLABLE, NULL))
142 * @hadjustment: (allow-none): horizontal scroll adjustment, or %NULL
143 * @vadjustment: (allow-none): vertical scroll adjustment, or %NULL
145 * Creates a new #GtkLayout. Unless you have a specific adjustment
146 * you'd like the layout to use for scrolling, pass %NULL for
147 * @hadjustment and @vadjustment.
149 * Return value: a new #GtkLayout
153 gtk_layout_new (GtkAdjustment *hadjustment,
154 GtkAdjustment *vadjustment)
158 layout = g_object_new (GTK_TYPE_LAYOUT,
159 "hadjustment", hadjustment,
160 "vadjustment", vadjustment,
163 return GTK_WIDGET (layout);
167 * gtk_layout_get_bin_window:
168 * @layout: a #GtkLayout
170 * Retrieve the bin window of the layout used for drawing operations.
172 * Return value: (transfer none): a #GdkWindow
177 gtk_layout_get_bin_window (GtkLayout *layout)
179 g_return_val_if_fail (GTK_IS_LAYOUT (layout), NULL);
181 return layout->priv->bin_window;
185 * gtk_layout_get_hadjustment:
186 * @layout: a #GtkLayout
188 * This function should only be called after the layout has been
189 * placed in a #GtkScrolledWindow or otherwise configured for
190 * scrolling. It returns the #GtkAdjustment used for communication
191 * between the horizontal scrollbar and @layout.
193 * See #GtkScrolledWindow, #GtkScrollbar, #GtkAdjustment for details.
195 * Return value: (transfer none): horizontal scroll adjustment
197 * Deprecated: 3.0: Use gtk_scrollable_get_hadjustment()
200 gtk_layout_get_hadjustment (GtkLayout *layout)
202 g_return_val_if_fail (GTK_IS_LAYOUT (layout), NULL);
204 return layout->priv->hadjustment;
207 * gtk_layout_get_vadjustment:
208 * @layout: a #GtkLayout
210 * This function should only be called after the layout has been
211 * placed in a #GtkScrolledWindow or otherwise configured for
212 * scrolling. It returns the #GtkAdjustment used for communication
213 * between the vertical scrollbar and @layout.
215 * See #GtkScrolledWindow, #GtkScrollbar, #GtkAdjustment for details.
217 * Return value: (transfer none): vertical scroll adjustment
219 * Deprecated: 3.0: Use gtk_scrollable_get_vadjustment()
222 gtk_layout_get_vadjustment (GtkLayout *layout)
224 g_return_val_if_fail (GTK_IS_LAYOUT (layout), NULL);
226 return layout->priv->vadjustment;
230 gtk_layout_set_hadjustment_values (GtkLayout *layout)
232 GtkLayoutPrivate *priv = layout->priv;
233 GtkAllocation allocation;
234 GtkAdjustment *adj = priv->hadjustment;
239 gtk_widget_get_allocation (GTK_WIDGET (layout), &allocation);
241 old_value = gtk_adjustment_get_value (adj);
242 new_upper = MAX (allocation.width, priv->width);
247 "page-size", (gdouble)allocation.width,
248 "step-increment", allocation.width * 0.1,
249 "page-increment", allocation.width * 0.9,
252 new_value = CLAMP (old_value, 0, new_upper - allocation.width);
253 if (new_value != old_value)
254 gtk_adjustment_set_value (adj, new_value);
258 gtk_layout_set_vadjustment_values (GtkLayout *layout)
260 GtkAllocation allocation;
261 GtkAdjustment *adj = layout->priv->vadjustment;
266 gtk_widget_get_allocation (GTK_WIDGET (layout), &allocation);
268 old_value = gtk_adjustment_get_value (adj);
269 new_upper = MAX (allocation.height, layout->priv->height);
274 "page-size", (gdouble)allocation.height,
275 "step-increment", allocation.height * 0.1,
276 "page-increment", allocation.height * 0.9,
279 new_value = CLAMP (old_value, 0, new_upper - allocation.height);
280 if (new_value != old_value)
281 gtk_adjustment_set_value (adj, new_value);
285 gtk_layout_finalize (GObject *object)
287 GtkLayout *layout = GTK_LAYOUT (object);
288 GtkLayoutPrivate *priv = layout->priv;
290 g_object_unref (priv->hadjustment);
291 g_object_unref (priv->vadjustment);
293 G_OBJECT_CLASS (gtk_layout_parent_class)->finalize (object);
297 * gtk_layout_set_hadjustment:
298 * @layout: a #GtkLayout
299 * @adjustment: (allow-none): new scroll adjustment
301 * Sets the horizontal scroll adjustment for the layout.
303 * See #GtkScrolledWindow, #GtkScrollbar, #GtkAdjustment for details.
305 * Deprecated: 3.0: Use gtk_scrollable_set_hadjustment()
308 gtk_layout_set_hadjustment (GtkLayout *layout,
309 GtkAdjustment *adjustment)
311 GtkLayoutPrivate *priv;
313 g_return_if_fail (GTK_IS_LAYOUT (layout));
314 g_return_if_fail (adjustment == NULL || GTK_IS_ADJUSTMENT (adjustment));
318 if (adjustment && priv->hadjustment == adjustment)
321 if (priv->hadjustment != NULL)
323 g_signal_handlers_disconnect_by_func (priv->hadjustment,
324 gtk_layout_adjustment_changed,
326 g_object_unref (priv->hadjustment);
329 if (adjustment == NULL)
330 adjustment = gtk_adjustment_new (0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
332 g_signal_connect (adjustment, "value-changed",
333 G_CALLBACK (gtk_layout_adjustment_changed), layout);
334 priv->hadjustment = g_object_ref_sink (adjustment);
335 gtk_layout_set_hadjustment_values (layout);
337 g_object_notify (G_OBJECT (layout), "hadjustment");
342 * gtk_layout_set_vadjustment:
343 * @layout: a #GtkLayout
344 * @adjustment: (allow-none): new scroll adjustment
346 * Sets the vertical scroll adjustment for the layout.
348 * See #GtkScrolledWindow, #GtkScrollbar, #GtkAdjustment for details.
350 * Deprecated: 3.0: Use gtk_scrollable_set_vadjustment()
353 gtk_layout_set_vadjustment (GtkLayout *layout,
354 GtkAdjustment *adjustment)
356 GtkLayoutPrivate *priv;
358 g_return_if_fail (GTK_IS_LAYOUT (layout));
359 g_return_if_fail (adjustment == NULL || GTK_IS_ADJUSTMENT (adjustment));
363 if (adjustment && priv->vadjustment == adjustment)
366 if (priv->vadjustment != NULL)
368 g_signal_handlers_disconnect_by_func (priv->vadjustment,
369 gtk_layout_adjustment_changed,
371 g_object_unref (priv->vadjustment);
374 if (adjustment == NULL)
375 adjustment = gtk_adjustment_new (0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
377 g_signal_connect (adjustment, "value-changed",
378 G_CALLBACK (gtk_layout_adjustment_changed), layout);
379 priv->vadjustment = g_object_ref_sink (adjustment);
380 gtk_layout_set_vadjustment_values (layout);
382 g_object_notify (G_OBJECT (layout), "vadjustment");
385 static GtkLayoutChild*
386 get_child (GtkLayout *layout,
389 GtkLayoutPrivate *priv = layout->priv;
392 children = priv->children;
395 GtkLayoutChild *child;
397 child = children->data;
398 children = children->next;
400 if (child->widget == widget)
409 * @layout: a #GtkLayout
410 * @child_widget: child widget
411 * @x: X position of child widget
412 * @y: Y position of child widget
414 * Adds @child_widget to @layout, at position (@x,@y).
415 * @layout becomes the new parent container of @child_widget.
419 gtk_layout_put (GtkLayout *layout,
420 GtkWidget *child_widget,
424 GtkLayoutPrivate *priv;
425 GtkLayoutChild *child;
427 g_return_if_fail (GTK_IS_LAYOUT (layout));
428 g_return_if_fail (GTK_IS_WIDGET (child_widget));
432 child = g_new (GtkLayoutChild, 1);
434 child->widget = child_widget;
438 priv->children = g_list_append (priv->children, child);
440 if (gtk_widget_get_realized (GTK_WIDGET (layout)))
441 gtk_widget_set_parent_window (child->widget, priv->bin_window);
443 gtk_widget_set_parent (child_widget, GTK_WIDGET (layout));
447 gtk_layout_move_internal (GtkLayout *layout,
454 GtkLayoutChild *child;
456 child = get_child (layout, widget);
460 gtk_widget_freeze_child_notify (widget);
465 gtk_widget_child_notify (widget, "x");
471 gtk_widget_child_notify (widget, "y");
474 gtk_widget_thaw_child_notify (widget);
476 if (gtk_widget_get_visible (widget) &&
477 gtk_widget_get_visible (GTK_WIDGET (layout)))
478 gtk_widget_queue_resize (widget);
483 * @layout: a #GtkLayout
484 * @child_widget: a current child of @layout
485 * @x: X position to move to
486 * @y: Y position to move to
488 * Moves a current child of @layout to a new position.
492 gtk_layout_move (GtkLayout *layout,
493 GtkWidget *child_widget,
497 g_return_if_fail (GTK_IS_LAYOUT (layout));
498 g_return_if_fail (GTK_IS_WIDGET (child_widget));
499 g_return_if_fail (gtk_widget_get_parent (child_widget) == GTK_WIDGET (layout));
501 gtk_layout_move_internal (layout, child_widget, TRUE, x, TRUE, y);
505 * gtk_layout_set_size:
506 * @layout: a #GtkLayout
507 * @width: width of entire scrollable area
508 * @height: height of entire scrollable area
510 * Sets the size of the scrollable area of the layout.
514 gtk_layout_set_size (GtkLayout *layout,
518 GtkLayoutPrivate *priv;
521 g_return_if_fail (GTK_IS_LAYOUT (layout));
524 widget = GTK_WIDGET (layout);
526 g_object_freeze_notify (G_OBJECT (layout));
527 if (width != priv->width)
530 g_object_notify (G_OBJECT (layout), "width");
532 if (height != priv->height)
534 priv->height = height;
535 g_object_notify (G_OBJECT (layout), "height");
537 g_object_thaw_notify (G_OBJECT (layout));
539 if (gtk_widget_get_realized (widget))
541 GtkAllocation allocation;
543 gtk_widget_get_allocation (widget, &allocation);
544 width = MAX (width, allocation.width);
545 height = MAX (height, allocation.height);
546 gdk_window_resize (priv->bin_window, width, height);
549 gtk_layout_set_hadjustment_values (layout);
550 gtk_layout_set_vadjustment_values (layout);
554 * gtk_layout_get_size:
555 * @layout: a #GtkLayout
556 * @width: (allow-none): location to store the width set on @layout, or %NULL
557 * @height: (allow-none): location to store the height set on @layout, or %NULL
559 * Gets the size that has been set on the layout, and that determines
560 * the total extents of the layout's scrollbar area. See
561 * gtk_layout_set_size ().
564 gtk_layout_get_size (GtkLayout *layout,
568 GtkLayoutPrivate *priv;
570 g_return_if_fail (GTK_IS_LAYOUT (layout));
575 *width = priv->width;
577 *height = priv->height;
580 /* Basic Object handling procedures
583 gtk_layout_class_init (GtkLayoutClass *class)
585 GObjectClass *gobject_class;
586 GtkWidgetClass *widget_class;
587 GtkContainerClass *container_class;
589 gobject_class = (GObjectClass*) class;
590 widget_class = (GtkWidgetClass*) class;
591 container_class = (GtkContainerClass*) class;
593 gobject_class->set_property = gtk_layout_set_property;
594 gobject_class->get_property = gtk_layout_get_property;
595 gobject_class->finalize = gtk_layout_finalize;
597 container_class->set_child_property = gtk_layout_set_child_property;
598 container_class->get_child_property = gtk_layout_get_child_property;
600 gtk_container_class_install_child_property (container_class,
602 g_param_spec_int ("x",
604 P_("X position of child widget"),
608 GTK_PARAM_READWRITE));
610 gtk_container_class_install_child_property (container_class,
612 g_param_spec_int ("y",
614 P_("Y position of child widget"),
618 GTK_PARAM_READWRITE));
620 /* Scrollable interface */
621 g_object_class_override_property (gobject_class, PROP_HADJUSTMENT, "hadjustment");
622 g_object_class_override_property (gobject_class, PROP_VADJUSTMENT, "vadjustment");
624 g_object_class_install_property (gobject_class,
626 g_param_spec_uint ("width",
628 P_("The width of the layout"),
632 GTK_PARAM_READWRITE));
633 g_object_class_install_property (gobject_class,
635 g_param_spec_uint ("height",
637 P_("The height of the layout"),
641 GTK_PARAM_READWRITE));
642 widget_class->realize = gtk_layout_realize;
643 widget_class->unrealize = gtk_layout_unrealize;
644 widget_class->map = gtk_layout_map;
645 widget_class->size_request = gtk_layout_size_request;
646 widget_class->size_allocate = gtk_layout_size_allocate;
647 widget_class->draw = gtk_layout_draw;
648 widget_class->style_set = gtk_layout_style_set;
650 container_class->add = gtk_layout_add;
651 container_class->remove = gtk_layout_remove;
652 container_class->forall = gtk_layout_forall;
654 g_type_class_add_private (class, sizeof (GtkLayoutPrivate));
658 gtk_layout_get_property (GObject *object,
663 GtkLayout *layout = GTK_LAYOUT (object);
664 GtkLayoutPrivate *priv = layout->priv;
668 case PROP_HADJUSTMENT:
669 g_value_set_object (value, priv->hadjustment);
671 case PROP_VADJUSTMENT:
672 g_value_set_object (value, priv->vadjustment);
675 g_value_set_uint (value, priv->width);
678 g_value_set_uint (value, priv->height);
681 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
687 gtk_layout_set_property (GObject *object,
692 GtkLayout *layout = GTK_LAYOUT (object);
693 GtkLayoutPrivate *priv = layout->priv;
697 case PROP_HADJUSTMENT:
698 gtk_layout_set_hadjustment (layout,
699 (GtkAdjustment*) g_value_get_object (value));
701 case PROP_VADJUSTMENT:
702 gtk_layout_set_vadjustment (layout,
703 (GtkAdjustment*) g_value_get_object (value));
706 gtk_layout_set_size (layout, g_value_get_uint (value),
710 gtk_layout_set_size (layout, priv->width,
711 g_value_get_uint (value));
714 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
720 gtk_layout_set_child_property (GtkContainer *container,
729 gtk_layout_move_internal (GTK_LAYOUT (container),
731 TRUE, g_value_get_int (value),
735 gtk_layout_move_internal (GTK_LAYOUT (container),
738 TRUE, g_value_get_int (value));
741 GTK_CONTAINER_WARN_INVALID_CHILD_PROPERTY_ID (container, property_id, pspec);
747 gtk_layout_get_child_property (GtkContainer *container,
753 GtkLayoutChild *layout_child;
755 layout_child = get_child (GTK_LAYOUT (container), child);
760 g_value_set_int (value, layout_child->x);
763 g_value_set_int (value, layout_child->y);
766 GTK_CONTAINER_WARN_INVALID_CHILD_PROPERTY_ID (container, property_id, pspec);
772 gtk_layout_init (GtkLayout *layout)
774 GtkLayoutPrivate *priv;
776 layout->priv = G_TYPE_INSTANCE_GET_PRIVATE (layout,
781 priv->children = NULL;
786 priv->hadjustment = NULL;
787 priv->vadjustment = NULL;
789 priv->bin_window = NULL;
793 priv->visibility = GDK_VISIBILITY_PARTIAL;
795 priv->freeze_count = 0;
802 gtk_layout_realize (GtkWidget *widget)
804 GtkLayout *layout = GTK_LAYOUT (widget);
805 GtkLayoutPrivate *priv = layout->priv;
806 GtkAllocation allocation;
808 GdkWindowAttr attributes;
810 gint attributes_mask;
812 gtk_widget_set_realized (widget, TRUE);
814 gtk_widget_get_allocation (widget, &allocation);
816 attributes.window_type = GDK_WINDOW_CHILD;
817 attributes.x = allocation.x;
818 attributes.y = allocation.y;
819 attributes.width = allocation.width;
820 attributes.height = allocation.height;
821 attributes.wclass = GDK_INPUT_OUTPUT;
822 attributes.visual = gtk_widget_get_visual (widget);
823 attributes.event_mask = GDK_VISIBILITY_NOTIFY_MASK;
825 attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL;
827 window = gdk_window_new (gtk_widget_get_parent_window (widget),
828 &attributes, attributes_mask);
829 gtk_widget_set_window (widget, window);
830 gdk_window_set_user_data (window, widget);
832 gtk_widget_get_allocation (widget, &allocation);
834 attributes.x = - priv->hadjustment->value,
835 attributes.y = - priv->vadjustment->value;
836 attributes.width = MAX (priv->width, allocation.width);
837 attributes.height = MAX (priv->height, allocation.height);
838 attributes.event_mask = GDK_EXPOSURE_MASK | GDK_SCROLL_MASK |
839 gtk_widget_get_events (widget);
841 priv->bin_window = gdk_window_new (window,
842 &attributes, attributes_mask);
843 gdk_window_set_user_data (priv->bin_window, widget);
845 gtk_widget_style_attach (widget);
846 gtk_style_set_background (gtk_widget_get_style (widget), priv->bin_window, GTK_STATE_NORMAL);
848 tmp_list = priv->children;
851 GtkLayoutChild *child = tmp_list->data;
852 tmp_list = tmp_list->next;
854 gtk_widget_set_parent_window (child->widget, priv->bin_window);
859 gtk_layout_style_set (GtkWidget *widget,
862 GtkLayoutPrivate *priv;
864 GTK_WIDGET_CLASS (gtk_layout_parent_class)->style_set (widget, old_style);
866 if (gtk_widget_get_realized (widget))
868 priv = GTK_LAYOUT (widget)->priv;
869 gtk_style_set_background (gtk_widget_get_style (widget), priv->bin_window, GTK_STATE_NORMAL);
874 gtk_layout_map (GtkWidget *widget)
876 GtkLayout *layout = GTK_LAYOUT (widget);
877 GtkLayoutPrivate *priv = layout->priv;
880 gtk_widget_set_mapped (widget, TRUE);
882 tmp_list = priv->children;
885 GtkLayoutChild *child = tmp_list->data;
886 tmp_list = tmp_list->next;
888 if (gtk_widget_get_visible (child->widget))
890 if (!gtk_widget_get_mapped (child->widget))
891 gtk_widget_map (child->widget);
895 gdk_window_show (priv->bin_window);
896 gdk_window_show (gtk_widget_get_window (widget));
900 gtk_layout_unrealize (GtkWidget *widget)
902 GtkLayout *layout = GTK_LAYOUT (widget);
903 GtkLayoutPrivate *priv = layout->priv;
905 gdk_window_set_user_data (priv->bin_window, NULL);
906 gdk_window_destroy (priv->bin_window);
907 priv->bin_window = NULL;
909 GTK_WIDGET_CLASS (gtk_layout_parent_class)->unrealize (widget);
913 gtk_layout_size_request (GtkWidget *widget,
914 GtkRequisition *requisition)
916 requisition->width = 0;
917 requisition->height = 0;
921 gtk_layout_size_allocate (GtkWidget *widget,
922 GtkAllocation *allocation)
924 GtkLayout *layout = GTK_LAYOUT (widget);
925 GtkLayoutPrivate *priv = layout->priv;
928 gtk_widget_set_allocation (widget, allocation);
930 tmp_list = priv->children;
934 GtkLayoutChild *child = tmp_list->data;
935 tmp_list = tmp_list->next;
937 gtk_layout_allocate_child (layout, child);
940 if (gtk_widget_get_realized (widget))
942 gdk_window_move_resize (gtk_widget_get_window (widget),
943 allocation->x, allocation->y,
944 allocation->width, allocation->height);
946 gdk_window_resize (priv->bin_window,
947 MAX (priv->width, allocation->width),
948 MAX (priv->height, allocation->height));
951 gtk_layout_set_hadjustment_values (layout);
952 gtk_layout_set_vadjustment_values (layout);
956 gtk_layout_draw (GtkWidget *widget,
959 GtkLayout *layout = GTK_LAYOUT (widget);
960 GtkLayoutPrivate *priv = layout->priv;
962 if (gtk_cairo_should_draw_window (cr, priv->bin_window))
963 GTK_WIDGET_CLASS (gtk_layout_parent_class)->draw (widget, cr);
971 gtk_layout_add (GtkContainer *container,
974 gtk_layout_put (GTK_LAYOUT (container), widget, 0, 0);
978 gtk_layout_remove (GtkContainer *container,
981 GtkLayout *layout = GTK_LAYOUT (container);
982 GtkLayoutPrivate *priv = layout->priv;
984 GtkLayoutChild *child = NULL;
986 tmp_list = priv->children;
989 child = tmp_list->data;
990 if (child->widget == widget)
992 tmp_list = tmp_list->next;
997 gtk_widget_unparent (widget);
999 priv->children = g_list_remove_link (priv->children, tmp_list);
1000 g_list_free_1 (tmp_list);
1006 gtk_layout_forall (GtkContainer *container,
1007 gboolean include_internals,
1008 GtkCallback callback,
1009 gpointer callback_data)
1011 GtkLayout *layout = GTK_LAYOUT (container);
1012 GtkLayoutPrivate *priv = layout->priv;
1013 GtkLayoutChild *child;
1016 tmp_list = priv->children;
1019 child = tmp_list->data;
1020 tmp_list = tmp_list->next;
1022 (* callback) (child->widget, callback_data);
1026 /* Operations on children
1030 gtk_layout_allocate_child (GtkLayout *layout,
1031 GtkLayoutChild *child)
1033 GtkAllocation allocation;
1034 GtkRequisition requisition;
1036 allocation.x = child->x;
1037 allocation.y = child->y;
1039 gtk_widget_get_preferred_size (child->widget, &requisition, NULL);
1040 allocation.width = requisition.width;
1041 allocation.height = requisition.height;
1043 gtk_widget_size_allocate (child->widget, &allocation);
1049 gtk_layout_adjustment_changed (GtkAdjustment *adjustment,
1052 GtkLayoutPrivate *priv = layout->priv;
1054 if (priv->freeze_count)
1057 if (gtk_widget_get_realized (GTK_WIDGET (layout)))
1059 gdk_window_move (priv->bin_window,
1060 - priv->hadjustment->value,
1061 - priv->vadjustment->value);
1063 gdk_window_process_updates (priv->bin_window, TRUE);