gtk2/gtk/gtkmenubar.c

943 lines
25 KiB
C
Raw Normal View History

1997-11-24 22:37:52 +00:00
/* GTK - The GIMP Toolkit
* Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
1997-11-24 22:37:52 +00:00
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
1997-11-24 22:37:52 +00:00
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
1997-11-24 22:37:52 +00:00
*/
/*
* Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
* file for a list of people on the GTK+ Team. See the ChangeLog
* files for a list of changes. These files are distributed with
* GTK+ at ftp://ftp.gtk.org/pub/gtk/.
*/
#define GTK_MENU_INTERNALS
#include <config.h>
Added gdk_text/string_extents() - too calculate all the metrics at once of Tue Jul 21 12:42:01 1998 Owen Taylor <otaylor@redhat.com> * gdk/gdk.h gdk/gdkfont.c: Added gdk_text/string_extents() - too calculate all the metrics at once of a string, including things which weren't calculated before. * gtk/Makefile.am gtk/gtk.h gtk/gtktearoffmenu.[ch]: New MenuItem type, that when put as the first thing in a menu, makes the menu tearoff. Currently drawn as a dashed line. * gtk/gtkmenuitem.h gtk/gtkcheckmenuitem.c: Added a flag "hide_on_activate" to the MenuItem class structure to allow check and radio buttons to be changed with <Space> without hiding the menu. * gtk/gtkaccellabel.[ch]: Added new capabilities to set a underline_group and underline_mods for the label - accelerators added in the underline group matching underline_mods will be displayed as an underline character. This doesn't work - Save As needs to be underlined as Save _As. * gtk/gtkitemfactory.c: - Create a AccelGroup for each MenuShell we create. - If an '&' appears before a character 'c' in the path, then make 'c' an accelerator in the menu's accel group, and if the menuitem is menubar <alt>C an accelerator in the itemfactory's accel group. * gtk/gtklabel.[ch]: Add support for a pattern arg - which is a string. If an '_' appears in this string, the corresponding position in the label is underlined. Add gtk_label_parse_uline() convenience function which takes a string with embedded underlines, sets the pattern and label, and returns the accelerator keyval. * gtk/gtkmenu.[ch]: Make menus no longer a toplevel widget. Instead, they create a GtkWindow and add themselves to that. (When torn off, another new feature, they create another GtkWindow to hold the torn off menu) New function gtk_menu_set_tearoff_state() * gtk/gtkenums.h gtk/gtkmenushell.[ch] gtk/gtkenums.h: Added action signals for keyboard navigation of menus. * gtk/gtkmenushell.c: Key press handler which activates bindings for navigation, and accelerators, for handling underline accelerators. Exported functions to select and activate menu items in a menushell. * gtk/testgtk.c: Added a new "Item Factory" test which tests GtkItemFactory and the new keyboard navigation of menus.
1998-08-12 16:49:13 +00:00
#include "gdk/gdkkeysyms.h"
#include "gtkbindings.h"
1997-11-24 22:37:52 +00:00
#include "gtkmain.h"
#include "gtkmarshalers.h"
1997-11-24 22:37:52 +00:00
#include "gtkmenubar.h"
#include "gtkmenuitem.h"
fix warning 2001-04-27 Havoc Pennington <hp@redhat.com> * gtk/gtkcombo.c (gtk_combo_popup_button_press): fix warning * gtk/gtkmessagedialog.c (gtk_message_dialog_init): make messages selectable * gtk/gtkentry.c (gtk_entry_real_insert_text): don't strip line/para separators (gtk_entry_create_layout): set single paragraph mode on the layout * gtk/gtkbutton.c (gtk_button_new_from_stock): don't put much spacing between the image and label; instead, inside a button box the button will get extra space that will go there, but if people configure button box for 0 chubbiness, then there's no spacing. * gtk/gtkbbox.c (gtk_button_box_class_init): Make child ipadding and min/max size style properties, so people can tune their chubbiness. * tests/testgtk.c (make_toolbar): remove calls to removed toolbar functions * gtk/gtktoolbar.c (gtk_toolbar_class_init): Make space_size, space_style, and button_relief into style properties, remove functions for setting them * gtk/gtkmenu.c (gtk_menu_key_press): handle menu bar accel to pop it back down * gtk/gtkoptionmenu.c (gtk_option_menu_get_props): free boxed types from gtk_widget_style_get * gtk/gtkmenubar.c (gtk_menu_bar_set_shadow_type): Remove, replace with a style property. * gdk/x11/gdkevents-x11.c: namespace the settings * gtk/gtkmenubar.c: Add F10 accelerator to move between menubars. * gtk/gtksettings.c (gtk_settings_class_init): remove code with side effects from inside g_assert(), so that G_DISABLE_ASSERT can be used. Also, translate doc strings for settings. Also, namespace the double-click-time property. Also, remove bell properties crap.
2001-04-28 00:12:47 +00:00
#include "gtksettings.h"
#include "gtkintl.h"
#include "gtkwindow.h"
#include "gtkprivate.h"
#include "gtkalias.h"
1997-11-24 22:37:52 +00:00
#define BORDER_SPACING 0
Handle case where we need to parse the xsetting as if it were an RC file 2001-05-10 Havoc Pennington <hp@redhat.com> * gtk/gtksettings.c (gtk_settings_get_property): Handle case where we need to parse the xsetting as if it were an RC file string. * gtk/gtkcolorsel.c (gtk_color_selection_class_init): load initial value of palette from settings, not from static variable * gdk/x11/gdkevents-x11.c: add color palette, toolbar mode to xsettings translation table * gtk/gtktoolbar.c (gtk_toolbar_new): Remove arguments, because hardcoding the toolbar style conflicts with new customizable toolbar style philosophy (gtk_toolbar_class_init): add settings for default toolbar style; these are used unless the app specifically forces a toolbar style * gtk/gtksettings.c (settings_install_property_parser): only return at the start if we warn and parser == NULL * gtk/gtkcolorsel.c (gtk_color_selection_finalize): disconnect the palette changed handler so we don't notify dead color selections * gtk/gtkstyle.c (gtk_default_draw_shadow): handle xthickness/ythickness of 0 or 1 properly (gtk_default_draw_resize_grip): clear the background behind the resize grips, and align to bottom right if we square the area to be drawn. * gtk/gtkstatusbar.c (gtk_statusbar_init): set horizontal usize on statusbar label to 1, so it doesn't make toplevels resize oddly (gtk_statusbar_size_request): add grip size to request (gtk_statusbar_size_allocate): hack so the hbox still works with the grip size in the request * gtk/gtktoolbar.c (gtk_toolbar_show_all): override to fix bug where showing all on a toplevel makes the toolbar button text appear despite the toolbar mode * gtk/gtkmenubar.c: add internal padding style property * gtk/gtktoolbar.c: Add internal padding style property; add shadow type style property * gtk/gtkmenubar.c (gtk_menu_bar_paint): paint box with widget state; and put Container::border_width outside the frame * gtk/gtktextview.c: don't draw focus rectangle if we're in interior focus mode, we just use blinking cursor
2001-06-04 23:15:51 +00:00
#define DEFAULT_IPADDING 1
1997-11-24 22:37:52 +00:00
Support vertical menubars (#166632): 2005-02-11 Matthias Clasen <mclasen@redhat.com> Support vertical menubars (#166632): * gtk/gtkenums.h (GtkPackDirection): New enumeration for pack directions, with values for left-to-right, right-to-left, top-to-bottom and bottom-to-top. * gtk/gtk.symbols: * gtk/gtkmenubar.h: * gtk/gtkmenubar.c: Add two properties, pack-direction and child-pack-direction, which specify how children and grandchildren of a menubar are packed, with getters and setters. * gtk/gtkmenubar.c (gtk_menu_bar_set_property): (gtk_menu_bar_get_property): Implement set_property and get_property. * gtk/gtkmenubar.c (gtk_menu_bar_size_request): (gtk_menu_bar_size_allocate): Take pack direction into account. * gtk/gtkmenubar.c (gtk_menu_bar_move_current): Implement move_current here move all the menubar-specific direction tweaking from the generic menushell implementation here. * gtk/gtkmenu.c (gtk_menu_move_current): Move menu-specific direction tweaking from the generic menushell implementation here. * gtk/gtkmenuitem.c (gtk_menu_item_size_request): (gtk_menu_bar_size_allocate): Take pack direction into account. * gtk/gtkimagemenuitem.c (gtk_image_menu_item_size_request) (gtk_image_menu_item_size_allocate): (gtk_image_menu_item_toggle_size_request): Take child pack direction into account and pack the image vertically if necessary. * gtk/gtkmenushell.c (gtk_menu_shell_real_select_item): Set the submenu direction to left-right for menuitems in vertical menubars. (gtk_real_menu_shell_move_current): Simplify by moving direction tweaking to menu- and menubar-specific implementations. Take pack direction into account when doing fallbacks. * tests/testmenubars.c: Test menubars in various packing direction combinations. * tests/Makefile.am (noinst_PROGRAMS): Add testmenubars.
2005-02-11 07:15:11 +00:00
/* Properties */
enum {
PROP_0,
PROP_PACK_DIRECTION,
PROP_CHILD_PACK_DIRECTION
};
typedef struct _GtkMenuBarPrivate GtkMenuBarPrivate;
struct _GtkMenuBarPrivate
{
GtkPackDirection pack_direction;
GtkPackDirection child_pack_direction;
};
#define GTK_MENU_BAR_GET_PRIVATE(o) \
(G_TYPE_INSTANCE_GET_PRIVATE ((o), GTK_TYPE_MENU_BAR, GtkMenuBarPrivate))
static void gtk_menu_bar_set_property (GObject *object,
guint prop_id,
const GValue *value,
GParamSpec *pspec);
static void gtk_menu_bar_get_property (GObject *object,
guint prop_id,
GValue *value,
GParamSpec *pspec);
static void gtk_menu_bar_size_request (GtkWidget *widget,
GtkRequisition *requisition);
static void gtk_menu_bar_size_allocate (GtkWidget *widget,
GtkAllocation *allocation);
static void gtk_menu_bar_paint (GtkWidget *widget,
GdkRectangle *area);
static gint gtk_menu_bar_expose (GtkWidget *widget,
GdkEventExpose *event);
static void gtk_menu_bar_hierarchy_changed (GtkWidget *widget,
GtkWidget *old_toplevel);
Support vertical menubars (#166632): 2005-02-11 Matthias Clasen <mclasen@redhat.com> Support vertical menubars (#166632): * gtk/gtkenums.h (GtkPackDirection): New enumeration for pack directions, with values for left-to-right, right-to-left, top-to-bottom and bottom-to-top. * gtk/gtk.symbols: * gtk/gtkmenubar.h: * gtk/gtkmenubar.c: Add two properties, pack-direction and child-pack-direction, which specify how children and grandchildren of a menubar are packed, with getters and setters. * gtk/gtkmenubar.c (gtk_menu_bar_set_property): (gtk_menu_bar_get_property): Implement set_property and get_property. * gtk/gtkmenubar.c (gtk_menu_bar_size_request): (gtk_menu_bar_size_allocate): Take pack direction into account. * gtk/gtkmenubar.c (gtk_menu_bar_move_current): Implement move_current here move all the menubar-specific direction tweaking from the generic menushell implementation here. * gtk/gtkmenu.c (gtk_menu_move_current): Move menu-specific direction tweaking from the generic menushell implementation here. * gtk/gtkmenuitem.c (gtk_menu_item_size_request): (gtk_menu_bar_size_allocate): Take pack direction into account. * gtk/gtkimagemenuitem.c (gtk_image_menu_item_size_request) (gtk_image_menu_item_size_allocate): (gtk_image_menu_item_toggle_size_request): Take child pack direction into account and pack the image vertically if necessary. * gtk/gtkmenushell.c (gtk_menu_shell_real_select_item): Set the submenu direction to left-right for menuitems in vertical menubars. (gtk_real_menu_shell_move_current): Simplify by moving direction tweaking to menu- and menubar-specific implementations. Take pack direction into account when doing fallbacks. * tests/testmenubars.c: Test menubars in various packing direction combinations. * tests/Makefile.am (noinst_PROGRAMS): Add testmenubars.
2005-02-11 07:15:11 +00:00
static gint gtk_menu_bar_get_popup_delay (GtkMenuShell *menu_shell);
static void gtk_menu_bar_move_current (GtkMenuShell *menu_shell,
GtkMenuDirectionType direction);
fix warning 2001-04-27 Havoc Pennington <hp@redhat.com> * gtk/gtkcombo.c (gtk_combo_popup_button_press): fix warning * gtk/gtkmessagedialog.c (gtk_message_dialog_init): make messages selectable * gtk/gtkentry.c (gtk_entry_real_insert_text): don't strip line/para separators (gtk_entry_create_layout): set single paragraph mode on the layout * gtk/gtkbutton.c (gtk_button_new_from_stock): don't put much spacing between the image and label; instead, inside a button box the button will get extra space that will go there, but if people configure button box for 0 chubbiness, then there's no spacing. * gtk/gtkbbox.c (gtk_button_box_class_init): Make child ipadding and min/max size style properties, so people can tune their chubbiness. * tests/testgtk.c (make_toolbar): remove calls to removed toolbar functions * gtk/gtktoolbar.c (gtk_toolbar_class_init): Make space_size, space_style, and button_relief into style properties, remove functions for setting them * gtk/gtkmenu.c (gtk_menu_key_press): handle menu bar accel to pop it back down * gtk/gtkoptionmenu.c (gtk_option_menu_get_props): free boxed types from gtk_widget_style_get * gtk/gtkmenubar.c (gtk_menu_bar_set_shadow_type): Remove, replace with a style property. * gdk/x11/gdkevents-x11.c: namespace the settings * gtk/gtkmenubar.c: Add F10 accelerator to move between menubars. * gtk/gtksettings.c (gtk_settings_class_init): remove code with side effects from inside g_assert(), so that G_DISABLE_ASSERT can be used. Also, translate doc strings for settings. Also, namespace the double-click-time property. Also, remove bell properties crap.
2001-04-28 00:12:47 +00:00
static GtkShadowType get_shadow_type (GtkMenuBar *menubar);
1997-11-24 22:37:52 +00:00
2006-05-14 04:25:34 +00:00
G_DEFINE_TYPE (GtkMenuBar, gtk_menu_bar, GTK_TYPE_MENU_SHELL)
Document expose event->region change and that gtk_widget_event doesn't 2001-03-09 Alexander Larsson <alexl@redhat.com> * docs/Changes-2.0.txt: Document expose event->region change and that gtk_widget_event doesn't allow passing expose events. * gdk/gdkevents.h: Add region to expose event. * gdk/gdkevents.c: Handle event->region in gdk_event_copy() and gdk_event_free(). * gdk/gdkwindow.c (gdk_window_process_updates_internal): Generate expose_event->region when creating expose events. * gdk/x11/gdkevents-x11.c: Generate expose events with regions when translating X events. * gtk/gtkcontainer.[ch]: Default expose handler that propagates expose events to NO_WINDOW children. New function gtk_container_propagate_expose() * gtk/gtkwidget.[ch]: Moved gtk_widget_event implementation to gtk_widget_event_internal. gtk_widget_event calls gtk_widget_event_internal but doesn't allow expose events. New function gtk_widget_send_expose() to send expose events. New function gtk_widget_region_intersect() to calculate window/region intersections. * gtk/gtkmain.c (gtk_main_do_event): Use gdk_window_begin_paint_region() instead of gdk_window_begin_paint_rect(). Use gtk_widget_send_expose() to send expose events. * gtk/gtkbin.c: * gtk/gtkbox.c: * gtk/gtkfixed.c: * gtk/gtkimagemenuitem.c: * gtk/gtklist.c: * gtk/gtkpacker.c: * gtk/gtktable.c: * gtk/gtktree.c: Remove expose handler, using the default container implementation instead. * gtk/gtkbutton.c: * gtk/gtkcheckbutton.c: * gtk/gtkeventbox.c: * gtk/gtkfixed.c: * gtk/gtkhandlebox.c: * gtk/gtklayout.c: * gtk/gtklistitem.c: * gtk/gtkmenu.c: * gtk/gtkmenubar.c: * gtk/gtkmenuitem.c: * gtk/gtknotebook.c: * gtk/gtkoptionmenu.c: * gtk/gtkpaned.c: * gtk/gtkscrolledwindow.c: * gtk/gtktogglebutton.c: * gtk/gtktoolbar.c: * gtk/gtktreeitem.c: * gtk/gtkviewport.c: Chain expose handler to parent class handler. Use gtk_container_propagate_expose() to propagate exposes. * gtk/gtkclist.c (check_exposures): * gtk/gtktext.c (process_exposes): Use gtk_widget_send_expose instead of gtk_widget_event.
2001-03-09 13:28:26 +00:00
1997-11-24 22:37:52 +00:00
static void
gtk_menu_bar_class_init (GtkMenuBarClass *class)
{
Support vertical menubars (#166632): 2005-02-11 Matthias Clasen <mclasen@redhat.com> Support vertical menubars (#166632): * gtk/gtkenums.h (GtkPackDirection): New enumeration for pack directions, with values for left-to-right, right-to-left, top-to-bottom and bottom-to-top. * gtk/gtk.symbols: * gtk/gtkmenubar.h: * gtk/gtkmenubar.c: Add two properties, pack-direction and child-pack-direction, which specify how children and grandchildren of a menubar are packed, with getters and setters. * gtk/gtkmenubar.c (gtk_menu_bar_set_property): (gtk_menu_bar_get_property): Implement set_property and get_property. * gtk/gtkmenubar.c (gtk_menu_bar_size_request): (gtk_menu_bar_size_allocate): Take pack direction into account. * gtk/gtkmenubar.c (gtk_menu_bar_move_current): Implement move_current here move all the menubar-specific direction tweaking from the generic menushell implementation here. * gtk/gtkmenu.c (gtk_menu_move_current): Move menu-specific direction tweaking from the generic menushell implementation here. * gtk/gtkmenuitem.c (gtk_menu_item_size_request): (gtk_menu_bar_size_allocate): Take pack direction into account. * gtk/gtkimagemenuitem.c (gtk_image_menu_item_size_request) (gtk_image_menu_item_size_allocate): (gtk_image_menu_item_toggle_size_request): Take child pack direction into account and pack the image vertically if necessary. * gtk/gtkmenushell.c (gtk_menu_shell_real_select_item): Set the submenu direction to left-right for menuitems in vertical menubars. (gtk_real_menu_shell_move_current): Simplify by moving direction tweaking to menu- and menubar-specific implementations. Take pack direction into account when doing fallbacks. * tests/testmenubars.c: Test menubars in various packing direction combinations. * tests/Makefile.am (noinst_PROGRAMS): Add testmenubars.
2005-02-11 07:15:11 +00:00
GObjectClass *gobject_class;
1997-11-24 22:37:52 +00:00
GtkWidgetClass *widget_class;
GtkMenuShellClass *menu_shell_class;
Added gdk_text/string_extents() - too calculate all the metrics at once of Tue Jul 21 12:42:01 1998 Owen Taylor <otaylor@redhat.com> * gdk/gdk.h gdk/gdkfont.c: Added gdk_text/string_extents() - too calculate all the metrics at once of a string, including things which weren't calculated before. * gtk/Makefile.am gtk/gtk.h gtk/gtktearoffmenu.[ch]: New MenuItem type, that when put as the first thing in a menu, makes the menu tearoff. Currently drawn as a dashed line. * gtk/gtkmenuitem.h gtk/gtkcheckmenuitem.c: Added a flag "hide_on_activate" to the MenuItem class structure to allow check and radio buttons to be changed with <Space> without hiding the menu. * gtk/gtkaccellabel.[ch]: Added new capabilities to set a underline_group and underline_mods for the label - accelerators added in the underline group matching underline_mods will be displayed as an underline character. This doesn't work - Save As needs to be underlined as Save _As. * gtk/gtkitemfactory.c: - Create a AccelGroup for each MenuShell we create. - If an '&' appears before a character 'c' in the path, then make 'c' an accelerator in the menu's accel group, and if the menuitem is menubar <alt>C an accelerator in the itemfactory's accel group. * gtk/gtklabel.[ch]: Add support for a pattern arg - which is a string. If an '_' appears in this string, the corresponding position in the label is underlined. Add gtk_label_parse_uline() convenience function which takes a string with embedded underlines, sets the pattern and label, and returns the accelerator keyval. * gtk/gtkmenu.[ch]: Make menus no longer a toplevel widget. Instead, they create a GtkWindow and add themselves to that. (When torn off, another new feature, they create another GtkWindow to hold the torn off menu) New function gtk_menu_set_tearoff_state() * gtk/gtkenums.h gtk/gtkmenushell.[ch] gtk/gtkenums.h: Added action signals for keyboard navigation of menus. * gtk/gtkmenushell.c: Key press handler which activates bindings for navigation, and accelerators, for handling underline accelerators. Exported functions to select and activate menu items in a menushell. * gtk/testgtk.c: Added a new "Item Factory" test which tests GtkItemFactory and the new keyboard navigation of menus.
1998-08-12 16:49:13 +00:00
GtkBindingSet *binding_set;
Support vertical menubars (#166632): 2005-02-11 Matthias Clasen <mclasen@redhat.com> Support vertical menubars (#166632): * gtk/gtkenums.h (GtkPackDirection): New enumeration for pack directions, with values for left-to-right, right-to-left, top-to-bottom and bottom-to-top. * gtk/gtk.symbols: * gtk/gtkmenubar.h: * gtk/gtkmenubar.c: Add two properties, pack-direction and child-pack-direction, which specify how children and grandchildren of a menubar are packed, with getters and setters. * gtk/gtkmenubar.c (gtk_menu_bar_set_property): (gtk_menu_bar_get_property): Implement set_property and get_property. * gtk/gtkmenubar.c (gtk_menu_bar_size_request): (gtk_menu_bar_size_allocate): Take pack direction into account. * gtk/gtkmenubar.c (gtk_menu_bar_move_current): Implement move_current here move all the menubar-specific direction tweaking from the generic menushell implementation here. * gtk/gtkmenu.c (gtk_menu_move_current): Move menu-specific direction tweaking from the generic menushell implementation here. * gtk/gtkmenuitem.c (gtk_menu_item_size_request): (gtk_menu_bar_size_allocate): Take pack direction into account. * gtk/gtkimagemenuitem.c (gtk_image_menu_item_size_request) (gtk_image_menu_item_size_allocate): (gtk_image_menu_item_toggle_size_request): Take child pack direction into account and pack the image vertically if necessary. * gtk/gtkmenushell.c (gtk_menu_shell_real_select_item): Set the submenu direction to left-right for menuitems in vertical menubars. (gtk_real_menu_shell_move_current): Simplify by moving direction tweaking to menu- and menubar-specific implementations. Take pack direction into account when doing fallbacks. * tests/testmenubars.c: Test menubars in various packing direction combinations. * tests/Makefile.am (noinst_PROGRAMS): Add testmenubars.
2005-02-11 07:15:11 +00:00
gobject_class = (GObjectClass*) class;
1997-11-24 22:37:52 +00:00
widget_class = (GtkWidgetClass*) class;
menu_shell_class = (GtkMenuShellClass*) class;
Support vertical menubars (#166632): 2005-02-11 Matthias Clasen <mclasen@redhat.com> Support vertical menubars (#166632): * gtk/gtkenums.h (GtkPackDirection): New enumeration for pack directions, with values for left-to-right, right-to-left, top-to-bottom and bottom-to-top. * gtk/gtk.symbols: * gtk/gtkmenubar.h: * gtk/gtkmenubar.c: Add two properties, pack-direction and child-pack-direction, which specify how children and grandchildren of a menubar are packed, with getters and setters. * gtk/gtkmenubar.c (gtk_menu_bar_set_property): (gtk_menu_bar_get_property): Implement set_property and get_property. * gtk/gtkmenubar.c (gtk_menu_bar_size_request): (gtk_menu_bar_size_allocate): Take pack direction into account. * gtk/gtkmenubar.c (gtk_menu_bar_move_current): Implement move_current here move all the menubar-specific direction tweaking from the generic menushell implementation here. * gtk/gtkmenu.c (gtk_menu_move_current): Move menu-specific direction tweaking from the generic menushell implementation here. * gtk/gtkmenuitem.c (gtk_menu_item_size_request): (gtk_menu_bar_size_allocate): Take pack direction into account. * gtk/gtkimagemenuitem.c (gtk_image_menu_item_size_request) (gtk_image_menu_item_size_allocate): (gtk_image_menu_item_toggle_size_request): Take child pack direction into account and pack the image vertically if necessary. * gtk/gtkmenushell.c (gtk_menu_shell_real_select_item): Set the submenu direction to left-right for menuitems in vertical menubars. (gtk_real_menu_shell_move_current): Simplify by moving direction tweaking to menu- and menubar-specific implementations. Take pack direction into account when doing fallbacks. * tests/testmenubars.c: Test menubars in various packing direction combinations. * tests/Makefile.am (noinst_PROGRAMS): Add testmenubars.
2005-02-11 07:15:11 +00:00
gobject_class->get_property = gtk_menu_bar_get_property;
gobject_class->set_property = gtk_menu_bar_set_property;
1997-11-24 22:37:52 +00:00
widget_class->size_request = gtk_menu_bar_size_request;
widget_class->size_allocate = gtk_menu_bar_size_allocate;
widget_class->expose_event = gtk_menu_bar_expose;
fix warning 2001-04-27 Havoc Pennington <hp@redhat.com> * gtk/gtkcombo.c (gtk_combo_popup_button_press): fix warning * gtk/gtkmessagedialog.c (gtk_message_dialog_init): make messages selectable * gtk/gtkentry.c (gtk_entry_real_insert_text): don't strip line/para separators (gtk_entry_create_layout): set single paragraph mode on the layout * gtk/gtkbutton.c (gtk_button_new_from_stock): don't put much spacing between the image and label; instead, inside a button box the button will get extra space that will go there, but if people configure button box for 0 chubbiness, then there's no spacing. * gtk/gtkbbox.c (gtk_button_box_class_init): Make child ipadding and min/max size style properties, so people can tune their chubbiness. * tests/testgtk.c (make_toolbar): remove calls to removed toolbar functions * gtk/gtktoolbar.c (gtk_toolbar_class_init): Make space_size, space_style, and button_relief into style properties, remove functions for setting them * gtk/gtkmenu.c (gtk_menu_key_press): handle menu bar accel to pop it back down * gtk/gtkoptionmenu.c (gtk_option_menu_get_props): free boxed types from gtk_widget_style_get * gtk/gtkmenubar.c (gtk_menu_bar_set_shadow_type): Remove, replace with a style property. * gdk/x11/gdkevents-x11.c: namespace the settings * gtk/gtkmenubar.c: Add F10 accelerator to move between menubars. * gtk/gtksettings.c (gtk_settings_class_init): remove code with side effects from inside g_assert(), so that G_DISABLE_ASSERT can be used. Also, translate doc strings for settings. Also, namespace the double-click-time property. Also, remove bell properties crap.
2001-04-28 00:12:47 +00:00
widget_class->hierarchy_changed = gtk_menu_bar_hierarchy_changed;
1997-11-24 22:37:52 +00:00
menu_shell_class->submenu_placement = GTK_TOP_BOTTOM;
menu_shell_class->get_popup_delay = gtk_menu_bar_get_popup_delay;
Support vertical menubars (#166632): 2005-02-11 Matthias Clasen <mclasen@redhat.com> Support vertical menubars (#166632): * gtk/gtkenums.h (GtkPackDirection): New enumeration for pack directions, with values for left-to-right, right-to-left, top-to-bottom and bottom-to-top. * gtk/gtk.symbols: * gtk/gtkmenubar.h: * gtk/gtkmenubar.c: Add two properties, pack-direction and child-pack-direction, which specify how children and grandchildren of a menubar are packed, with getters and setters. * gtk/gtkmenubar.c (gtk_menu_bar_set_property): (gtk_menu_bar_get_property): Implement set_property and get_property. * gtk/gtkmenubar.c (gtk_menu_bar_size_request): (gtk_menu_bar_size_allocate): Take pack direction into account. * gtk/gtkmenubar.c (gtk_menu_bar_move_current): Implement move_current here move all the menubar-specific direction tweaking from the generic menushell implementation here. * gtk/gtkmenu.c (gtk_menu_move_current): Move menu-specific direction tweaking from the generic menushell implementation here. * gtk/gtkmenuitem.c (gtk_menu_item_size_request): (gtk_menu_bar_size_allocate): Take pack direction into account. * gtk/gtkimagemenuitem.c (gtk_image_menu_item_size_request) (gtk_image_menu_item_size_allocate): (gtk_image_menu_item_toggle_size_request): Take child pack direction into account and pack the image vertically if necessary. * gtk/gtkmenushell.c (gtk_menu_shell_real_select_item): Set the submenu direction to left-right for menuitems in vertical menubars. (gtk_real_menu_shell_move_current): Simplify by moving direction tweaking to menu- and menubar-specific implementations. Take pack direction into account when doing fallbacks. * tests/testmenubars.c: Test menubars in various packing direction combinations. * tests/Makefile.am (noinst_PROGRAMS): Add testmenubars.
2005-02-11 07:15:11 +00:00
menu_shell_class->move_current = gtk_menu_bar_move_current;
Added gdk_text/string_extents() - too calculate all the metrics at once of Tue Jul 21 12:42:01 1998 Owen Taylor <otaylor@redhat.com> * gdk/gdk.h gdk/gdkfont.c: Added gdk_text/string_extents() - too calculate all the metrics at once of a string, including things which weren't calculated before. * gtk/Makefile.am gtk/gtk.h gtk/gtktearoffmenu.[ch]: New MenuItem type, that when put as the first thing in a menu, makes the menu tearoff. Currently drawn as a dashed line. * gtk/gtkmenuitem.h gtk/gtkcheckmenuitem.c: Added a flag "hide_on_activate" to the MenuItem class structure to allow check and radio buttons to be changed with <Space> without hiding the menu. * gtk/gtkaccellabel.[ch]: Added new capabilities to set a underline_group and underline_mods for the label - accelerators added in the underline group matching underline_mods will be displayed as an underline character. This doesn't work - Save As needs to be underlined as Save _As. * gtk/gtkitemfactory.c: - Create a AccelGroup for each MenuShell we create. - If an '&' appears before a character 'c' in the path, then make 'c' an accelerator in the menu's accel group, and if the menuitem is menubar <alt>C an accelerator in the itemfactory's accel group. * gtk/gtklabel.[ch]: Add support for a pattern arg - which is a string. If an '_' appears in this string, the corresponding position in the label is underlined. Add gtk_label_parse_uline() convenience function which takes a string with embedded underlines, sets the pattern and label, and returns the accelerator keyval. * gtk/gtkmenu.[ch]: Make menus no longer a toplevel widget. Instead, they create a GtkWindow and add themselves to that. (When torn off, another new feature, they create another GtkWindow to hold the torn off menu) New function gtk_menu_set_tearoff_state() * gtk/gtkenums.h gtk/gtkmenushell.[ch] gtk/gtkenums.h: Added action signals for keyboard navigation of menus. * gtk/gtkmenushell.c: Key press handler which activates bindings for navigation, and accelerators, for handling underline accelerators. Exported functions to select and activate menu items in a menushell. * gtk/testgtk.c: Added a new "Item Factory" test which tests GtkItemFactory and the new keyboard navigation of menus.
1998-08-12 16:49:13 +00:00
binding_set = gtk_binding_set_by_class (class);
gtk_binding_entry_add_signal (binding_set,
GDK_Left, 0,
"move_current", 1,
GTK_TYPE_MENU_DIRECTION_TYPE,
GTK_MENU_DIR_PREV);
Clip the retrieved image data to the screen, using a server grab to avoid 2001-06-28 Havoc Pennington <hp@pobox.com> * gdk/x11/gdkimage-x11.c (_gdk_x11_get_image): Clip the retrieved image data to the screen, using a server grab to avoid race conditions. * gtk/gtkitemfactory.c (gtk_item_factory_create_item): remove check for NULL return from gtk_image_new_from_stock(), it never returns NULL. (gtk_item_factory_create_item): fix bug where we parsed the stock ID as an inline pixbuf * gtk/gtktext.c (gtk_text_key_press): numeric keypad support * gtk/gtkspinbutton.c (gtk_spin_button_key_press): numeric keypad support (should be using binding set here) * gtk/gtkoptionmenu.c (gtk_option_menu_key_press): numeric keypad support (should be using binding set here) * gtk/gtkmenushell.c (gtk_menu_shell_class_init): numeric keypad support * gtk/gtkmenu.c (gtk_menu_class_init): numeric keypad support * gtk/gtkmenubar.c (gtk_menu_bar_class_init): numeric keypad * gtk/gtklistitem.c (gtk_list_item_class_init): numeric keypad * gtk/gtkimcontextsimple.c (gtk_im_context_simple_filter_keypress): keypad * gtk/gtkfilesel.c (gtk_file_selection_key_press): keypad * gtk/gtkentry.c (gtk_entry_class_init): numeric keypad fixes * gtk/gtkctree.c (gtk_ctree_class_init): numeric keypad support * gtk/gtkcolorsel.c (palette_activate): keypad support (of course, should be binding-setted) * gtk/gtkwindow.c (gtk_window_class_init): numeric keypad fixes * gtk/gtkclist.c (gtk_clist_class_init): numeric keypad fixes * gtk/gtkcalendar.c: numeric keypad fixes * gtk/gtktextview.c (gtk_text_view_class_init): numeric keypad support * gdk/gdkwindow.c (gdk_window_get_clip_region): fix infinite loop screwup * gdk/gdkpixbuf-render.c (gdk_pixbuf_render_to_drawable_alpha): clip the render area to the drawable's clip region in advance, so we don't get data from the server that we don't need. * gdk/gdkpixbuf-render.c (gdk_pixbuf_render_to_drawable_alpha): check return value of gdk_pixbuf_get_from_drawable(), fall back to bilevel alpha if we can't get the pixbuf to composite against. * gdk/gdkdraw.c (gdk_drawable_get_image): set the image colormap * gdk/gdkimage.c (gdk_image_get_colormap): add gdk_image_set_colormap, gdk_image_get_colormap * gdk/gdkpixbuf-drawable.c (rgbconvert): Change all converters to take a region of the image, instead of converting the entire image. * gtk/gtkwidget.h (struct _GtkWidgetClass): add show_help keybinding signal. Add default bindings for it. Add default handler for show_help that shows the tooltip for the widget. * gtk/gtkdialog.c (gtk_dialog_class_init): add binding set and "close" keybinding signal, remove key press handler. * gtk/gtktooltips.c (gtk_tooltips_set_colors): Just remove this, it's not our usual practice to leave a deprecated function around with a runtime warning, plus we don't want it to appear in docs, plus if we make them yellow no one will want to change them anyhow.
2001-06-29 01:59:02 +00:00
gtk_binding_entry_add_signal (binding_set,
GDK_KP_Left, 0,
"move_current", 1,
GTK_TYPE_MENU_DIRECTION_TYPE,
GTK_MENU_DIR_PREV);
Added gdk_text/string_extents() - too calculate all the metrics at once of Tue Jul 21 12:42:01 1998 Owen Taylor <otaylor@redhat.com> * gdk/gdk.h gdk/gdkfont.c: Added gdk_text/string_extents() - too calculate all the metrics at once of a string, including things which weren't calculated before. * gtk/Makefile.am gtk/gtk.h gtk/gtktearoffmenu.[ch]: New MenuItem type, that when put as the first thing in a menu, makes the menu tearoff. Currently drawn as a dashed line. * gtk/gtkmenuitem.h gtk/gtkcheckmenuitem.c: Added a flag "hide_on_activate" to the MenuItem class structure to allow check and radio buttons to be changed with <Space> without hiding the menu. * gtk/gtkaccellabel.[ch]: Added new capabilities to set a underline_group and underline_mods for the label - accelerators added in the underline group matching underline_mods will be displayed as an underline character. This doesn't work - Save As needs to be underlined as Save _As. * gtk/gtkitemfactory.c: - Create a AccelGroup for each MenuShell we create. - If an '&' appears before a character 'c' in the path, then make 'c' an accelerator in the menu's accel group, and if the menuitem is menubar <alt>C an accelerator in the itemfactory's accel group. * gtk/gtklabel.[ch]: Add support for a pattern arg - which is a string. If an '_' appears in this string, the corresponding position in the label is underlined. Add gtk_label_parse_uline() convenience function which takes a string with embedded underlines, sets the pattern and label, and returns the accelerator keyval. * gtk/gtkmenu.[ch]: Make menus no longer a toplevel widget. Instead, they create a GtkWindow and add themselves to that. (When torn off, another new feature, they create another GtkWindow to hold the torn off menu) New function gtk_menu_set_tearoff_state() * gtk/gtkenums.h gtk/gtkmenushell.[ch] gtk/gtkenums.h: Added action signals for keyboard navigation of menus. * gtk/gtkmenushell.c: Key press handler which activates bindings for navigation, and accelerators, for handling underline accelerators. Exported functions to select and activate menu items in a menushell. * gtk/testgtk.c: Added a new "Item Factory" test which tests GtkItemFactory and the new keyboard navigation of menus.
1998-08-12 16:49:13 +00:00
gtk_binding_entry_add_signal (binding_set,
GDK_Right, 0,
"move_current", 1,
GTK_TYPE_MENU_DIRECTION_TYPE,
GTK_MENU_DIR_NEXT);
Clip the retrieved image data to the screen, using a server grab to avoid 2001-06-28 Havoc Pennington <hp@pobox.com> * gdk/x11/gdkimage-x11.c (_gdk_x11_get_image): Clip the retrieved image data to the screen, using a server grab to avoid race conditions. * gtk/gtkitemfactory.c (gtk_item_factory_create_item): remove check for NULL return from gtk_image_new_from_stock(), it never returns NULL. (gtk_item_factory_create_item): fix bug where we parsed the stock ID as an inline pixbuf * gtk/gtktext.c (gtk_text_key_press): numeric keypad support * gtk/gtkspinbutton.c (gtk_spin_button_key_press): numeric keypad support (should be using binding set here) * gtk/gtkoptionmenu.c (gtk_option_menu_key_press): numeric keypad support (should be using binding set here) * gtk/gtkmenushell.c (gtk_menu_shell_class_init): numeric keypad support * gtk/gtkmenu.c (gtk_menu_class_init): numeric keypad support * gtk/gtkmenubar.c (gtk_menu_bar_class_init): numeric keypad * gtk/gtklistitem.c (gtk_list_item_class_init): numeric keypad * gtk/gtkimcontextsimple.c (gtk_im_context_simple_filter_keypress): keypad * gtk/gtkfilesel.c (gtk_file_selection_key_press): keypad * gtk/gtkentry.c (gtk_entry_class_init): numeric keypad fixes * gtk/gtkctree.c (gtk_ctree_class_init): numeric keypad support * gtk/gtkcolorsel.c (palette_activate): keypad support (of course, should be binding-setted) * gtk/gtkwindow.c (gtk_window_class_init): numeric keypad fixes * gtk/gtkclist.c (gtk_clist_class_init): numeric keypad fixes * gtk/gtkcalendar.c: numeric keypad fixes * gtk/gtktextview.c (gtk_text_view_class_init): numeric keypad support * gdk/gdkwindow.c (gdk_window_get_clip_region): fix infinite loop screwup * gdk/gdkpixbuf-render.c (gdk_pixbuf_render_to_drawable_alpha): clip the render area to the drawable's clip region in advance, so we don't get data from the server that we don't need. * gdk/gdkpixbuf-render.c (gdk_pixbuf_render_to_drawable_alpha): check return value of gdk_pixbuf_get_from_drawable(), fall back to bilevel alpha if we can't get the pixbuf to composite against. * gdk/gdkdraw.c (gdk_drawable_get_image): set the image colormap * gdk/gdkimage.c (gdk_image_get_colormap): add gdk_image_set_colormap, gdk_image_get_colormap * gdk/gdkpixbuf-drawable.c (rgbconvert): Change all converters to take a region of the image, instead of converting the entire image. * gtk/gtkwidget.h (struct _GtkWidgetClass): add show_help keybinding signal. Add default bindings for it. Add default handler for show_help that shows the tooltip for the widget. * gtk/gtkdialog.c (gtk_dialog_class_init): add binding set and "close" keybinding signal, remove key press handler. * gtk/gtktooltips.c (gtk_tooltips_set_colors): Just remove this, it's not our usual practice to leave a deprecated function around with a runtime warning, plus we don't want it to appear in docs, plus if we make them yellow no one will want to change them anyhow.
2001-06-29 01:59:02 +00:00
gtk_binding_entry_add_signal (binding_set,
GDK_KP_Right, 0,
"move_current", 1,
GTK_TYPE_MENU_DIRECTION_TYPE,
GTK_MENU_DIR_NEXT);
Added gdk_text/string_extents() - too calculate all the metrics at once of Tue Jul 21 12:42:01 1998 Owen Taylor <otaylor@redhat.com> * gdk/gdk.h gdk/gdkfont.c: Added gdk_text/string_extents() - too calculate all the metrics at once of a string, including things which weren't calculated before. * gtk/Makefile.am gtk/gtk.h gtk/gtktearoffmenu.[ch]: New MenuItem type, that when put as the first thing in a menu, makes the menu tearoff. Currently drawn as a dashed line. * gtk/gtkmenuitem.h gtk/gtkcheckmenuitem.c: Added a flag "hide_on_activate" to the MenuItem class structure to allow check and radio buttons to be changed with <Space> without hiding the menu. * gtk/gtkaccellabel.[ch]: Added new capabilities to set a underline_group and underline_mods for the label - accelerators added in the underline group matching underline_mods will be displayed as an underline character. This doesn't work - Save As needs to be underlined as Save _As. * gtk/gtkitemfactory.c: - Create a AccelGroup for each MenuShell we create. - If an '&' appears before a character 'c' in the path, then make 'c' an accelerator in the menu's accel group, and if the menuitem is menubar <alt>C an accelerator in the itemfactory's accel group. * gtk/gtklabel.[ch]: Add support for a pattern arg - which is a string. If an '_' appears in this string, the corresponding position in the label is underlined. Add gtk_label_parse_uline() convenience function which takes a string with embedded underlines, sets the pattern and label, and returns the accelerator keyval. * gtk/gtkmenu.[ch]: Make menus no longer a toplevel widget. Instead, they create a GtkWindow and add themselves to that. (When torn off, another new feature, they create another GtkWindow to hold the torn off menu) New function gtk_menu_set_tearoff_state() * gtk/gtkenums.h gtk/gtkmenushell.[ch] gtk/gtkenums.h: Added action signals for keyboard navigation of menus. * gtk/gtkmenushell.c: Key press handler which activates bindings for navigation, and accelerators, for handling underline accelerators. Exported functions to select and activate menu items in a menushell. * gtk/testgtk.c: Added a new "Item Factory" test which tests GtkItemFactory and the new keyboard navigation of menus.
1998-08-12 16:49:13 +00:00
gtk_binding_entry_add_signal (binding_set,
GDK_Up, 0,
"move_current", 1,
GTK_TYPE_MENU_DIRECTION_TYPE,
GTK_MENU_DIR_PARENT);
Clip the retrieved image data to the screen, using a server grab to avoid 2001-06-28 Havoc Pennington <hp@pobox.com> * gdk/x11/gdkimage-x11.c (_gdk_x11_get_image): Clip the retrieved image data to the screen, using a server grab to avoid race conditions. * gtk/gtkitemfactory.c (gtk_item_factory_create_item): remove check for NULL return from gtk_image_new_from_stock(), it never returns NULL. (gtk_item_factory_create_item): fix bug where we parsed the stock ID as an inline pixbuf * gtk/gtktext.c (gtk_text_key_press): numeric keypad support * gtk/gtkspinbutton.c (gtk_spin_button_key_press): numeric keypad support (should be using binding set here) * gtk/gtkoptionmenu.c (gtk_option_menu_key_press): numeric keypad support (should be using binding set here) * gtk/gtkmenushell.c (gtk_menu_shell_class_init): numeric keypad support * gtk/gtkmenu.c (gtk_menu_class_init): numeric keypad support * gtk/gtkmenubar.c (gtk_menu_bar_class_init): numeric keypad * gtk/gtklistitem.c (gtk_list_item_class_init): numeric keypad * gtk/gtkimcontextsimple.c (gtk_im_context_simple_filter_keypress): keypad * gtk/gtkfilesel.c (gtk_file_selection_key_press): keypad * gtk/gtkentry.c (gtk_entry_class_init): numeric keypad fixes * gtk/gtkctree.c (gtk_ctree_class_init): numeric keypad support * gtk/gtkcolorsel.c (palette_activate): keypad support (of course, should be binding-setted) * gtk/gtkwindow.c (gtk_window_class_init): numeric keypad fixes * gtk/gtkclist.c (gtk_clist_class_init): numeric keypad fixes * gtk/gtkcalendar.c: numeric keypad fixes * gtk/gtktextview.c (gtk_text_view_class_init): numeric keypad support * gdk/gdkwindow.c (gdk_window_get_clip_region): fix infinite loop screwup * gdk/gdkpixbuf-render.c (gdk_pixbuf_render_to_drawable_alpha): clip the render area to the drawable's clip region in advance, so we don't get data from the server that we don't need. * gdk/gdkpixbuf-render.c (gdk_pixbuf_render_to_drawable_alpha): check return value of gdk_pixbuf_get_from_drawable(), fall back to bilevel alpha if we can't get the pixbuf to composite against. * gdk/gdkdraw.c (gdk_drawable_get_image): set the image colormap * gdk/gdkimage.c (gdk_image_get_colormap): add gdk_image_set_colormap, gdk_image_get_colormap * gdk/gdkpixbuf-drawable.c (rgbconvert): Change all converters to take a region of the image, instead of converting the entire image. * gtk/gtkwidget.h (struct _GtkWidgetClass): add show_help keybinding signal. Add default bindings for it. Add default handler for show_help that shows the tooltip for the widget. * gtk/gtkdialog.c (gtk_dialog_class_init): add binding set and "close" keybinding signal, remove key press handler. * gtk/gtktooltips.c (gtk_tooltips_set_colors): Just remove this, it's not our usual practice to leave a deprecated function around with a runtime warning, plus we don't want it to appear in docs, plus if we make them yellow no one will want to change them anyhow.
2001-06-29 01:59:02 +00:00
gtk_binding_entry_add_signal (binding_set,
GDK_KP_Up, 0,
"move_current", 1,
GTK_TYPE_MENU_DIRECTION_TYPE,
GTK_MENU_DIR_PARENT);
Added gdk_text/string_extents() - too calculate all the metrics at once of Tue Jul 21 12:42:01 1998 Owen Taylor <otaylor@redhat.com> * gdk/gdk.h gdk/gdkfont.c: Added gdk_text/string_extents() - too calculate all the metrics at once of a string, including things which weren't calculated before. * gtk/Makefile.am gtk/gtk.h gtk/gtktearoffmenu.[ch]: New MenuItem type, that when put as the first thing in a menu, makes the menu tearoff. Currently drawn as a dashed line. * gtk/gtkmenuitem.h gtk/gtkcheckmenuitem.c: Added a flag "hide_on_activate" to the MenuItem class structure to allow check and radio buttons to be changed with <Space> without hiding the menu. * gtk/gtkaccellabel.[ch]: Added new capabilities to set a underline_group and underline_mods for the label - accelerators added in the underline group matching underline_mods will be displayed as an underline character. This doesn't work - Save As needs to be underlined as Save _As. * gtk/gtkitemfactory.c: - Create a AccelGroup for each MenuShell we create. - If an '&' appears before a character 'c' in the path, then make 'c' an accelerator in the menu's accel group, and if the menuitem is menubar <alt>C an accelerator in the itemfactory's accel group. * gtk/gtklabel.[ch]: Add support for a pattern arg - which is a string. If an '_' appears in this string, the corresponding position in the label is underlined. Add gtk_label_parse_uline() convenience function which takes a string with embedded underlines, sets the pattern and label, and returns the accelerator keyval. * gtk/gtkmenu.[ch]: Make menus no longer a toplevel widget. Instead, they create a GtkWindow and add themselves to that. (When torn off, another new feature, they create another GtkWindow to hold the torn off menu) New function gtk_menu_set_tearoff_state() * gtk/gtkenums.h gtk/gtkmenushell.[ch] gtk/gtkenums.h: Added action signals for keyboard navigation of menus. * gtk/gtkmenushell.c: Key press handler which activates bindings for navigation, and accelerators, for handling underline accelerators. Exported functions to select and activate menu items in a menushell. * gtk/testgtk.c: Added a new "Item Factory" test which tests GtkItemFactory and the new keyboard navigation of menus.
1998-08-12 16:49:13 +00:00
gtk_binding_entry_add_signal (binding_set,
GDK_Down, 0,
"move_current", 1,
GTK_TYPE_MENU_DIRECTION_TYPE,
GTK_MENU_DIR_CHILD);
Clip the retrieved image data to the screen, using a server grab to avoid 2001-06-28 Havoc Pennington <hp@pobox.com> * gdk/x11/gdkimage-x11.c (_gdk_x11_get_image): Clip the retrieved image data to the screen, using a server grab to avoid race conditions. * gtk/gtkitemfactory.c (gtk_item_factory_create_item): remove check for NULL return from gtk_image_new_from_stock(), it never returns NULL. (gtk_item_factory_create_item): fix bug where we parsed the stock ID as an inline pixbuf * gtk/gtktext.c (gtk_text_key_press): numeric keypad support * gtk/gtkspinbutton.c (gtk_spin_button_key_press): numeric keypad support (should be using binding set here) * gtk/gtkoptionmenu.c (gtk_option_menu_key_press): numeric keypad support (should be using binding set here) * gtk/gtkmenushell.c (gtk_menu_shell_class_init): numeric keypad support * gtk/gtkmenu.c (gtk_menu_class_init): numeric keypad support * gtk/gtkmenubar.c (gtk_menu_bar_class_init): numeric keypad * gtk/gtklistitem.c (gtk_list_item_class_init): numeric keypad * gtk/gtkimcontextsimple.c (gtk_im_context_simple_filter_keypress): keypad * gtk/gtkfilesel.c (gtk_file_selection_key_press): keypad * gtk/gtkentry.c (gtk_entry_class_init): numeric keypad fixes * gtk/gtkctree.c (gtk_ctree_class_init): numeric keypad support * gtk/gtkcolorsel.c (palette_activate): keypad support (of course, should be binding-setted) * gtk/gtkwindow.c (gtk_window_class_init): numeric keypad fixes * gtk/gtkclist.c (gtk_clist_class_init): numeric keypad fixes * gtk/gtkcalendar.c: numeric keypad fixes * gtk/gtktextview.c (gtk_text_view_class_init): numeric keypad support * gdk/gdkwindow.c (gdk_window_get_clip_region): fix infinite loop screwup * gdk/gdkpixbuf-render.c (gdk_pixbuf_render_to_drawable_alpha): clip the render area to the drawable's clip region in advance, so we don't get data from the server that we don't need. * gdk/gdkpixbuf-render.c (gdk_pixbuf_render_to_drawable_alpha): check return value of gdk_pixbuf_get_from_drawable(), fall back to bilevel alpha if we can't get the pixbuf to composite against. * gdk/gdkdraw.c (gdk_drawable_get_image): set the image colormap * gdk/gdkimage.c (gdk_image_get_colormap): add gdk_image_set_colormap, gdk_image_get_colormap * gdk/gdkpixbuf-drawable.c (rgbconvert): Change all converters to take a region of the image, instead of converting the entire image. * gtk/gtkwidget.h (struct _GtkWidgetClass): add show_help keybinding signal. Add default bindings for it. Add default handler for show_help that shows the tooltip for the widget. * gtk/gtkdialog.c (gtk_dialog_class_init): add binding set and "close" keybinding signal, remove key press handler. * gtk/gtktooltips.c (gtk_tooltips_set_colors): Just remove this, it's not our usual practice to leave a deprecated function around with a runtime warning, plus we don't want it to appear in docs, plus if we make them yellow no one will want to change them anyhow.
2001-06-29 01:59:02 +00:00
gtk_binding_entry_add_signal (binding_set,
GDK_KP_Down, 0,
"move_current", 1,
GTK_TYPE_MENU_DIRECTION_TYPE,
GTK_MENU_DIR_CHILD);
fix warning 2001-04-27 Havoc Pennington <hp@redhat.com> * gtk/gtkcombo.c (gtk_combo_popup_button_press): fix warning * gtk/gtkmessagedialog.c (gtk_message_dialog_init): make messages selectable * gtk/gtkentry.c (gtk_entry_real_insert_text): don't strip line/para separators (gtk_entry_create_layout): set single paragraph mode on the layout * gtk/gtkbutton.c (gtk_button_new_from_stock): don't put much spacing between the image and label; instead, inside a button box the button will get extra space that will go there, but if people configure button box for 0 chubbiness, then there's no spacing. * gtk/gtkbbox.c (gtk_button_box_class_init): Make child ipadding and min/max size style properties, so people can tune their chubbiness. * tests/testgtk.c (make_toolbar): remove calls to removed toolbar functions * gtk/gtktoolbar.c (gtk_toolbar_class_init): Make space_size, space_style, and button_relief into style properties, remove functions for setting them * gtk/gtkmenu.c (gtk_menu_key_press): handle menu bar accel to pop it back down * gtk/gtkoptionmenu.c (gtk_option_menu_get_props): free boxed types from gtk_widget_style_get * gtk/gtkmenubar.c (gtk_menu_bar_set_shadow_type): Remove, replace with a style property. * gdk/x11/gdkevents-x11.c: namespace the settings * gtk/gtkmenubar.c: Add F10 accelerator to move between menubars. * gtk/gtksettings.c (gtk_settings_class_init): remove code with side effects from inside g_assert(), so that G_DISABLE_ASSERT can be used. Also, translate doc strings for settings. Also, namespace the double-click-time property. Also, remove bell properties crap.
2001-04-28 00:12:47 +00:00
Support vertical menubars (#166632): 2005-02-11 Matthias Clasen <mclasen@redhat.com> Support vertical menubars (#166632): * gtk/gtkenums.h (GtkPackDirection): New enumeration for pack directions, with values for left-to-right, right-to-left, top-to-bottom and bottom-to-top. * gtk/gtk.symbols: * gtk/gtkmenubar.h: * gtk/gtkmenubar.c: Add two properties, pack-direction and child-pack-direction, which specify how children and grandchildren of a menubar are packed, with getters and setters. * gtk/gtkmenubar.c (gtk_menu_bar_set_property): (gtk_menu_bar_get_property): Implement set_property and get_property. * gtk/gtkmenubar.c (gtk_menu_bar_size_request): (gtk_menu_bar_size_allocate): Take pack direction into account. * gtk/gtkmenubar.c (gtk_menu_bar_move_current): Implement move_current here move all the menubar-specific direction tweaking from the generic menushell implementation here. * gtk/gtkmenu.c (gtk_menu_move_current): Move menu-specific direction tweaking from the generic menushell implementation here. * gtk/gtkmenuitem.c (gtk_menu_item_size_request): (gtk_menu_bar_size_allocate): Take pack direction into account. * gtk/gtkimagemenuitem.c (gtk_image_menu_item_size_request) (gtk_image_menu_item_size_allocate): (gtk_image_menu_item_toggle_size_request): Take child pack direction into account and pack the image vertically if necessary. * gtk/gtkmenushell.c (gtk_menu_shell_real_select_item): Set the submenu direction to left-right for menuitems in vertical menubars. (gtk_real_menu_shell_move_current): Simplify by moving direction tweaking to menu- and menubar-specific implementations. Take pack direction into account when doing fallbacks. * tests/testmenubars.c: Test menubars in various packing direction combinations. * tests/Makefile.am (noinst_PROGRAMS): Add testmenubars.
2005-02-11 07:15:11 +00:00
/**
* GtkMenuBar:pack-direction:
*
* The pack direction of the menubar. It determines how
* menuitems are arranged in the menubar.
*
* Since: 2.8
*/
g_object_class_install_property (gobject_class,
PROP_PACK_DIRECTION,
2005-03-09 06:15:13 +00:00
g_param_spec_enum ("pack-direction",
Support vertical menubars (#166632): 2005-02-11 Matthias Clasen <mclasen@redhat.com> Support vertical menubars (#166632): * gtk/gtkenums.h (GtkPackDirection): New enumeration for pack directions, with values for left-to-right, right-to-left, top-to-bottom and bottom-to-top. * gtk/gtk.symbols: * gtk/gtkmenubar.h: * gtk/gtkmenubar.c: Add two properties, pack-direction and child-pack-direction, which specify how children and grandchildren of a menubar are packed, with getters and setters. * gtk/gtkmenubar.c (gtk_menu_bar_set_property): (gtk_menu_bar_get_property): Implement set_property and get_property. * gtk/gtkmenubar.c (gtk_menu_bar_size_request): (gtk_menu_bar_size_allocate): Take pack direction into account. * gtk/gtkmenubar.c (gtk_menu_bar_move_current): Implement move_current here move all the menubar-specific direction tweaking from the generic menushell implementation here. * gtk/gtkmenu.c (gtk_menu_move_current): Move menu-specific direction tweaking from the generic menushell implementation here. * gtk/gtkmenuitem.c (gtk_menu_item_size_request): (gtk_menu_bar_size_allocate): Take pack direction into account. * gtk/gtkimagemenuitem.c (gtk_image_menu_item_size_request) (gtk_image_menu_item_size_allocate): (gtk_image_menu_item_toggle_size_request): Take child pack direction into account and pack the image vertically if necessary. * gtk/gtkmenushell.c (gtk_menu_shell_real_select_item): Set the submenu direction to left-right for menuitems in vertical menubars. (gtk_real_menu_shell_move_current): Simplify by moving direction tweaking to menu- and menubar-specific implementations. Take pack direction into account when doing fallbacks. * tests/testmenubars.c: Test menubars in various packing direction combinations. * tests/Makefile.am (noinst_PROGRAMS): Add testmenubars.
2005-02-11 07:15:11 +00:00
P_("Pack direction"),
P_("The pack direction of the menubar"),
GTK_TYPE_PACK_DIRECTION,
GTK_PACK_DIRECTION_LTR,
GTK_PARAM_READWRITE));
Support vertical menubars (#166632): 2005-02-11 Matthias Clasen <mclasen@redhat.com> Support vertical menubars (#166632): * gtk/gtkenums.h (GtkPackDirection): New enumeration for pack directions, with values for left-to-right, right-to-left, top-to-bottom and bottom-to-top. * gtk/gtk.symbols: * gtk/gtkmenubar.h: * gtk/gtkmenubar.c: Add two properties, pack-direction and child-pack-direction, which specify how children and grandchildren of a menubar are packed, with getters and setters. * gtk/gtkmenubar.c (gtk_menu_bar_set_property): (gtk_menu_bar_get_property): Implement set_property and get_property. * gtk/gtkmenubar.c (gtk_menu_bar_size_request): (gtk_menu_bar_size_allocate): Take pack direction into account. * gtk/gtkmenubar.c (gtk_menu_bar_move_current): Implement move_current here move all the menubar-specific direction tweaking from the generic menushell implementation here. * gtk/gtkmenu.c (gtk_menu_move_current): Move menu-specific direction tweaking from the generic menushell implementation here. * gtk/gtkmenuitem.c (gtk_menu_item_size_request): (gtk_menu_bar_size_allocate): Take pack direction into account. * gtk/gtkimagemenuitem.c (gtk_image_menu_item_size_request) (gtk_image_menu_item_size_allocate): (gtk_image_menu_item_toggle_size_request): Take child pack direction into account and pack the image vertically if necessary. * gtk/gtkmenushell.c (gtk_menu_shell_real_select_item): Set the submenu direction to left-right for menuitems in vertical menubars. (gtk_real_menu_shell_move_current): Simplify by moving direction tweaking to menu- and menubar-specific implementations. Take pack direction into account when doing fallbacks. * tests/testmenubars.c: Test menubars in various packing direction combinations. * tests/Makefile.am (noinst_PROGRAMS): Add testmenubars.
2005-02-11 07:15:11 +00:00
/**
* GtkMenuBar:child-pack-direction:
*
* The pack direction of the menubar. It determines how
* the widgets contained in child menuitems are arranged.
*
* Since: 2.8
*/
g_object_class_install_property (gobject_class,
PROP_CHILD_PACK_DIRECTION,
2005-03-09 06:15:13 +00:00
g_param_spec_enum ("child-pack-direction",
Support vertical menubars (#166632): 2005-02-11 Matthias Clasen <mclasen@redhat.com> Support vertical menubars (#166632): * gtk/gtkenums.h (GtkPackDirection): New enumeration for pack directions, with values for left-to-right, right-to-left, top-to-bottom and bottom-to-top. * gtk/gtk.symbols: * gtk/gtkmenubar.h: * gtk/gtkmenubar.c: Add two properties, pack-direction and child-pack-direction, which specify how children and grandchildren of a menubar are packed, with getters and setters. * gtk/gtkmenubar.c (gtk_menu_bar_set_property): (gtk_menu_bar_get_property): Implement set_property and get_property. * gtk/gtkmenubar.c (gtk_menu_bar_size_request): (gtk_menu_bar_size_allocate): Take pack direction into account. * gtk/gtkmenubar.c (gtk_menu_bar_move_current): Implement move_current here move all the menubar-specific direction tweaking from the generic menushell implementation here. * gtk/gtkmenu.c (gtk_menu_move_current): Move menu-specific direction tweaking from the generic menushell implementation here. * gtk/gtkmenuitem.c (gtk_menu_item_size_request): (gtk_menu_bar_size_allocate): Take pack direction into account. * gtk/gtkimagemenuitem.c (gtk_image_menu_item_size_request) (gtk_image_menu_item_size_allocate): (gtk_image_menu_item_toggle_size_request): Take child pack direction into account and pack the image vertically if necessary. * gtk/gtkmenushell.c (gtk_menu_shell_real_select_item): Set the submenu direction to left-right for menuitems in vertical menubars. (gtk_real_menu_shell_move_current): Simplify by moving direction tweaking to menu- and menubar-specific implementations. Take pack direction into account when doing fallbacks. * tests/testmenubars.c: Test menubars in various packing direction combinations. * tests/Makefile.am (noinst_PROGRAMS): Add testmenubars.
2005-02-11 07:15:11 +00:00
P_("Child Pack direction"),
P_("The child pack direction of the menubar"),
GTK_TYPE_PACK_DIRECTION,
GTK_PACK_DIRECTION_LTR,
GTK_PARAM_READWRITE));
Support vertical menubars (#166632): 2005-02-11 Matthias Clasen <mclasen@redhat.com> Support vertical menubars (#166632): * gtk/gtkenums.h (GtkPackDirection): New enumeration for pack directions, with values for left-to-right, right-to-left, top-to-bottom and bottom-to-top. * gtk/gtk.symbols: * gtk/gtkmenubar.h: * gtk/gtkmenubar.c: Add two properties, pack-direction and child-pack-direction, which specify how children and grandchildren of a menubar are packed, with getters and setters. * gtk/gtkmenubar.c (gtk_menu_bar_set_property): (gtk_menu_bar_get_property): Implement set_property and get_property. * gtk/gtkmenubar.c (gtk_menu_bar_size_request): (gtk_menu_bar_size_allocate): Take pack direction into account. * gtk/gtkmenubar.c (gtk_menu_bar_move_current): Implement move_current here move all the menubar-specific direction tweaking from the generic menushell implementation here. * gtk/gtkmenu.c (gtk_menu_move_current): Move menu-specific direction tweaking from the generic menushell implementation here. * gtk/gtkmenuitem.c (gtk_menu_item_size_request): (gtk_menu_bar_size_allocate): Take pack direction into account. * gtk/gtkimagemenuitem.c (gtk_image_menu_item_size_request) (gtk_image_menu_item_size_allocate): (gtk_image_menu_item_toggle_size_request): Take child pack direction into account and pack the image vertically if necessary. * gtk/gtkmenushell.c (gtk_menu_shell_real_select_item): Set the submenu direction to left-right for menuitems in vertical menubars. (gtk_real_menu_shell_move_current): Simplify by moving direction tweaking to menu- and menubar-specific implementations. Take pack direction into account when doing fallbacks. * tests/testmenubars.c: Test menubars in various packing direction combinations. * tests/Makefile.am (noinst_PROGRAMS): Add testmenubars.
2005-02-11 07:15:11 +00:00
fix warning 2001-04-27 Havoc Pennington <hp@redhat.com> * gtk/gtkcombo.c (gtk_combo_popup_button_press): fix warning * gtk/gtkmessagedialog.c (gtk_message_dialog_init): make messages selectable * gtk/gtkentry.c (gtk_entry_real_insert_text): don't strip line/para separators (gtk_entry_create_layout): set single paragraph mode on the layout * gtk/gtkbutton.c (gtk_button_new_from_stock): don't put much spacing between the image and label; instead, inside a button box the button will get extra space that will go there, but if people configure button box for 0 chubbiness, then there's no spacing. * gtk/gtkbbox.c (gtk_button_box_class_init): Make child ipadding and min/max size style properties, so people can tune their chubbiness. * tests/testgtk.c (make_toolbar): remove calls to removed toolbar functions * gtk/gtktoolbar.c (gtk_toolbar_class_init): Make space_size, space_style, and button_relief into style properties, remove functions for setting them * gtk/gtkmenu.c (gtk_menu_key_press): handle menu bar accel to pop it back down * gtk/gtkoptionmenu.c (gtk_option_menu_get_props): free boxed types from gtk_widget_style_get * gtk/gtkmenubar.c (gtk_menu_bar_set_shadow_type): Remove, replace with a style property. * gdk/x11/gdkevents-x11.c: namespace the settings * gtk/gtkmenubar.c: Add F10 accelerator to move between menubars. * gtk/gtksettings.c (gtk_settings_class_init): remove code with side effects from inside g_assert(), so that G_DISABLE_ASSERT can be used. Also, translate doc strings for settings. Also, namespace the double-click-time property. Also, remove bell properties crap.
2001-04-28 00:12:47 +00:00
gtk_widget_class_install_style_property (widget_class,
2005-03-09 06:15:13 +00:00
g_param_spec_enum ("shadow-type",
P_("Shadow type"),
P_("Style of bevel around the menubar"),
fix warning 2001-04-27 Havoc Pennington <hp@redhat.com> * gtk/gtkcombo.c (gtk_combo_popup_button_press): fix warning * gtk/gtkmessagedialog.c (gtk_message_dialog_init): make messages selectable * gtk/gtkentry.c (gtk_entry_real_insert_text): don't strip line/para separators (gtk_entry_create_layout): set single paragraph mode on the layout * gtk/gtkbutton.c (gtk_button_new_from_stock): don't put much spacing between the image and label; instead, inside a button box the button will get extra space that will go there, but if people configure button box for 0 chubbiness, then there's no spacing. * gtk/gtkbbox.c (gtk_button_box_class_init): Make child ipadding and min/max size style properties, so people can tune their chubbiness. * tests/testgtk.c (make_toolbar): remove calls to removed toolbar functions * gtk/gtktoolbar.c (gtk_toolbar_class_init): Make space_size, space_style, and button_relief into style properties, remove functions for setting them * gtk/gtkmenu.c (gtk_menu_key_press): handle menu bar accel to pop it back down * gtk/gtkoptionmenu.c (gtk_option_menu_get_props): free boxed types from gtk_widget_style_get * gtk/gtkmenubar.c (gtk_menu_bar_set_shadow_type): Remove, replace with a style property. * gdk/x11/gdkevents-x11.c: namespace the settings * gtk/gtkmenubar.c: Add F10 accelerator to move between menubars. * gtk/gtksettings.c (gtk_settings_class_init): remove code with side effects from inside g_assert(), so that G_DISABLE_ASSERT can be used. Also, translate doc strings for settings. Also, namespace the double-click-time property. Also, remove bell properties crap.
2001-04-28 00:12:47 +00:00
GTK_TYPE_SHADOW_TYPE,
GTK_SHADOW_OUT,
GTK_PARAM_READABLE));
Handle case where we need to parse the xsetting as if it were an RC file 2001-05-10 Havoc Pennington <hp@redhat.com> * gtk/gtksettings.c (gtk_settings_get_property): Handle case where we need to parse the xsetting as if it were an RC file string. * gtk/gtkcolorsel.c (gtk_color_selection_class_init): load initial value of palette from settings, not from static variable * gdk/x11/gdkevents-x11.c: add color palette, toolbar mode to xsettings translation table * gtk/gtktoolbar.c (gtk_toolbar_new): Remove arguments, because hardcoding the toolbar style conflicts with new customizable toolbar style philosophy (gtk_toolbar_class_init): add settings for default toolbar style; these are used unless the app specifically forces a toolbar style * gtk/gtksettings.c (settings_install_property_parser): only return at the start if we warn and parser == NULL * gtk/gtkcolorsel.c (gtk_color_selection_finalize): disconnect the palette changed handler so we don't notify dead color selections * gtk/gtkstyle.c (gtk_default_draw_shadow): handle xthickness/ythickness of 0 or 1 properly (gtk_default_draw_resize_grip): clear the background behind the resize grips, and align to bottom right if we square the area to be drawn. * gtk/gtkstatusbar.c (gtk_statusbar_init): set horizontal usize on statusbar label to 1, so it doesn't make toplevels resize oddly (gtk_statusbar_size_request): add grip size to request (gtk_statusbar_size_allocate): hack so the hbox still works with the grip size in the request * gtk/gtktoolbar.c (gtk_toolbar_show_all): override to fix bug where showing all on a toplevel makes the toolbar button text appear despite the toolbar mode * gtk/gtkmenubar.c: add internal padding style property * gtk/gtktoolbar.c: Add internal padding style property; add shadow type style property * gtk/gtkmenubar.c (gtk_menu_bar_paint): paint box with widget state; and put Container::border_width outside the frame * gtk/gtktextview.c: don't draw focus rectangle if we're in interior focus mode, we just use blinking cursor
2001-06-04 23:15:51 +00:00
gtk_widget_class_install_style_property (widget_class,
2005-03-09 06:15:13 +00:00
g_param_spec_int ("internal-padding",
P_("Internal padding"),
P_("Amount of border space between the menubar shadow and the menu items"),
Handle case where we need to parse the xsetting as if it were an RC file 2001-05-10 Havoc Pennington <hp@redhat.com> * gtk/gtksettings.c (gtk_settings_get_property): Handle case where we need to parse the xsetting as if it were an RC file string. * gtk/gtkcolorsel.c (gtk_color_selection_class_init): load initial value of palette from settings, not from static variable * gdk/x11/gdkevents-x11.c: add color palette, toolbar mode to xsettings translation table * gtk/gtktoolbar.c (gtk_toolbar_new): Remove arguments, because hardcoding the toolbar style conflicts with new customizable toolbar style philosophy (gtk_toolbar_class_init): add settings for default toolbar style; these are used unless the app specifically forces a toolbar style * gtk/gtksettings.c (settings_install_property_parser): only return at the start if we warn and parser == NULL * gtk/gtkcolorsel.c (gtk_color_selection_finalize): disconnect the palette changed handler so we don't notify dead color selections * gtk/gtkstyle.c (gtk_default_draw_shadow): handle xthickness/ythickness of 0 or 1 properly (gtk_default_draw_resize_grip): clear the background behind the resize grips, and align to bottom right if we square the area to be drawn. * gtk/gtkstatusbar.c (gtk_statusbar_init): set horizontal usize on statusbar label to 1, so it doesn't make toplevels resize oddly (gtk_statusbar_size_request): add grip size to request (gtk_statusbar_size_allocate): hack so the hbox still works with the grip size in the request * gtk/gtktoolbar.c (gtk_toolbar_show_all): override to fix bug where showing all on a toplevel makes the toolbar button text appear despite the toolbar mode * gtk/gtkmenubar.c: add internal padding style property * gtk/gtktoolbar.c: Add internal padding style property; add shadow type style property * gtk/gtkmenubar.c (gtk_menu_bar_paint): paint box with widget state; and put Container::border_width outside the frame * gtk/gtktextview.c: don't draw focus rectangle if we're in interior focus mode, we just use blinking cursor
2001-06-04 23:15:51 +00:00
0,
G_MAXINT,
DEFAULT_IPADDING,
GTK_PARAM_READABLE));
Handle case where we need to parse the xsetting as if it were an RC file 2001-05-10 Havoc Pennington <hp@redhat.com> * gtk/gtksettings.c (gtk_settings_get_property): Handle case where we need to parse the xsetting as if it were an RC file string. * gtk/gtkcolorsel.c (gtk_color_selection_class_init): load initial value of palette from settings, not from static variable * gdk/x11/gdkevents-x11.c: add color palette, toolbar mode to xsettings translation table * gtk/gtktoolbar.c (gtk_toolbar_new): Remove arguments, because hardcoding the toolbar style conflicts with new customizable toolbar style philosophy (gtk_toolbar_class_init): add settings for default toolbar style; these are used unless the app specifically forces a toolbar style * gtk/gtksettings.c (settings_install_property_parser): only return at the start if we warn and parser == NULL * gtk/gtkcolorsel.c (gtk_color_selection_finalize): disconnect the palette changed handler so we don't notify dead color selections * gtk/gtkstyle.c (gtk_default_draw_shadow): handle xthickness/ythickness of 0 or 1 properly (gtk_default_draw_resize_grip): clear the background behind the resize grips, and align to bottom right if we square the area to be drawn. * gtk/gtkstatusbar.c (gtk_statusbar_init): set horizontal usize on statusbar label to 1, so it doesn't make toplevels resize oddly (gtk_statusbar_size_request): add grip size to request (gtk_statusbar_size_allocate): hack so the hbox still works with the grip size in the request * gtk/gtktoolbar.c (gtk_toolbar_show_all): override to fix bug where showing all on a toplevel makes the toolbar button text appear despite the toolbar mode * gtk/gtkmenubar.c: add internal padding style property * gtk/gtktoolbar.c: Add internal padding style property; add shadow type style property * gtk/gtkmenubar.c (gtk_menu_bar_paint): paint box with widget state; and put Container::border_width outside the frame * gtk/gtktextview.c: don't draw focus rectangle if we're in interior focus mode, we just use blinking cursor
2001-06-04 23:15:51 +00:00
gtk_settings_install_property (g_param_spec_int ("gtk-menu-bar-popup-delay",
P_("Delay before drop down menus appear"),
P_("Delay before the submenus of a menu bar appear"),
0,
G_MAXINT,
0,
GTK_PARAM_READWRITE));
Support vertical menubars (#166632): 2005-02-11 Matthias Clasen <mclasen@redhat.com> Support vertical menubars (#166632): * gtk/gtkenums.h (GtkPackDirection): New enumeration for pack directions, with values for left-to-right, right-to-left, top-to-bottom and bottom-to-top. * gtk/gtk.symbols: * gtk/gtkmenubar.h: * gtk/gtkmenubar.c: Add two properties, pack-direction and child-pack-direction, which specify how children and grandchildren of a menubar are packed, with getters and setters. * gtk/gtkmenubar.c (gtk_menu_bar_set_property): (gtk_menu_bar_get_property): Implement set_property and get_property. * gtk/gtkmenubar.c (gtk_menu_bar_size_request): (gtk_menu_bar_size_allocate): Take pack direction into account. * gtk/gtkmenubar.c (gtk_menu_bar_move_current): Implement move_current here move all the menubar-specific direction tweaking from the generic menushell implementation here. * gtk/gtkmenu.c (gtk_menu_move_current): Move menu-specific direction tweaking from the generic menushell implementation here. * gtk/gtkmenuitem.c (gtk_menu_item_size_request): (gtk_menu_bar_size_allocate): Take pack direction into account. * gtk/gtkimagemenuitem.c (gtk_image_menu_item_size_request) (gtk_image_menu_item_size_allocate): (gtk_image_menu_item_toggle_size_request): Take child pack direction into account and pack the image vertically if necessary. * gtk/gtkmenushell.c (gtk_menu_shell_real_select_item): Set the submenu direction to left-right for menuitems in vertical menubars. (gtk_real_menu_shell_move_current): Simplify by moving direction tweaking to menu- and menubar-specific implementations. Take pack direction into account when doing fallbacks. * tests/testmenubars.c: Test menubars in various packing direction combinations. * tests/Makefile.am (noinst_PROGRAMS): Add testmenubars.
2005-02-11 07:15:11 +00:00
g_type_class_add_private (gobject_class, sizeof (GtkMenuBarPrivate));
}
static void
gtk_menu_bar_init (GtkMenuBar *object)
{
}
1997-11-24 22:37:52 +00:00
GtkWidget*
configure.in acheader.h gdk/gdkwindow.c Check for Shape extension both on Sun May 3 13:38:22 1998 Owen Taylor <otaylor@gtk.org> * configure.in acheader.h gdk/gdkwindow.c Check for Shape extension both on the client and server side. (And, more importantly, check for the shape extension so we may include -lXext even when compiling with --disable-xshm) Don't set override_redirect on all shaped windows. It isn't necessary. * gdk/gdkwindow.c: Set ->colormap to NULL for root and foreign windows. Use this to check if we need to get the colormap from X. Fri May 1 22:32:47 1998 Owen Taylor <otaylor@gtk.org> * gtk/gtkbutton.c (gtk_button_paint): Draw the areas between the default and the button always in GTK_STATE_NORMAL. * gtk/gtkrange.c (gtk_range_style_set): Added a style_set callback. Fri May 1 16:40:57 1998 Owen Taylor <otaylor@gtk.org> * gdk/gdkpixmap.c (gdk_pixmap_colormap_create_from_xpmp[_d]): Fix a buffer overflow on pixmaps that claim to have more than 31 characters per pixel. (gdk_pixmap_read_string): Don't wrap around strings longer than half of address space ;-) * gtk/gtk[vh]ruler.c gtk/gtkinputdialog.c: Expand some buffers that were used for printing integers. * */* (almost): Style: All int foo () { ... } changed to int foo (void) { ... } ^^^^^^^ This is why some many files changed Even where there were proper prototypes elsewhere. * gdk/gxid.c (handle_claim_device): Some extra checks. It isn't safe against being fed bad X id's, but at least it should be safe against deleting all your files.
1998-05-03 22:41:32 +00:00
gtk_menu_bar_new (void)
1997-11-24 22:37:52 +00:00
{
return g_object_new (GTK_TYPE_MENU_BAR, NULL);
1997-11-24 22:37:52 +00:00
}
Support vertical menubars (#166632): 2005-02-11 Matthias Clasen <mclasen@redhat.com> Support vertical menubars (#166632): * gtk/gtkenums.h (GtkPackDirection): New enumeration for pack directions, with values for left-to-right, right-to-left, top-to-bottom and bottom-to-top. * gtk/gtk.symbols: * gtk/gtkmenubar.h: * gtk/gtkmenubar.c: Add two properties, pack-direction and child-pack-direction, which specify how children and grandchildren of a menubar are packed, with getters and setters. * gtk/gtkmenubar.c (gtk_menu_bar_set_property): (gtk_menu_bar_get_property): Implement set_property and get_property. * gtk/gtkmenubar.c (gtk_menu_bar_size_request): (gtk_menu_bar_size_allocate): Take pack direction into account. * gtk/gtkmenubar.c (gtk_menu_bar_move_current): Implement move_current here move all the menubar-specific direction tweaking from the generic menushell implementation here. * gtk/gtkmenu.c (gtk_menu_move_current): Move menu-specific direction tweaking from the generic menushell implementation here. * gtk/gtkmenuitem.c (gtk_menu_item_size_request): (gtk_menu_bar_size_allocate): Take pack direction into account. * gtk/gtkimagemenuitem.c (gtk_image_menu_item_size_request) (gtk_image_menu_item_size_allocate): (gtk_image_menu_item_toggle_size_request): Take child pack direction into account and pack the image vertically if necessary. * gtk/gtkmenushell.c (gtk_menu_shell_real_select_item): Set the submenu direction to left-right for menuitems in vertical menubars. (gtk_real_menu_shell_move_current): Simplify by moving direction tweaking to menu- and menubar-specific implementations. Take pack direction into account when doing fallbacks. * tests/testmenubars.c: Test menubars in various packing direction combinations. * tests/Makefile.am (noinst_PROGRAMS): Add testmenubars.
2005-02-11 07:15:11 +00:00
static void
gtk_menu_bar_set_property (GObject *object,
guint prop_id,
const GValue *value,
GParamSpec *pspec)
{
GtkMenuBar *menubar = GTK_MENU_BAR (object);
switch (prop_id)
{
case PROP_PACK_DIRECTION:
gtk_menu_bar_set_pack_direction (menubar, g_value_get_enum (value));
break;
case PROP_CHILD_PACK_DIRECTION:
gtk_menu_bar_set_child_pack_direction (menubar, g_value_get_enum (value));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
}
static void
gtk_menu_bar_get_property (GObject *object,
guint prop_id,
GValue *value,
GParamSpec *pspec)
{
GtkMenuBar *menubar = GTK_MENU_BAR (object);
switch (prop_id)
{
case PROP_PACK_DIRECTION:
g_value_set_enum (value, gtk_menu_bar_get_pack_direction (menubar));
break;
case PROP_CHILD_PACK_DIRECTION:
g_value_set_enum (value, gtk_menu_bar_get_child_pack_direction (menubar));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
}
1997-11-24 22:37:52 +00:00
static void
gtk_menu_bar_size_request (GtkWidget *widget,
GtkRequisition *requisition)
{
GtkMenuBar *menu_bar;
Support vertical menubars (#166632): 2005-02-11 Matthias Clasen <mclasen@redhat.com> Support vertical menubars (#166632): * gtk/gtkenums.h (GtkPackDirection): New enumeration for pack directions, with values for left-to-right, right-to-left, top-to-bottom and bottom-to-top. * gtk/gtk.symbols: * gtk/gtkmenubar.h: * gtk/gtkmenubar.c: Add two properties, pack-direction and child-pack-direction, which specify how children and grandchildren of a menubar are packed, with getters and setters. * gtk/gtkmenubar.c (gtk_menu_bar_set_property): (gtk_menu_bar_get_property): Implement set_property and get_property. * gtk/gtkmenubar.c (gtk_menu_bar_size_request): (gtk_menu_bar_size_allocate): Take pack direction into account. * gtk/gtkmenubar.c (gtk_menu_bar_move_current): Implement move_current here move all the menubar-specific direction tweaking from the generic menushell implementation here. * gtk/gtkmenu.c (gtk_menu_move_current): Move menu-specific direction tweaking from the generic menushell implementation here. * gtk/gtkmenuitem.c (gtk_menu_item_size_request): (gtk_menu_bar_size_allocate): Take pack direction into account. * gtk/gtkimagemenuitem.c (gtk_image_menu_item_size_request) (gtk_image_menu_item_size_allocate): (gtk_image_menu_item_toggle_size_request): Take child pack direction into account and pack the image vertically if necessary. * gtk/gtkmenushell.c (gtk_menu_shell_real_select_item): Set the submenu direction to left-right for menuitems in vertical menubars. (gtk_real_menu_shell_move_current): Simplify by moving direction tweaking to menu- and menubar-specific implementations. Take pack direction into account when doing fallbacks. * tests/testmenubars.c: Test menubars in various packing direction combinations. * tests/Makefile.am (noinst_PROGRAMS): Add testmenubars.
2005-02-11 07:15:11 +00:00
GtkMenuBarPrivate *priv;
1997-11-24 22:37:52 +00:00
GtkMenuShell *menu_shell;
GtkWidget *child;
GList *children;
gint nchildren;
GtkRequisition child_requisition;
Handle case where we need to parse the xsetting as if it were an RC file 2001-05-10 Havoc Pennington <hp@redhat.com> * gtk/gtksettings.c (gtk_settings_get_property): Handle case where we need to parse the xsetting as if it were an RC file string. * gtk/gtkcolorsel.c (gtk_color_selection_class_init): load initial value of palette from settings, not from static variable * gdk/x11/gdkevents-x11.c: add color palette, toolbar mode to xsettings translation table * gtk/gtktoolbar.c (gtk_toolbar_new): Remove arguments, because hardcoding the toolbar style conflicts with new customizable toolbar style philosophy (gtk_toolbar_class_init): add settings for default toolbar style; these are used unless the app specifically forces a toolbar style * gtk/gtksettings.c (settings_install_property_parser): only return at the start if we warn and parser == NULL * gtk/gtkcolorsel.c (gtk_color_selection_finalize): disconnect the palette changed handler so we don't notify dead color selections * gtk/gtkstyle.c (gtk_default_draw_shadow): handle xthickness/ythickness of 0 or 1 properly (gtk_default_draw_resize_grip): clear the background behind the resize grips, and align to bottom right if we square the area to be drawn. * gtk/gtkstatusbar.c (gtk_statusbar_init): set horizontal usize on statusbar label to 1, so it doesn't make toplevels resize oddly (gtk_statusbar_size_request): add grip size to request (gtk_statusbar_size_allocate): hack so the hbox still works with the grip size in the request * gtk/gtktoolbar.c (gtk_toolbar_show_all): override to fix bug where showing all on a toplevel makes the toolbar button text appear despite the toolbar mode * gtk/gtkmenubar.c: add internal padding style property * gtk/gtktoolbar.c: Add internal padding style property; add shadow type style property * gtk/gtkmenubar.c (gtk_menu_bar_paint): paint box with widget state; and put Container::border_width outside the frame * gtk/gtktextview.c: don't draw focus rectangle if we're in interior focus mode, we just use blinking cursor
2001-06-04 23:15:51 +00:00
gint ipadding;
1997-11-24 22:37:52 +00:00
g_return_if_fail (GTK_IS_MENU_BAR (widget));
g_return_if_fail (requisition != NULL);
requisition->width = 0;
requisition->height = 0;
Handle case where we need to parse the xsetting as if it were an RC file 2001-05-10 Havoc Pennington <hp@redhat.com> * gtk/gtksettings.c (gtk_settings_get_property): Handle case where we need to parse the xsetting as if it were an RC file string. * gtk/gtkcolorsel.c (gtk_color_selection_class_init): load initial value of palette from settings, not from static variable * gdk/x11/gdkevents-x11.c: add color palette, toolbar mode to xsettings translation table * gtk/gtktoolbar.c (gtk_toolbar_new): Remove arguments, because hardcoding the toolbar style conflicts with new customizable toolbar style philosophy (gtk_toolbar_class_init): add settings for default toolbar style; these are used unless the app specifically forces a toolbar style * gtk/gtksettings.c (settings_install_property_parser): only return at the start if we warn and parser == NULL * gtk/gtkcolorsel.c (gtk_color_selection_finalize): disconnect the palette changed handler so we don't notify dead color selections * gtk/gtkstyle.c (gtk_default_draw_shadow): handle xthickness/ythickness of 0 or 1 properly (gtk_default_draw_resize_grip): clear the background behind the resize grips, and align to bottom right if we square the area to be drawn. * gtk/gtkstatusbar.c (gtk_statusbar_init): set horizontal usize on statusbar label to 1, so it doesn't make toplevels resize oddly (gtk_statusbar_size_request): add grip size to request (gtk_statusbar_size_allocate): hack so the hbox still works with the grip size in the request * gtk/gtktoolbar.c (gtk_toolbar_show_all): override to fix bug where showing all on a toplevel makes the toolbar button text appear despite the toolbar mode * gtk/gtkmenubar.c: add internal padding style property * gtk/gtktoolbar.c: Add internal padding style property; add shadow type style property * gtk/gtkmenubar.c (gtk_menu_bar_paint): paint box with widget state; and put Container::border_width outside the frame * gtk/gtktextview.c: don't draw focus rectangle if we're in interior focus mode, we just use blinking cursor
2001-06-04 23:15:51 +00:00
1997-11-24 22:37:52 +00:00
if (GTK_WIDGET_VISIBLE (widget))
{
menu_bar = GTK_MENU_BAR (widget);
menu_shell = GTK_MENU_SHELL (widget);
Support vertical menubars (#166632): 2005-02-11 Matthias Clasen <mclasen@redhat.com> Support vertical menubars (#166632): * gtk/gtkenums.h (GtkPackDirection): New enumeration for pack directions, with values for left-to-right, right-to-left, top-to-bottom and bottom-to-top. * gtk/gtk.symbols: * gtk/gtkmenubar.h: * gtk/gtkmenubar.c: Add two properties, pack-direction and child-pack-direction, which specify how children and grandchildren of a menubar are packed, with getters and setters. * gtk/gtkmenubar.c (gtk_menu_bar_set_property): (gtk_menu_bar_get_property): Implement set_property and get_property. * gtk/gtkmenubar.c (gtk_menu_bar_size_request): (gtk_menu_bar_size_allocate): Take pack direction into account. * gtk/gtkmenubar.c (gtk_menu_bar_move_current): Implement move_current here move all the menubar-specific direction tweaking from the generic menushell implementation here. * gtk/gtkmenu.c (gtk_menu_move_current): Move menu-specific direction tweaking from the generic menushell implementation here. * gtk/gtkmenuitem.c (gtk_menu_item_size_request): (gtk_menu_bar_size_allocate): Take pack direction into account. * gtk/gtkimagemenuitem.c (gtk_image_menu_item_size_request) (gtk_image_menu_item_size_allocate): (gtk_image_menu_item_toggle_size_request): Take child pack direction into account and pack the image vertically if necessary. * gtk/gtkmenushell.c (gtk_menu_shell_real_select_item): Set the submenu direction to left-right for menuitems in vertical menubars. (gtk_real_menu_shell_move_current): Simplify by moving direction tweaking to menu- and menubar-specific implementations. Take pack direction into account when doing fallbacks. * tests/testmenubars.c: Test menubars in various packing direction combinations. * tests/Makefile.am (noinst_PROGRAMS): Add testmenubars.
2005-02-11 07:15:11 +00:00
priv = GTK_MENU_BAR_GET_PRIVATE (menu_bar);
1997-11-24 22:37:52 +00:00
nchildren = 0;
children = menu_shell->children;
while (children)
{
child = children->data;
children = children->next;
if (GTK_WIDGET_VISIBLE (child))
{
fix bug where it always set the foreground, even if we were only using a 2001-02-12 Havoc Pennington <hp@pobox.com> * gdk/gdkpango.c (gdk_pango_get_gc): fix bug where it always set the foreground, even if we were only using a stipple. (gdk_draw_layout_line_with_colors): new function, allow override colors (gdk_draw_layout_with_colors): new function, allow override colors (gdk_pango_layout_line_get_clip_region): function to get the clip region for a logical text range (gdk_pango_layout_get_clip_region): get the clip region for a logical text range * gdk/x11/gdkcolor-x11.c: forward declare gdk_colormap_sync(), (gdk_colormap_new): fix call to gdk_colormap_sync() so it has the right number of arguments. * gtk/gtktextbtree.c (gtk_text_btree_node_check_consistency): enhance the function to check that node data corresponds to a view still belonging to the tree. * gtk/gtktreeview.c (gtk_tree_view_changed): we were leaking the GtkTreePath (gtk_tree_view_inserted): ditto (gtk_tree_view_child_toggled): ditto * gtk/gtktreemodel.c (gtk_tree_path_append_index): use realloc to simplify this code. * gtk/gtkcellrenderertext.c (get_layout): fix leak of a PangoAttrList * demos/gtk-demo/main.c (load_file): Fix leak of a GString * gtk/gtkentry.c (gtk_entry_realize): Fix leak of a GdkCursor * gtk/gtkmenubar.c (gtk_menu_bar_size_request): consider toggle size in the size request (gtk_menu_bar_size_allocate): consider toggle size here * gtk/gtkimagemenuitem.h, gtkimagemenuitem.c: Menu item that displays a widget in the toggle slot * gtk/testgtk.c: test GtkImageMenuItem * gtk/Makefile.am, gtk/gtk.h: Add GtkImageMenuItem * gtk/gtkmenuitem.h: Use "gint" not "guint16" for toggle size request and allocation * gtk/gtkmenu.c (gtk_menu_size_request): use gint not guint16 * gtk/gtkcheckmenuitem.c (gtk_check_menu_item_toggle_size_request): ditto
2001-02-13 05:44:47 +00:00
gint toggle_size;
Support vertical menubars (#166632): 2005-02-11 Matthias Clasen <mclasen@redhat.com> Support vertical menubars (#166632): * gtk/gtkenums.h (GtkPackDirection): New enumeration for pack directions, with values for left-to-right, right-to-left, top-to-bottom and bottom-to-top. * gtk/gtk.symbols: * gtk/gtkmenubar.h: * gtk/gtkmenubar.c: Add two properties, pack-direction and child-pack-direction, which specify how children and grandchildren of a menubar are packed, with getters and setters. * gtk/gtkmenubar.c (gtk_menu_bar_set_property): (gtk_menu_bar_get_property): Implement set_property and get_property. * gtk/gtkmenubar.c (gtk_menu_bar_size_request): (gtk_menu_bar_size_allocate): Take pack direction into account. * gtk/gtkmenubar.c (gtk_menu_bar_move_current): Implement move_current here move all the menubar-specific direction tweaking from the generic menushell implementation here. * gtk/gtkmenu.c (gtk_menu_move_current): Move menu-specific direction tweaking from the generic menushell implementation here. * gtk/gtkmenuitem.c (gtk_menu_item_size_request): (gtk_menu_bar_size_allocate): Take pack direction into account. * gtk/gtkimagemenuitem.c (gtk_image_menu_item_size_request) (gtk_image_menu_item_size_allocate): (gtk_image_menu_item_toggle_size_request): Take child pack direction into account and pack the image vertically if necessary. * gtk/gtkmenushell.c (gtk_menu_shell_real_select_item): Set the submenu direction to left-right for menuitems in vertical menubars. (gtk_real_menu_shell_move_current): Simplify by moving direction tweaking to menu- and menubar-specific implementations. Take pack direction into account when doing fallbacks. * tests/testmenubars.c: Test menubars in various packing direction combinations. * tests/Makefile.am (noinst_PROGRAMS): Add testmenubars.
2005-02-11 07:15:11 +00:00
1997-11-24 22:37:52 +00:00
GTK_MENU_ITEM (child)->show_submenu_indicator = FALSE;
gtk_widget_size_request (child, &child_requisition);
fix bug where it always set the foreground, even if we were only using a 2001-02-12 Havoc Pennington <hp@pobox.com> * gdk/gdkpango.c (gdk_pango_get_gc): fix bug where it always set the foreground, even if we were only using a stipple. (gdk_draw_layout_line_with_colors): new function, allow override colors (gdk_draw_layout_with_colors): new function, allow override colors (gdk_pango_layout_line_get_clip_region): function to get the clip region for a logical text range (gdk_pango_layout_get_clip_region): get the clip region for a logical text range * gdk/x11/gdkcolor-x11.c: forward declare gdk_colormap_sync(), (gdk_colormap_new): fix call to gdk_colormap_sync() so it has the right number of arguments. * gtk/gtktextbtree.c (gtk_text_btree_node_check_consistency): enhance the function to check that node data corresponds to a view still belonging to the tree. * gtk/gtktreeview.c (gtk_tree_view_changed): we were leaking the GtkTreePath (gtk_tree_view_inserted): ditto (gtk_tree_view_child_toggled): ditto * gtk/gtktreemodel.c (gtk_tree_path_append_index): use realloc to simplify this code. * gtk/gtkcellrenderertext.c (get_layout): fix leak of a PangoAttrList * demos/gtk-demo/main.c (load_file): Fix leak of a GString * gtk/gtkentry.c (gtk_entry_realize): Fix leak of a GdkCursor * gtk/gtkmenubar.c (gtk_menu_bar_size_request): consider toggle size in the size request (gtk_menu_bar_size_allocate): consider toggle size here * gtk/gtkimagemenuitem.h, gtkimagemenuitem.c: Menu item that displays a widget in the toggle slot * gtk/testgtk.c: test GtkImageMenuItem * gtk/Makefile.am, gtk/gtk.h: Add GtkImageMenuItem * gtk/gtkmenuitem.h: Use "gint" not "guint16" for toggle size request and allocation * gtk/gtkmenu.c (gtk_menu_size_request): use gint not guint16 * gtk/gtkcheckmenuitem.c (gtk_check_menu_item_toggle_size_request): ditto
2001-02-13 05:44:47 +00:00
gtk_menu_item_toggle_size_request (GTK_MENU_ITEM (child),
&toggle_size);
Support vertical menubars (#166632): 2005-02-11 Matthias Clasen <mclasen@redhat.com> Support vertical menubars (#166632): * gtk/gtkenums.h (GtkPackDirection): New enumeration for pack directions, with values for left-to-right, right-to-left, top-to-bottom and bottom-to-top. * gtk/gtk.symbols: * gtk/gtkmenubar.h: * gtk/gtkmenubar.c: Add two properties, pack-direction and child-pack-direction, which specify how children and grandchildren of a menubar are packed, with getters and setters. * gtk/gtkmenubar.c (gtk_menu_bar_set_property): (gtk_menu_bar_get_property): Implement set_property and get_property. * gtk/gtkmenubar.c (gtk_menu_bar_size_request): (gtk_menu_bar_size_allocate): Take pack direction into account. * gtk/gtkmenubar.c (gtk_menu_bar_move_current): Implement move_current here move all the menubar-specific direction tweaking from the generic menushell implementation here. * gtk/gtkmenu.c (gtk_menu_move_current): Move menu-specific direction tweaking from the generic menushell implementation here. * gtk/gtkmenuitem.c (gtk_menu_item_size_request): (gtk_menu_bar_size_allocate): Take pack direction into account. * gtk/gtkimagemenuitem.c (gtk_image_menu_item_size_request) (gtk_image_menu_item_size_allocate): (gtk_image_menu_item_toggle_size_request): Take child pack direction into account and pack the image vertically if necessary. * gtk/gtkmenushell.c (gtk_menu_shell_real_select_item): Set the submenu direction to left-right for menuitems in vertical menubars. (gtk_real_menu_shell_move_current): Simplify by moving direction tweaking to menu- and menubar-specific implementations. Take pack direction into account when doing fallbacks. * tests/testmenubars.c: Test menubars in various packing direction combinations. * tests/Makefile.am (noinst_PROGRAMS): Add testmenubars.
2005-02-11 07:15:11 +00:00
if (priv->child_pack_direction == GTK_PACK_DIRECTION_LTR ||
priv->child_pack_direction == GTK_PACK_DIRECTION_RTL)
child_requisition.width += toggle_size;
else
child_requisition.height += toggle_size;
if (priv->pack_direction == GTK_PACK_DIRECTION_LTR ||
priv->pack_direction == GTK_PACK_DIRECTION_RTL)
{
requisition->width += child_requisition.width;
requisition->height = MAX (requisition->height, child_requisition.height);
}
else
{
requisition->width = MAX (requisition->width, child_requisition.width);
requisition->height += child_requisition.height;
}
1997-11-24 22:37:52 +00:00
nchildren += 1;
}
}
gtk_widget_style_get (widget, "internal-padding", &ipadding, NULL);
Handle case where we need to parse the xsetting as if it were an RC file 2001-05-10 Havoc Pennington <hp@redhat.com> * gtk/gtksettings.c (gtk_settings_get_property): Handle case where we need to parse the xsetting as if it were an RC file string. * gtk/gtkcolorsel.c (gtk_color_selection_class_init): load initial value of palette from settings, not from static variable * gdk/x11/gdkevents-x11.c: add color palette, toolbar mode to xsettings translation table * gtk/gtktoolbar.c (gtk_toolbar_new): Remove arguments, because hardcoding the toolbar style conflicts with new customizable toolbar style philosophy (gtk_toolbar_class_init): add settings for default toolbar style; these are used unless the app specifically forces a toolbar style * gtk/gtksettings.c (settings_install_property_parser): only return at the start if we warn and parser == NULL * gtk/gtkcolorsel.c (gtk_color_selection_finalize): disconnect the palette changed handler so we don't notify dead color selections * gtk/gtkstyle.c (gtk_default_draw_shadow): handle xthickness/ythickness of 0 or 1 properly (gtk_default_draw_resize_grip): clear the background behind the resize grips, and align to bottom right if we square the area to be drawn. * gtk/gtkstatusbar.c (gtk_statusbar_init): set horizontal usize on statusbar label to 1, so it doesn't make toplevels resize oddly (gtk_statusbar_size_request): add grip size to request (gtk_statusbar_size_allocate): hack so the hbox still works with the grip size in the request * gtk/gtktoolbar.c (gtk_toolbar_show_all): override to fix bug where showing all on a toplevel makes the toolbar button text appear despite the toolbar mode * gtk/gtkmenubar.c: add internal padding style property * gtk/gtktoolbar.c: Add internal padding style property; add shadow type style property * gtk/gtkmenubar.c (gtk_menu_bar_paint): paint box with widget state; and put Container::border_width outside the frame * gtk/gtktextview.c: don't draw focus rectangle if we're in interior focus mode, we just use blinking cursor
2001-06-04 23:15:51 +00:00
1997-11-24 22:37:52 +00:00
requisition->width += (GTK_CONTAINER (menu_bar)->border_width +
Handle case where we need to parse the xsetting as if it were an RC file 2001-05-10 Havoc Pennington <hp@redhat.com> * gtk/gtksettings.c (gtk_settings_get_property): Handle case where we need to parse the xsetting as if it were an RC file string. * gtk/gtkcolorsel.c (gtk_color_selection_class_init): load initial value of palette from settings, not from static variable * gdk/x11/gdkevents-x11.c: add color palette, toolbar mode to xsettings translation table * gtk/gtktoolbar.c (gtk_toolbar_new): Remove arguments, because hardcoding the toolbar style conflicts with new customizable toolbar style philosophy (gtk_toolbar_class_init): add settings for default toolbar style; these are used unless the app specifically forces a toolbar style * gtk/gtksettings.c (settings_install_property_parser): only return at the start if we warn and parser == NULL * gtk/gtkcolorsel.c (gtk_color_selection_finalize): disconnect the palette changed handler so we don't notify dead color selections * gtk/gtkstyle.c (gtk_default_draw_shadow): handle xthickness/ythickness of 0 or 1 properly (gtk_default_draw_resize_grip): clear the background behind the resize grips, and align to bottom right if we square the area to be drawn. * gtk/gtkstatusbar.c (gtk_statusbar_init): set horizontal usize on statusbar label to 1, so it doesn't make toplevels resize oddly (gtk_statusbar_size_request): add grip size to request (gtk_statusbar_size_allocate): hack so the hbox still works with the grip size in the request * gtk/gtktoolbar.c (gtk_toolbar_show_all): override to fix bug where showing all on a toplevel makes the toolbar button text appear despite the toolbar mode * gtk/gtkmenubar.c: add internal padding style property * gtk/gtktoolbar.c: Add internal padding style property; add shadow type style property * gtk/gtkmenubar.c (gtk_menu_bar_paint): paint box with widget state; and put Container::border_width outside the frame * gtk/gtktextview.c: don't draw focus rectangle if we're in interior focus mode, we just use blinking cursor
2001-06-04 23:15:51 +00:00
ipadding +
1997-11-24 22:37:52 +00:00
BORDER_SPACING) * 2;
requisition->height += (GTK_CONTAINER (menu_bar)->border_width +
Handle case where we need to parse the xsetting as if it were an RC file 2001-05-10 Havoc Pennington <hp@redhat.com> * gtk/gtksettings.c (gtk_settings_get_property): Handle case where we need to parse the xsetting as if it were an RC file string. * gtk/gtkcolorsel.c (gtk_color_selection_class_init): load initial value of palette from settings, not from static variable * gdk/x11/gdkevents-x11.c: add color palette, toolbar mode to xsettings translation table * gtk/gtktoolbar.c (gtk_toolbar_new): Remove arguments, because hardcoding the toolbar style conflicts with new customizable toolbar style philosophy (gtk_toolbar_class_init): add settings for default toolbar style; these are used unless the app specifically forces a toolbar style * gtk/gtksettings.c (settings_install_property_parser): only return at the start if we warn and parser == NULL * gtk/gtkcolorsel.c (gtk_color_selection_finalize): disconnect the palette changed handler so we don't notify dead color selections * gtk/gtkstyle.c (gtk_default_draw_shadow): handle xthickness/ythickness of 0 or 1 properly (gtk_default_draw_resize_grip): clear the background behind the resize grips, and align to bottom right if we square the area to be drawn. * gtk/gtkstatusbar.c (gtk_statusbar_init): set horizontal usize on statusbar label to 1, so it doesn't make toplevels resize oddly (gtk_statusbar_size_request): add grip size to request (gtk_statusbar_size_allocate): hack so the hbox still works with the grip size in the request * gtk/gtktoolbar.c (gtk_toolbar_show_all): override to fix bug where showing all on a toplevel makes the toolbar button text appear despite the toolbar mode * gtk/gtkmenubar.c: add internal padding style property * gtk/gtktoolbar.c: Add internal padding style property; add shadow type style property * gtk/gtkmenubar.c (gtk_menu_bar_paint): paint box with widget state; and put Container::border_width outside the frame * gtk/gtktextview.c: don't draw focus rectangle if we're in interior focus mode, we just use blinking cursor
2001-06-04 23:15:51 +00:00
ipadding +
1997-11-24 22:37:52 +00:00
BORDER_SPACING) * 2;
if (get_shadow_type (menu_bar) != GTK_SHADOW_NONE)
{
requisition->width += widget->style->xthickness * 2;
requisition->height += widget->style->ythickness * 2;
}
1997-11-24 22:37:52 +00:00
}
}
static void
gtk_menu_bar_size_allocate (GtkWidget *widget,
GtkAllocation *allocation)
{
GtkMenuBar *menu_bar;
GtkMenuShell *menu_shell;
Support vertical menubars (#166632): 2005-02-11 Matthias Clasen <mclasen@redhat.com> Support vertical menubars (#166632): * gtk/gtkenums.h (GtkPackDirection): New enumeration for pack directions, with values for left-to-right, right-to-left, top-to-bottom and bottom-to-top. * gtk/gtk.symbols: * gtk/gtkmenubar.h: * gtk/gtkmenubar.c: Add two properties, pack-direction and child-pack-direction, which specify how children and grandchildren of a menubar are packed, with getters and setters. * gtk/gtkmenubar.c (gtk_menu_bar_set_property): (gtk_menu_bar_get_property): Implement set_property and get_property. * gtk/gtkmenubar.c (gtk_menu_bar_size_request): (gtk_menu_bar_size_allocate): Take pack direction into account. * gtk/gtkmenubar.c (gtk_menu_bar_move_current): Implement move_current here move all the menubar-specific direction tweaking from the generic menushell implementation here. * gtk/gtkmenu.c (gtk_menu_move_current): Move menu-specific direction tweaking from the generic menushell implementation here. * gtk/gtkmenuitem.c (gtk_menu_item_size_request): (gtk_menu_bar_size_allocate): Take pack direction into account. * gtk/gtkimagemenuitem.c (gtk_image_menu_item_size_request) (gtk_image_menu_item_size_allocate): (gtk_image_menu_item_toggle_size_request): Take child pack direction into account and pack the image vertically if necessary. * gtk/gtkmenushell.c (gtk_menu_shell_real_select_item): Set the submenu direction to left-right for menuitems in vertical menubars. (gtk_real_menu_shell_move_current): Simplify by moving direction tweaking to menu- and menubar-specific implementations. Take pack direction into account when doing fallbacks. * tests/testmenubars.c: Test menubars in various packing direction combinations. * tests/Makefile.am (noinst_PROGRAMS): Add testmenubars.
2005-02-11 07:15:11 +00:00
GtkMenuBarPrivate *priv;
1997-11-24 22:37:52 +00:00
GtkWidget *child;
GList *children;
GtkAllocation child_allocation;
GtkRequisition child_requisition;
1997-11-24 22:37:52 +00:00
guint offset;
GtkTextDirection direction;
Support vertical menubars (#166632): 2005-02-11 Matthias Clasen <mclasen@redhat.com> Support vertical menubars (#166632): * gtk/gtkenums.h (GtkPackDirection): New enumeration for pack directions, with values for left-to-right, right-to-left, top-to-bottom and bottom-to-top. * gtk/gtk.symbols: * gtk/gtkmenubar.h: * gtk/gtkmenubar.c: Add two properties, pack-direction and child-pack-direction, which specify how children and grandchildren of a menubar are packed, with getters and setters. * gtk/gtkmenubar.c (gtk_menu_bar_set_property): (gtk_menu_bar_get_property): Implement set_property and get_property. * gtk/gtkmenubar.c (gtk_menu_bar_size_request): (gtk_menu_bar_size_allocate): Take pack direction into account. * gtk/gtkmenubar.c (gtk_menu_bar_move_current): Implement move_current here move all the menubar-specific direction tweaking from the generic menushell implementation here. * gtk/gtkmenu.c (gtk_menu_move_current): Move menu-specific direction tweaking from the generic menushell implementation here. * gtk/gtkmenuitem.c (gtk_menu_item_size_request): (gtk_menu_bar_size_allocate): Take pack direction into account. * gtk/gtkimagemenuitem.c (gtk_image_menu_item_size_request) (gtk_image_menu_item_size_allocate): (gtk_image_menu_item_toggle_size_request): Take child pack direction into account and pack the image vertically if necessary. * gtk/gtkmenushell.c (gtk_menu_shell_real_select_item): Set the submenu direction to left-right for menuitems in vertical menubars. (gtk_real_menu_shell_move_current): Simplify by moving direction tweaking to menu- and menubar-specific implementations. Take pack direction into account when doing fallbacks. * tests/testmenubars.c: Test menubars in various packing direction combinations. * tests/Makefile.am (noinst_PROGRAMS): Add testmenubars.
2005-02-11 07:15:11 +00:00
gint ltr_x, ltr_y;
gint ipadding;
1997-11-24 22:37:52 +00:00
g_return_if_fail (GTK_IS_MENU_BAR (widget));
g_return_if_fail (allocation != NULL);
menu_bar = GTK_MENU_BAR (widget);
menu_shell = GTK_MENU_SHELL (widget);
Support vertical menubars (#166632): 2005-02-11 Matthias Clasen <mclasen@redhat.com> Support vertical menubars (#166632): * gtk/gtkenums.h (GtkPackDirection): New enumeration for pack directions, with values for left-to-right, right-to-left, top-to-bottom and bottom-to-top. * gtk/gtk.symbols: * gtk/gtkmenubar.h: * gtk/gtkmenubar.c: Add two properties, pack-direction and child-pack-direction, which specify how children and grandchildren of a menubar are packed, with getters and setters. * gtk/gtkmenubar.c (gtk_menu_bar_set_property): (gtk_menu_bar_get_property): Implement set_property and get_property. * gtk/gtkmenubar.c (gtk_menu_bar_size_request): (gtk_menu_bar_size_allocate): Take pack direction into account. * gtk/gtkmenubar.c (gtk_menu_bar_move_current): Implement move_current here move all the menubar-specific direction tweaking from the generic menushell implementation here. * gtk/gtkmenu.c (gtk_menu_move_current): Move menu-specific direction tweaking from the generic menushell implementation here. * gtk/gtkmenuitem.c (gtk_menu_item_size_request): (gtk_menu_bar_size_allocate): Take pack direction into account. * gtk/gtkimagemenuitem.c (gtk_image_menu_item_size_request) (gtk_image_menu_item_size_allocate): (gtk_image_menu_item_toggle_size_request): Take child pack direction into account and pack the image vertically if necessary. * gtk/gtkmenushell.c (gtk_menu_shell_real_select_item): Set the submenu direction to left-right for menuitems in vertical menubars. (gtk_real_menu_shell_move_current): Simplify by moving direction tweaking to menu- and menubar-specific implementations. Take pack direction into account when doing fallbacks. * tests/testmenubars.c: Test menubars in various packing direction combinations. * tests/Makefile.am (noinst_PROGRAMS): Add testmenubars.
2005-02-11 07:15:11 +00:00
priv = GTK_MENU_BAR_GET_PRIVATE (menu_bar);
1997-11-24 22:37:52 +00:00
direction = gtk_widget_get_direction (widget);
1997-11-24 22:37:52 +00:00
widget->allocation = *allocation;
if (GTK_WIDGET_REALIZED (widget))
gdk_window_move_resize (widget->window,
allocation->x, allocation->y,
allocation->width, allocation->height);
gtk_widget_style_get (widget, "internal-padding", &ipadding, NULL);
Handle case where we need to parse the xsetting as if it were an RC file 2001-05-10 Havoc Pennington <hp@redhat.com> * gtk/gtksettings.c (gtk_settings_get_property): Handle case where we need to parse the xsetting as if it were an RC file string. * gtk/gtkcolorsel.c (gtk_color_selection_class_init): load initial value of palette from settings, not from static variable * gdk/x11/gdkevents-x11.c: add color palette, toolbar mode to xsettings translation table * gtk/gtktoolbar.c (gtk_toolbar_new): Remove arguments, because hardcoding the toolbar style conflicts with new customizable toolbar style philosophy (gtk_toolbar_class_init): add settings for default toolbar style; these are used unless the app specifically forces a toolbar style * gtk/gtksettings.c (settings_install_property_parser): only return at the start if we warn and parser == NULL * gtk/gtkcolorsel.c (gtk_color_selection_finalize): disconnect the palette changed handler so we don't notify dead color selections * gtk/gtkstyle.c (gtk_default_draw_shadow): handle xthickness/ythickness of 0 or 1 properly (gtk_default_draw_resize_grip): clear the background behind the resize grips, and align to bottom right if we square the area to be drawn. * gtk/gtkstatusbar.c (gtk_statusbar_init): set horizontal usize on statusbar label to 1, so it doesn't make toplevels resize oddly (gtk_statusbar_size_request): add grip size to request (gtk_statusbar_size_allocate): hack so the hbox still works with the grip size in the request * gtk/gtktoolbar.c (gtk_toolbar_show_all): override to fix bug where showing all on a toplevel makes the toolbar button text appear despite the toolbar mode * gtk/gtkmenubar.c: add internal padding style property * gtk/gtktoolbar.c: Add internal padding style property; add shadow type style property * gtk/gtkmenubar.c (gtk_menu_bar_paint): paint box with widget state; and put Container::border_width outside the frame * gtk/gtktextview.c: don't draw focus rectangle if we're in interior focus mode, we just use blinking cursor
2001-06-04 23:15:51 +00:00
1997-11-24 22:37:52 +00:00
if (menu_shell->children)
{
child_allocation.x = (GTK_CONTAINER (menu_bar)->border_width +
ipadding +
1997-11-24 22:37:52 +00:00
BORDER_SPACING);
child_allocation.y = (GTK_CONTAINER (menu_bar)->border_width +
BORDER_SPACING);
Support vertical menubars (#166632): 2005-02-11 Matthias Clasen <mclasen@redhat.com> Support vertical menubars (#166632): * gtk/gtkenums.h (GtkPackDirection): New enumeration for pack directions, with values for left-to-right, right-to-left, top-to-bottom and bottom-to-top. * gtk/gtk.symbols: * gtk/gtkmenubar.h: * gtk/gtkmenubar.c: Add two properties, pack-direction and child-pack-direction, which specify how children and grandchildren of a menubar are packed, with getters and setters. * gtk/gtkmenubar.c (gtk_menu_bar_set_property): (gtk_menu_bar_get_property): Implement set_property and get_property. * gtk/gtkmenubar.c (gtk_menu_bar_size_request): (gtk_menu_bar_size_allocate): Take pack direction into account. * gtk/gtkmenubar.c (gtk_menu_bar_move_current): Implement move_current here move all the menubar-specific direction tweaking from the generic menushell implementation here. * gtk/gtkmenu.c (gtk_menu_move_current): Move menu-specific direction tweaking from the generic menushell implementation here. * gtk/gtkmenuitem.c (gtk_menu_item_size_request): (gtk_menu_bar_size_allocate): Take pack direction into account. * gtk/gtkimagemenuitem.c (gtk_image_menu_item_size_request) (gtk_image_menu_item_size_allocate): (gtk_image_menu_item_toggle_size_request): Take child pack direction into account and pack the image vertically if necessary. * gtk/gtkmenushell.c (gtk_menu_shell_real_select_item): Set the submenu direction to left-right for menuitems in vertical menubars. (gtk_real_menu_shell_move_current): Simplify by moving direction tweaking to menu- and menubar-specific implementations. Take pack direction into account when doing fallbacks. * tests/testmenubars.c: Test menubars in various packing direction combinations. * tests/Makefile.am (noinst_PROGRAMS): Add testmenubars.
2005-02-11 07:15:11 +00:00
if (get_shadow_type (menu_bar) != GTK_SHADOW_NONE)
{
child_allocation.x += widget->style->xthickness;
child_allocation.y += widget->style->ythickness;
}
Support vertical menubars (#166632): 2005-02-11 Matthias Clasen <mclasen@redhat.com> Support vertical menubars (#166632): * gtk/gtkenums.h (GtkPackDirection): New enumeration for pack directions, with values for left-to-right, right-to-left, top-to-bottom and bottom-to-top. * gtk/gtk.symbols: * gtk/gtkmenubar.h: * gtk/gtkmenubar.c: Add two properties, pack-direction and child-pack-direction, which specify how children and grandchildren of a menubar are packed, with getters and setters. * gtk/gtkmenubar.c (gtk_menu_bar_set_property): (gtk_menu_bar_get_property): Implement set_property and get_property. * gtk/gtkmenubar.c (gtk_menu_bar_size_request): (gtk_menu_bar_size_allocate): Take pack direction into account. * gtk/gtkmenubar.c (gtk_menu_bar_move_current): Implement move_current here move all the menubar-specific direction tweaking from the generic menushell implementation here. * gtk/gtkmenu.c (gtk_menu_move_current): Move menu-specific direction tweaking from the generic menushell implementation here. * gtk/gtkmenuitem.c (gtk_menu_item_size_request): (gtk_menu_bar_size_allocate): Take pack direction into account. * gtk/gtkimagemenuitem.c (gtk_image_menu_item_size_request) (gtk_image_menu_item_size_allocate): (gtk_image_menu_item_toggle_size_request): Take child pack direction into account and pack the image vertically if necessary. * gtk/gtkmenushell.c (gtk_menu_shell_real_select_item): Set the submenu direction to left-right for menuitems in vertical menubars. (gtk_real_menu_shell_move_current): Simplify by moving direction tweaking to menu- and menubar-specific implementations. Take pack direction into account when doing fallbacks. * tests/testmenubars.c: Test menubars in various packing direction combinations. * tests/Makefile.am (noinst_PROGRAMS): Add testmenubars.
2005-02-11 07:15:11 +00:00
if (priv->pack_direction == GTK_PACK_DIRECTION_LTR ||
priv->pack_direction == GTK_PACK_DIRECTION_RTL)
1997-11-24 22:37:52 +00:00
{
Support vertical menubars (#166632): 2005-02-11 Matthias Clasen <mclasen@redhat.com> Support vertical menubars (#166632): * gtk/gtkenums.h (GtkPackDirection): New enumeration for pack directions, with values for left-to-right, right-to-left, top-to-bottom and bottom-to-top. * gtk/gtk.symbols: * gtk/gtkmenubar.h: * gtk/gtkmenubar.c: Add two properties, pack-direction and child-pack-direction, which specify how children and grandchildren of a menubar are packed, with getters and setters. * gtk/gtkmenubar.c (gtk_menu_bar_set_property): (gtk_menu_bar_get_property): Implement set_property and get_property. * gtk/gtkmenubar.c (gtk_menu_bar_size_request): (gtk_menu_bar_size_allocate): Take pack direction into account. * gtk/gtkmenubar.c (gtk_menu_bar_move_current): Implement move_current here move all the menubar-specific direction tweaking from the generic menushell implementation here. * gtk/gtkmenu.c (gtk_menu_move_current): Move menu-specific direction tweaking from the generic menushell implementation here. * gtk/gtkmenuitem.c (gtk_menu_item_size_request): (gtk_menu_bar_size_allocate): Take pack direction into account. * gtk/gtkimagemenuitem.c (gtk_image_menu_item_size_request) (gtk_image_menu_item_size_allocate): (gtk_image_menu_item_toggle_size_request): Take child pack direction into account and pack the image vertically if necessary. * gtk/gtkmenushell.c (gtk_menu_shell_real_select_item): Set the submenu direction to left-right for menuitems in vertical menubars. (gtk_real_menu_shell_move_current): Simplify by moving direction tweaking to menu- and menubar-specific implementations. Take pack direction into account when doing fallbacks. * tests/testmenubars.c: Test menubars in various packing direction combinations. * tests/Makefile.am (noinst_PROGRAMS): Add testmenubars.
2005-02-11 07:15:11 +00:00
child_allocation.height = MAX (1, (gint)allocation->height - child_allocation.y * 2);
offset = child_allocation.x; /* Window edge to menubar start */
ltr_x = child_allocation.x;
children = menu_shell->children;
while (children)
{
Support vertical menubars (#166632): 2005-02-11 Matthias Clasen <mclasen@redhat.com> Support vertical menubars (#166632): * gtk/gtkenums.h (GtkPackDirection): New enumeration for pack directions, with values for left-to-right, right-to-left, top-to-bottom and bottom-to-top. * gtk/gtk.symbols: * gtk/gtkmenubar.h: * gtk/gtkmenubar.c: Add two properties, pack-direction and child-pack-direction, which specify how children and grandchildren of a menubar are packed, with getters and setters. * gtk/gtkmenubar.c (gtk_menu_bar_set_property): (gtk_menu_bar_get_property): Implement set_property and get_property. * gtk/gtkmenubar.c (gtk_menu_bar_size_request): (gtk_menu_bar_size_allocate): Take pack direction into account. * gtk/gtkmenubar.c (gtk_menu_bar_move_current): Implement move_current here move all the menubar-specific direction tweaking from the generic menushell implementation here. * gtk/gtkmenu.c (gtk_menu_move_current): Move menu-specific direction tweaking from the generic menushell implementation here. * gtk/gtkmenuitem.c (gtk_menu_item_size_request): (gtk_menu_bar_size_allocate): Take pack direction into account. * gtk/gtkimagemenuitem.c (gtk_image_menu_item_size_request) (gtk_image_menu_item_size_allocate): (gtk_image_menu_item_toggle_size_request): Take child pack direction into account and pack the image vertically if necessary. * gtk/gtkmenushell.c (gtk_menu_shell_real_select_item): Set the submenu direction to left-right for menuitems in vertical menubars. (gtk_real_menu_shell_move_current): Simplify by moving direction tweaking to menu- and menubar-specific implementations. Take pack direction into account when doing fallbacks. * tests/testmenubars.c: Test menubars in various packing direction combinations. * tests/Makefile.am (noinst_PROGRAMS): Add testmenubars.
2005-02-11 07:15:11 +00:00
gint toggle_size;
child = children->data;
children = children->next;
gtk_menu_item_toggle_size_request (GTK_MENU_ITEM (child),
&toggle_size);
gtk_widget_get_child_requisition (child, &child_requisition);
if (priv->child_pack_direction == GTK_PACK_DIRECTION_LTR ||
priv->child_pack_direction == GTK_PACK_DIRECTION_RTL)
child_requisition.width += toggle_size;
else
child_requisition.height += toggle_size;
/* Support for the right justified help menu */
if ((children == NULL) && (GTK_IS_MENU_ITEM(child))
&& (GTK_MENU_ITEM(child)->right_justify))
{
ltr_x = allocation->width -
child_requisition.width - offset;
}
if (GTK_WIDGET_VISIBLE (child))
{
if ((direction == GTK_TEXT_DIR_LTR) == (priv->pack_direction == GTK_PACK_DIRECTION_LTR))
child_allocation.x = ltr_x;
else
child_allocation.x = allocation->width -
child_requisition.width - ltr_x;
child_allocation.width = child_requisition.width;
gtk_menu_item_toggle_size_allocate (GTK_MENU_ITEM (child),
toggle_size);
gtk_widget_size_allocate (child, &child_allocation);
ltr_x += child_allocation.width;
}
}
Support vertical menubars (#166632): 2005-02-11 Matthias Clasen <mclasen@redhat.com> Support vertical menubars (#166632): * gtk/gtkenums.h (GtkPackDirection): New enumeration for pack directions, with values for left-to-right, right-to-left, top-to-bottom and bottom-to-top. * gtk/gtk.symbols: * gtk/gtkmenubar.h: * gtk/gtkmenubar.c: Add two properties, pack-direction and child-pack-direction, which specify how children and grandchildren of a menubar are packed, with getters and setters. * gtk/gtkmenubar.c (gtk_menu_bar_set_property): (gtk_menu_bar_get_property): Implement set_property and get_property. * gtk/gtkmenubar.c (gtk_menu_bar_size_request): (gtk_menu_bar_size_allocate): Take pack direction into account. * gtk/gtkmenubar.c (gtk_menu_bar_move_current): Implement move_current here move all the menubar-specific direction tweaking from the generic menushell implementation here. * gtk/gtkmenu.c (gtk_menu_move_current): Move menu-specific direction tweaking from the generic menushell implementation here. * gtk/gtkmenuitem.c (gtk_menu_item_size_request): (gtk_menu_bar_size_allocate): Take pack direction into account. * gtk/gtkimagemenuitem.c (gtk_image_menu_item_size_request) (gtk_image_menu_item_size_allocate): (gtk_image_menu_item_toggle_size_request): Take child pack direction into account and pack the image vertically if necessary. * gtk/gtkmenushell.c (gtk_menu_shell_real_select_item): Set the submenu direction to left-right for menuitems in vertical menubars. (gtk_real_menu_shell_move_current): Simplify by moving direction tweaking to menu- and menubar-specific implementations. Take pack direction into account when doing fallbacks. * tests/testmenubars.c: Test menubars in various packing direction combinations. * tests/Makefile.am (noinst_PROGRAMS): Add testmenubars.
2005-02-11 07:15:11 +00:00
}
else
{
child_allocation.width = MAX (1, (gint)allocation->width - child_allocation.x * 2);
offset = child_allocation.y; /* Window edge to menubar start */
ltr_y = child_allocation.y;
children = menu_shell->children;
while (children)
1997-11-24 22:37:52 +00:00
{
Support vertical menubars (#166632): 2005-02-11 Matthias Clasen <mclasen@redhat.com> Support vertical menubars (#166632): * gtk/gtkenums.h (GtkPackDirection): New enumeration for pack directions, with values for left-to-right, right-to-left, top-to-bottom and bottom-to-top. * gtk/gtk.symbols: * gtk/gtkmenubar.h: * gtk/gtkmenubar.c: Add two properties, pack-direction and child-pack-direction, which specify how children and grandchildren of a menubar are packed, with getters and setters. * gtk/gtkmenubar.c (gtk_menu_bar_set_property): (gtk_menu_bar_get_property): Implement set_property and get_property. * gtk/gtkmenubar.c (gtk_menu_bar_size_request): (gtk_menu_bar_size_allocate): Take pack direction into account. * gtk/gtkmenubar.c (gtk_menu_bar_move_current): Implement move_current here move all the menubar-specific direction tweaking from the generic menushell implementation here. * gtk/gtkmenu.c (gtk_menu_move_current): Move menu-specific direction tweaking from the generic menushell implementation here. * gtk/gtkmenuitem.c (gtk_menu_item_size_request): (gtk_menu_bar_size_allocate): Take pack direction into account. * gtk/gtkimagemenuitem.c (gtk_image_menu_item_size_request) (gtk_image_menu_item_size_allocate): (gtk_image_menu_item_toggle_size_request): Take child pack direction into account and pack the image vertically if necessary. * gtk/gtkmenushell.c (gtk_menu_shell_real_select_item): Set the submenu direction to left-right for menuitems in vertical menubars. (gtk_real_menu_shell_move_current): Simplify by moving direction tweaking to menu- and menubar-specific implementations. Take pack direction into account when doing fallbacks. * tests/testmenubars.c: Test menubars in various packing direction combinations. * tests/Makefile.am (noinst_PROGRAMS): Add testmenubars.
2005-02-11 07:15:11 +00:00
gint toggle_size;
child = children->data;
children = children->next;
gtk_menu_item_toggle_size_request (GTK_MENU_ITEM (child),
&toggle_size);
gtk_widget_get_child_requisition (child, &child_requisition);
if (priv->child_pack_direction == GTK_PACK_DIRECTION_LTR ||
priv->child_pack_direction == GTK_PACK_DIRECTION_RTL)
child_requisition.width += toggle_size;
else
Support vertical menubars (#166632): 2005-02-11 Matthias Clasen <mclasen@redhat.com> Support vertical menubars (#166632): * gtk/gtkenums.h (GtkPackDirection): New enumeration for pack directions, with values for left-to-right, right-to-left, top-to-bottom and bottom-to-top. * gtk/gtk.symbols: * gtk/gtkmenubar.h: * gtk/gtkmenubar.c: Add two properties, pack-direction and child-pack-direction, which specify how children and grandchildren of a menubar are packed, with getters and setters. * gtk/gtkmenubar.c (gtk_menu_bar_set_property): (gtk_menu_bar_get_property): Implement set_property and get_property. * gtk/gtkmenubar.c (gtk_menu_bar_size_request): (gtk_menu_bar_size_allocate): Take pack direction into account. * gtk/gtkmenubar.c (gtk_menu_bar_move_current): Implement move_current here move all the menubar-specific direction tweaking from the generic menushell implementation here. * gtk/gtkmenu.c (gtk_menu_move_current): Move menu-specific direction tweaking from the generic menushell implementation here. * gtk/gtkmenuitem.c (gtk_menu_item_size_request): (gtk_menu_bar_size_allocate): Take pack direction into account. * gtk/gtkimagemenuitem.c (gtk_image_menu_item_size_request) (gtk_image_menu_item_size_allocate): (gtk_image_menu_item_toggle_size_request): Take child pack direction into account and pack the image vertically if necessary. * gtk/gtkmenushell.c (gtk_menu_shell_real_select_item): Set the submenu direction to left-right for menuitems in vertical menubars. (gtk_real_menu_shell_move_current): Simplify by moving direction tweaking to menu- and menubar-specific implementations. Take pack direction into account when doing fallbacks. * tests/testmenubars.c: Test menubars in various packing direction combinations. * tests/Makefile.am (noinst_PROGRAMS): Add testmenubars.
2005-02-11 07:15:11 +00:00
child_requisition.height += toggle_size;
/* Support for the right justified help menu */
if ((children == NULL) && (GTK_IS_MENU_ITEM(child))
&& (GTK_MENU_ITEM(child)->right_justify))
{
ltr_y = allocation->height -
child_requisition.height - offset;
}
if (GTK_WIDGET_VISIBLE (child))
{
if ((direction == GTK_TEXT_DIR_LTR) ==
(priv->pack_direction == GTK_PACK_DIRECTION_TTB))
child_allocation.y = ltr_y;
else
child_allocation.y = allocation->height -
child_requisition.height - ltr_y;
child_allocation.height = child_requisition.height;
gtk_menu_item_toggle_size_allocate (GTK_MENU_ITEM (child),
toggle_size);
gtk_widget_size_allocate (child, &child_allocation);
ltr_y += child_allocation.height;
}
1997-11-24 22:37:52 +00:00
}
}
}
}
static void
gtk_menu_bar_paint (GtkWidget *widget,
GdkRectangle *area)
1997-11-24 22:37:52 +00:00
{
g_return_if_fail (GTK_IS_MENU_BAR (widget));
if (GTK_WIDGET_DRAWABLE (widget))
{
Handle case where we need to parse the xsetting as if it were an RC file 2001-05-10 Havoc Pennington <hp@redhat.com> * gtk/gtksettings.c (gtk_settings_get_property): Handle case where we need to parse the xsetting as if it were an RC file string. * gtk/gtkcolorsel.c (gtk_color_selection_class_init): load initial value of palette from settings, not from static variable * gdk/x11/gdkevents-x11.c: add color palette, toolbar mode to xsettings translation table * gtk/gtktoolbar.c (gtk_toolbar_new): Remove arguments, because hardcoding the toolbar style conflicts with new customizable toolbar style philosophy (gtk_toolbar_class_init): add settings for default toolbar style; these are used unless the app specifically forces a toolbar style * gtk/gtksettings.c (settings_install_property_parser): only return at the start if we warn and parser == NULL * gtk/gtkcolorsel.c (gtk_color_selection_finalize): disconnect the palette changed handler so we don't notify dead color selections * gtk/gtkstyle.c (gtk_default_draw_shadow): handle xthickness/ythickness of 0 or 1 properly (gtk_default_draw_resize_grip): clear the background behind the resize grips, and align to bottom right if we square the area to be drawn. * gtk/gtkstatusbar.c (gtk_statusbar_init): set horizontal usize on statusbar label to 1, so it doesn't make toplevels resize oddly (gtk_statusbar_size_request): add grip size to request (gtk_statusbar_size_allocate): hack so the hbox still works with the grip size in the request * gtk/gtktoolbar.c (gtk_toolbar_show_all): override to fix bug where showing all on a toplevel makes the toolbar button text appear despite the toolbar mode * gtk/gtkmenubar.c: add internal padding style property * gtk/gtktoolbar.c: Add internal padding style property; add shadow type style property * gtk/gtkmenubar.c (gtk_menu_bar_paint): paint box with widget state; and put Container::border_width outside the frame * gtk/gtktextview.c: don't draw focus rectangle if we're in interior focus mode, we just use blinking cursor
2001-06-04 23:15:51 +00:00
gint border;
border = GTK_CONTAINER (widget)->border_width;
gtk_paint_box (widget->style,
widget->window,
Handle case where we need to parse the xsetting as if it were an RC file 2001-05-10 Havoc Pennington <hp@redhat.com> * gtk/gtksettings.c (gtk_settings_get_property): Handle case where we need to parse the xsetting as if it were an RC file string. * gtk/gtkcolorsel.c (gtk_color_selection_class_init): load initial value of palette from settings, not from static variable * gdk/x11/gdkevents-x11.c: add color palette, toolbar mode to xsettings translation table * gtk/gtktoolbar.c (gtk_toolbar_new): Remove arguments, because hardcoding the toolbar style conflicts with new customizable toolbar style philosophy (gtk_toolbar_class_init): add settings for default toolbar style; these are used unless the app specifically forces a toolbar style * gtk/gtksettings.c (settings_install_property_parser): only return at the start if we warn and parser == NULL * gtk/gtkcolorsel.c (gtk_color_selection_finalize): disconnect the palette changed handler so we don't notify dead color selections * gtk/gtkstyle.c (gtk_default_draw_shadow): handle xthickness/ythickness of 0 or 1 properly (gtk_default_draw_resize_grip): clear the background behind the resize grips, and align to bottom right if we square the area to be drawn. * gtk/gtkstatusbar.c (gtk_statusbar_init): set horizontal usize on statusbar label to 1, so it doesn't make toplevels resize oddly (gtk_statusbar_size_request): add grip size to request (gtk_statusbar_size_allocate): hack so the hbox still works with the grip size in the request * gtk/gtktoolbar.c (gtk_toolbar_show_all): override to fix bug where showing all on a toplevel makes the toolbar button text appear despite the toolbar mode * gtk/gtkmenubar.c: add internal padding style property * gtk/gtktoolbar.c: Add internal padding style property; add shadow type style property * gtk/gtkmenubar.c (gtk_menu_bar_paint): paint box with widget state; and put Container::border_width outside the frame * gtk/gtktextview.c: don't draw focus rectangle if we're in interior focus mode, we just use blinking cursor
2001-06-04 23:15:51 +00:00
GTK_WIDGET_STATE (widget),
fix warning 2001-04-27 Havoc Pennington <hp@redhat.com> * gtk/gtkcombo.c (gtk_combo_popup_button_press): fix warning * gtk/gtkmessagedialog.c (gtk_message_dialog_init): make messages selectable * gtk/gtkentry.c (gtk_entry_real_insert_text): don't strip line/para separators (gtk_entry_create_layout): set single paragraph mode on the layout * gtk/gtkbutton.c (gtk_button_new_from_stock): don't put much spacing between the image and label; instead, inside a button box the button will get extra space that will go there, but if people configure button box for 0 chubbiness, then there's no spacing. * gtk/gtkbbox.c (gtk_button_box_class_init): Make child ipadding and min/max size style properties, so people can tune their chubbiness. * tests/testgtk.c (make_toolbar): remove calls to removed toolbar functions * gtk/gtktoolbar.c (gtk_toolbar_class_init): Make space_size, space_style, and button_relief into style properties, remove functions for setting them * gtk/gtkmenu.c (gtk_menu_key_press): handle menu bar accel to pop it back down * gtk/gtkoptionmenu.c (gtk_option_menu_get_props): free boxed types from gtk_widget_style_get * gtk/gtkmenubar.c (gtk_menu_bar_set_shadow_type): Remove, replace with a style property. * gdk/x11/gdkevents-x11.c: namespace the settings * gtk/gtkmenubar.c: Add F10 accelerator to move between menubars. * gtk/gtksettings.c (gtk_settings_class_init): remove code with side effects from inside g_assert(), so that G_DISABLE_ASSERT can be used. Also, translate doc strings for settings. Also, namespace the double-click-time property. Also, remove bell properties crap.
2001-04-28 00:12:47 +00:00
get_shadow_type (GTK_MENU_BAR (widget)),
area, widget, "menubar",
Handle case where we need to parse the xsetting as if it were an RC file 2001-05-10 Havoc Pennington <hp@redhat.com> * gtk/gtksettings.c (gtk_settings_get_property): Handle case where we need to parse the xsetting as if it were an RC file string. * gtk/gtkcolorsel.c (gtk_color_selection_class_init): load initial value of palette from settings, not from static variable * gdk/x11/gdkevents-x11.c: add color palette, toolbar mode to xsettings translation table * gtk/gtktoolbar.c (gtk_toolbar_new): Remove arguments, because hardcoding the toolbar style conflicts with new customizable toolbar style philosophy (gtk_toolbar_class_init): add settings for default toolbar style; these are used unless the app specifically forces a toolbar style * gtk/gtksettings.c (settings_install_property_parser): only return at the start if we warn and parser == NULL * gtk/gtkcolorsel.c (gtk_color_selection_finalize): disconnect the palette changed handler so we don't notify dead color selections * gtk/gtkstyle.c (gtk_default_draw_shadow): handle xthickness/ythickness of 0 or 1 properly (gtk_default_draw_resize_grip): clear the background behind the resize grips, and align to bottom right if we square the area to be drawn. * gtk/gtkstatusbar.c (gtk_statusbar_init): set horizontal usize on statusbar label to 1, so it doesn't make toplevels resize oddly (gtk_statusbar_size_request): add grip size to request (gtk_statusbar_size_allocate): hack so the hbox still works with the grip size in the request * gtk/gtktoolbar.c (gtk_toolbar_show_all): override to fix bug where showing all on a toplevel makes the toolbar button text appear despite the toolbar mode * gtk/gtkmenubar.c: add internal padding style property * gtk/gtktoolbar.c: Add internal padding style property; add shadow type style property * gtk/gtkmenubar.c (gtk_menu_bar_paint): paint box with widget state; and put Container::border_width outside the frame * gtk/gtktextview.c: don't draw focus rectangle if we're in interior focus mode, we just use blinking cursor
2001-06-04 23:15:51 +00:00
border, border,
widget->allocation.width - border * 2,
widget->allocation.height - border * 2);
1997-11-24 22:37:52 +00:00
}
}
static gint
gtk_menu_bar_expose (GtkWidget *widget,
GdkEventExpose *event)
{
g_return_val_if_fail (GTK_IS_MENU_BAR (widget), FALSE);
g_return_val_if_fail (event != NULL, FALSE);
if (GTK_WIDGET_DRAWABLE (widget))
{
gtk_menu_bar_paint (widget, &event->area);
1997-11-24 22:37:52 +00:00
(* GTK_WIDGET_CLASS (gtk_menu_bar_parent_class)->expose_event) (widget, event);
1997-11-24 22:37:52 +00:00
}
return FALSE;
}
fix warning 2001-04-27 Havoc Pennington <hp@redhat.com> * gtk/gtkcombo.c (gtk_combo_popup_button_press): fix warning * gtk/gtkmessagedialog.c (gtk_message_dialog_init): make messages selectable * gtk/gtkentry.c (gtk_entry_real_insert_text): don't strip line/para separators (gtk_entry_create_layout): set single paragraph mode on the layout * gtk/gtkbutton.c (gtk_button_new_from_stock): don't put much spacing between the image and label; instead, inside a button box the button will get extra space that will go there, but if people configure button box for 0 chubbiness, then there's no spacing. * gtk/gtkbbox.c (gtk_button_box_class_init): Make child ipadding and min/max size style properties, so people can tune their chubbiness. * tests/testgtk.c (make_toolbar): remove calls to removed toolbar functions * gtk/gtktoolbar.c (gtk_toolbar_class_init): Make space_size, space_style, and button_relief into style properties, remove functions for setting them * gtk/gtkmenu.c (gtk_menu_key_press): handle menu bar accel to pop it back down * gtk/gtkoptionmenu.c (gtk_option_menu_get_props): free boxed types from gtk_widget_style_get * gtk/gtkmenubar.c (gtk_menu_bar_set_shadow_type): Remove, replace with a style property. * gdk/x11/gdkevents-x11.c: namespace the settings * gtk/gtkmenubar.c: Add F10 accelerator to move between menubars. * gtk/gtksettings.c (gtk_settings_class_init): remove code with side effects from inside g_assert(), so that G_DISABLE_ASSERT can be used. Also, translate doc strings for settings. Also, namespace the double-click-time property. Also, remove bell properties crap.
2001-04-28 00:12:47 +00:00
static GList *
get_menu_bars (GtkWindow *window)
{
return g_object_get_data (G_OBJECT (window), "gtk-menu-bar-list");
}
static GList *
get_viewable_menu_bars (GtkWindow *window)
{
GList *menu_bars;
GList *viewable_menu_bars = NULL;
for (menu_bars = get_menu_bars (window);
menu_bars;
menu_bars = menu_bars->next)
{
GtkWidget *widget = menu_bars->data;
gboolean viewable = TRUE;
while (widget)
{
if (!GTK_WIDGET_MAPPED (widget))
viewable = FALSE;
widget = widget->parent;
}
if (viewable)
viewable_menu_bars = g_list_prepend (viewable_menu_bars, menu_bars->data);
}
return g_list_reverse (viewable_menu_bars);
}
static void
set_menu_bars (GtkWindow *window,
GList *menubars)
{
g_object_set_data (G_OBJECT (window), I_("gtk-menu-bar-list"), menubars);
}
fix warning 2001-04-27 Havoc Pennington <hp@redhat.com> * gtk/gtkcombo.c (gtk_combo_popup_button_press): fix warning * gtk/gtkmessagedialog.c (gtk_message_dialog_init): make messages selectable * gtk/gtkentry.c (gtk_entry_real_insert_text): don't strip line/para separators (gtk_entry_create_layout): set single paragraph mode on the layout * gtk/gtkbutton.c (gtk_button_new_from_stock): don't put much spacing between the image and label; instead, inside a button box the button will get extra space that will go there, but if people configure button box for 0 chubbiness, then there's no spacing. * gtk/gtkbbox.c (gtk_button_box_class_init): Make child ipadding and min/max size style properties, so people can tune their chubbiness. * tests/testgtk.c (make_toolbar): remove calls to removed toolbar functions * gtk/gtktoolbar.c (gtk_toolbar_class_init): Make space_size, space_style, and button_relief into style properties, remove functions for setting them * gtk/gtkmenu.c (gtk_menu_key_press): handle menu bar accel to pop it back down * gtk/gtkoptionmenu.c (gtk_option_menu_get_props): free boxed types from gtk_widget_style_get * gtk/gtkmenubar.c (gtk_menu_bar_set_shadow_type): Remove, replace with a style property. * gdk/x11/gdkevents-x11.c: namespace the settings * gtk/gtkmenubar.c: Add F10 accelerator to move between menubars. * gtk/gtksettings.c (gtk_settings_class_init): remove code with side effects from inside g_assert(), so that G_DISABLE_ASSERT can be used. Also, translate doc strings for settings. Also, namespace the double-click-time property. Also, remove bell properties crap.
2001-04-28 00:12:47 +00:00
static gboolean
window_key_press_handler (GtkWidget *widget,
GdkEventKey *event,
gpointer data)
{
gchar *accel = NULL;
gboolean retval = FALSE;
g_object_get (gtk_widget_get_settings (widget),
"gtk-menu-bar-accel", &accel,
fix warning 2001-04-27 Havoc Pennington <hp@redhat.com> * gtk/gtkcombo.c (gtk_combo_popup_button_press): fix warning * gtk/gtkmessagedialog.c (gtk_message_dialog_init): make messages selectable * gtk/gtkentry.c (gtk_entry_real_insert_text): don't strip line/para separators (gtk_entry_create_layout): set single paragraph mode on the layout * gtk/gtkbutton.c (gtk_button_new_from_stock): don't put much spacing between the image and label; instead, inside a button box the button will get extra space that will go there, but if people configure button box for 0 chubbiness, then there's no spacing. * gtk/gtkbbox.c (gtk_button_box_class_init): Make child ipadding and min/max size style properties, so people can tune their chubbiness. * tests/testgtk.c (make_toolbar): remove calls to removed toolbar functions * gtk/gtktoolbar.c (gtk_toolbar_class_init): Make space_size, space_style, and button_relief into style properties, remove functions for setting them * gtk/gtkmenu.c (gtk_menu_key_press): handle menu bar accel to pop it back down * gtk/gtkoptionmenu.c (gtk_option_menu_get_props): free boxed types from gtk_widget_style_get * gtk/gtkmenubar.c (gtk_menu_bar_set_shadow_type): Remove, replace with a style property. * gdk/x11/gdkevents-x11.c: namespace the settings * gtk/gtkmenubar.c: Add F10 accelerator to move between menubars. * gtk/gtksettings.c (gtk_settings_class_init): remove code with side effects from inside g_assert(), so that G_DISABLE_ASSERT can be used. Also, translate doc strings for settings. Also, namespace the double-click-time property. Also, remove bell properties crap.
2001-04-28 00:12:47 +00:00
NULL);
if (accel && *accel)
fix warning 2001-04-27 Havoc Pennington <hp@redhat.com> * gtk/gtkcombo.c (gtk_combo_popup_button_press): fix warning * gtk/gtkmessagedialog.c (gtk_message_dialog_init): make messages selectable * gtk/gtkentry.c (gtk_entry_real_insert_text): don't strip line/para separators (gtk_entry_create_layout): set single paragraph mode on the layout * gtk/gtkbutton.c (gtk_button_new_from_stock): don't put much spacing between the image and label; instead, inside a button box the button will get extra space that will go there, but if people configure button box for 0 chubbiness, then there's no spacing. * gtk/gtkbbox.c (gtk_button_box_class_init): Make child ipadding and min/max size style properties, so people can tune their chubbiness. * tests/testgtk.c (make_toolbar): remove calls to removed toolbar functions * gtk/gtktoolbar.c (gtk_toolbar_class_init): Make space_size, space_style, and button_relief into style properties, remove functions for setting them * gtk/gtkmenu.c (gtk_menu_key_press): handle menu bar accel to pop it back down * gtk/gtkoptionmenu.c (gtk_option_menu_get_props): free boxed types from gtk_widget_style_get * gtk/gtkmenubar.c (gtk_menu_bar_set_shadow_type): Remove, replace with a style property. * gdk/x11/gdkevents-x11.c: namespace the settings * gtk/gtkmenubar.c: Add F10 accelerator to move between menubars. * gtk/gtksettings.c (gtk_settings_class_init): remove code with side effects from inside g_assert(), so that G_DISABLE_ASSERT can be used. Also, translate doc strings for settings. Also, namespace the double-click-time property. Also, remove bell properties crap.
2001-04-28 00:12:47 +00:00
{
guint keyval = 0;
GdkModifierType mods = 0;
gtk_accelerator_parse (accel, &keyval, &mods);
if (keyval == 0)
g_warning ("Failed to parse menu bar accelerator '%s'\n", accel);
/* FIXME this is wrong, needs to be in the global accel resolution
* thing, to properly consider i18n etc., but that probably requires
* AccelGroup changes etc.
*/
if (event->keyval == keyval &&
((event->state & gtk_accelerator_get_default_mod_mask ()) ==
(mods & gtk_accelerator_get_default_mod_mask ())))
fix warning 2001-04-27 Havoc Pennington <hp@redhat.com> * gtk/gtkcombo.c (gtk_combo_popup_button_press): fix warning * gtk/gtkmessagedialog.c (gtk_message_dialog_init): make messages selectable * gtk/gtkentry.c (gtk_entry_real_insert_text): don't strip line/para separators (gtk_entry_create_layout): set single paragraph mode on the layout * gtk/gtkbutton.c (gtk_button_new_from_stock): don't put much spacing between the image and label; instead, inside a button box the button will get extra space that will go there, but if people configure button box for 0 chubbiness, then there's no spacing. * gtk/gtkbbox.c (gtk_button_box_class_init): Make child ipadding and min/max size style properties, so people can tune their chubbiness. * tests/testgtk.c (make_toolbar): remove calls to removed toolbar functions * gtk/gtktoolbar.c (gtk_toolbar_class_init): Make space_size, space_style, and button_relief into style properties, remove functions for setting them * gtk/gtkmenu.c (gtk_menu_key_press): handle menu bar accel to pop it back down * gtk/gtkoptionmenu.c (gtk_option_menu_get_props): free boxed types from gtk_widget_style_get * gtk/gtkmenubar.c (gtk_menu_bar_set_shadow_type): Remove, replace with a style property. * gdk/x11/gdkevents-x11.c: namespace the settings * gtk/gtkmenubar.c: Add F10 accelerator to move between menubars. * gtk/gtksettings.c (gtk_settings_class_init): remove code with side effects from inside g_assert(), so that G_DISABLE_ASSERT can be used. Also, translate doc strings for settings. Also, namespace the double-click-time property. Also, remove bell properties crap.
2001-04-28 00:12:47 +00:00
{
GList *tmp_menubars = get_viewable_menu_bars (GTK_WINDOW (widget));
GList *menubars;
fix warning 2001-04-27 Havoc Pennington <hp@redhat.com> * gtk/gtkcombo.c (gtk_combo_popup_button_press): fix warning * gtk/gtkmessagedialog.c (gtk_message_dialog_init): make messages selectable * gtk/gtkentry.c (gtk_entry_real_insert_text): don't strip line/para separators (gtk_entry_create_layout): set single paragraph mode on the layout * gtk/gtkbutton.c (gtk_button_new_from_stock): don't put much spacing between the image and label; instead, inside a button box the button will get extra space that will go there, but if people configure button box for 0 chubbiness, then there's no spacing. * gtk/gtkbbox.c (gtk_button_box_class_init): Make child ipadding and min/max size style properties, so people can tune their chubbiness. * tests/testgtk.c (make_toolbar): remove calls to removed toolbar functions * gtk/gtktoolbar.c (gtk_toolbar_class_init): Make space_size, space_style, and button_relief into style properties, remove functions for setting them * gtk/gtkmenu.c (gtk_menu_key_press): handle menu bar accel to pop it back down * gtk/gtkoptionmenu.c (gtk_option_menu_get_props): free boxed types from gtk_widget_style_get * gtk/gtkmenubar.c (gtk_menu_bar_set_shadow_type): Remove, replace with a style property. * gdk/x11/gdkevents-x11.c: namespace the settings * gtk/gtkmenubar.c: Add F10 accelerator to move between menubars. * gtk/gtksettings.c (gtk_settings_class_init): remove code with side effects from inside g_assert(), so that G_DISABLE_ASSERT can be used. Also, translate doc strings for settings. Also, namespace the double-click-time property. Also, remove bell properties crap.
2001-04-28 00:12:47 +00:00
menubars = _gtk_container_focus_sort (GTK_CONTAINER (widget), tmp_menubars,
GTK_DIR_TAB_FORWARD, NULL);
g_list_free (tmp_menubars);
if (menubars)
{
GtkMenuShell *menu_shell = GTK_MENU_SHELL (menubars->data);
_gtk_menu_shell_activate (menu_shell);
gtk_menu_shell_select_first (menu_shell, FALSE);
g_list_free (menubars);
retval = TRUE;
}
fix warning 2001-04-27 Havoc Pennington <hp@redhat.com> * gtk/gtkcombo.c (gtk_combo_popup_button_press): fix warning * gtk/gtkmessagedialog.c (gtk_message_dialog_init): make messages selectable * gtk/gtkentry.c (gtk_entry_real_insert_text): don't strip line/para separators (gtk_entry_create_layout): set single paragraph mode on the layout * gtk/gtkbutton.c (gtk_button_new_from_stock): don't put much spacing between the image and label; instead, inside a button box the button will get extra space that will go there, but if people configure button box for 0 chubbiness, then there's no spacing. * gtk/gtkbbox.c (gtk_button_box_class_init): Make child ipadding and min/max size style properties, so people can tune their chubbiness. * tests/testgtk.c (make_toolbar): remove calls to removed toolbar functions * gtk/gtktoolbar.c (gtk_toolbar_class_init): Make space_size, space_style, and button_relief into style properties, remove functions for setting them * gtk/gtkmenu.c (gtk_menu_key_press): handle menu bar accel to pop it back down * gtk/gtkoptionmenu.c (gtk_option_menu_get_props): free boxed types from gtk_widget_style_get * gtk/gtkmenubar.c (gtk_menu_bar_set_shadow_type): Remove, replace with a style property. * gdk/x11/gdkevents-x11.c: namespace the settings * gtk/gtkmenubar.c: Add F10 accelerator to move between menubars. * gtk/gtksettings.c (gtk_settings_class_init): remove code with side effects from inside g_assert(), so that G_DISABLE_ASSERT can be used. Also, translate doc strings for settings. Also, namespace the double-click-time property. Also, remove bell properties crap.
2001-04-28 00:12:47 +00:00
}
}
g_free (accel);
fix warning 2001-04-27 Havoc Pennington <hp@redhat.com> * gtk/gtkcombo.c (gtk_combo_popup_button_press): fix warning * gtk/gtkmessagedialog.c (gtk_message_dialog_init): make messages selectable * gtk/gtkentry.c (gtk_entry_real_insert_text): don't strip line/para separators (gtk_entry_create_layout): set single paragraph mode on the layout * gtk/gtkbutton.c (gtk_button_new_from_stock): don't put much spacing between the image and label; instead, inside a button box the button will get extra space that will go there, but if people configure button box for 0 chubbiness, then there's no spacing. * gtk/gtkbbox.c (gtk_button_box_class_init): Make child ipadding and min/max size style properties, so people can tune their chubbiness. * tests/testgtk.c (make_toolbar): remove calls to removed toolbar functions * gtk/gtktoolbar.c (gtk_toolbar_class_init): Make space_size, space_style, and button_relief into style properties, remove functions for setting them * gtk/gtkmenu.c (gtk_menu_key_press): handle menu bar accel to pop it back down * gtk/gtkoptionmenu.c (gtk_option_menu_get_props): free boxed types from gtk_widget_style_get * gtk/gtkmenubar.c (gtk_menu_bar_set_shadow_type): Remove, replace with a style property. * gdk/x11/gdkevents-x11.c: namespace the settings * gtk/gtkmenubar.c: Add F10 accelerator to move between menubars. * gtk/gtksettings.c (gtk_settings_class_init): remove code with side effects from inside g_assert(), so that G_DISABLE_ASSERT can be used. Also, translate doc strings for settings. Also, namespace the double-click-time property. Also, remove bell properties crap.
2001-04-28 00:12:47 +00:00
return retval;
}
static void
add_to_window (GtkWindow *window,
GtkMenuBar *menubar)
{
GList *menubars = get_menu_bars (window);
fix warning 2001-04-27 Havoc Pennington <hp@redhat.com> * gtk/gtkcombo.c (gtk_combo_popup_button_press): fix warning * gtk/gtkmessagedialog.c (gtk_message_dialog_init): make messages selectable * gtk/gtkentry.c (gtk_entry_real_insert_text): don't strip line/para separators (gtk_entry_create_layout): set single paragraph mode on the layout * gtk/gtkbutton.c (gtk_button_new_from_stock): don't put much spacing between the image and label; instead, inside a button box the button will get extra space that will go there, but if people configure button box for 0 chubbiness, then there's no spacing. * gtk/gtkbbox.c (gtk_button_box_class_init): Make child ipadding and min/max size style properties, so people can tune their chubbiness. * tests/testgtk.c (make_toolbar): remove calls to removed toolbar functions * gtk/gtktoolbar.c (gtk_toolbar_class_init): Make space_size, space_style, and button_relief into style properties, remove functions for setting them * gtk/gtkmenu.c (gtk_menu_key_press): handle menu bar accel to pop it back down * gtk/gtkoptionmenu.c (gtk_option_menu_get_props): free boxed types from gtk_widget_style_get * gtk/gtkmenubar.c (gtk_menu_bar_set_shadow_type): Remove, replace with a style property. * gdk/x11/gdkevents-x11.c: namespace the settings * gtk/gtkmenubar.c: Add F10 accelerator to move between menubars. * gtk/gtksettings.c (gtk_settings_class_init): remove code with side effects from inside g_assert(), so that G_DISABLE_ASSERT can be used. Also, translate doc strings for settings. Also, namespace the double-click-time property. Also, remove bell properties crap.
2001-04-28 00:12:47 +00:00
if (!menubars)
{
g_signal_connect (window,
"key_press_event",
G_CALLBACK (window_key_press_handler),
NULL);
}
set_menu_bars (window, g_list_prepend (menubars, menubar));
fix warning 2001-04-27 Havoc Pennington <hp@redhat.com> * gtk/gtkcombo.c (gtk_combo_popup_button_press): fix warning * gtk/gtkmessagedialog.c (gtk_message_dialog_init): make messages selectable * gtk/gtkentry.c (gtk_entry_real_insert_text): don't strip line/para separators (gtk_entry_create_layout): set single paragraph mode on the layout * gtk/gtkbutton.c (gtk_button_new_from_stock): don't put much spacing between the image and label; instead, inside a button box the button will get extra space that will go there, but if people configure button box for 0 chubbiness, then there's no spacing. * gtk/gtkbbox.c (gtk_button_box_class_init): Make child ipadding and min/max size style properties, so people can tune their chubbiness. * tests/testgtk.c (make_toolbar): remove calls to removed toolbar functions * gtk/gtktoolbar.c (gtk_toolbar_class_init): Make space_size, space_style, and button_relief into style properties, remove functions for setting them * gtk/gtkmenu.c (gtk_menu_key_press): handle menu bar accel to pop it back down * gtk/gtkoptionmenu.c (gtk_option_menu_get_props): free boxed types from gtk_widget_style_get * gtk/gtkmenubar.c (gtk_menu_bar_set_shadow_type): Remove, replace with a style property. * gdk/x11/gdkevents-x11.c: namespace the settings * gtk/gtkmenubar.c: Add F10 accelerator to move between menubars. * gtk/gtksettings.c (gtk_settings_class_init): remove code with side effects from inside g_assert(), so that G_DISABLE_ASSERT can be used. Also, translate doc strings for settings. Also, namespace the double-click-time property. Also, remove bell properties crap.
2001-04-28 00:12:47 +00:00
}
static void
remove_from_window (GtkWindow *window,
GtkMenuBar *menubar)
{
GList *menubars = get_menu_bars (window);
menubars = g_list_remove (menubars, menubar);
if (!menubars)
{
g_signal_handlers_disconnect_by_func (window,
window_key_press_handler,
NULL);
}
set_menu_bars (window, menubars);
fix warning 2001-04-27 Havoc Pennington <hp@redhat.com> * gtk/gtkcombo.c (gtk_combo_popup_button_press): fix warning * gtk/gtkmessagedialog.c (gtk_message_dialog_init): make messages selectable * gtk/gtkentry.c (gtk_entry_real_insert_text): don't strip line/para separators (gtk_entry_create_layout): set single paragraph mode on the layout * gtk/gtkbutton.c (gtk_button_new_from_stock): don't put much spacing between the image and label; instead, inside a button box the button will get extra space that will go there, but if people configure button box for 0 chubbiness, then there's no spacing. * gtk/gtkbbox.c (gtk_button_box_class_init): Make child ipadding and min/max size style properties, so people can tune their chubbiness. * tests/testgtk.c (make_toolbar): remove calls to removed toolbar functions * gtk/gtktoolbar.c (gtk_toolbar_class_init): Make space_size, space_style, and button_relief into style properties, remove functions for setting them * gtk/gtkmenu.c (gtk_menu_key_press): handle menu bar accel to pop it back down * gtk/gtkoptionmenu.c (gtk_option_menu_get_props): free boxed types from gtk_widget_style_get * gtk/gtkmenubar.c (gtk_menu_bar_set_shadow_type): Remove, replace with a style property. * gdk/x11/gdkevents-x11.c: namespace the settings * gtk/gtkmenubar.c: Add F10 accelerator to move between menubars. * gtk/gtksettings.c (gtk_settings_class_init): remove code with side effects from inside g_assert(), so that G_DISABLE_ASSERT can be used. Also, translate doc strings for settings. Also, namespace the double-click-time property. Also, remove bell properties crap.
2001-04-28 00:12:47 +00:00
}
static void
gtk_menu_bar_hierarchy_changed (GtkWidget *widget,
GtkWidget *old_toplevel)
fix warning 2001-04-27 Havoc Pennington <hp@redhat.com> * gtk/gtkcombo.c (gtk_combo_popup_button_press): fix warning * gtk/gtkmessagedialog.c (gtk_message_dialog_init): make messages selectable * gtk/gtkentry.c (gtk_entry_real_insert_text): don't strip line/para separators (gtk_entry_create_layout): set single paragraph mode on the layout * gtk/gtkbutton.c (gtk_button_new_from_stock): don't put much spacing between the image and label; instead, inside a button box the button will get extra space that will go there, but if people configure button box for 0 chubbiness, then there's no spacing. * gtk/gtkbbox.c (gtk_button_box_class_init): Make child ipadding and min/max size style properties, so people can tune their chubbiness. * tests/testgtk.c (make_toolbar): remove calls to removed toolbar functions * gtk/gtktoolbar.c (gtk_toolbar_class_init): Make space_size, space_style, and button_relief into style properties, remove functions for setting them * gtk/gtkmenu.c (gtk_menu_key_press): handle menu bar accel to pop it back down * gtk/gtkoptionmenu.c (gtk_option_menu_get_props): free boxed types from gtk_widget_style_get * gtk/gtkmenubar.c (gtk_menu_bar_set_shadow_type): Remove, replace with a style property. * gdk/x11/gdkevents-x11.c: namespace the settings * gtk/gtkmenubar.c: Add F10 accelerator to move between menubars. * gtk/gtksettings.c (gtk_settings_class_init): remove code with side effects from inside g_assert(), so that G_DISABLE_ASSERT can be used. Also, translate doc strings for settings. Also, namespace the double-click-time property. Also, remove bell properties crap.
2001-04-28 00:12:47 +00:00
{
GtkWidget *toplevel;
GtkMenuBar *menubar;
menubar = GTK_MENU_BAR (widget);
toplevel = gtk_widget_get_toplevel (widget);
Check GTK_WIDGET_TOPLEVEL(gtk_widget_get_toplevel (widget)), not Wed Jul 4 22:35:40 2001 Owen Taylor <otaylor@redhat.com> * gtk/gtklabel.c gtk/gtkmenubar.c gtk/gtktreeviewcolumn.c gtk/gtkwidget.c: Check GTK_WIDGET_TOPLEVEL(gtk_widget_get_toplevel (widget)), not GTK_WIDGET_GET_ANCESTOR ... see http://mail.gnome.org/archives/gtk-devel-list/2001-July/msg00072.html. Indicate the best practice in the docs for gtk_widget_get_toplevel(). * gtk/gtkwidget.[ch]: Expose a private _gtk_widget_hierarchy_changed(), so GtkPlug can give the correct signals when transforming from a child to a toplevel. * gtk/gtkdnd.c (gtk_drag_dest_hierarchy_changed): Handle reparentation correctly. * gtk/gtkwidget.c (gtk_widget_propagate_hierarchy_changed): Propagate the previous_toplevel argument down properly. * gtk/gtklabel.c (gtk_label_finalize): Fix unrefing of wrong atr list. * gtk/gtkplug.[ch]: Add an "embedded" signal. * gtk/gtksocket.[ch]: Add "child_added", "child_removed" signals. * gtk/gtkplug.[ch] gtk/gtksocket.[ch]: Add functions gtk_plug_get_id(), gtk_socket_get_id(), to avoid the user having to worry about realization, and gdkx.h. * tests/testsocket.c: Extend to try out the new signals and gtk_plug/socket_get_id(). * gtk/gtklabel.c (gtk_label_set_pattern_internal): Fix setting of underline attributes. * gdk/x11/gdkevents-x11.c (gdk_event_translate): Ignore DestroyNotify events from SubstructureNotifyMask * gdk/x11/gdkwindow-x11.c (gdk_window_reparent): Switch GDK_WINDOW_TYPE (window) as needed. * gdk/x11/gdkwindow-x11.c (gdk_window_new): Clean up, allow creation of toplevel windows as children of foreign windows. * gtk/gtkplug.c: Remove hacks involving changing private fields of GdkWindow. * gtk/gtkplug.[ch] gtk/gtksocket.c: Work to make exactly the same signals and notification be emitted for local embedding as for inter-process embedding.
2001-07-05 02:58:34 +00:00
if (old_toplevel)
Ignore the sgml directory made by gtkdoc. Use gtk_window_set_resizable * .cvsignore: Ignore the sgml directory made by gtkdoc. * demos/pixbuf-demo.c: (main): Use gtk_window_set_resizable instead of the deprecated gtk_window_set_policy. * demos/testpixbuf-scale.c: Add missing <stdlib.h> include. * gdk/gdkkeys.c: (gdk_keymap_class_init): Remove empty finalize function to get rid of warning and some code too. * gdk/x11/gdkfont-x11.c: (gdk_font_charset_for_locale): Add missing const. * gdk/x11/gdkmain-x11.c: (_gdk_windowing_init_check): Remove unused local. * gdk/x11/gdkpango-x11.c: (gdk_pango_context_get): Add missing const. * gdk/x11/gdkselection-x11.c: (gdk_text_property_to_utf8_list), (gdk_utf8_to_compound_text): Add missing const. * gtk/gtkimage.c: (gtk_image_expose): Remove unused local. * gtk/gtkmenubar.c: (gtk_menu_bar_hierarchy_changed): Add missing cast and get rid of an unnecessary one. * gtk/gtksettings.c: (gtk_settings_notify): Remove unused local. * gtk/gtkstatusbar.c: (gtk_statusbar_size_allocate): Remove unused local. * gtk/gtktreemodelsort.c: (gtk_tree_model_sort_build_level): Remove unused local. * modules/input/gtkimcontextxim.c: (gtk_im_context_xim_new): Add missing const. * tests/testsocket.c: (add_child): Add cast so the printf format doesn't make us implicitly depend on what integer type gtk_socket_get_id returns. * tests/testtextbuffer.c: Add missing const. * tests/testtreefocus.c: (main): Remove unused local. * tests/treestoretest.c: (iter_remove): Remove unused local. (uppercase_value): Remove unused function. (make_window): Add statement to quiet the compiler's uninitialized variable warning.
2001-07-18 04:31:11 +00:00
remove_from_window (GTK_WINDOW (old_toplevel), menubar);
fix warning 2001-04-27 Havoc Pennington <hp@redhat.com> * gtk/gtkcombo.c (gtk_combo_popup_button_press): fix warning * gtk/gtkmessagedialog.c (gtk_message_dialog_init): make messages selectable * gtk/gtkentry.c (gtk_entry_real_insert_text): don't strip line/para separators (gtk_entry_create_layout): set single paragraph mode on the layout * gtk/gtkbutton.c (gtk_button_new_from_stock): don't put much spacing between the image and label; instead, inside a button box the button will get extra space that will go there, but if people configure button box for 0 chubbiness, then there's no spacing. * gtk/gtkbbox.c (gtk_button_box_class_init): Make child ipadding and min/max size style properties, so people can tune their chubbiness. * tests/testgtk.c (make_toolbar): remove calls to removed toolbar functions * gtk/gtktoolbar.c (gtk_toolbar_class_init): Make space_size, space_style, and button_relief into style properties, remove functions for setting them * gtk/gtkmenu.c (gtk_menu_key_press): handle menu bar accel to pop it back down * gtk/gtkoptionmenu.c (gtk_option_menu_get_props): free boxed types from gtk_widget_style_get * gtk/gtkmenubar.c (gtk_menu_bar_set_shadow_type): Remove, replace with a style property. * gdk/x11/gdkevents-x11.c: namespace the settings * gtk/gtkmenubar.c: Add F10 accelerator to move between menubars. * gtk/gtksettings.c (gtk_settings_class_init): remove code with side effects from inside g_assert(), so that G_DISABLE_ASSERT can be used. Also, translate doc strings for settings. Also, namespace the double-click-time property. Also, remove bell properties crap.
2001-04-28 00:12:47 +00:00
Check GTK_WIDGET_TOPLEVEL(gtk_widget_get_toplevel (widget)), not Wed Jul 4 22:35:40 2001 Owen Taylor <otaylor@redhat.com> * gtk/gtklabel.c gtk/gtkmenubar.c gtk/gtktreeviewcolumn.c gtk/gtkwidget.c: Check GTK_WIDGET_TOPLEVEL(gtk_widget_get_toplevel (widget)), not GTK_WIDGET_GET_ANCESTOR ... see http://mail.gnome.org/archives/gtk-devel-list/2001-July/msg00072.html. Indicate the best practice in the docs for gtk_widget_get_toplevel(). * gtk/gtkwidget.[ch]: Expose a private _gtk_widget_hierarchy_changed(), so GtkPlug can give the correct signals when transforming from a child to a toplevel. * gtk/gtkdnd.c (gtk_drag_dest_hierarchy_changed): Handle reparentation correctly. * gtk/gtkwidget.c (gtk_widget_propagate_hierarchy_changed): Propagate the previous_toplevel argument down properly. * gtk/gtklabel.c (gtk_label_finalize): Fix unrefing of wrong atr list. * gtk/gtkplug.[ch]: Add an "embedded" signal. * gtk/gtksocket.[ch]: Add "child_added", "child_removed" signals. * gtk/gtkplug.[ch] gtk/gtksocket.[ch]: Add functions gtk_plug_get_id(), gtk_socket_get_id(), to avoid the user having to worry about realization, and gdkx.h. * tests/testsocket.c: Extend to try out the new signals and gtk_plug/socket_get_id(). * gtk/gtklabel.c (gtk_label_set_pattern_internal): Fix setting of underline attributes. * gdk/x11/gdkevents-x11.c (gdk_event_translate): Ignore DestroyNotify events from SubstructureNotifyMask * gdk/x11/gdkwindow-x11.c (gdk_window_reparent): Switch GDK_WINDOW_TYPE (window) as needed. * gdk/x11/gdkwindow-x11.c (gdk_window_new): Clean up, allow creation of toplevel windows as children of foreign windows. * gtk/gtkplug.c: Remove hacks involving changing private fields of GdkWindow. * gtk/gtkplug.[ch] gtk/gtksocket.c: Work to make exactly the same signals and notification be emitted for local embedding as for inter-process embedding.
2001-07-05 02:58:34 +00:00
if (GTK_WIDGET_TOPLEVEL (toplevel))
add_to_window (GTK_WINDOW (toplevel), menubar);
fix warning 2001-04-27 Havoc Pennington <hp@redhat.com> * gtk/gtkcombo.c (gtk_combo_popup_button_press): fix warning * gtk/gtkmessagedialog.c (gtk_message_dialog_init): make messages selectable * gtk/gtkentry.c (gtk_entry_real_insert_text): don't strip line/para separators (gtk_entry_create_layout): set single paragraph mode on the layout * gtk/gtkbutton.c (gtk_button_new_from_stock): don't put much spacing between the image and label; instead, inside a button box the button will get extra space that will go there, but if people configure button box for 0 chubbiness, then there's no spacing. * gtk/gtkbbox.c (gtk_button_box_class_init): Make child ipadding and min/max size style properties, so people can tune their chubbiness. * tests/testgtk.c (make_toolbar): remove calls to removed toolbar functions * gtk/gtktoolbar.c (gtk_toolbar_class_init): Make space_size, space_style, and button_relief into style properties, remove functions for setting them * gtk/gtkmenu.c (gtk_menu_key_press): handle menu bar accel to pop it back down * gtk/gtkoptionmenu.c (gtk_option_menu_get_props): free boxed types from gtk_widget_style_get * gtk/gtkmenubar.c (gtk_menu_bar_set_shadow_type): Remove, replace with a style property. * gdk/x11/gdkevents-x11.c: namespace the settings * gtk/gtkmenubar.c: Add F10 accelerator to move between menubars. * gtk/gtksettings.c (gtk_settings_class_init): remove code with side effects from inside g_assert(), so that G_DISABLE_ASSERT can be used. Also, translate doc strings for settings. Also, namespace the double-click-time property. Also, remove bell properties crap.
2001-04-28 00:12:47 +00:00
}
/**
* _gtk_menu_bar_cycle_focus:
* @menubar: a #GtkMenuBar
* @dir: direction in which to cycle the focus
*
* Move the focus between menubars in the toplevel.
**/
void
_gtk_menu_bar_cycle_focus (GtkMenuBar *menubar,
GtkDirectionType dir)
{
GtkWidget *toplevel = gtk_widget_get_toplevel (GTK_WIDGET (menubar));
GtkMenuItem *to_activate = NULL;
if (GTK_WIDGET_TOPLEVEL (toplevel))
{
GList *tmp_menubars = get_viewable_menu_bars (GTK_WINDOW (toplevel));
GList *menubars;
GList *current;
menubars = _gtk_container_focus_sort (GTK_CONTAINER (toplevel), tmp_menubars,
dir, GTK_WIDGET (menubar));
g_list_free (tmp_menubars);
if (menubars)
{
current = g_list_find (menubars, menubar);
if (current && current->next)
{
GtkMenuShell *new_menushell = GTK_MENU_SHELL (current->next->data);
if (new_menushell->children)
to_activate = new_menushell->children->data;
}
}
g_list_free (menubars);
}
gtk_menu_shell_cancel (GTK_MENU_SHELL (menubar));
if (to_activate)
g_signal_emit_by_name (to_activate, "activate_item");
}
fix warning 2001-04-27 Havoc Pennington <hp@redhat.com> * gtk/gtkcombo.c (gtk_combo_popup_button_press): fix warning * gtk/gtkmessagedialog.c (gtk_message_dialog_init): make messages selectable * gtk/gtkentry.c (gtk_entry_real_insert_text): don't strip line/para separators (gtk_entry_create_layout): set single paragraph mode on the layout * gtk/gtkbutton.c (gtk_button_new_from_stock): don't put much spacing between the image and label; instead, inside a button box the button will get extra space that will go there, but if people configure button box for 0 chubbiness, then there's no spacing. * gtk/gtkbbox.c (gtk_button_box_class_init): Make child ipadding and min/max size style properties, so people can tune their chubbiness. * tests/testgtk.c (make_toolbar): remove calls to removed toolbar functions * gtk/gtktoolbar.c (gtk_toolbar_class_init): Make space_size, space_style, and button_relief into style properties, remove functions for setting them * gtk/gtkmenu.c (gtk_menu_key_press): handle menu bar accel to pop it back down * gtk/gtkoptionmenu.c (gtk_option_menu_get_props): free boxed types from gtk_widget_style_get * gtk/gtkmenubar.c (gtk_menu_bar_set_shadow_type): Remove, replace with a style property. * gdk/x11/gdkevents-x11.c: namespace the settings * gtk/gtkmenubar.c: Add F10 accelerator to move between menubars. * gtk/gtksettings.c (gtk_settings_class_init): remove code with side effects from inside g_assert(), so that G_DISABLE_ASSERT can be used. Also, translate doc strings for settings. Also, namespace the double-click-time property. Also, remove bell properties crap.
2001-04-28 00:12:47 +00:00
static GtkShadowType
get_shadow_type (GtkMenuBar *menubar)
{
GtkShadowType shadow_type = GTK_SHADOW_OUT;
gtk_widget_style_get (GTK_WIDGET (menubar),
"shadow-type", &shadow_type,
fix warning 2001-04-27 Havoc Pennington <hp@redhat.com> * gtk/gtkcombo.c (gtk_combo_popup_button_press): fix warning * gtk/gtkmessagedialog.c (gtk_message_dialog_init): make messages selectable * gtk/gtkentry.c (gtk_entry_real_insert_text): don't strip line/para separators (gtk_entry_create_layout): set single paragraph mode on the layout * gtk/gtkbutton.c (gtk_button_new_from_stock): don't put much spacing between the image and label; instead, inside a button box the button will get extra space that will go there, but if people configure button box for 0 chubbiness, then there's no spacing. * gtk/gtkbbox.c (gtk_button_box_class_init): Make child ipadding and min/max size style properties, so people can tune their chubbiness. * tests/testgtk.c (make_toolbar): remove calls to removed toolbar functions * gtk/gtktoolbar.c (gtk_toolbar_class_init): Make space_size, space_style, and button_relief into style properties, remove functions for setting them * gtk/gtkmenu.c (gtk_menu_key_press): handle menu bar accel to pop it back down * gtk/gtkoptionmenu.c (gtk_option_menu_get_props): free boxed types from gtk_widget_style_get * gtk/gtkmenubar.c (gtk_menu_bar_set_shadow_type): Remove, replace with a style property. * gdk/x11/gdkevents-x11.c: namespace the settings * gtk/gtkmenubar.c: Add F10 accelerator to move between menubars. * gtk/gtksettings.c (gtk_settings_class_init): remove code with side effects from inside g_assert(), so that G_DISABLE_ASSERT can be used. Also, translate doc strings for settings. Also, namespace the double-click-time property. Also, remove bell properties crap.
2001-04-28 00:12:47 +00:00
NULL);
return shadow_type;
}
static gint
gtk_menu_bar_get_popup_delay (GtkMenuShell *menu_shell)
{
gint popup_delay;
g_object_get (gtk_widget_get_settings (GTK_WIDGET (menu_shell)),
"gtk-menu-bar-popup-delay", &popup_delay,
NULL);
return popup_delay;
}
Support vertical menubars (#166632): 2005-02-11 Matthias Clasen <mclasen@redhat.com> Support vertical menubars (#166632): * gtk/gtkenums.h (GtkPackDirection): New enumeration for pack directions, with values for left-to-right, right-to-left, top-to-bottom and bottom-to-top. * gtk/gtk.symbols: * gtk/gtkmenubar.h: * gtk/gtkmenubar.c: Add two properties, pack-direction and child-pack-direction, which specify how children and grandchildren of a menubar are packed, with getters and setters. * gtk/gtkmenubar.c (gtk_menu_bar_set_property): (gtk_menu_bar_get_property): Implement set_property and get_property. * gtk/gtkmenubar.c (gtk_menu_bar_size_request): (gtk_menu_bar_size_allocate): Take pack direction into account. * gtk/gtkmenubar.c (gtk_menu_bar_move_current): Implement move_current here move all the menubar-specific direction tweaking from the generic menushell implementation here. * gtk/gtkmenu.c (gtk_menu_move_current): Move menu-specific direction tweaking from the generic menushell implementation here. * gtk/gtkmenuitem.c (gtk_menu_item_size_request): (gtk_menu_bar_size_allocate): Take pack direction into account. * gtk/gtkimagemenuitem.c (gtk_image_menu_item_size_request) (gtk_image_menu_item_size_allocate): (gtk_image_menu_item_toggle_size_request): Take child pack direction into account and pack the image vertically if necessary. * gtk/gtkmenushell.c (gtk_menu_shell_real_select_item): Set the submenu direction to left-right for menuitems in vertical menubars. (gtk_real_menu_shell_move_current): Simplify by moving direction tweaking to menu- and menubar-specific implementations. Take pack direction into account when doing fallbacks. * tests/testmenubars.c: Test menubars in various packing direction combinations. * tests/Makefile.am (noinst_PROGRAMS): Add testmenubars.
2005-02-11 07:15:11 +00:00
static void
gtk_menu_bar_move_current (GtkMenuShell *menu_shell,
GtkMenuDirectionType direction)
Support vertical menubars (#166632): 2005-02-11 Matthias Clasen <mclasen@redhat.com> Support vertical menubars (#166632): * gtk/gtkenums.h (GtkPackDirection): New enumeration for pack directions, with values for left-to-right, right-to-left, top-to-bottom and bottom-to-top. * gtk/gtk.symbols: * gtk/gtkmenubar.h: * gtk/gtkmenubar.c: Add two properties, pack-direction and child-pack-direction, which specify how children and grandchildren of a menubar are packed, with getters and setters. * gtk/gtkmenubar.c (gtk_menu_bar_set_property): (gtk_menu_bar_get_property): Implement set_property and get_property. * gtk/gtkmenubar.c (gtk_menu_bar_size_request): (gtk_menu_bar_size_allocate): Take pack direction into account. * gtk/gtkmenubar.c (gtk_menu_bar_move_current): Implement move_current here move all the menubar-specific direction tweaking from the generic menushell implementation here. * gtk/gtkmenu.c (gtk_menu_move_current): Move menu-specific direction tweaking from the generic menushell implementation here. * gtk/gtkmenuitem.c (gtk_menu_item_size_request): (gtk_menu_bar_size_allocate): Take pack direction into account. * gtk/gtkimagemenuitem.c (gtk_image_menu_item_size_request) (gtk_image_menu_item_size_allocate): (gtk_image_menu_item_toggle_size_request): Take child pack direction into account and pack the image vertically if necessary. * gtk/gtkmenushell.c (gtk_menu_shell_real_select_item): Set the submenu direction to left-right for menuitems in vertical menubars. (gtk_real_menu_shell_move_current): Simplify by moving direction tweaking to menu- and menubar-specific implementations. Take pack direction into account when doing fallbacks. * tests/testmenubars.c: Test menubars in various packing direction combinations. * tests/Makefile.am (noinst_PROGRAMS): Add testmenubars.
2005-02-11 07:15:11 +00:00
{
GtkMenuBar *menubar = GTK_MENU_BAR (menu_shell);
GtkTextDirection text_dir;
GtkPackDirection pack_dir;
text_dir = gtk_widget_get_direction (GTK_WIDGET (menubar));
pack_dir = gtk_menu_bar_get_pack_direction (menubar);
if (pack_dir == GTK_PACK_DIRECTION_LTR || pack_dir == GTK_PACK_DIRECTION_RTL)
{
if ((text_dir == GTK_TEXT_DIR_RTL) == (pack_dir == GTK_PACK_DIRECTION_LTR))
{
switch (direction)
{
case GTK_MENU_DIR_PREV:
direction = GTK_MENU_DIR_NEXT;
break;
case GTK_MENU_DIR_NEXT:
direction = GTK_MENU_DIR_PREV;
break;
default: ;
}
}
}
else
{
switch (direction)
{
case GTK_MENU_DIR_PARENT:
if ((text_dir == GTK_TEXT_DIR_LTR) == (pack_dir == GTK_PACK_DIRECTION_TTB))
direction = GTK_MENU_DIR_PREV;
else
direction = GTK_MENU_DIR_NEXT;
break;
case GTK_MENU_DIR_CHILD:
if ((text_dir == GTK_TEXT_DIR_LTR) == (pack_dir == GTK_PACK_DIRECTION_TTB))
direction = GTK_MENU_DIR_NEXT;
else
direction = GTK_MENU_DIR_PREV;
break;
case GTK_MENU_DIR_PREV:
if (text_dir == GTK_TEXT_DIR_RTL)
direction = GTK_MENU_DIR_CHILD;
else
direction = GTK_MENU_DIR_PARENT;
break;
case GTK_MENU_DIR_NEXT:
if (text_dir == GTK_TEXT_DIR_RTL)
direction = GTK_MENU_DIR_PARENT;
else
direction = GTK_MENU_DIR_CHILD;
break;
default: ;
}
}
GTK_MENU_SHELL_CLASS (gtk_menu_bar_parent_class)->move_current (menu_shell, direction);
Support vertical menubars (#166632): 2005-02-11 Matthias Clasen <mclasen@redhat.com> Support vertical menubars (#166632): * gtk/gtkenums.h (GtkPackDirection): New enumeration for pack directions, with values for left-to-right, right-to-left, top-to-bottom and bottom-to-top. * gtk/gtk.symbols: * gtk/gtkmenubar.h: * gtk/gtkmenubar.c: Add two properties, pack-direction and child-pack-direction, which specify how children and grandchildren of a menubar are packed, with getters and setters. * gtk/gtkmenubar.c (gtk_menu_bar_set_property): (gtk_menu_bar_get_property): Implement set_property and get_property. * gtk/gtkmenubar.c (gtk_menu_bar_size_request): (gtk_menu_bar_size_allocate): Take pack direction into account. * gtk/gtkmenubar.c (gtk_menu_bar_move_current): Implement move_current here move all the menubar-specific direction tweaking from the generic menushell implementation here. * gtk/gtkmenu.c (gtk_menu_move_current): Move menu-specific direction tweaking from the generic menushell implementation here. * gtk/gtkmenuitem.c (gtk_menu_item_size_request): (gtk_menu_bar_size_allocate): Take pack direction into account. * gtk/gtkimagemenuitem.c (gtk_image_menu_item_size_request) (gtk_image_menu_item_size_allocate): (gtk_image_menu_item_toggle_size_request): Take child pack direction into account and pack the image vertically if necessary. * gtk/gtkmenushell.c (gtk_menu_shell_real_select_item): Set the submenu direction to left-right for menuitems in vertical menubars. (gtk_real_menu_shell_move_current): Simplify by moving direction tweaking to menu- and menubar-specific implementations. Take pack direction into account when doing fallbacks. * tests/testmenubars.c: Test menubars in various packing direction combinations. * tests/Makefile.am (noinst_PROGRAMS): Add testmenubars.
2005-02-11 07:15:11 +00:00
}
/**
* gtk_menu_bar_get_pack_direction:
* @menubar: a #GtkMenuBar
*
* Retrieves the current pack direction of the menubar. See
* gtk_menu_bar_set_pack_direction().
*
* Return value: the pack direction
*
* Since: 2.8
**/
GtkPackDirection
gtk_menu_bar_get_pack_direction (GtkMenuBar *menubar)
{
GtkMenuBarPrivate *priv;
g_return_val_if_fail (GTK_IS_MENU_BAR (menubar),
GTK_PACK_DIRECTION_LTR);
priv = GTK_MENU_BAR_GET_PRIVATE (menubar);
return priv->pack_direction;
}
/**
* gtk_menu_bar_set_pack_direction:
* @menubar: a #GtkMenuBar.
* @pack_dir: a new #GtkPackDirection.
*
* Sets how items should be packed inside a menubar.
*
* Since: 2.8
**/
void
gtk_menu_bar_set_pack_direction (GtkMenuBar *menubar,
GtkPackDirection pack_dir)
Support vertical menubars (#166632): 2005-02-11 Matthias Clasen <mclasen@redhat.com> Support vertical menubars (#166632): * gtk/gtkenums.h (GtkPackDirection): New enumeration for pack directions, with values for left-to-right, right-to-left, top-to-bottom and bottom-to-top. * gtk/gtk.symbols: * gtk/gtkmenubar.h: * gtk/gtkmenubar.c: Add two properties, pack-direction and child-pack-direction, which specify how children and grandchildren of a menubar are packed, with getters and setters. * gtk/gtkmenubar.c (gtk_menu_bar_set_property): (gtk_menu_bar_get_property): Implement set_property and get_property. * gtk/gtkmenubar.c (gtk_menu_bar_size_request): (gtk_menu_bar_size_allocate): Take pack direction into account. * gtk/gtkmenubar.c (gtk_menu_bar_move_current): Implement move_current here move all the menubar-specific direction tweaking from the generic menushell implementation here. * gtk/gtkmenu.c (gtk_menu_move_current): Move menu-specific direction tweaking from the generic menushell implementation here. * gtk/gtkmenuitem.c (gtk_menu_item_size_request): (gtk_menu_bar_size_allocate): Take pack direction into account. * gtk/gtkimagemenuitem.c (gtk_image_menu_item_size_request) (gtk_image_menu_item_size_allocate): (gtk_image_menu_item_toggle_size_request): Take child pack direction into account and pack the image vertically if necessary. * gtk/gtkmenushell.c (gtk_menu_shell_real_select_item): Set the submenu direction to left-right for menuitems in vertical menubars. (gtk_real_menu_shell_move_current): Simplify by moving direction tweaking to menu- and menubar-specific implementations. Take pack direction into account when doing fallbacks. * tests/testmenubars.c: Test menubars in various packing direction combinations. * tests/Makefile.am (noinst_PROGRAMS): Add testmenubars.
2005-02-11 07:15:11 +00:00
{
GtkMenuBarPrivate *priv;
GList *l;
Support vertical menubars (#166632): 2005-02-11 Matthias Clasen <mclasen@redhat.com> Support vertical menubars (#166632): * gtk/gtkenums.h (GtkPackDirection): New enumeration for pack directions, with values for left-to-right, right-to-left, top-to-bottom and bottom-to-top. * gtk/gtk.symbols: * gtk/gtkmenubar.h: * gtk/gtkmenubar.c: Add two properties, pack-direction and child-pack-direction, which specify how children and grandchildren of a menubar are packed, with getters and setters. * gtk/gtkmenubar.c (gtk_menu_bar_set_property): (gtk_menu_bar_get_property): Implement set_property and get_property. * gtk/gtkmenubar.c (gtk_menu_bar_size_request): (gtk_menu_bar_size_allocate): Take pack direction into account. * gtk/gtkmenubar.c (gtk_menu_bar_move_current): Implement move_current here move all the menubar-specific direction tweaking from the generic menushell implementation here. * gtk/gtkmenu.c (gtk_menu_move_current): Move menu-specific direction tweaking from the generic menushell implementation here. * gtk/gtkmenuitem.c (gtk_menu_item_size_request): (gtk_menu_bar_size_allocate): Take pack direction into account. * gtk/gtkimagemenuitem.c (gtk_image_menu_item_size_request) (gtk_image_menu_item_size_allocate): (gtk_image_menu_item_toggle_size_request): Take child pack direction into account and pack the image vertically if necessary. * gtk/gtkmenushell.c (gtk_menu_shell_real_select_item): Set the submenu direction to left-right for menuitems in vertical menubars. (gtk_real_menu_shell_move_current): Simplify by moving direction tweaking to menu- and menubar-specific implementations. Take pack direction into account when doing fallbacks. * tests/testmenubars.c: Test menubars in various packing direction combinations. * tests/Makefile.am (noinst_PROGRAMS): Add testmenubars.
2005-02-11 07:15:11 +00:00
g_return_if_fail (GTK_IS_MENU_BAR (menubar));
priv = GTK_MENU_BAR_GET_PRIVATE (menubar);
if (priv->pack_direction != pack_dir)
{
priv->pack_direction = pack_dir;
gtk_widget_queue_resize (GTK_WIDGET (menubar));
for (l = GTK_MENU_SHELL (menubar)->children; l; l = l->next)
gtk_widget_queue_resize (GTK_WIDGET (l->data));
Support vertical menubars (#166632): 2005-02-11 Matthias Clasen <mclasen@redhat.com> Support vertical menubars (#166632): * gtk/gtkenums.h (GtkPackDirection): New enumeration for pack directions, with values for left-to-right, right-to-left, top-to-bottom and bottom-to-top. * gtk/gtk.symbols: * gtk/gtkmenubar.h: * gtk/gtkmenubar.c: Add two properties, pack-direction and child-pack-direction, which specify how children and grandchildren of a menubar are packed, with getters and setters. * gtk/gtkmenubar.c (gtk_menu_bar_set_property): (gtk_menu_bar_get_property): Implement set_property and get_property. * gtk/gtkmenubar.c (gtk_menu_bar_size_request): (gtk_menu_bar_size_allocate): Take pack direction into account. * gtk/gtkmenubar.c (gtk_menu_bar_move_current): Implement move_current here move all the menubar-specific direction tweaking from the generic menushell implementation here. * gtk/gtkmenu.c (gtk_menu_move_current): Move menu-specific direction tweaking from the generic menushell implementation here. * gtk/gtkmenuitem.c (gtk_menu_item_size_request): (gtk_menu_bar_size_allocate): Take pack direction into account. * gtk/gtkimagemenuitem.c (gtk_image_menu_item_size_request) (gtk_image_menu_item_size_allocate): (gtk_image_menu_item_toggle_size_request): Take child pack direction into account and pack the image vertically if necessary. * gtk/gtkmenushell.c (gtk_menu_shell_real_select_item): Set the submenu direction to left-right for menuitems in vertical menubars. (gtk_real_menu_shell_move_current): Simplify by moving direction tweaking to menu- and menubar-specific implementations. Take pack direction into account when doing fallbacks. * tests/testmenubars.c: Test menubars in various packing direction combinations. * tests/Makefile.am (noinst_PROGRAMS): Add testmenubars.
2005-02-11 07:15:11 +00:00
g_object_notify (G_OBJECT (menubar), "pack-direction");
}
}
/**
* gtk_menu_bar_get_child_pack_direction:
* @menubar: a #GtkMenuBar
*
* Retrieves the current child pack direction of the menubar. See
* gtk_menu_bar_set_child_pack_direction().
*
* Return value: the child pack direction
*
* Since: 2.8
**/
GtkPackDirection
gtk_menu_bar_get_child_pack_direction (GtkMenuBar *menubar)
{
GtkMenuBarPrivate *priv;
g_return_val_if_fail (GTK_IS_MENU_BAR (menubar),
GTK_PACK_DIRECTION_LTR);
priv = GTK_MENU_BAR_GET_PRIVATE (menubar);
return priv->child_pack_direction;
}
/**
* gtk_menu_bar_set_child_pack_direction:
* @menubar: a #GtkMenuBar.
* @child_pack_dir: a new #GtkPackDirection.
*
* Sets how widgets should be packed inside the children of a menubar.
*
* Since: 2.8
**/
void
gtk_menu_bar_set_child_pack_direction (GtkMenuBar *menubar,
GtkPackDirection child_pack_dir)
Support vertical menubars (#166632): 2005-02-11 Matthias Clasen <mclasen@redhat.com> Support vertical menubars (#166632): * gtk/gtkenums.h (GtkPackDirection): New enumeration for pack directions, with values for left-to-right, right-to-left, top-to-bottom and bottom-to-top. * gtk/gtk.symbols: * gtk/gtkmenubar.h: * gtk/gtkmenubar.c: Add two properties, pack-direction and child-pack-direction, which specify how children and grandchildren of a menubar are packed, with getters and setters. * gtk/gtkmenubar.c (gtk_menu_bar_set_property): (gtk_menu_bar_get_property): Implement set_property and get_property. * gtk/gtkmenubar.c (gtk_menu_bar_size_request): (gtk_menu_bar_size_allocate): Take pack direction into account. * gtk/gtkmenubar.c (gtk_menu_bar_move_current): Implement move_current here move all the menubar-specific direction tweaking from the generic menushell implementation here. * gtk/gtkmenu.c (gtk_menu_move_current): Move menu-specific direction tweaking from the generic menushell implementation here. * gtk/gtkmenuitem.c (gtk_menu_item_size_request): (gtk_menu_bar_size_allocate): Take pack direction into account. * gtk/gtkimagemenuitem.c (gtk_image_menu_item_size_request) (gtk_image_menu_item_size_allocate): (gtk_image_menu_item_toggle_size_request): Take child pack direction into account and pack the image vertically if necessary. * gtk/gtkmenushell.c (gtk_menu_shell_real_select_item): Set the submenu direction to left-right for menuitems in vertical menubars. (gtk_real_menu_shell_move_current): Simplify by moving direction tweaking to menu- and menubar-specific implementations. Take pack direction into account when doing fallbacks. * tests/testmenubars.c: Test menubars in various packing direction combinations. * tests/Makefile.am (noinst_PROGRAMS): Add testmenubars.
2005-02-11 07:15:11 +00:00
{
GtkMenuBarPrivate *priv;
GList *l;
Support vertical menubars (#166632): 2005-02-11 Matthias Clasen <mclasen@redhat.com> Support vertical menubars (#166632): * gtk/gtkenums.h (GtkPackDirection): New enumeration for pack directions, with values for left-to-right, right-to-left, top-to-bottom and bottom-to-top. * gtk/gtk.symbols: * gtk/gtkmenubar.h: * gtk/gtkmenubar.c: Add two properties, pack-direction and child-pack-direction, which specify how children and grandchildren of a menubar are packed, with getters and setters. * gtk/gtkmenubar.c (gtk_menu_bar_set_property): (gtk_menu_bar_get_property): Implement set_property and get_property. * gtk/gtkmenubar.c (gtk_menu_bar_size_request): (gtk_menu_bar_size_allocate): Take pack direction into account. * gtk/gtkmenubar.c (gtk_menu_bar_move_current): Implement move_current here move all the menubar-specific direction tweaking from the generic menushell implementation here. * gtk/gtkmenu.c (gtk_menu_move_current): Move menu-specific direction tweaking from the generic menushell implementation here. * gtk/gtkmenuitem.c (gtk_menu_item_size_request): (gtk_menu_bar_size_allocate): Take pack direction into account. * gtk/gtkimagemenuitem.c (gtk_image_menu_item_size_request) (gtk_image_menu_item_size_allocate): (gtk_image_menu_item_toggle_size_request): Take child pack direction into account and pack the image vertically if necessary. * gtk/gtkmenushell.c (gtk_menu_shell_real_select_item): Set the submenu direction to left-right for menuitems in vertical menubars. (gtk_real_menu_shell_move_current): Simplify by moving direction tweaking to menu- and menubar-specific implementations. Take pack direction into account when doing fallbacks. * tests/testmenubars.c: Test menubars in various packing direction combinations. * tests/Makefile.am (noinst_PROGRAMS): Add testmenubars.
2005-02-11 07:15:11 +00:00
g_return_if_fail (GTK_IS_MENU_BAR (menubar));
priv = GTK_MENU_BAR_GET_PRIVATE (menubar);
if (priv->child_pack_direction != child_pack_dir)
{
priv->child_pack_direction = child_pack_dir;
gtk_widget_queue_resize (GTK_WIDGET (menubar));
for (l = GTK_MENU_SHELL (menubar)->children; l; l = l->next)
gtk_widget_queue_resize (GTK_WIDGET (l->data));
Support vertical menubars (#166632): 2005-02-11 Matthias Clasen <mclasen@redhat.com> Support vertical menubars (#166632): * gtk/gtkenums.h (GtkPackDirection): New enumeration for pack directions, with values for left-to-right, right-to-left, top-to-bottom and bottom-to-top. * gtk/gtk.symbols: * gtk/gtkmenubar.h: * gtk/gtkmenubar.c: Add two properties, pack-direction and child-pack-direction, which specify how children and grandchildren of a menubar are packed, with getters and setters. * gtk/gtkmenubar.c (gtk_menu_bar_set_property): (gtk_menu_bar_get_property): Implement set_property and get_property. * gtk/gtkmenubar.c (gtk_menu_bar_size_request): (gtk_menu_bar_size_allocate): Take pack direction into account. * gtk/gtkmenubar.c (gtk_menu_bar_move_current): Implement move_current here move all the menubar-specific direction tweaking from the generic menushell implementation here. * gtk/gtkmenu.c (gtk_menu_move_current): Move menu-specific direction tweaking from the generic menushell implementation here. * gtk/gtkmenuitem.c (gtk_menu_item_size_request): (gtk_menu_bar_size_allocate): Take pack direction into account. * gtk/gtkimagemenuitem.c (gtk_image_menu_item_size_request) (gtk_image_menu_item_size_allocate): (gtk_image_menu_item_toggle_size_request): Take child pack direction into account and pack the image vertically if necessary. * gtk/gtkmenushell.c (gtk_menu_shell_real_select_item): Set the submenu direction to left-right for menuitems in vertical menubars. (gtk_real_menu_shell_move_current): Simplify by moving direction tweaking to menu- and menubar-specific implementations. Take pack direction into account when doing fallbacks. * tests/testmenubars.c: Test menubars in various packing direction combinations. * tests/Makefile.am (noinst_PROGRAMS): Add testmenubars.
2005-02-11 07:15:11 +00:00
g_object_notify (G_OBJECT (menubar), "child-pack-direction");
}
}
#define __GTK_MENU_BAR_C__
#include "gtkaliasdef.c"