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.
21 * Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
22 * file for a list of people on the GTK+ Team. See the ChangeLog
23 * files for a list of changes. These files are distributed with
24 * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
29 #include "gtkmenubar.h"
31 #include "gdk/gdkkeysyms.h"
32 #include "gtkbindings.h"
34 #include "gtkmarshalers.h"
35 #include "gtkmenuitem.h"
36 #include "gtkmenuprivate.h"
37 #include "gtksettings.h"
38 #include "gtksizerequest.h"
39 #include "gtkwindow.h"
42 #include "gtkprivate.h"
44 #define BORDER_SPACING 0
45 #define DEFAULT_IPADDING 1
51 PROP_CHILD_PACK_DIRECTION
54 struct _GtkMenuBarPrivate
56 GtkPackDirection pack_direction;
57 GtkPackDirection child_pack_direction;
61 static void gtk_menu_bar_set_property (GObject *object,
65 static void gtk_menu_bar_get_property (GObject *object,
69 static void gtk_menu_bar_size_request (GtkWidget *widget,
70 GtkRequisition *requisition);
71 static void gtk_menu_bar_get_preferred_width (GtkWidget *widget,
74 static void gtk_menu_bar_get_preferred_height (GtkWidget *widget,
77 static void gtk_menu_bar_size_allocate (GtkWidget *widget,
78 GtkAllocation *allocation);
79 static gint gtk_menu_bar_draw (GtkWidget *widget,
81 static void gtk_menu_bar_hierarchy_changed (GtkWidget *widget,
82 GtkWidget *old_toplevel);
83 static gint gtk_menu_bar_get_popup_delay (GtkMenuShell *menu_shell);
84 static void gtk_menu_bar_move_current (GtkMenuShell *menu_shell,
85 GtkMenuDirectionType direction);
87 static GtkShadowType get_shadow_type (GtkMenuBar *menubar);
89 G_DEFINE_TYPE (GtkMenuBar, gtk_menu_bar, GTK_TYPE_MENU_SHELL)
92 gtk_menu_bar_class_init (GtkMenuBarClass *class)
94 GObjectClass *gobject_class;
95 GtkWidgetClass *widget_class;
96 GtkMenuShellClass *menu_shell_class;
98 GtkBindingSet *binding_set;
100 gobject_class = (GObjectClass*) class;
101 widget_class = (GtkWidgetClass*) class;
102 menu_shell_class = (GtkMenuShellClass*) class;
104 gobject_class->get_property = gtk_menu_bar_get_property;
105 gobject_class->set_property = gtk_menu_bar_set_property;
107 widget_class->get_preferred_width = gtk_menu_bar_get_preferred_width;
108 widget_class->get_preferred_height = gtk_menu_bar_get_preferred_height;
109 widget_class->size_allocate = gtk_menu_bar_size_allocate;
110 widget_class->draw = gtk_menu_bar_draw;
111 widget_class->hierarchy_changed = gtk_menu_bar_hierarchy_changed;
113 menu_shell_class->submenu_placement = GTK_TOP_BOTTOM;
114 menu_shell_class->get_popup_delay = gtk_menu_bar_get_popup_delay;
115 menu_shell_class->move_current = gtk_menu_bar_move_current;
117 binding_set = gtk_binding_set_by_class (class);
118 gtk_binding_entry_add_signal (binding_set,
121 GTK_TYPE_MENU_DIRECTION_TYPE,
123 gtk_binding_entry_add_signal (binding_set,
126 GTK_TYPE_MENU_DIRECTION_TYPE,
128 gtk_binding_entry_add_signal (binding_set,
131 GTK_TYPE_MENU_DIRECTION_TYPE,
133 gtk_binding_entry_add_signal (binding_set,
136 GTK_TYPE_MENU_DIRECTION_TYPE,
138 gtk_binding_entry_add_signal (binding_set,
141 GTK_TYPE_MENU_DIRECTION_TYPE,
142 GTK_MENU_DIR_PARENT);
143 gtk_binding_entry_add_signal (binding_set,
146 GTK_TYPE_MENU_DIRECTION_TYPE,
147 GTK_MENU_DIR_PARENT);
148 gtk_binding_entry_add_signal (binding_set,
151 GTK_TYPE_MENU_DIRECTION_TYPE,
153 gtk_binding_entry_add_signal (binding_set,
156 GTK_TYPE_MENU_DIRECTION_TYPE,
160 * GtkMenuBar:pack-direction:
162 * The pack direction of the menubar. It determines how
163 * menuitems are arranged in the menubar.
167 g_object_class_install_property (gobject_class,
169 g_param_spec_enum ("pack-direction",
170 P_("Pack direction"),
171 P_("The pack direction of the menubar"),
172 GTK_TYPE_PACK_DIRECTION,
173 GTK_PACK_DIRECTION_LTR,
174 GTK_PARAM_READWRITE));
177 * GtkMenuBar:child-pack-direction:
179 * The child pack direction of the menubar. It determines how
180 * the widgets contained in child menuitems are arranged.
184 g_object_class_install_property (gobject_class,
185 PROP_CHILD_PACK_DIRECTION,
186 g_param_spec_enum ("child-pack-direction",
187 P_("Child Pack direction"),
188 P_("The child pack direction of the menubar"),
189 GTK_TYPE_PACK_DIRECTION,
190 GTK_PACK_DIRECTION_LTR,
191 GTK_PARAM_READWRITE));
194 gtk_widget_class_install_style_property (widget_class,
195 g_param_spec_enum ("shadow-type",
197 P_("Style of bevel around the menubar"),
198 GTK_TYPE_SHADOW_TYPE,
200 GTK_PARAM_READABLE));
202 gtk_widget_class_install_style_property (widget_class,
203 g_param_spec_int ("internal-padding",
204 P_("Internal padding"),
205 P_("Amount of border space between the menubar shadow and the menu items"),
209 GTK_PARAM_READABLE));
211 g_type_class_add_private (gobject_class, sizeof (GtkMenuBarPrivate));
215 gtk_menu_bar_init (GtkMenuBar *menu_bar)
217 menu_bar->priv = G_TYPE_INSTANCE_GET_PRIVATE (menu_bar,
223 gtk_menu_bar_new (void)
225 return g_object_new (GTK_TYPE_MENU_BAR, NULL);
229 gtk_menu_bar_set_property (GObject *object,
234 GtkMenuBar *menubar = GTK_MENU_BAR (object);
238 case PROP_PACK_DIRECTION:
239 gtk_menu_bar_set_pack_direction (menubar, g_value_get_enum (value));
241 case PROP_CHILD_PACK_DIRECTION:
242 gtk_menu_bar_set_child_pack_direction (menubar, g_value_get_enum (value));
245 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
251 gtk_menu_bar_get_property (GObject *object,
256 GtkMenuBar *menubar = GTK_MENU_BAR (object);
260 case PROP_PACK_DIRECTION:
261 g_value_set_enum (value, gtk_menu_bar_get_pack_direction (menubar));
263 case PROP_CHILD_PACK_DIRECTION:
264 g_value_set_enum (value, gtk_menu_bar_get_child_pack_direction (menubar));
267 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
273 gtk_menu_bar_size_request (GtkWidget *widget,
274 GtkRequisition *requisition)
276 GtkMenuBar *menu_bar;
277 GtkMenuBarPrivate *priv;
278 GtkMenuShell *menu_shell;
282 GtkRequisition child_requisition;
286 g_return_if_fail (GTK_IS_MENU_BAR (widget));
287 g_return_if_fail (requisition != NULL);
289 requisition->width = 0;
290 requisition->height = 0;
292 if (gtk_widget_get_visible (widget))
294 menu_bar = GTK_MENU_BAR (widget);
295 menu_shell = GTK_MENU_SHELL (widget);
296 priv = menu_bar->priv;
299 children = menu_shell->children;
303 child = children->data;
304 children = children->next;
306 if (gtk_widget_get_visible (child))
310 GTK_MENU_ITEM (child)->show_submenu_indicator = FALSE;
311 gtk_widget_get_preferred_size (child, &child_requisition, NULL);
312 gtk_menu_item_toggle_size_request (GTK_MENU_ITEM (child),
315 if (priv->child_pack_direction == GTK_PACK_DIRECTION_LTR ||
316 priv->child_pack_direction == GTK_PACK_DIRECTION_RTL)
317 child_requisition.width += toggle_size;
319 child_requisition.height += toggle_size;
321 if (priv->pack_direction == GTK_PACK_DIRECTION_LTR ||
322 priv->pack_direction == GTK_PACK_DIRECTION_RTL)
324 requisition->width += child_requisition.width;
325 requisition->height = MAX (requisition->height, child_requisition.height);
329 requisition->width = MAX (requisition->width, child_requisition.width);
330 requisition->height += child_requisition.height;
336 gtk_widget_style_get (widget, "internal-padding", &ipadding, NULL);
338 border_width = gtk_container_get_border_width (GTK_CONTAINER (menu_bar));
339 requisition->width += (border_width +
342 requisition->height += (border_width +
346 if (get_shadow_type (menu_bar) != GTK_SHADOW_NONE)
350 style = gtk_widget_get_style (widget);
351 requisition->width += style->xthickness * 2;
352 requisition->height += style->ythickness * 2;
358 gtk_menu_bar_get_preferred_width (GtkWidget *widget,
362 GtkRequisition requisition;
364 gtk_menu_bar_size_request (widget, &requisition);
366 *minimum = *natural = requisition.width;
370 gtk_menu_bar_get_preferred_height (GtkWidget *widget,
374 GtkRequisition requisition;
376 gtk_menu_bar_size_request (widget, &requisition);
378 *minimum = *natural = requisition.height;
382 gtk_menu_bar_size_allocate (GtkWidget *widget,
383 GtkAllocation *allocation)
385 GtkMenuBar *menu_bar;
386 GtkMenuShell *menu_shell;
387 GtkMenuBarPrivate *priv;
390 GtkAllocation child_allocation;
391 GtkRequisition child_requisition;
393 GtkTextDirection direction;
398 g_return_if_fail (GTK_IS_MENU_BAR (widget));
399 g_return_if_fail (allocation != NULL);
401 menu_bar = GTK_MENU_BAR (widget);
402 menu_shell = GTK_MENU_SHELL (widget);
403 priv = menu_bar->priv;
405 direction = gtk_widget_get_direction (widget);
407 gtk_widget_set_allocation (widget, allocation);
409 if (gtk_widget_get_realized (widget))
410 gdk_window_move_resize (gtk_widget_get_window (widget),
411 allocation->x, allocation->y,
412 allocation->width, allocation->height);
414 gtk_widget_style_get (widget, "internal-padding", &ipadding, NULL);
416 if (menu_shell->children)
418 border_width = gtk_container_get_border_width (GTK_CONTAINER (menu_bar));
419 child_allocation.x = (border_width +
422 child_allocation.y = (border_width +
425 if (get_shadow_type (menu_bar) != GTK_SHADOW_NONE)
429 style = gtk_widget_get_style (widget);
430 child_allocation.x += style->xthickness;
431 child_allocation.y += style->ythickness;
434 if (priv->pack_direction == GTK_PACK_DIRECTION_LTR ||
435 priv->pack_direction == GTK_PACK_DIRECTION_RTL)
437 child_allocation.height = MAX (1, (gint)allocation->height - child_allocation.y * 2);
439 offset = child_allocation.x; /* Window edge to menubar start */
440 ltr_x = child_allocation.x;
442 children = menu_shell->children;
447 child = children->data;
448 children = children->next;
450 gtk_menu_item_toggle_size_request (GTK_MENU_ITEM (child),
452 gtk_widget_get_preferred_size (child, &child_requisition, NULL);
454 if (priv->child_pack_direction == GTK_PACK_DIRECTION_LTR ||
455 priv->child_pack_direction == GTK_PACK_DIRECTION_RTL)
456 child_requisition.width += toggle_size;
458 child_requisition.height += toggle_size;
460 /* Support for the right justified help menu */
461 if ((children == NULL) && (GTK_IS_MENU_ITEM(child))
462 && (GTK_MENU_ITEM(child)->right_justify))
464 ltr_x = allocation->width -
465 child_requisition.width - offset;
467 if (gtk_widget_get_visible (child))
469 if ((direction == GTK_TEXT_DIR_LTR) == (priv->pack_direction == GTK_PACK_DIRECTION_LTR))
470 child_allocation.x = ltr_x;
472 child_allocation.x = allocation->width -
473 child_requisition.width - ltr_x;
475 child_allocation.width = child_requisition.width;
477 gtk_menu_item_toggle_size_allocate (GTK_MENU_ITEM (child),
479 gtk_widget_size_allocate (child, &child_allocation);
481 ltr_x += child_allocation.width;
487 child_allocation.width = MAX (1, (gint)allocation->width - child_allocation.x * 2);
489 offset = child_allocation.y; /* Window edge to menubar start */
490 ltr_y = child_allocation.y;
492 children = menu_shell->children;
497 child = children->data;
498 children = children->next;
500 gtk_menu_item_toggle_size_request (GTK_MENU_ITEM (child),
502 gtk_widget_get_preferred_size (child, &child_requisition, NULL);
504 if (priv->child_pack_direction == GTK_PACK_DIRECTION_LTR ||
505 priv->child_pack_direction == GTK_PACK_DIRECTION_RTL)
506 child_requisition.width += toggle_size;
508 child_requisition.height += toggle_size;
510 /* Support for the right justified help menu */
511 if ((children == NULL) && (GTK_IS_MENU_ITEM(child))
512 && (GTK_MENU_ITEM(child)->right_justify))
514 ltr_y = allocation->height -
515 child_requisition.height - offset;
517 if (gtk_widget_get_visible (child))
519 if ((direction == GTK_TEXT_DIR_LTR) ==
520 (priv->pack_direction == GTK_PACK_DIRECTION_TTB))
521 child_allocation.y = ltr_y;
523 child_allocation.y = allocation->height -
524 child_requisition.height - ltr_y;
525 child_allocation.height = child_requisition.height;
527 gtk_menu_item_toggle_size_allocate (GTK_MENU_ITEM (child),
529 gtk_widget_size_allocate (child, &child_allocation);
531 ltr_y += child_allocation.height;
539 gtk_menu_bar_draw (GtkWidget *widget,
544 border = gtk_container_get_border_width (GTK_CONTAINER (widget));
546 gtk_paint_box (gtk_widget_get_style (widget),
548 gtk_widget_get_state (widget),
549 get_shadow_type (GTK_MENU_BAR (widget)),
552 gtk_widget_get_allocated_width (widget) - border * 2,
553 gtk_widget_get_allocated_height (widget) - border * 2);
555 GTK_WIDGET_CLASS (gtk_menu_bar_parent_class)->draw (widget, cr);
561 get_menu_bars (GtkWindow *window)
563 return g_object_get_data (G_OBJECT (window), "gtk-menu-bar-list");
567 get_viewable_menu_bars (GtkWindow *window)
570 GList *viewable_menu_bars = NULL;
572 for (menu_bars = get_menu_bars (window);
574 menu_bars = menu_bars->next)
576 GtkWidget *widget = menu_bars->data;
577 gboolean viewable = TRUE;
581 if (!gtk_widget_get_mapped (widget))
584 widget = gtk_widget_get_parent (widget);
588 viewable_menu_bars = g_list_prepend (viewable_menu_bars, menu_bars->data);
591 return g_list_reverse (viewable_menu_bars);
595 set_menu_bars (GtkWindow *window,
598 g_object_set_data (G_OBJECT (window), I_("gtk-menu-bar-list"), menubars);
602 window_key_press_handler (GtkWidget *widget,
607 gboolean retval = FALSE;
609 g_object_get (gtk_widget_get_settings (widget),
610 "gtk-menu-bar-accel", &accel,
616 GdkModifierType mods = 0;
618 gtk_accelerator_parse (accel, &keyval, &mods);
621 g_warning ("Failed to parse menu bar accelerator '%s'\n", accel);
623 /* FIXME this is wrong, needs to be in the global accel resolution
624 * thing, to properly consider i18n etc., but that probably requires
625 * AccelGroup changes etc.
627 if (event->keyval == keyval &&
628 ((event->state & gtk_accelerator_get_default_mod_mask ()) ==
629 (mods & gtk_accelerator_get_default_mod_mask ())))
631 GList *tmp_menubars = get_viewable_menu_bars (GTK_WINDOW (widget));
634 menubars = _gtk_container_focus_sort (GTK_CONTAINER (widget), tmp_menubars,
635 GTK_DIR_TAB_FORWARD, NULL);
636 g_list_free (tmp_menubars);
640 GtkMenuShell *menu_shell = GTK_MENU_SHELL (menubars->data);
642 _gtk_menu_shell_set_keyboard_mode (menu_shell, TRUE);
643 _gtk_menu_shell_activate (menu_shell);
644 gtk_menu_shell_select_first (menu_shell, FALSE);
646 g_list_free (menubars);
659 add_to_window (GtkWindow *window,
662 GList *menubars = get_menu_bars (window);
666 g_signal_connect (window,
668 G_CALLBACK (window_key_press_handler),
672 set_menu_bars (window, g_list_prepend (menubars, menubar));
676 remove_from_window (GtkWindow *window,
679 GList *menubars = get_menu_bars (window);
681 menubars = g_list_remove (menubars, menubar);
685 g_signal_handlers_disconnect_by_func (window,
686 window_key_press_handler,
690 set_menu_bars (window, menubars);
694 gtk_menu_bar_hierarchy_changed (GtkWidget *widget,
695 GtkWidget *old_toplevel)
700 menubar = GTK_MENU_BAR (widget);
702 toplevel = gtk_widget_get_toplevel (widget);
705 remove_from_window (GTK_WINDOW (old_toplevel), menubar);
707 if (gtk_widget_is_toplevel (toplevel))
708 add_to_window (GTK_WINDOW (toplevel), menubar);
712 * _gtk_menu_bar_cycle_focus:
713 * @menubar: a #GtkMenuBar
714 * @dir: direction in which to cycle the focus
716 * Move the focus between menubars in the toplevel.
719 _gtk_menu_bar_cycle_focus (GtkMenuBar *menubar,
720 GtkDirectionType dir)
722 GtkWidget *toplevel = gtk_widget_get_toplevel (GTK_WIDGET (menubar));
723 GtkMenuItem *to_activate = NULL;
725 if (gtk_widget_is_toplevel (toplevel))
727 GList *tmp_menubars = get_viewable_menu_bars (GTK_WINDOW (toplevel));
731 menubars = _gtk_container_focus_sort (GTK_CONTAINER (toplevel), tmp_menubars,
732 dir, GTK_WIDGET (menubar));
733 g_list_free (tmp_menubars);
737 current = g_list_find (menubars, menubar);
739 if (current && current->next)
741 GtkMenuShell *new_menushell = GTK_MENU_SHELL (current->next->data);
742 if (new_menushell->children)
743 to_activate = new_menushell->children->data;
747 g_list_free (menubars);
750 gtk_menu_shell_cancel (GTK_MENU_SHELL (menubar));
753 g_signal_emit_by_name (to_activate, "activate_item");
757 get_shadow_type (GtkMenuBar *menubar)
759 GtkShadowType shadow_type = GTK_SHADOW_OUT;
761 gtk_widget_style_get (GTK_WIDGET (menubar),
762 "shadow-type", &shadow_type,
769 gtk_menu_bar_get_popup_delay (GtkMenuShell *menu_shell)
773 g_object_get (gtk_widget_get_settings (GTK_WIDGET (menu_shell)),
774 "gtk-menu-bar-popup-delay", &popup_delay,
781 gtk_menu_bar_move_current (GtkMenuShell *menu_shell,
782 GtkMenuDirectionType direction)
784 GtkMenuBar *menubar = GTK_MENU_BAR (menu_shell);
785 GtkTextDirection text_dir;
786 GtkPackDirection pack_dir;
788 text_dir = gtk_widget_get_direction (GTK_WIDGET (menubar));
789 pack_dir = gtk_menu_bar_get_pack_direction (menubar);
791 if (pack_dir == GTK_PACK_DIRECTION_LTR || pack_dir == GTK_PACK_DIRECTION_RTL)
793 if ((text_dir == GTK_TEXT_DIR_RTL) == (pack_dir == GTK_PACK_DIRECTION_LTR))
797 case GTK_MENU_DIR_PREV:
798 direction = GTK_MENU_DIR_NEXT;
800 case GTK_MENU_DIR_NEXT:
801 direction = GTK_MENU_DIR_PREV;
811 case GTK_MENU_DIR_PARENT:
812 if ((text_dir == GTK_TEXT_DIR_LTR) == (pack_dir == GTK_PACK_DIRECTION_TTB))
813 direction = GTK_MENU_DIR_PREV;
815 direction = GTK_MENU_DIR_NEXT;
817 case GTK_MENU_DIR_CHILD:
818 if ((text_dir == GTK_TEXT_DIR_LTR) == (pack_dir == GTK_PACK_DIRECTION_TTB))
819 direction = GTK_MENU_DIR_NEXT;
821 direction = GTK_MENU_DIR_PREV;
823 case GTK_MENU_DIR_PREV:
824 if (text_dir == GTK_TEXT_DIR_RTL)
825 direction = GTK_MENU_DIR_CHILD;
827 direction = GTK_MENU_DIR_PARENT;
829 case GTK_MENU_DIR_NEXT:
830 if (text_dir == GTK_TEXT_DIR_RTL)
831 direction = GTK_MENU_DIR_PARENT;
833 direction = GTK_MENU_DIR_CHILD;
839 GTK_MENU_SHELL_CLASS (gtk_menu_bar_parent_class)->move_current (menu_shell, direction);
843 * gtk_menu_bar_get_pack_direction:
844 * @menubar: a #GtkMenuBar
846 * Retrieves the current pack direction of the menubar.
847 * See gtk_menu_bar_set_pack_direction().
849 * Return value: the pack direction
854 gtk_menu_bar_get_pack_direction (GtkMenuBar *menubar)
856 g_return_val_if_fail (GTK_IS_MENU_BAR (menubar),
857 GTK_PACK_DIRECTION_LTR);
859 return menubar->priv->pack_direction;
863 * gtk_menu_bar_set_pack_direction:
864 * @menubar: a #GtkMenuBar
865 * @pack_dir: a new #GtkPackDirection
867 * Sets how items should be packed inside a menubar.
872 gtk_menu_bar_set_pack_direction (GtkMenuBar *menubar,
873 GtkPackDirection pack_dir)
875 GtkMenuBarPrivate *priv;
878 g_return_if_fail (GTK_IS_MENU_BAR (menubar));
880 priv = menubar->priv;
882 if (priv->pack_direction != pack_dir)
884 priv->pack_direction = pack_dir;
886 gtk_widget_queue_resize (GTK_WIDGET (menubar));
888 for (l = GTK_MENU_SHELL (menubar)->children; l; l = l->next)
889 gtk_widget_queue_resize (GTK_WIDGET (l->data));
891 g_object_notify (G_OBJECT (menubar), "pack-direction");
896 * gtk_menu_bar_get_child_pack_direction:
897 * @menubar: a #GtkMenuBar
899 * Retrieves the current child pack direction of the menubar.
900 * See gtk_menu_bar_set_child_pack_direction().
902 * Return value: the child pack direction
907 gtk_menu_bar_get_child_pack_direction (GtkMenuBar *menubar)
909 g_return_val_if_fail (GTK_IS_MENU_BAR (menubar),
910 GTK_PACK_DIRECTION_LTR);
912 return menubar->priv->child_pack_direction;
916 * gtk_menu_bar_set_child_pack_direction:
917 * @menubar: a #GtkMenuBar
918 * @child_pack_dir: a new #GtkPackDirection
920 * Sets how widgets should be packed inside the children of a menubar.
925 gtk_menu_bar_set_child_pack_direction (GtkMenuBar *menubar,
926 GtkPackDirection child_pack_dir)
928 GtkMenuBarPrivate *priv;
931 g_return_if_fail (GTK_IS_MENU_BAR (menubar));
933 priv = menubar->priv;
935 if (priv->child_pack_direction != child_pack_dir)
937 priv->child_pack_direction = child_pack_dir;
939 gtk_widget_queue_resize (GTK_WIDGET (menubar));
941 for (l = GTK_MENU_SHELL (menubar)->children; l; l = l->next)
942 gtk_widget_queue_resize (GTK_WIDGET (l->data));
944 g_object_notify (G_OBJECT (menubar), "child-pack-direction");