2008-07-01 22:57:50 +00:00
|
|
|
/* GTK - The GIMP Toolkit
|
1997-11-24 22:37:52 +00:00
|
|
|
* Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
2000-07-26 11:33:08 +00:00
|
|
|
* 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
|
2000-07-26 11:33:08 +00:00
|
|
|
* Lesser General Public License for more details.
|
1997-11-24 22:37:52 +00:00
|
|
|
*
|
2000-07-26 11:33:08 +00:00
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
1998-04-13 02:02:47 +00:00
|
|
|
* 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
|
|
|
*/
|
1999-02-24 07:37:18 +00:00
|
|
|
|
|
|
|
/*
|
2000-07-26 11:33:08 +00:00
|
|
|
* Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
|
1999-02-24 07:37:18 +00:00
|
|
|
* 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/.
|
|
|
|
*/
|
|
|
|
|
2011-01-14 03:11:22 +00:00
|
|
|
/**
|
|
|
|
* SECTION:gtkmenubar
|
|
|
|
* @Title: GtkMenuBar
|
|
|
|
* @Short_description: A subclass of GtkMenuShell which holds GtkMenuItem widgets
|
|
|
|
* @See_also: #GtkMenuShell, #GtkMenu, #GtkMenuItem
|
|
|
|
*
|
|
|
|
* The #GtkMenuBar is a subclass of #GtkMenuShell which contains one or
|
|
|
|
* more #GtkMenuItems. The result is a standard menu bar which can hold
|
|
|
|
* many menu items.
|
|
|
|
*/
|
|
|
|
|
2008-06-22 14:28:52 +00:00
|
|
|
#include "config.h"
|
2010-09-09 13:35:58 +00:00
|
|
|
|
|
|
|
#include "gtkmenubar.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 "gtkbindings.h"
|
1997-11-24 22:37:52 +00:00
|
|
|
#include "gtkmain.h"
|
2002-03-01 01:05:11 +00:00
|
|
|
#include "gtkmarshalers.h"
|
2010-12-27 01:36:51 +00:00
|
|
|
#include "gtkmenuitemprivate.h"
|
2010-08-29 01:24:11 +00:00
|
|
|
#include "gtkmenuprivate.h"
|
2010-12-23 23:21:53 +00:00
|
|
|
#include "gtkmenushellprivate.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"
|
2010-09-09 13:35:58 +00:00
|
|
|
#include "gtksizerequest.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 "gtkwindow.h"
|
2011-06-05 23:31:59 +00:00
|
|
|
#include "gtkcontainerprivate.h"
|
2010-09-09 13:35:58 +00:00
|
|
|
#include "gtkintl.h"
|
2005-03-22 02:14:55 +00:00
|
|
|
#include "gtkprivate.h"
|
2011-01-04 19:51:19 +00:00
|
|
|
#include "gtktypebuiltins.h"
|
1997-11-24 22:37:52 +00:00
|
|
|
|
1999-01-17 19:01:49 +00:00
|
|
|
#define BORDER_SPACING 0
|
2001-06-04 23:15:51 +00:00
|
|
|
#define DEFAULT_IPADDING 1
|
1997-11-24 22:37:52 +00:00
|
|
|
|
2005-02-11 07:15:11 +00:00
|
|
|
/* Properties */
|
|
|
|
enum {
|
|
|
|
PROP_0,
|
|
|
|
PROP_PACK_DIRECTION,
|
|
|
|
PROP_CHILD_PACK_DIRECTION
|
|
|
|
};
|
|
|
|
|
|
|
|
struct _GtkMenuBarPrivate
|
|
|
|
{
|
|
|
|
GtkPackDirection pack_direction;
|
|
|
|
GtkPackDirection child_pack_direction;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
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);
|
2010-10-27 05:30:07 +00:00
|
|
|
static void gtk_menu_bar_get_preferred_width (GtkWidget *widget,
|
|
|
|
gint *minimum,
|
|
|
|
gint *natural);
|
|
|
|
static void gtk_menu_bar_get_preferred_height (GtkWidget *widget,
|
|
|
|
gint *minimum,
|
|
|
|
gint *natural);
|
2011-04-30 04:41:56 +00:00
|
|
|
static void gtk_menu_bar_get_preferred_width_for_height (GtkWidget *widget,
|
|
|
|
gint height,
|
|
|
|
gint *minimum,
|
|
|
|
gint *natural);
|
|
|
|
static void gtk_menu_bar_get_preferred_height_for_width (GtkWidget *widget,
|
|
|
|
gint width,
|
|
|
|
gint *minimum,
|
|
|
|
gint *natural);
|
gtkmenu.c, gtkmenubar.c, gtkmenuitem.c, gtkmenushell.c, gtkmenushell.h,
Sun Oct 20 23:58:03 2002 Soeren Sandmann <sandmann@daimi.au.dk>
* gtkmenu.c, gtkmenubar.c, gtkmenuitem.c, gtkmenushell.c,
gtkmenushell.h, gtkmenushell.h
- make the delay before submenus appear below menu bars a
GtkSetting
- make the delay before submenus pops up a GtkSetting
- make the stay up triangle slightly larger
- don't pop up the first submenu immediately.
- make the default delay for submenus 225 ms, and 0 for menubars.
- make the default delay before popping down inside the stay-up
triangle 1000 ms
Fixes #74950
2002-10-20 22:29:57 +00:00
|
|
|
static void gtk_menu_bar_size_allocate (GtkWidget *widget,
|
|
|
|
GtkAllocation *allocation);
|
2010-09-06 15:23:40 +00:00
|
|
|
static gint gtk_menu_bar_draw (GtkWidget *widget,
|
|
|
|
cairo_t *cr);
|
gtkmenu.c, gtkmenubar.c, gtkmenuitem.c, gtkmenushell.c, gtkmenushell.h,
Sun Oct 20 23:58:03 2002 Soeren Sandmann <sandmann@daimi.au.dk>
* gtkmenu.c, gtkmenubar.c, gtkmenuitem.c, gtkmenushell.c,
gtkmenushell.h, gtkmenushell.h
- make the delay before submenus appear below menu bars a
GtkSetting
- make the delay before submenus pops up a GtkSetting
- make the stay up triangle slightly larger
- don't pop up the first submenu immediately.
- make the default delay for submenus 225 ms, and 0 for menubars.
- make the default delay before popping down inside the stay-up
triangle 1000 ms
Fixes #74950
2002-10-20 22:29:57 +00:00
|
|
|
static void gtk_menu_bar_hierarchy_changed (GtkWidget *widget,
|
|
|
|
GtkWidget *old_toplevel);
|
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);
|
gtkmenu.c, gtkmenubar.c, gtkmenuitem.c, gtkmenushell.c, gtkmenushell.h,
Sun Oct 20 23:58:03 2002 Soeren Sandmann <sandmann@daimi.au.dk>
* gtkmenu.c, gtkmenubar.c, gtkmenuitem.c, gtkmenushell.c,
gtkmenushell.h, gtkmenushell.h
- make the delay before submenus appear below menu bars a
GtkSetting
- make the delay before submenus pops up a GtkSetting
- make the stay up triangle slightly larger
- don't pop up the first submenu immediately.
- make the default delay for submenus 225 ms, and 0 for menubars.
- make the default delay before popping down inside the stay-up
triangle 1000 ms
Fixes #74950
2002-10-20 22:29:57 +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
|
|
|
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)
|
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)
|
|
|
|
{
|
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;
|
|
|
|
|
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;
|
|
|
|
|
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;
|
|
|
|
|
2010-10-27 05:30:07 +00:00
|
|
|
widget_class->get_preferred_width = gtk_menu_bar_get_preferred_width;
|
|
|
|
widget_class->get_preferred_height = gtk_menu_bar_get_preferred_height;
|
2011-04-30 04:41:56 +00:00
|
|
|
widget_class->get_preferred_width_for_height = gtk_menu_bar_get_preferred_width_for_height;
|
|
|
|
widget_class->get_preferred_height_for_width = gtk_menu_bar_get_preferred_height_for_width;
|
1997-11-24 22:37:52 +00:00
|
|
|
widget_class->size_allocate = gtk_menu_bar_size_allocate;
|
2010-09-06 15:23:40 +00:00
|
|
|
widget_class->draw = gtk_menu_bar_draw;
|
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;
|
gtkmenu.c, gtkmenubar.c, gtkmenuitem.c, gtkmenushell.c, gtkmenushell.h,
Sun Oct 20 23:58:03 2002 Soeren Sandmann <sandmann@daimi.au.dk>
* gtkmenu.c, gtkmenubar.c, gtkmenuitem.c, gtkmenushell.c,
gtkmenushell.h, gtkmenushell.h
- make the delay before submenus appear below menu bars a
GtkSetting
- make the delay before submenus pops up a GtkSetting
- make the stay up triangle slightly larger
- don't pop up the first submenu immediately.
- make the default delay for submenus 225 ms, and 0 for menubars.
- make the default delay before popping down inside the stay-up
triangle 1000 ms
Fixes #74950
2002-10-20 22:29:57 +00:00
|
|
|
menu_shell_class->get_popup_delay = gtk_menu_bar_get_popup_delay;
|
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,
|
2010-09-08 17:35:51 +00:00
|
|
|
GDK_KEY_Left, 0,
|
2008-08-12 14:37:03 +00:00
|
|
|
"move-current", 1,
|
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_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,
|
2010-09-08 17:35:51 +00:00
|
|
|
GDK_KEY_KP_Left, 0,
|
2008-08-12 14:37:03 +00:00
|
|
|
"move-current", 1,
|
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_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,
|
2010-09-08 17:35:51 +00:00
|
|
|
GDK_KEY_Right, 0,
|
2008-08-12 14:37:03 +00:00
|
|
|
"move-current", 1,
|
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_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,
|
2010-09-08 17:35:51 +00:00
|
|
|
GDK_KEY_KP_Right, 0,
|
2008-08-12 14:37:03 +00:00
|
|
|
"move-current", 1,
|
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_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,
|
2010-09-08 17:35:51 +00:00
|
|
|
GDK_KEY_Up, 0,
|
2008-08-12 14:37:03 +00:00
|
|
|
"move-current", 1,
|
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_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,
|
2010-09-08 17:35:51 +00:00
|
|
|
GDK_KEY_KP_Up, 0,
|
2008-08-12 14:37:03 +00:00
|
|
|
"move-current", 1,
|
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_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,
|
2010-09-08 17:35:51 +00:00
|
|
|
GDK_KEY_Down, 0,
|
2008-08-12 14:37:03 +00:00
|
|
|
"move-current", 1,
|
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_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,
|
2010-09-08 17:35:51 +00:00
|
|
|
GDK_KEY_KP_Down, 0,
|
2008-08-12 14:37:03 +00:00
|
|
|
"move-current", 1,
|
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_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
|
|
|
|
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",
|
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,
|
2005-03-22 02:14:55 +00:00
|
|
|
GTK_PARAM_READWRITE));
|
2005-02-11 07:15:11 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* GtkMenuBar:child-pack-direction:
|
|
|
|
*
|
2008-12-30 20:47:03 +00:00
|
|
|
* The child pack direction of the menubar. It determines how
|
2005-02-11 07:15:11 +00:00
|
|
|
* 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",
|
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,
|
2005-03-22 02:14:55 +00:00
|
|
|
GTK_PARAM_READWRITE));
|
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",
|
2004-01-16 23:10:05 +00:00
|
|
|
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,
|
2005-03-22 02:14:55 +00:00
|
|
|
GTK_PARAM_READABLE));
|
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",
|
2004-01-16 23:10:05 +00:00
|
|
|
P_("Internal padding"),
|
|
|
|
P_("Amount of border space between the menubar shadow and the menu items"),
|
2001-06-04 23:15:51 +00:00
|
|
|
0,
|
|
|
|
G_MAXINT,
|
|
|
|
DEFAULT_IPADDING,
|
2005-03-22 02:14:55 +00:00
|
|
|
GTK_PARAM_READABLE));
|
2001-06-04 23:15:51 +00:00
|
|
|
|
2010-06-28 21:21:58 +00:00
|
|
|
g_type_class_add_private (gobject_class, sizeof (GtkMenuBarPrivate));
|
1998-11-16 09:05:26 +00:00
|
|
|
}
|
2007-09-14 09:17:59 +00:00
|
|
|
|
|
|
|
static void
|
2010-06-28 21:21:58 +00:00
|
|
|
gtk_menu_bar_init (GtkMenuBar *menu_bar)
|
2007-09-14 09:17:59 +00:00
|
|
|
{
|
2010-11-21 18:38:52 +00:00
|
|
|
GtkStyleContext *context;
|
|
|
|
|
2010-06-28 21:21:58 +00:00
|
|
|
menu_bar->priv = G_TYPE_INSTANCE_GET_PRIVATE (menu_bar,
|
|
|
|
GTK_TYPE_MENU_BAR,
|
|
|
|
GtkMenuBarPrivate);
|
2010-11-21 18:38:52 +00:00
|
|
|
|
|
|
|
context = gtk_widget_get_style_context (GTK_WIDGET (menu_bar));
|
|
|
|
gtk_style_context_add_class (context, GTK_STYLE_CLASS_MENUBAR);
|
2007-09-14 09:17:59 +00:00
|
|
|
}
|
|
|
|
|
2011-01-14 03:11:22 +00:00
|
|
|
/**
|
|
|
|
* gtk_menu_bar_new:
|
|
|
|
*
|
|
|
|
* Creates a new #GtkMenuBar
|
|
|
|
*
|
|
|
|
* Returns: the new menu bar, as a #GtkWidget
|
|
|
|
*/
|
1997-11-24 22:37:52 +00:00
|
|
|
GtkWidget*
|
1998-05-03 22:41:32 +00:00
|
|
|
gtk_menu_bar_new (void)
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
2002-10-05 01:51:16 +00:00
|
|
|
return g_object_new (GTK_TYPE_MENU_BAR, NULL);
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-04-30 04:31:01 +00:00
|
|
|
static void
|
|
|
|
get_preferred_size_for_size (GtkWidget *widget,
|
|
|
|
GtkOrientation orientation,
|
|
|
|
gint size,
|
|
|
|
gint *minimum,
|
|
|
|
gint *natural)
|
|
|
|
{
|
|
|
|
if (orientation == GTK_ORIENTATION_HORIZONTAL)
|
|
|
|
if (size < 0)
|
|
|
|
gtk_widget_get_preferred_width (widget, minimum, natural);
|
|
|
|
else
|
|
|
|
gtk_widget_get_preferred_width_for_height (widget, size, minimum, natural);
|
|
|
|
else
|
|
|
|
if (size < 0)
|
|
|
|
gtk_widget_get_preferred_height (widget, minimum, natural);
|
|
|
|
else
|
|
|
|
gtk_widget_get_preferred_height_for_width (widget, size, minimum, natural);
|
|
|
|
}
|
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
static void
|
|
|
|
gtk_menu_bar_size_request (GtkWidget *widget,
|
2011-04-30 03:56:25 +00:00
|
|
|
GtkOrientation orientation,
|
2011-04-30 04:41:56 +00:00
|
|
|
gint size,
|
2011-04-30 03:56:25 +00:00
|
|
|
gint *minimum,
|
|
|
|
gint *natural)
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
|
|
|
GtkMenuBar *menu_bar;
|
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;
|
2001-06-04 23:15:51 +00:00
|
|
|
gint ipadding;
|
2010-06-02 04:28:22 +00:00
|
|
|
guint border_width;
|
2011-04-30 04:31:01 +00:00
|
|
|
gboolean use_toggle_size, use_maximize;
|
2011-04-30 04:34:58 +00:00
|
|
|
gint child_minimum, child_natural;
|
|
|
|
|
|
|
|
*minimum = 0;
|
|
|
|
*natural = 0;
|
1997-11-24 22:37:52 +00:00
|
|
|
|
2011-04-30 03:10:55 +00:00
|
|
|
menu_bar = GTK_MENU_BAR (widget);
|
|
|
|
menu_shell = GTK_MENU_SHELL (widget);
|
|
|
|
priv = menu_bar->priv;
|
|
|
|
|
|
|
|
children = menu_shell->priv->children;
|
|
|
|
|
2011-04-30 04:16:18 +00:00
|
|
|
if (priv->child_pack_direction == GTK_PACK_DIRECTION_LTR ||
|
|
|
|
priv->child_pack_direction == GTK_PACK_DIRECTION_RTL)
|
|
|
|
use_toggle_size = (orientation == GTK_ORIENTATION_HORIZONTAL);
|
|
|
|
else
|
|
|
|
use_toggle_size = (orientation == GTK_ORIENTATION_VERTICAL);
|
|
|
|
|
2011-04-30 04:31:01 +00:00
|
|
|
if (priv->pack_direction == GTK_PACK_DIRECTION_LTR ||
|
|
|
|
priv->pack_direction == GTK_PACK_DIRECTION_RTL)
|
|
|
|
use_maximize = (orientation == GTK_ORIENTATION_VERTICAL);
|
|
|
|
else
|
|
|
|
use_maximize = (orientation == GTK_ORIENTATION_HORIZONTAL);
|
|
|
|
|
2011-04-30 03:10:55 +00:00
|
|
|
while (children)
|
|
|
|
{
|
|
|
|
child = children->data;
|
|
|
|
children = children->next;
|
|
|
|
|
|
|
|
if (gtk_widget_get_visible (child))
|
|
|
|
{
|
2011-04-30 04:41:56 +00:00
|
|
|
get_preferred_size_for_size (child, orientation, size, &child_minimum, &child_natural);
|
2011-04-30 03:10:55 +00:00
|
|
|
|
2011-04-30 04:16:18 +00:00
|
|
|
if (use_toggle_size)
|
|
|
|
{
|
|
|
|
gint toggle_size;
|
|
|
|
|
|
|
|
gtk_menu_item_toggle_size_request (GTK_MENU_ITEM (child),
|
|
|
|
&toggle_size);
|
|
|
|
|
2011-04-30 04:34:58 +00:00
|
|
|
child_minimum += toggle_size;
|
|
|
|
child_natural += toggle_size;
|
2011-04-30 04:16:18 +00:00
|
|
|
}
|
2011-04-30 03:10:55 +00:00
|
|
|
|
2011-04-30 04:31:01 +00:00
|
|
|
if (use_maximize)
|
2011-04-30 04:34:58 +00:00
|
|
|
{
|
|
|
|
*minimum = MAX (*minimum, child_minimum);
|
|
|
|
*natural = MAX (*natural, child_natural);
|
|
|
|
}
|
2011-04-30 03:10:55 +00:00
|
|
|
else
|
2011-04-30 04:34:58 +00:00
|
|
|
{
|
|
|
|
*minimum += child_minimum;
|
|
|
|
*natural += child_natural;
|
|
|
|
}
|
2011-04-30 03:10:55 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
gtk_widget_style_get (widget, "internal-padding", &ipadding, NULL);
|
|
|
|
border_width = gtk_container_get_border_width (GTK_CONTAINER (menu_bar));
|
2011-04-30 04:34:58 +00:00
|
|
|
*minimum += (border_width + ipadding + BORDER_SPACING) * 2;
|
|
|
|
*natural += (border_width + ipadding + BORDER_SPACING) * 2;
|
2011-04-30 03:10:55 +00:00
|
|
|
|
|
|
|
if (get_shadow_type (menu_bar) != GTK_SHADOW_NONE)
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
2011-04-30 03:10:55 +00:00
|
|
|
GtkStyleContext *context;
|
2011-05-17 18:20:31 +00:00
|
|
|
GtkBorder border;
|
2011-04-30 03:10:55 +00:00
|
|
|
|
|
|
|
context = gtk_widget_get_style_context (widget);
|
2011-05-17 18:20:31 +00:00
|
|
|
gtk_style_context_get_border (context, gtk_widget_get_state_flags (widget),
|
|
|
|
&border);
|
2011-04-30 03:10:55 +00:00
|
|
|
|
2011-04-30 04:24:51 +00:00
|
|
|
if (orientation == GTK_ORIENTATION_HORIZONTAL)
|
2011-04-30 04:34:58 +00:00
|
|
|
{
|
2011-05-17 18:20:31 +00:00
|
|
|
*minimum += border.left + border.right;
|
|
|
|
*natural += border.left + border.right;
|
2011-04-30 04:34:58 +00:00
|
|
|
}
|
2011-04-30 04:24:51 +00:00
|
|
|
else
|
2011-04-30 04:34:58 +00:00
|
|
|
{
|
2011-05-17 18:20:31 +00:00
|
|
|
*minimum += border.top + border.bottom;
|
|
|
|
*natural += border.top + border.bottom;
|
2011-04-30 04:34:58 +00:00
|
|
|
}
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-10-27 05:30:07 +00:00
|
|
|
static void
|
|
|
|
gtk_menu_bar_get_preferred_width (GtkWidget *widget,
|
|
|
|
gint *minimum,
|
|
|
|
gint *natural)
|
|
|
|
{
|
2011-04-30 04:41:56 +00:00
|
|
|
gtk_menu_bar_size_request (widget, GTK_ORIENTATION_HORIZONTAL, -1, minimum, natural);
|
2010-10-27 05:30:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gtk_menu_bar_get_preferred_height (GtkWidget *widget,
|
|
|
|
gint *minimum,
|
|
|
|
gint *natural)
|
|
|
|
{
|
2011-04-30 04:41:56 +00:00
|
|
|
gtk_menu_bar_size_request (widget, GTK_ORIENTATION_VERTICAL, -1, minimum, natural);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gtk_menu_bar_get_preferred_width_for_height (GtkWidget *widget,
|
|
|
|
gint height,
|
|
|
|
gint *minimum,
|
|
|
|
gint *natural)
|
|
|
|
{
|
|
|
|
gtk_menu_bar_size_request (widget, GTK_ORIENTATION_HORIZONTAL, height, minimum, natural);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gtk_menu_bar_get_preferred_height_for_width (GtkWidget *widget,
|
|
|
|
gint width,
|
|
|
|
gint *minimum,
|
|
|
|
gint *natural)
|
|
|
|
{
|
|
|
|
gtk_menu_bar_size_request (widget, GTK_ORIENTATION_VERTICAL, width, minimum, natural);
|
2010-10-27 05:30:07 +00:00
|
|
|
}
|
|
|
|
|
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;
|
2005-02-11 07:15:11 +00:00
|
|
|
GtkMenuBarPrivate *priv;
|
1997-11-24 22:37:52 +00:00
|
|
|
GtkWidget *child;
|
|
|
|
GList *children;
|
2011-05-01 05:06:06 +00:00
|
|
|
GtkAllocation remaining_space;
|
2004-02-26 22:29:24 +00:00
|
|
|
gint ipadding;
|
2010-06-02 04:28:22 +00:00
|
|
|
guint border_width;
|
2011-05-01 05:06:06 +00:00
|
|
|
GArray *requested_sizes;
|
|
|
|
gint toggle_size;
|
|
|
|
guint i;
|
2002-11-02 00:18:14 +00:00
|
|
|
|
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);
|
2010-06-28 21:21:58 +00:00
|
|
|
priv = menu_bar->priv;
|
1997-11-24 22:37:52 +00:00
|
|
|
|
2010-08-11 21:08:21 +00:00
|
|
|
gtk_widget_set_allocation (widget, allocation);
|
|
|
|
|
2010-03-02 06:16:02 +00:00
|
|
|
if (gtk_widget_get_realized (widget))
|
2010-08-11 21:08:21 +00:00
|
|
|
gdk_window_move_resize (gtk_widget_get_window (widget),
|
1997-11-24 22:37:52 +00:00
|
|
|
allocation->x, allocation->y,
|
|
|
|
allocation->width, allocation->height);
|
|
|
|
|
2010-12-23 23:21:53 +00:00
|
|
|
if (menu_shell->priv->children)
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
2011-05-01 03:38:47 +00:00
|
|
|
gtk_widget_style_get (widget, "internal-padding", &ipadding, NULL);
|
|
|
|
|
2010-06-02 04:28:22 +00:00
|
|
|
border_width = gtk_container_get_border_width (GTK_CONTAINER (menu_bar));
|
2011-05-01 05:06:06 +00:00
|
|
|
remaining_space.x = (border_width +
|
2004-02-26 22:29:24 +00:00
|
|
|
ipadding +
|
1997-11-24 22:37:52 +00:00
|
|
|
BORDER_SPACING);
|
2011-05-01 05:06:06 +00:00
|
|
|
remaining_space.y = (border_width +
|
2011-05-01 03:30:42 +00:00
|
|
|
ipadding +
|
1997-11-24 22:37:52 +00:00
|
|
|
BORDER_SPACING);
|
2011-05-01 05:06:06 +00:00
|
|
|
remaining_space.width = allocation->width -
|
|
|
|
2 * (border_width + ipadding + BORDER_SPACING);
|
|
|
|
remaining_space.height = allocation->height -
|
|
|
|
2 * (border_width + ipadding + BORDER_SPACING);
|
|
|
|
|
2002-02-27 21:57:27 +00:00
|
|
|
if (get_shadow_type (menu_bar) != GTK_SHADOW_NONE)
|
|
|
|
{
|
2010-11-21 18:38:52 +00:00
|
|
|
GtkStyleContext *context;
|
2011-05-17 18:20:31 +00:00
|
|
|
GtkBorder border;
|
2010-08-11 21:08:21 +00:00
|
|
|
|
2010-11-21 18:38:52 +00:00
|
|
|
context = gtk_widget_get_style_context (widget);
|
2011-05-17 18:20:31 +00:00
|
|
|
gtk_style_context_get_border (context, gtk_widget_get_state_flags (widget),
|
|
|
|
&border);
|
2010-11-30 23:55:14 +00:00
|
|
|
|
2011-05-17 18:20:31 +00:00
|
|
|
remaining_space.x += border.left;
|
|
|
|
remaining_space.y += border.top;
|
|
|
|
remaining_space.width -= border.left + border.right;
|
|
|
|
remaining_space.height -= border.top + border.bottom;
|
2002-02-27 21:57:27 +00:00
|
|
|
}
|
|
|
|
|
2011-05-01 05:06:06 +00:00
|
|
|
requested_sizes = g_array_new (FALSE, FALSE, sizeof (GtkRequestedSize));
|
|
|
|
|
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
|
|
|
{
|
2011-05-01 05:06:06 +00:00
|
|
|
int size = remaining_space.width;
|
|
|
|
gboolean ltr = (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_LTR) == (priv->pack_direction == GTK_PACK_DIRECTION_LTR);
|
2010-12-23 23:21:53 +00:00
|
|
|
|
2011-05-01 05:06:06 +00:00
|
|
|
for (children = menu_shell->priv->children; children; children = children->next)
|
2010-12-23 23:21:53 +00:00
|
|
|
{
|
2011-05-01 05:06:06 +00:00
|
|
|
GtkRequestedSize request;
|
2005-02-11 07:15:11 +00:00
|
|
|
child = children->data;
|
2011-05-01 05:06:06 +00:00
|
|
|
|
|
|
|
if (!gtk_widget_get_visible (child))
|
|
|
|
continue;
|
|
|
|
|
|
|
|
request.data = child;
|
|
|
|
gtk_widget_get_preferred_width_for_height (child,
|
|
|
|
remaining_space.height,
|
|
|
|
&request.minimum_size,
|
|
|
|
&request.natural_size);
|
2005-02-11 07:15:11 +00:00
|
|
|
gtk_menu_item_toggle_size_request (GTK_MENU_ITEM (child),
|
|
|
|
&toggle_size);
|
2011-05-01 05:06:06 +00:00
|
|
|
request.minimum_size += toggle_size;
|
|
|
|
request.natural_size += toggle_size;
|
|
|
|
|
|
|
|
gtk_menu_item_toggle_size_allocate (GTK_MENU_ITEM (child), toggle_size);
|
|
|
|
|
|
|
|
g_array_append_val (requested_sizes, request);
|
|
|
|
|
|
|
|
size -= request.minimum_size;
|
|
|
|
}
|
|
|
|
|
|
|
|
size = gtk_distribute_natural_allocation (size,
|
|
|
|
requested_sizes->len,
|
|
|
|
(GtkRequestedSize *) requested_sizes->data);
|
|
|
|
|
|
|
|
for (i = 0; i < requested_sizes->len; i++)
|
|
|
|
{
|
|
|
|
GtkAllocation child_allocation = remaining_space;
|
|
|
|
GtkRequestedSize *request = &g_array_index (requested_sizes, GtkRequestedSize, i);
|
|
|
|
|
|
|
|
child_allocation.width = request->minimum_size;
|
|
|
|
remaining_space.width -= request->minimum_size;
|
|
|
|
|
|
|
|
if (i + 1 == requested_sizes->len && GTK_IS_MENU_ITEM (request->data) &&
|
2011-05-02 14:49:03 +00:00
|
|
|
GTK_MENU_ITEM (request->data)->priv->right_justify)
|
2011-05-01 05:06:06 +00:00
|
|
|
ltr = !ltr;
|
|
|
|
|
|
|
|
if (ltr)
|
|
|
|
remaining_space.x += request->minimum_size;
|
|
|
|
else
|
|
|
|
child_allocation.x += remaining_space.width;
|
|
|
|
|
|
|
|
gtk_widget_size_allocate (request->data, &child_allocation);
|
|
|
|
}
|
2005-02-11 07:15:11 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2011-05-01 05:06:06 +00:00
|
|
|
int size = remaining_space.height;
|
|
|
|
gboolean ttb = (priv->pack_direction == GTK_PACK_DIRECTION_TTB);
|
2010-12-23 23:21:53 +00:00
|
|
|
|
2011-05-01 05:06:06 +00:00
|
|
|
for (children = menu_shell->priv->children; children; children = children->next)
|
2010-12-23 23:21:53 +00:00
|
|
|
{
|
2011-05-01 05:06:06 +00:00
|
|
|
GtkRequestedSize request;
|
2005-02-11 07:15:11 +00:00
|
|
|
child = children->data;
|
2011-05-01 05:06:06 +00:00
|
|
|
|
|
|
|
if (!gtk_widget_get_visible (child))
|
|
|
|
continue;
|
|
|
|
|
|
|
|
request.data = child;
|
|
|
|
gtk_widget_get_preferred_height_for_width (child,
|
|
|
|
remaining_space.width,
|
|
|
|
&request.minimum_size,
|
|
|
|
&request.natural_size);
|
2005-02-11 07:15:11 +00:00
|
|
|
gtk_menu_item_toggle_size_request (GTK_MENU_ITEM (child),
|
|
|
|
&toggle_size);
|
2011-05-01 05:06:06 +00:00
|
|
|
request.minimum_size += toggle_size;
|
|
|
|
request.natural_size += toggle_size;
|
|
|
|
|
|
|
|
gtk_menu_item_toggle_size_allocate (GTK_MENU_ITEM (child), toggle_size);
|
|
|
|
|
|
|
|
g_array_append_val (requested_sizes, request);
|
|
|
|
|
|
|
|
size -= request.minimum_size;
|
|
|
|
}
|
|
|
|
|
|
|
|
size = gtk_distribute_natural_allocation (size,
|
|
|
|
requested_sizes->len,
|
|
|
|
(GtkRequestedSize *) requested_sizes->data);
|
|
|
|
|
|
|
|
for (i = 0; i < requested_sizes->len; i++)
|
|
|
|
{
|
|
|
|
GtkAllocation child_allocation = remaining_space;
|
|
|
|
GtkRequestedSize *request = &g_array_index (requested_sizes, GtkRequestedSize, i);
|
|
|
|
|
|
|
|
child_allocation.height = request->minimum_size;
|
|
|
|
remaining_space.height -= request->minimum_size;
|
|
|
|
|
|
|
|
if (i + 1 == requested_sizes->len && GTK_IS_MENU_ITEM (request->data) &&
|
2011-05-02 14:49:03 +00:00
|
|
|
GTK_MENU_ITEM (request->data)->priv->right_justify)
|
2011-05-01 05:06:06 +00:00
|
|
|
ttb = !ttb;
|
|
|
|
|
|
|
|
if (ttb)
|
|
|
|
remaining_space.y += request->minimum_size;
|
|
|
|
else
|
|
|
|
child_allocation.y += remaining_space.height;
|
|
|
|
|
|
|
|
gtk_widget_size_allocate (request->data, &child_allocation);
|
|
|
|
}
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
2011-05-01 05:06:06 +00:00
|
|
|
|
|
|
|
g_array_free (requested_sizes, TRUE);
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static gint
|
2010-09-06 15:23:40 +00:00
|
|
|
gtk_menu_bar_draw (GtkWidget *widget,
|
|
|
|
cairo_t *cr)
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
2010-11-21 18:38:52 +00:00
|
|
|
GtkStyleContext *context;
|
|
|
|
GtkStateFlags state;
|
2010-09-06 15:23:40 +00:00
|
|
|
int border;
|
1997-11-24 22:37:52 +00:00
|
|
|
|
2010-09-06 15:23:40 +00:00
|
|
|
border = gtk_container_get_border_width (GTK_CONTAINER (widget));
|
2010-11-21 18:38:52 +00:00
|
|
|
context = gtk_widget_get_style_context (widget);
|
|
|
|
|
|
|
|
state = gtk_widget_get_state_flags (widget);
|
|
|
|
gtk_style_context_set_state (context, state);
|
|
|
|
|
|
|
|
if (get_shadow_type (GTK_MENU_BAR (widget)) != GTK_SHADOW_NONE)
|
|
|
|
gtk_render_background (context, cr,
|
|
|
|
border, border,
|
|
|
|
gtk_widget_get_allocated_width (widget) - border * 2,
|
|
|
|
gtk_widget_get_allocated_height (widget) - border * 2);
|
1997-11-24 22:37:52 +00:00
|
|
|
|
2010-11-21 18:38:52 +00:00
|
|
|
gtk_render_frame (context, cr,
|
|
|
|
border, border,
|
|
|
|
gtk_widget_get_allocated_width (widget) - border * 2,
|
|
|
|
gtk_widget_get_allocated_height (widget) - border * 2);
|
2010-09-06 15:23:40 +00:00
|
|
|
|
|
|
|
GTK_WIDGET_CLASS (gtk_menu_bar_parent_class)->draw (widget, cr);
|
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
|
|
|
|
2002-03-01 01:05:11 +00:00
|
|
|
static GList *
|
|
|
|
get_menu_bars (GtkWindow *window)
|
|
|
|
{
|
|
|
|
return g_object_get_data (G_OBJECT (window), "gtk-menu-bar-list");
|
|
|
|
}
|
|
|
|
|
2002-06-12 20:42:44 +00:00
|
|
|
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)
|
|
|
|
{
|
2010-03-02 04:19:28 +00:00
|
|
|
if (!gtk_widget_get_mapped (widget))
|
2002-06-12 20:42:44 +00:00
|
|
|
viewable = FALSE;
|
2010-08-11 21:08:21 +00:00
|
|
|
|
|
|
|
widget = gtk_widget_get_parent (widget);
|
2002-06-12 20:42:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (viewable)
|
|
|
|
viewable_menu_bars = g_list_prepend (viewable_menu_bars, menu_bars->data);
|
|
|
|
}
|
|
|
|
|
|
|
|
return g_list_reverse (viewable_menu_bars);
|
|
|
|
}
|
|
|
|
|
2002-03-01 01:05:11 +00:00
|
|
|
static void
|
|
|
|
set_menu_bars (GtkWindow *window,
|
|
|
|
GList *menubars)
|
|
|
|
{
|
2005-09-01 05:11:46 +00:00
|
|
|
g_object_set_data (G_OBJECT (window), I_("gtk-menu-bar-list"), menubars);
|
2002-03-01 01:05: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
|
|
|
static gboolean
|
|
|
|
window_key_press_handler (GtkWidget *widget,
|
|
|
|
GdkEventKey *event,
|
|
|
|
gpointer data)
|
|
|
|
{
|
|
|
|
gchar *accel = NULL;
|
|
|
|
gboolean retval = FALSE;
|
|
|
|
|
2003-02-28 01:45:51 +00:00
|
|
|
g_object_get (gtk_widget_get_settings (widget),
|
2006-07-03 00:25:06 +00:00
|
|
|
"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);
|
|
|
|
|
2006-07-03 00:25:06 +00:00
|
|
|
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 &&
|
2001-12-12 19:30:01 +00:00
|
|
|
((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
|
|
|
{
|
2002-06-12 20:42:44 +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
|
|
|
|
2002-06-12 20:42:44 +00:00
|
|
|
menubars = _gtk_container_focus_sort (GTK_CONTAINER (widget), tmp_menubars,
|
2002-03-01 01:05:11 +00:00
|
|
|
GTK_DIR_TAB_FORWARD, NULL);
|
2002-06-12 20:42:44 +00:00
|
|
|
g_list_free (tmp_menubars);
|
|
|
|
|
2002-03-01 01:05:11 +00:00
|
|
|
if (menubars)
|
|
|
|
{
|
2002-04-11 14:28:11 +00:00
|
|
|
GtkMenuShell *menu_shell = GTK_MENU_SHELL (menubars->data);
|
2002-03-01 01:05:11 +00:00
|
|
|
|
2009-12-20 08:04:52 +00:00
|
|
|
_gtk_menu_shell_set_keyboard_mode (menu_shell, TRUE);
|
2002-09-23 21:53:20 +00:00
|
|
|
gtk_menu_shell_select_first (menu_shell, FALSE);
|
2002-03-01 01:05:11 +00:00
|
|
|
|
|
|
|
g_list_free (menubars);
|
2002-04-11 14:28:11 +00:00
|
|
|
|
|
|
|
retval = TRUE;
|
2002-03-01 01:05: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
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-07-24 04:56: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)
|
|
|
|
{
|
2002-03-01 01:05:11 +00:00
|
|
|
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
|
|
|
|
2002-03-01 01:05:11 +00:00
|
|
|
if (!menubars)
|
|
|
|
{
|
2002-10-05 01:51:16 +00:00
|
|
|
g_signal_connect (window,
|
2008-08-12 14:37:03 +00:00
|
|
|
"key-press-event",
|
2002-03-01 01:05:11 +00:00
|
|
|
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)
|
|
|
|
{
|
2002-03-01 01:05:11 +00:00
|
|
|
GList *menubars = get_menu_bars (window);
|
|
|
|
|
|
|
|
menubars = g_list_remove (menubars, menubar);
|
|
|
|
|
|
|
|
if (!menubars)
|
|
|
|
{
|
2002-10-05 01:51:16 +00:00
|
|
|
g_signal_handlers_disconnect_by_func (window,
|
|
|
|
window_key_press_handler,
|
2002-03-01 01:05:11 +00:00
|
|
|
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
|
2001-07-01 00:57:21 +00:00
|
|
|
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);
|
|
|
|
|
2001-07-05 02:58:34 +00:00
|
|
|
if (old_toplevel)
|
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
|
|
|
|
2010-01-04 06:49:26 +00:00
|
|
|
if (gtk_widget_is_toplevel (toplevel))
|
2001-07-01 00:57:21 +00:00
|
|
|
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
|
|
|
}
|
|
|
|
|
2002-03-03 22:15:39 +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)
|
2002-03-01 01:05:11 +00:00
|
|
|
{
|
|
|
|
GtkWidget *toplevel = gtk_widget_get_toplevel (GTK_WIDGET (menubar));
|
2002-07-25 18:17:28 +00:00
|
|
|
GtkMenuItem *to_activate = NULL;
|
2002-03-01 01:05:11 +00:00
|
|
|
|
2010-01-04 06:49:26 +00:00
|
|
|
if (gtk_widget_is_toplevel (toplevel))
|
2002-03-01 01:05:11 +00:00
|
|
|
{
|
2002-06-12 20:42:44 +00:00
|
|
|
GList *tmp_menubars = get_viewable_menu_bars (GTK_WINDOW (toplevel));
|
|
|
|
GList *menubars;
|
2002-03-01 01:05:11 +00:00
|
|
|
GList *current;
|
|
|
|
|
2002-06-12 20:42:44 +00:00
|
|
|
menubars = _gtk_container_focus_sort (GTK_CONTAINER (toplevel), tmp_menubars,
|
2002-03-01 01:05:11 +00:00
|
|
|
dir, GTK_WIDGET (menubar));
|
2002-06-12 20:42:44 +00:00
|
|
|
g_list_free (tmp_menubars);
|
2002-03-01 01:05:11 +00:00
|
|
|
|
|
|
|
if (menubars)
|
|
|
|
{
|
|
|
|
current = g_list_find (menubars, menubar);
|
2002-07-25 18:17:28 +00:00
|
|
|
|
2002-03-01 01:05:11 +00:00
|
|
|
if (current && current->next)
|
|
|
|
{
|
2002-07-25 18:17:28 +00:00
|
|
|
GtkMenuShell *new_menushell = GTK_MENU_SHELL (current->next->data);
|
2010-12-23 23:21:53 +00:00
|
|
|
if (new_menushell->priv->children)
|
|
|
|
to_activate = new_menushell->priv->children->data;
|
2002-03-01 01:05:11 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
g_list_free (menubars);
|
|
|
|
}
|
2002-07-25 18:17:28 +00:00
|
|
|
|
2003-12-21 00:59:46 +00:00
|
|
|
gtk_menu_shell_cancel (GTK_MENU_SHELL (menubar));
|
2002-07-25 18:17:28 +00:00
|
|
|
|
|
|
|
if (to_activate)
|
|
|
|
g_signal_emit_by_name (to_activate, "activate_item");
|
2002-03-01 01:05: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
|
|
|
static GtkShadowType
|
|
|
|
get_shadow_type (GtkMenuBar *menubar)
|
|
|
|
{
|
|
|
|
GtkShadowType shadow_type = GTK_SHADOW_OUT;
|
|
|
|
|
|
|
|
gtk_widget_style_get (GTK_WIDGET (menubar),
|
2005-03-26 05:49:15 +00:00
|
|
|
"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;
|
|
|
|
}
|
gtkmenu.c, gtkmenubar.c, gtkmenuitem.c, gtkmenushell.c, gtkmenushell.h,
Sun Oct 20 23:58:03 2002 Soeren Sandmann <sandmann@daimi.au.dk>
* gtkmenu.c, gtkmenubar.c, gtkmenuitem.c, gtkmenushell.c,
gtkmenushell.h, gtkmenushell.h
- make the delay before submenus appear below menu bars a
GtkSetting
- make the delay before submenus pops up a GtkSetting
- make the stay up triangle slightly larger
- don't pop up the first submenu immediately.
- make the default delay for submenus 225 ms, and 0 for menubars.
- make the default delay before popping down inside the stay-up
triangle 1000 ms
Fixes #74950
2002-10-20 22:29:57 +00:00
|
|
|
|
|
|
|
static gint
|
|
|
|
gtk_menu_bar_get_popup_delay (GtkMenuShell *menu_shell)
|
|
|
|
{
|
|
|
|
gint popup_delay;
|
|
|
|
|
2003-02-28 01:45:51 +00:00
|
|
|
g_object_get (gtk_widget_get_settings (GTK_WIDGET (menu_shell)),
|
gtkmenu.c, gtkmenubar.c, gtkmenuitem.c, gtkmenushell.c, gtkmenushell.h,
Sun Oct 20 23:58:03 2002 Soeren Sandmann <sandmann@daimi.au.dk>
* gtkmenu.c, gtkmenubar.c, gtkmenuitem.c, gtkmenushell.c,
gtkmenushell.h, gtkmenushell.h
- make the delay before submenus appear below menu bars a
GtkSetting
- make the delay before submenus pops up a GtkSetting
- make the stay up triangle slightly larger
- don't pop up the first submenu immediately.
- make the default delay for submenus 225 ms, and 0 for menubars.
- make the default delay before popping down inside the stay-up
triangle 1000 ms
Fixes #74950
2002-10-20 22:29:57 +00:00
|
|
|
"gtk-menu-bar-popup-delay", &popup_delay,
|
|
|
|
NULL);
|
|
|
|
|
|
|
|
return popup_delay;
|
|
|
|
}
|
2005-02-11 07:15:11 +00:00
|
|
|
|
|
|
|
static void
|
|
|
|
gtk_menu_bar_move_current (GtkMenuShell *menu_shell,
|
2007-09-14 09:17:59 +00:00
|
|
|
GtkMenuDirectionType direction)
|
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: ;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-05-03 17:07:09 +00:00
|
|
|
GTK_MENU_SHELL_CLASS (gtk_menu_bar_parent_class)->move_current (menu_shell, direction);
|
2005-02-11 07:15:11 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gtk_menu_bar_get_pack_direction:
|
|
|
|
* @menubar: a #GtkMenuBar
|
|
|
|
*
|
2008-12-30 20:47:03 +00:00
|
|
|
* Retrieves the current pack direction of the menubar.
|
|
|
|
* See gtk_menu_bar_set_pack_direction().
|
2005-02-11 07:15:11 +00:00
|
|
|
*
|
|
|
|
* Return value: the pack direction
|
|
|
|
*
|
|
|
|
* Since: 2.8
|
2008-12-30 20:47:03 +00:00
|
|
|
*/
|
2005-02-11 07:15:11 +00:00
|
|
|
GtkPackDirection
|
|
|
|
gtk_menu_bar_get_pack_direction (GtkMenuBar *menubar)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (GTK_IS_MENU_BAR (menubar),
|
|
|
|
GTK_PACK_DIRECTION_LTR);
|
|
|
|
|
2010-06-28 21:21:58 +00:00
|
|
|
return menubar->priv->pack_direction;
|
2005-02-11 07:15:11 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gtk_menu_bar_set_pack_direction:
|
2008-12-30 20:47:03 +00:00
|
|
|
* @menubar: a #GtkMenuBar
|
|
|
|
* @pack_dir: a new #GtkPackDirection
|
2005-02-11 07:15:11 +00:00
|
|
|
*
|
|
|
|
* Sets how items should be packed inside a menubar.
|
|
|
|
*
|
|
|
|
* Since: 2.8
|
2008-12-30 20:47:03 +00:00
|
|
|
*/
|
2007-09-14 09:17:59 +00:00
|
|
|
void
|
|
|
|
gtk_menu_bar_set_pack_direction (GtkMenuBar *menubar,
|
|
|
|
GtkPackDirection pack_dir)
|
2005-02-11 07:15:11 +00:00
|
|
|
{
|
|
|
|
GtkMenuBarPrivate *priv;
|
2005-07-04 06:51:57 +00:00
|
|
|
GList *l;
|
2005-02-11 07:15:11 +00:00
|
|
|
|
|
|
|
g_return_if_fail (GTK_IS_MENU_BAR (menubar));
|
|
|
|
|
2010-06-28 21:21:58 +00:00
|
|
|
priv = menubar->priv;
|
2005-02-11 07:15:11 +00:00
|
|
|
|
|
|
|
if (priv->pack_direction != pack_dir)
|
|
|
|
{
|
|
|
|
priv->pack_direction = pack_dir;
|
|
|
|
|
|
|
|
gtk_widget_queue_resize (GTK_WIDGET (menubar));
|
2005-07-04 06:51:57 +00:00
|
|
|
|
2010-12-23 23:21:53 +00:00
|
|
|
for (l = GTK_MENU_SHELL (menubar)->priv->children; l; l = l->next)
|
2005-07-04 06:51:57 +00:00
|
|
|
gtk_widget_queue_resize (GTK_WIDGET (l->data));
|
|
|
|
|
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
|
|
|
|
*
|
2008-12-30 20:47:03 +00:00
|
|
|
* Retrieves the current child pack direction of the menubar.
|
|
|
|
* See gtk_menu_bar_set_child_pack_direction().
|
2005-02-11 07:15:11 +00:00
|
|
|
*
|
|
|
|
* Return value: the child pack direction
|
|
|
|
*
|
|
|
|
* Since: 2.8
|
2008-12-30 20:47:03 +00:00
|
|
|
*/
|
2005-02-11 07:15:11 +00:00
|
|
|
GtkPackDirection
|
|
|
|
gtk_menu_bar_get_child_pack_direction (GtkMenuBar *menubar)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (GTK_IS_MENU_BAR (menubar),
|
|
|
|
GTK_PACK_DIRECTION_LTR);
|
|
|
|
|
2010-06-28 21:21:58 +00:00
|
|
|
return menubar->priv->child_pack_direction;
|
2005-02-11 07:15:11 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gtk_menu_bar_set_child_pack_direction:
|
2008-12-30 20:47:03 +00:00
|
|
|
* @menubar: a #GtkMenuBar
|
|
|
|
* @child_pack_dir: a new #GtkPackDirection
|
2005-02-11 07:15:11 +00:00
|
|
|
*
|
|
|
|
* Sets how widgets should be packed inside the children of a menubar.
|
|
|
|
*
|
|
|
|
* Since: 2.8
|
2008-12-30 20:47:03 +00:00
|
|
|
*/
|
2007-09-14 09:17:59 +00:00
|
|
|
void
|
|
|
|
gtk_menu_bar_set_child_pack_direction (GtkMenuBar *menubar,
|
|
|
|
GtkPackDirection child_pack_dir)
|
2005-02-11 07:15:11 +00:00
|
|
|
{
|
|
|
|
GtkMenuBarPrivate *priv;
|
2005-07-04 06:51:57 +00:00
|
|
|
GList *l;
|
2005-02-11 07:15:11 +00:00
|
|
|
|
|
|
|
g_return_if_fail (GTK_IS_MENU_BAR (menubar));
|
|
|
|
|
2010-06-28 21:21:58 +00:00
|
|
|
priv = menubar->priv;
|
2005-02-11 07:15:11 +00:00
|
|
|
|
|
|
|
if (priv->child_pack_direction != child_pack_dir)
|
|
|
|
{
|
|
|
|
priv->child_pack_direction = child_pack_dir;
|
|
|
|
|
|
|
|
gtk_widget_queue_resize (GTK_WIDGET (menubar));
|
2005-07-04 06:51:57 +00:00
|
|
|
|
2010-12-23 23:21:53 +00:00
|
|
|
for (l = GTK_MENU_SHELL (menubar)->priv->children; l; l = l->next)
|
2005-07-04 06:51:57 +00:00
|
|
|
gtk_widget_queue_resize (GTK_WIDGET (l->data));
|
|
|
|
|
2005-02-11 07:15:11 +00:00
|
|
|
g_object_notify (G_OBJECT (menubar), "child-pack-direction");
|
|
|
|
}
|
|
|
|
}
|