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
|
2010-12-23 20:50:18 +00:00
|
|
|
|
* 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
|
2012-02-27 13:01:10 +00:00
|
|
|
|
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
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
|
2008-09-03 15:23:17 +00:00
|
|
|
|
* GTK+ at ftp://ftp.gtk.org/pub/gtk/.
|
1999-02-24 07:37:18 +00:00
|
|
|
|
*/
|
|
|
|
|
|
2011-01-15 13:51:11 +00:00
|
|
|
|
/**
|
|
|
|
|
* SECTION:gtkmenu
|
|
|
|
|
* @Short_description: A menu widget
|
|
|
|
|
* @Title: GtkMenu
|
|
|
|
|
*
|
|
|
|
|
* A #GtkMenu is a #GtkMenuShell that implements a drop down menu
|
|
|
|
|
* consisting of a list of #GtkMenuItem objects which can be navigated
|
|
|
|
|
* and activated by the user to perform application functions.
|
|
|
|
|
*
|
|
|
|
|
* A #GtkMenu is most commonly dropped down by activating a
|
|
|
|
|
* #GtkMenuItem in a #GtkMenuBar or popped up by activating a
|
|
|
|
|
* #GtkMenuItem in another #GtkMenu.
|
|
|
|
|
*
|
2012-07-02 06:19:06 +00:00
|
|
|
|
* A #GtkMenu can also be popped up by activating a #GtkComboBox.
|
2011-01-15 13:51:11 +00:00
|
|
|
|
* Other composite widgets such as the #GtkNotebook can pop up a
|
|
|
|
|
* #GtkMenu as well.
|
|
|
|
|
*
|
|
|
|
|
* Applications can display a #GtkMenu as a popup menu by calling the
|
|
|
|
|
* gtk_menu_popup() function. The example below shows how an application
|
|
|
|
|
* can pop up a menu when the 3rd mouse button is pressed.
|
|
|
|
|
*
|
2014-02-04 21:57:57 +00:00
|
|
|
|
* ## Connecting the popup signal handler.
|
|
|
|
|
*
|
2014-01-27 19:55:18 +00:00
|
|
|
|
* |[<!-- language="C" -->
|
2014-03-29 04:24:15 +00:00
|
|
|
|
* // connect our handler which will popup the menu
|
2011-01-15 13:51:11 +00:00
|
|
|
|
* g_signal_connect_swapped (window, "button_press_event",
|
|
|
|
|
* G_CALLBACK (my_popup_handler), menu);
|
2014-01-27 17:12:55 +00:00
|
|
|
|
* ]|
|
2011-01-15 13:51:11 +00:00
|
|
|
|
*
|
2014-02-04 21:57:57 +00:00
|
|
|
|
* ## Signal handler which displays a popup menu.
|
|
|
|
|
*
|
2014-01-27 19:55:18 +00:00
|
|
|
|
* |[<!-- language="C" -->
|
2011-01-15 13:51:11 +00:00
|
|
|
|
* static gint
|
|
|
|
|
* my_popup_handler (GtkWidget *widget, GdkEvent *event)
|
|
|
|
|
* {
|
|
|
|
|
* GtkMenu *menu;
|
|
|
|
|
* GdkEventButton *event_button;
|
|
|
|
|
*
|
|
|
|
|
* g_return_val_if_fail (widget != NULL, FALSE);
|
|
|
|
|
* g_return_val_if_fail (GTK_IS_MENU (widget), FALSE);
|
|
|
|
|
* g_return_val_if_fail (event != NULL, FALSE);
|
|
|
|
|
*
|
2014-03-29 04:24:15 +00:00
|
|
|
|
* // The "widget" is the menu that was supplied when
|
|
|
|
|
* // g_signal_connect_swapped() was called.
|
2011-01-15 13:51:11 +00:00
|
|
|
|
* menu = GTK_MENU (widget);
|
|
|
|
|
*
|
|
|
|
|
* if (event->type == GDK_BUTTON_PRESS)
|
|
|
|
|
* {
|
|
|
|
|
* event_button = (GdkEventButton *) event;
|
2012-01-25 17:36:12 +00:00
|
|
|
|
* if (event_button->button == GDK_BUTTON_SECONDARY)
|
2011-01-15 13:51:11 +00:00
|
|
|
|
* {
|
|
|
|
|
* gtk_menu_popup (menu, NULL, NULL, NULL, NULL,
|
|
|
|
|
* event_button->button, event_button->time);
|
|
|
|
|
* return TRUE;
|
|
|
|
|
* }
|
|
|
|
|
* }
|
2014-02-04 21:57:57 +00:00
|
|
|
|
*
|
2011-01-15 13:51:11 +00:00
|
|
|
|
* return FALSE;
|
|
|
|
|
* }
|
2014-01-27 17:12:55 +00:00
|
|
|
|
* ]|
|
2015-11-03 02:40:40 +00:00
|
|
|
|
*
|
|
|
|
|
* # CSS nodes
|
|
|
|
|
*
|
2015-11-03 19:24:25 +00:00
|
|
|
|
* |[<!-- language="plain" -->
|
|
|
|
|
* menu
|
|
|
|
|
* ├── arrow.top
|
2015-12-16 15:55:52 +00:00
|
|
|
|
* ├── <child>
|
|
|
|
|
* ┊
|
|
|
|
|
* ├── <child>
|
2015-11-03 19:24:25 +00:00
|
|
|
|
* ╰── arrow.bottom
|
|
|
|
|
* ]|
|
|
|
|
|
*
|
2015-11-03 02:40:40 +00:00
|
|
|
|
* The main CSS node of GtkMenu has name menu, and there are two subnodes
|
|
|
|
|
* with name arrow, for scrolling menu arrows. These subnodes get the
|
|
|
|
|
* .top and .bottom style classes.
|
2011-01-15 13:51:11 +00:00
|
|
|
|
*/
|
|
|
|
|
|
2008-06-22 14:28:52 +00:00
|
|
|
|
#include "config.h"
|
2011-01-04 17:21:41 +00:00
|
|
|
|
|
2018-05-06 10:41:12 +00:00
|
|
|
|
#include <math.h>
|
2008-09-03 15:23:17 +00:00
|
|
|
|
#include <string.h>
|
2011-01-04 17:21:41 +00:00
|
|
|
|
|
|
|
|
|
#include <gobject/gvaluecollector.h>
|
|
|
|
|
|
2003-09-11 21:02:24 +00:00
|
|
|
|
#include "gtkaccellabel.h"
|
added gtkaccelmap.sgml. other updates.
Mon Nov 12 23:06:38 2001 Tim Janik <timj@gtk.org>
* added gtkaccelmap.sgml. other updates.
Mon Nov 12 23:08:37 2001 Tim Janik <timj@gtk.org>
* gtk/maketypes.awk: fix type utils generation on unix.
* gtk/gtkaccelmap.[hc]: new files, implementing a global accelerator
registry.
* gtk/gtkaccelgroup.[hc]: major API/implementation revamp:
removed GTK_ACCEL_SIGNAL_VISIBLE, gtk_accel_group_get_default,
gtk_accel_group_get_entry, gtk_accel_group_(un)lock_entry,
gtk_accel_group_add/remove, gtk_accel_group_handle_add/remove,
gtk_accel_group_create_add/remove, gtk_accel_group_entries_from_object.
introduced ::accel_changed signal for change notification, and
gtk_accel_group_connect/disconnect to connect closures to accel groups.
made gtk_accel_group_attach/detach and gtk_accel_group_activate private
functions.
deprecated gtk_accel_group_ref/unref.
* gtk/gtkaccellabel.[hc]: changes to make accellabels pay attention
to accel group changed notification and basically operate on closures.
removed gtk_accel_label_get_accel_object and
gtk_accel_label_set_accel_object.
introduced gtk_accel_label_set_accel_closure, and for convenience,
gtk_accel_label_set_accel_widget.
* gtk/gtkitemfactory.[hc]: removed accelerator propagation code
which mostly moved into gtkaccelmap.[hc].
removed gtk_item_factory_parse_rc*, gtk_item_factory_dump_*
and gtk_item_factory_print_func.
* gtk/gtkmain.c: call _gtk_accel_map_init().
* gtk/gtkmenuitem.[hc]: introduced gtk_menu_item_set_accel_path(),
that associates an accelerator path with menu items, through which
persistent accelerator settings on menu items are enabled.
* gtk/gtkmenu.[hc]: added gtk_menu_set_accel_path() so accelerator
paths of menu item can be default constructed to allow installation
of accelerators on menu items that don't come with an accelerator
binding by default.
* gtk/gtksettings.c: fix STRING type rc settings by special casing
them appropriately in the parser.
* gtk/gtksignal.[hc]: allow a class function offset of 0 for
gtk_signal_newv().
* gtk/gtkwidget.[hc]: accelerator API revamp.
removed ::accelerator_add/remove signals, gtk_widget_accelerator_signal,
gtk_widget_accelerators_locked, gtk_widget_remove_accelerators and
gtk_widget_(un)lock_accelerators.
accelerators maintained through gtk_widget_add/remove_accelerator()
are not runtime changable now, the correct sequence to setup a
widget for runtime changable accelerators is now:
gtk_accel_map_add_entry(accel_path, key, mods);
_gtk_widget_set_accel_path(widget, accel_path, accel_group);
* gtk/gtkwindow.[hc]: accelerator changes, proxy and coalesce accel
group changes (as well as mnemonic changes) through the new signal
::accels_changed.
Sat Nov 10 12:08:56 2001 Tim Janik <timj@gtk.org>
* gtk/gtksettings.c (_gtk_settings_parse_convert): properly handle
GString->string conversions.
2001-11-13 00:53:47 +00:00
|
|
|
|
#include "gtkaccelmap.h"
|
2012-03-03 18:41:55 +00:00
|
|
|
|
#include "gtkadjustment.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"
|
2015-12-21 01:30:52 +00:00
|
|
|
|
#include "gtkbuiltiniconprivate.h"
|
2008-11-01 04:32:40 +00:00
|
|
|
|
#include "gtkcheckmenuitem.h"
|
2015-12-19 01:52:16 +00:00
|
|
|
|
#include "gtkcheckmenuitemprivate.h"
|
1997-11-24 22:37:52 +00:00
|
|
|
|
#include "gtkmain.h"
|
2002-12-14 22:43:52 +00:00
|
|
|
|
#include "gtkmarshalers.h"
|
2010-08-29 01:24:11 +00:00
|
|
|
|
#include "gtkmenuprivate.h"
|
2010-12-27 01:36:51 +00:00
|
|
|
|
#include "gtkmenuitemprivate.h"
|
2010-12-23 23:21:53 +00:00
|
|
|
|
#include "gtkmenushellprivate.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 "gtkwindow.h"
|
2011-08-28 05:54:55 +00:00
|
|
|
|
#include "gtkbox.h"
|
2011-06-08 14:23:53 +00:00
|
|
|
|
#include "gtkscrollbar.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"
|
2005-03-22 02:14:55 +00:00
|
|
|
|
#include "gtkprivate.h"
|
2012-03-16 19:01:50 +00:00
|
|
|
|
#include "gtkwidgetpath.h"
|
2011-06-02 13:25:12 +00:00
|
|
|
|
#include "gtkwidgetprivate.h"
|
2011-12-12 17:11:57 +00:00
|
|
|
|
#include "gtkdnd.h"
|
2001-08-25 03:15:26 +00:00
|
|
|
|
#include "gtkintl.h"
|
2011-01-04 19:51:19 +00:00
|
|
|
|
#include "gtktypebuiltins.h"
|
2011-12-12 17:11:57 +00:00
|
|
|
|
#include "gtkwidgetprivate.h"
|
2014-06-06 22:00:36 +00:00
|
|
|
|
#include "gtkwindowprivate.h"
|
2015-11-03 01:45:46 +00:00
|
|
|
|
#include "gtkcssnodeprivate.h"
|
|
|
|
|
#include "gtkstylecontextprivate.h"
|
|
|
|
|
#include "gtkcssstylepropertyprivate.h"
|
2011-10-01 03:49:48 +00:00
|
|
|
|
|
2011-11-02 02:52:32 +00:00
|
|
|
|
#include "deprecated/gtktearoffmenuitem.h"
|
2011-10-01 03:49:48 +00:00
|
|
|
|
|
|
|
|
|
|
2011-07-02 02:30:54 +00:00
|
|
|
|
#include "a11y/gtkmenuaccessible.h"
|
2016-06-14 19:42:13 +00:00
|
|
|
|
#include "gdk/gdk-private.h"
|
1997-11-24 22:37:52 +00:00
|
|
|
|
|
2002-10-29 19:44:59 +00:00
|
|
|
|
#define NAVIGATION_REGION_OVERSHOOT 50 /* How much the navigation region
|
2010-12-23 20:50:18 +00:00
|
|
|
|
* extends below the submenu
|
|
|
|
|
*/
|
2000-09-02 02:43:50 +00:00
|
|
|
|
|
2008-09-03 15:23:17 +00:00
|
|
|
|
#define MENU_SCROLL_STEP1 8
|
|
|
|
|
#define MENU_SCROLL_STEP2 15
|
|
|
|
|
#define MENU_SCROLL_FAST_ZONE 8
|
|
|
|
|
#define MENU_SCROLL_TIMEOUT1 50
|
|
|
|
|
#define MENU_SCROLL_TIMEOUT2 20
|
Add note about GtkMenuPositionFunc API changes.
2000-11-08 Alexander Larsson <alexl@redhat.com>
* docs/Changes-2.0.txt: Add note about GtkMenuPositionFunc
API changes.
* gtk/gtkmenu.c: Add support for scrolling menus.
Remove gtk_menu_append/prepend/insert, these have been moved to
gtkcompat.h as #defines.
* gtk/gtkcompat.h.in:
Add compatibility #defines for gtk_menu_append/prepend/insert
* gtk/gtkmenu.h: Add data needed for scrolling menus.
GtkMenuPositionFunc gets an extra argument push_in.
gtk_menu_append/prepend/insert removed.
* gtk/gtkmenuitem.c (gtk_menu_item_position_menu): Change menu
positioning behaviour to fit to scrolling menus.
* gtk/gtkmenuitem.c (gtk_menu_item_forall): Don't recurse
into menuitem->submeny. That is wrong, and broke torn
off submenus of torn off menus, since they were unrealized
when the first menu was unrealized.
* gtk/gtkmenushell.[ch]: Virtualize gtk_menu_shell_insert() and
gtk_menu_shell_select_item() since these need to be overridden in
GtkMenu.
* gtk/gtkoptionmenu.c (gtk_opttion_menu_position): Change menu
positioning behaviour to fit to scrolling menus.
(gtk_option_menu_key_press, gtk_option_menu_button_press): Select
the current item so that it is prelighted when the menu pops up.
This is a workaround to the fact that the menu doesn't get the
initial enter event (due to grabs).
* gtk/gtkfilesel.c, gtk/gtkinputdialog.c, gtk/testgtk.c:
s/gtk_menu_append/gtk_menu_shell_append/
* gtk/gtknotebook.c:
s/gtk_menu_insert/gtk_menu_shell_insert/
* gtk/testgtk.c (create_menu, create_menus):
Create the first menu with 50 items so that menu scrolling
can be tested.
Patch from Jonathan Blandford <jrb@redhat.com>
* gtk/gtkmenuitem.[ch] (gtk_menu_item_toggle_size_request): new
system to handle size requests. First, we ask what the size of
the toggle is. Then, when allocating the size, we allocate the
toggle_size first. This way we can have multiple menu-item
classes w/o needing a seperate class for each.
* gtk/gtkmenu.c (gtk_menu_size_request): Actually use the new system.
* gtk/gtkmenu.c (gtk_menu_size_allocate): Use the new system.
* gtk/gtkcheckmenuitem.c
(gtk_check_menu_item_toggle_size_request): New function to handle
the toggle size-request.
2000-11-08 17:34:52 +00:00
|
|
|
|
|
2013-06-26 18:08:37 +00:00
|
|
|
|
#define MENU_POPUP_DELAY 225
|
|
|
|
|
#define MENU_POPDOWN_DELAY 1000
|
|
|
|
|
|
The table menu patch! Turns GtkMenu into a table, so you can attach menu
Wed Sep 10 22:25:04 2003 Kristian Rietveld <kris@gtk.org>
The table menu patch! Turns GtkMenu into a table, so you can attach
menu items in numerous new ways! Be creative!
Contains some bug fixes and RTL adaptions from Matthias Clasen.
* gtk/gtkmenu.c [toplevel]: introduce ATTACH_INFO_KEY, extend
GtkMenuPrivate, introduce AttachInfo, add child properties enum,
(gtk_menu_free_private), (gtk_menu_get_private): we have to free
the heights array in the private struct,
(gtk_menu_class_init): reorder code a bit, install child properties,
(get_attach_info), (get_child_attach): new utility functions,
(gtk_menu_set_child_property), (gtk_menu_get_child_property): introduce
child properties, for the attach info,
(gtk_menu_remove): remove AttachInfo from menu item,
(gtk_menu_real_insert): implemented algorithm to automagically place
inserted menu items at the correct place in the table,
(gtk_menu_size_request), (gtk_menu_size_allocate),
(compute_child_offset): reworked/rewritten to support table menus,
(gtk_menu_attach): new function,
(find_child_containing), (gtk_menu_move_current): new functions to
get table menu keynav right.
* gtk/gtkmenu.h: add gtk_menu_attach() prototype.
2003-09-10 20:32:33 +00:00
|
|
|
|
#define ATTACH_INFO_KEY "gtk-menu-child-attach-info-key"
|
2004-05-06 07:35:26 +00:00
|
|
|
|
#define ATTACHED_MENUS "gtk-attached-menus"
|
The table menu patch! Turns GtkMenu into a table, so you can attach menu
Wed Sep 10 22:25:04 2003 Kristian Rietveld <kris@gtk.org>
The table menu patch! Turns GtkMenu into a table, so you can attach
menu items in numerous new ways! Be creative!
Contains some bug fixes and RTL adaptions from Matthias Clasen.
* gtk/gtkmenu.c [toplevel]: introduce ATTACH_INFO_KEY, extend
GtkMenuPrivate, introduce AttachInfo, add child properties enum,
(gtk_menu_free_private), (gtk_menu_get_private): we have to free
the heights array in the private struct,
(gtk_menu_class_init): reorder code a bit, install child properties,
(get_attach_info), (get_child_attach): new utility functions,
(gtk_menu_set_child_property), (gtk_menu_get_child_property): introduce
child properties, for the attach info,
(gtk_menu_remove): remove AttachInfo from menu item,
(gtk_menu_real_insert): implemented algorithm to automagically place
inserted menu items at the correct place in the table,
(gtk_menu_size_request), (gtk_menu_size_allocate),
(compute_child_offset): reworked/rewritten to support table menus,
(gtk_menu_attach): new function,
(find_child_containing), (gtk_menu_move_current): new functions to
get table menu keynav right.
* gtk/gtkmenu.h: add gtk_menu_attach() prototype.
2003-09-10 20:32:33 +00:00
|
|
|
|
|
2010-12-23 20:50:18 +00:00
|
|
|
|
typedef struct _GtkMenuAttachData GtkMenuAttachData;
|
|
|
|
|
typedef struct _GtkMenuPopdownData GtkMenuPopdownData;
|
1998-02-03 14:13:05 +00:00
|
|
|
|
|
|
|
|
|
struct _GtkMenuAttachData
|
|
|
|
|
{
|
|
|
|
|
GtkWidget *attach_widget;
|
|
|
|
|
GtkMenuDetachFunc detacher;
|
|
|
|
|
};
|
|
|
|
|
|
2010-05-25 22:38:44 +00:00
|
|
|
|
struct _GtkMenuPopdownData
|
|
|
|
|
{
|
|
|
|
|
GtkMenu *menu;
|
|
|
|
|
GdkDevice *device;
|
|
|
|
|
};
|
|
|
|
|
|
The table menu patch! Turns GtkMenu into a table, so you can attach menu
Wed Sep 10 22:25:04 2003 Kristian Rietveld <kris@gtk.org>
The table menu patch! Turns GtkMenu into a table, so you can attach
menu items in numerous new ways! Be creative!
Contains some bug fixes and RTL adaptions from Matthias Clasen.
* gtk/gtkmenu.c [toplevel]: introduce ATTACH_INFO_KEY, extend
GtkMenuPrivate, introduce AttachInfo, add child properties enum,
(gtk_menu_free_private), (gtk_menu_get_private): we have to free
the heights array in the private struct,
(gtk_menu_class_init): reorder code a bit, install child properties,
(get_attach_info), (get_child_attach): new utility functions,
(gtk_menu_set_child_property), (gtk_menu_get_child_property): introduce
child properties, for the attach info,
(gtk_menu_remove): remove AttachInfo from menu item,
(gtk_menu_real_insert): implemented algorithm to automagically place
inserted menu items at the correct place in the table,
(gtk_menu_size_request), (gtk_menu_size_allocate),
(compute_child_offset): reworked/rewritten to support table menus,
(gtk_menu_attach): new function,
(find_child_containing), (gtk_menu_move_current): new functions to
get table menu keynav right.
* gtk/gtkmenu.h: add gtk_menu_attach() prototype.
2003-09-10 20:32:33 +00:00
|
|
|
|
typedef struct
|
|
|
|
|
{
|
2004-03-15 02:03:59 +00:00
|
|
|
|
gint left_attach;
|
|
|
|
|
gint right_attach;
|
|
|
|
|
gint top_attach;
|
|
|
|
|
gint bottom_attach;
|
|
|
|
|
gint effective_left_attach;
|
|
|
|
|
gint effective_right_attach;
|
|
|
|
|
gint effective_top_attach;
|
|
|
|
|
gint effective_bottom_attach;
|
|
|
|
|
} AttachInfo;
|
The table menu patch! Turns GtkMenu into a table, so you can attach menu
Wed Sep 10 22:25:04 2003 Kristian Rietveld <kris@gtk.org>
The table menu patch! Turns GtkMenu into a table, so you can attach
menu items in numerous new ways! Be creative!
Contains some bug fixes and RTL adaptions from Matthias Clasen.
* gtk/gtkmenu.c [toplevel]: introduce ATTACH_INFO_KEY, extend
GtkMenuPrivate, introduce AttachInfo, add child properties enum,
(gtk_menu_free_private), (gtk_menu_get_private): we have to free
the heights array in the private struct,
(gtk_menu_class_init): reorder code a bit, install child properties,
(get_attach_info), (get_child_attach): new utility functions,
(gtk_menu_set_child_property), (gtk_menu_get_child_property): introduce
child properties, for the attach info,
(gtk_menu_remove): remove AttachInfo from menu item,
(gtk_menu_real_insert): implemented algorithm to automagically place
inserted menu items at the correct place in the table,
(gtk_menu_size_request), (gtk_menu_size_allocate),
(compute_child_offset): reworked/rewritten to support table menus,
(gtk_menu_attach): new function,
(find_child_containing), (gtk_menu_move_current): new functions to
get table menu keynav right.
* gtk/gtkmenu.h: add gtk_menu_attach() prototype.
2003-09-10 20:32:33 +00:00
|
|
|
|
|
2002-12-14 22:43:52 +00:00
|
|
|
|
enum {
|
|
|
|
|
MOVE_SCROLL,
|
2016-06-14 19:42:13 +00:00
|
|
|
|
POPPED_UP,
|
2002-12-14 22:43:52 +00:00
|
|
|
|
LAST_SIGNAL
|
|
|
|
|
};
|
|
|
|
|
|
2001-08-25 03:15:26 +00:00
|
|
|
|
enum {
|
|
|
|
|
PROP_0,
|
2008-06-20 11:06:52 +00:00
|
|
|
|
PROP_ACTIVE,
|
|
|
|
|
PROP_ACCEL_GROUP,
|
|
|
|
|
PROP_ACCEL_PATH,
|
|
|
|
|
PROP_ATTACH_WIDGET,
|
2004-05-07 04:43:56 +00:00
|
|
|
|
PROP_TEAROFF_STATE,
|
2008-06-20 11:06:52 +00:00
|
|
|
|
PROP_TEAROFF_TITLE,
|
2009-06-24 05:01:51 +00:00
|
|
|
|
PROP_MONITOR,
|
2016-06-14 19:42:13 +00:00
|
|
|
|
PROP_RESERVE_TOGGLE_SIZE,
|
|
|
|
|
PROP_ANCHOR_HINTS,
|
|
|
|
|
PROP_RECT_ANCHOR_DX,
|
|
|
|
|
PROP_RECT_ANCHOR_DY,
|
|
|
|
|
PROP_MENU_TYPE_HINT
|
2001-08-25 03:15:26 +00:00
|
|
|
|
};
|
1998-02-03 14:13:05 +00:00
|
|
|
|
|
2004-03-15 02:03:59 +00:00
|
|
|
|
enum {
|
The table menu patch! Turns GtkMenu into a table, so you can attach menu
Wed Sep 10 22:25:04 2003 Kristian Rietveld <kris@gtk.org>
The table menu patch! Turns GtkMenu into a table, so you can attach
menu items in numerous new ways! Be creative!
Contains some bug fixes and RTL adaptions from Matthias Clasen.
* gtk/gtkmenu.c [toplevel]: introduce ATTACH_INFO_KEY, extend
GtkMenuPrivate, introduce AttachInfo, add child properties enum,
(gtk_menu_free_private), (gtk_menu_get_private): we have to free
the heights array in the private struct,
(gtk_menu_class_init): reorder code a bit, install child properties,
(get_attach_info), (get_child_attach): new utility functions,
(gtk_menu_set_child_property), (gtk_menu_get_child_property): introduce
child properties, for the attach info,
(gtk_menu_remove): remove AttachInfo from menu item,
(gtk_menu_real_insert): implemented algorithm to automagically place
inserted menu items at the correct place in the table,
(gtk_menu_size_request), (gtk_menu_size_allocate),
(compute_child_offset): reworked/rewritten to support table menus,
(gtk_menu_attach): new function,
(find_child_containing), (gtk_menu_move_current): new functions to
get table menu keynav right.
* gtk/gtkmenu.h: add gtk_menu_attach() prototype.
2003-09-10 20:32:33 +00:00
|
|
|
|
CHILD_PROP_0,
|
|
|
|
|
CHILD_PROP_LEFT_ATTACH,
|
|
|
|
|
CHILD_PROP_RIGHT_ATTACH,
|
|
|
|
|
CHILD_PROP_TOP_ATTACH,
|
|
|
|
|
CHILD_PROP_BOTTOM_ATTACH
|
|
|
|
|
};
|
|
|
|
|
|
2019-01-17 18:27:51 +00:00
|
|
|
|
typedef enum _GtkMenuScrollFlag
|
|
|
|
|
{
|
|
|
|
|
GTK_MENU_SCROLL_FLAG_NONE = 0,
|
|
|
|
|
GTK_MENU_SCROLL_FLAG_ADAPT = 1 << 0,
|
|
|
|
|
} GtkMenuScrollFlag;
|
|
|
|
|
|
The table menu patch! Turns GtkMenu into a table, so you can attach menu
Wed Sep 10 22:25:04 2003 Kristian Rietveld <kris@gtk.org>
The table menu patch! Turns GtkMenu into a table, so you can attach
menu items in numerous new ways! Be creative!
Contains some bug fixes and RTL adaptions from Matthias Clasen.
* gtk/gtkmenu.c [toplevel]: introduce ATTACH_INFO_KEY, extend
GtkMenuPrivate, introduce AttachInfo, add child properties enum,
(gtk_menu_free_private), (gtk_menu_get_private): we have to free
the heights array in the private struct,
(gtk_menu_class_init): reorder code a bit, install child properties,
(get_attach_info), (get_child_attach): new utility functions,
(gtk_menu_set_child_property), (gtk_menu_get_child_property): introduce
child properties, for the attach info,
(gtk_menu_remove): remove AttachInfo from menu item,
(gtk_menu_real_insert): implemented algorithm to automagically place
inserted menu items at the correct place in the table,
(gtk_menu_size_request), (gtk_menu_size_allocate),
(compute_child_offset): reworked/rewritten to support table menus,
(gtk_menu_attach): new function,
(find_child_containing), (gtk_menu_move_current): new functions to
get table menu keynav right.
* gtk/gtkmenu.h: add gtk_menu_attach() prototype.
2003-09-10 20:32:33 +00:00
|
|
|
|
static void gtk_menu_set_property (GObject *object,
|
2010-12-23 20:50:18 +00:00
|
|
|
|
guint prop_id,
|
|
|
|
|
const GValue *value,
|
|
|
|
|
GParamSpec *pspec);
|
The table menu patch! Turns GtkMenu into a table, so you can attach menu
Wed Sep 10 22:25:04 2003 Kristian Rietveld <kris@gtk.org>
The table menu patch! Turns GtkMenu into a table, so you can attach
menu items in numerous new ways! Be creative!
Contains some bug fixes and RTL adaptions from Matthias Clasen.
* gtk/gtkmenu.c [toplevel]: introduce ATTACH_INFO_KEY, extend
GtkMenuPrivate, introduce AttachInfo, add child properties enum,
(gtk_menu_free_private), (gtk_menu_get_private): we have to free
the heights array in the private struct,
(gtk_menu_class_init): reorder code a bit, install child properties,
(get_attach_info), (get_child_attach): new utility functions,
(gtk_menu_set_child_property), (gtk_menu_get_child_property): introduce
child properties, for the attach info,
(gtk_menu_remove): remove AttachInfo from menu item,
(gtk_menu_real_insert): implemented algorithm to automagically place
inserted menu items at the correct place in the table,
(gtk_menu_size_request), (gtk_menu_size_allocate),
(compute_child_offset): reworked/rewritten to support table menus,
(gtk_menu_attach): new function,
(find_child_containing), (gtk_menu_move_current): new functions to
get table menu keynav right.
* gtk/gtkmenu.h: add gtk_menu_attach() prototype.
2003-09-10 20:32:33 +00:00
|
|
|
|
static void gtk_menu_get_property (GObject *object,
|
2010-12-23 20:50:18 +00:00
|
|
|
|
guint prop_id,
|
|
|
|
|
GValue *value,
|
|
|
|
|
GParamSpec *pspec);
|
2016-06-05 23:34:30 +00:00
|
|
|
|
static void gtk_menu_finalize (GObject *object);
|
The table menu patch! Turns GtkMenu into a table, so you can attach menu
Wed Sep 10 22:25:04 2003 Kristian Rietveld <kris@gtk.org>
The table menu patch! Turns GtkMenu into a table, so you can attach
menu items in numerous new ways! Be creative!
Contains some bug fixes and RTL adaptions from Matthias Clasen.
* gtk/gtkmenu.c [toplevel]: introduce ATTACH_INFO_KEY, extend
GtkMenuPrivate, introduce AttachInfo, add child properties enum,
(gtk_menu_free_private), (gtk_menu_get_private): we have to free
the heights array in the private struct,
(gtk_menu_class_init): reorder code a bit, install child properties,
(get_attach_info), (get_child_attach): new utility functions,
(gtk_menu_set_child_property), (gtk_menu_get_child_property): introduce
child properties, for the attach info,
(gtk_menu_remove): remove AttachInfo from menu item,
(gtk_menu_real_insert): implemented algorithm to automagically place
inserted menu items at the correct place in the table,
(gtk_menu_size_request), (gtk_menu_size_allocate),
(compute_child_offset): reworked/rewritten to support table menus,
(gtk_menu_attach): new function,
(find_child_containing), (gtk_menu_move_current): new functions to
get table menu keynav right.
* gtk/gtkmenu.h: add gtk_menu_attach() prototype.
2003-09-10 20:32:33 +00:00
|
|
|
|
static void gtk_menu_set_child_property(GtkContainer *container,
|
|
|
|
|
GtkWidget *child,
|
|
|
|
|
guint property_id,
|
|
|
|
|
const GValue *value,
|
|
|
|
|
GParamSpec *pspec);
|
|
|
|
|
static void gtk_menu_get_child_property(GtkContainer *container,
|
|
|
|
|
GtkWidget *child,
|
|
|
|
|
guint property_id,
|
|
|
|
|
GValue *value,
|
|
|
|
|
GParamSpec *pspec);
|
2010-09-18 23:55:42 +00:00
|
|
|
|
static void gtk_menu_destroy (GtkWidget *widget);
|
Add note about GtkMenuPositionFunc API changes.
2000-11-08 Alexander Larsson <alexl@redhat.com>
* docs/Changes-2.0.txt: Add note about GtkMenuPositionFunc
API changes.
* gtk/gtkmenu.c: Add support for scrolling menus.
Remove gtk_menu_append/prepend/insert, these have been moved to
gtkcompat.h as #defines.
* gtk/gtkcompat.h.in:
Add compatibility #defines for gtk_menu_append/prepend/insert
* gtk/gtkmenu.h: Add data needed for scrolling menus.
GtkMenuPositionFunc gets an extra argument push_in.
gtk_menu_append/prepend/insert removed.
* gtk/gtkmenuitem.c (gtk_menu_item_position_menu): Change menu
positioning behaviour to fit to scrolling menus.
* gtk/gtkmenuitem.c (gtk_menu_item_forall): Don't recurse
into menuitem->submeny. That is wrong, and broke torn
off submenus of torn off menus, since they were unrealized
when the first menu was unrealized.
* gtk/gtkmenushell.[ch]: Virtualize gtk_menu_shell_insert() and
gtk_menu_shell_select_item() since these need to be overridden in
GtkMenu.
* gtk/gtkoptionmenu.c (gtk_opttion_menu_position): Change menu
positioning behaviour to fit to scrolling menus.
(gtk_option_menu_key_press, gtk_option_menu_button_press): Select
the current item so that it is prelighted when the menu pops up.
This is a workaround to the fact that the menu doesn't get the
initial enter event (due to grabs).
* gtk/gtkfilesel.c, gtk/gtkinputdialog.c, gtk/testgtk.c:
s/gtk_menu_append/gtk_menu_shell_append/
* gtk/gtknotebook.c:
s/gtk_menu_insert/gtk_menu_shell_insert/
* gtk/testgtk.c (create_menu, create_menus):
Create the first menu with 50 items so that menu scrolling
can be tested.
Patch from Jonathan Blandford <jrb@redhat.com>
* gtk/gtkmenuitem.[ch] (gtk_menu_item_toggle_size_request): new
system to handle size requests. First, we ask what the size of
the toggle is. Then, when allocating the size, we allocate the
toggle_size first. This way we can have multiple menu-item
classes w/o needing a seperate class for each.
* gtk/gtkmenu.c (gtk_menu_size_request): Actually use the new system.
* gtk/gtkmenu.c (gtk_menu_size_allocate): Use the new system.
* gtk/gtkcheckmenuitem.c
(gtk_check_menu_item_toggle_size_request): New function to handle
the toggle size-request.
2000-11-08 17:34:52 +00:00
|
|
|
|
static void gtk_menu_realize (GtkWidget *widget);
|
|
|
|
|
static void gtk_menu_unrealize (GtkWidget *widget);
|
|
|
|
|
static void gtk_menu_size_allocate (GtkWidget *widget,
|
2010-12-23 20:50:18 +00:00
|
|
|
|
GtkAllocation *allocation);
|
added gtkaccelmap.sgml. other updates.
Mon Nov 12 23:06:38 2001 Tim Janik <timj@gtk.org>
* added gtkaccelmap.sgml. other updates.
Mon Nov 12 23:08:37 2001 Tim Janik <timj@gtk.org>
* gtk/maketypes.awk: fix type utils generation on unix.
* gtk/gtkaccelmap.[hc]: new files, implementing a global accelerator
registry.
* gtk/gtkaccelgroup.[hc]: major API/implementation revamp:
removed GTK_ACCEL_SIGNAL_VISIBLE, gtk_accel_group_get_default,
gtk_accel_group_get_entry, gtk_accel_group_(un)lock_entry,
gtk_accel_group_add/remove, gtk_accel_group_handle_add/remove,
gtk_accel_group_create_add/remove, gtk_accel_group_entries_from_object.
introduced ::accel_changed signal for change notification, and
gtk_accel_group_connect/disconnect to connect closures to accel groups.
made gtk_accel_group_attach/detach and gtk_accel_group_activate private
functions.
deprecated gtk_accel_group_ref/unref.
* gtk/gtkaccellabel.[hc]: changes to make accellabels pay attention
to accel group changed notification and basically operate on closures.
removed gtk_accel_label_get_accel_object and
gtk_accel_label_set_accel_object.
introduced gtk_accel_label_set_accel_closure, and for convenience,
gtk_accel_label_set_accel_widget.
* gtk/gtkitemfactory.[hc]: removed accelerator propagation code
which mostly moved into gtkaccelmap.[hc].
removed gtk_item_factory_parse_rc*, gtk_item_factory_dump_*
and gtk_item_factory_print_func.
* gtk/gtkmain.c: call _gtk_accel_map_init().
* gtk/gtkmenuitem.[hc]: introduced gtk_menu_item_set_accel_path(),
that associates an accelerator path with menu items, through which
persistent accelerator settings on menu items are enabled.
* gtk/gtkmenu.[hc]: added gtk_menu_set_accel_path() so accelerator
paths of menu item can be default constructed to allow installation
of accelerators on menu items that don't come with an accelerator
binding by default.
* gtk/gtksettings.c: fix STRING type rc settings by special casing
them appropriately in the parser.
* gtk/gtksignal.[hc]: allow a class function offset of 0 for
gtk_signal_newv().
* gtk/gtkwidget.[hc]: accelerator API revamp.
removed ::accelerator_add/remove signals, gtk_widget_accelerator_signal,
gtk_widget_accelerators_locked, gtk_widget_remove_accelerators and
gtk_widget_(un)lock_accelerators.
accelerators maintained through gtk_widget_add/remove_accelerator()
are not runtime changable now, the correct sequence to setup a
widget for runtime changable accelerators is now:
gtk_accel_map_add_entry(accel_path, key, mods);
_gtk_widget_set_accel_path(widget, accel_path, accel_group);
* gtk/gtkwindow.[hc]: accelerator changes, proxy and coalesce accel
group changes (as well as mnemonic changes) through the new signal
::accels_changed.
Sat Nov 10 12:08:56 2001 Tim Janik <timj@gtk.org>
* gtk/gtksettings.c (_gtk_settings_parse_convert): properly handle
GString->string conversions.
2001-11-13 00:53:47 +00:00
|
|
|
|
static void gtk_menu_show (GtkWidget *widget);
|
2010-09-06 15:32:30 +00:00
|
|
|
|
static gboolean gtk_menu_draw (GtkWidget *widget,
|
|
|
|
|
cairo_t *cr);
|
Add note about GtkMenuPositionFunc API changes.
2000-11-08 Alexander Larsson <alexl@redhat.com>
* docs/Changes-2.0.txt: Add note about GtkMenuPositionFunc
API changes.
* gtk/gtkmenu.c: Add support for scrolling menus.
Remove gtk_menu_append/prepend/insert, these have been moved to
gtkcompat.h as #defines.
* gtk/gtkcompat.h.in:
Add compatibility #defines for gtk_menu_append/prepend/insert
* gtk/gtkmenu.h: Add data needed for scrolling menus.
GtkMenuPositionFunc gets an extra argument push_in.
gtk_menu_append/prepend/insert removed.
* gtk/gtkmenuitem.c (gtk_menu_item_position_menu): Change menu
positioning behaviour to fit to scrolling menus.
* gtk/gtkmenuitem.c (gtk_menu_item_forall): Don't recurse
into menuitem->submeny. That is wrong, and broke torn
off submenus of torn off menus, since they were unrealized
when the first menu was unrealized.
* gtk/gtkmenushell.[ch]: Virtualize gtk_menu_shell_insert() and
gtk_menu_shell_select_item() since these need to be overridden in
GtkMenu.
* gtk/gtkoptionmenu.c (gtk_opttion_menu_position): Change menu
positioning behaviour to fit to scrolling menus.
(gtk_option_menu_key_press, gtk_option_menu_button_press): Select
the current item so that it is prelighted when the menu pops up.
This is a workaround to the fact that the menu doesn't get the
initial enter event (due to grabs).
* gtk/gtkfilesel.c, gtk/gtkinputdialog.c, gtk/testgtk.c:
s/gtk_menu_append/gtk_menu_shell_append/
* gtk/gtknotebook.c:
s/gtk_menu_insert/gtk_menu_shell_insert/
* gtk/testgtk.c (create_menu, create_menus):
Create the first menu with 50 items so that menu scrolling
can be tested.
Patch from Jonathan Blandford <jrb@redhat.com>
* gtk/gtkmenuitem.[ch] (gtk_menu_item_toggle_size_request): new
system to handle size requests. First, we ask what the size of
the toggle is. Then, when allocating the size, we allocate the
toggle_size first. This way we can have multiple menu-item
classes w/o needing a seperate class for each.
* gtk/gtkmenu.c (gtk_menu_size_request): Actually use the new system.
* gtk/gtkmenu.c (gtk_menu_size_allocate): Use the new system.
* gtk/gtkcheckmenuitem.c
(gtk_check_menu_item_toggle_size_request): New function to handle
the toggle size-request.
2000-11-08 17:34:52 +00:00
|
|
|
|
static gboolean gtk_menu_key_press (GtkWidget *widget,
|
2010-12-23 20:50:18 +00:00
|
|
|
|
GdkEventKey *event);
|
2004-12-13 18:22:02 +00:00
|
|
|
|
static gboolean gtk_menu_scroll (GtkWidget *widget,
|
2010-12-23 20:50:18 +00:00
|
|
|
|
GdkEventScroll *event);
|
2002-11-09 20:52:31 +00:00
|
|
|
|
static gboolean gtk_menu_button_press (GtkWidget *widget,
|
2010-12-23 20:50:18 +00:00
|
|
|
|
GdkEventButton *event);
|
2002-11-09 20:52:31 +00:00
|
|
|
|
static gboolean gtk_menu_button_release (GtkWidget *widget,
|
2010-12-23 20:50:18 +00:00
|
|
|
|
GdkEventButton *event);
|
Add note about GtkMenuPositionFunc API changes.
2000-11-08 Alexander Larsson <alexl@redhat.com>
* docs/Changes-2.0.txt: Add note about GtkMenuPositionFunc
API changes.
* gtk/gtkmenu.c: Add support for scrolling menus.
Remove gtk_menu_append/prepend/insert, these have been moved to
gtkcompat.h as #defines.
* gtk/gtkcompat.h.in:
Add compatibility #defines for gtk_menu_append/prepend/insert
* gtk/gtkmenu.h: Add data needed for scrolling menus.
GtkMenuPositionFunc gets an extra argument push_in.
gtk_menu_append/prepend/insert removed.
* gtk/gtkmenuitem.c (gtk_menu_item_position_menu): Change menu
positioning behaviour to fit to scrolling menus.
* gtk/gtkmenuitem.c (gtk_menu_item_forall): Don't recurse
into menuitem->submeny. That is wrong, and broke torn
off submenus of torn off menus, since they were unrealized
when the first menu was unrealized.
* gtk/gtkmenushell.[ch]: Virtualize gtk_menu_shell_insert() and
gtk_menu_shell_select_item() since these need to be overridden in
GtkMenu.
* gtk/gtkoptionmenu.c (gtk_opttion_menu_position): Change menu
positioning behaviour to fit to scrolling menus.
(gtk_option_menu_key_press, gtk_option_menu_button_press): Select
the current item so that it is prelighted when the menu pops up.
This is a workaround to the fact that the menu doesn't get the
initial enter event (due to grabs).
* gtk/gtkfilesel.c, gtk/gtkinputdialog.c, gtk/testgtk.c:
s/gtk_menu_append/gtk_menu_shell_append/
* gtk/gtknotebook.c:
s/gtk_menu_insert/gtk_menu_shell_insert/
* gtk/testgtk.c (create_menu, create_menus):
Create the first menu with 50 items so that menu scrolling
can be tested.
Patch from Jonathan Blandford <jrb@redhat.com>
* gtk/gtkmenuitem.[ch] (gtk_menu_item_toggle_size_request): new
system to handle size requests. First, we ask what the size of
the toggle is. Then, when allocating the size, we allocate the
toggle_size first. This way we can have multiple menu-item
classes w/o needing a seperate class for each.
* gtk/gtkmenu.c (gtk_menu_size_request): Actually use the new system.
* gtk/gtkmenu.c (gtk_menu_size_allocate): Use the new system.
* gtk/gtkcheckmenuitem.c
(gtk_check_menu_item_toggle_size_request): New function to handle
the toggle size-request.
2000-11-08 17:34:52 +00:00
|
|
|
|
static gboolean gtk_menu_motion_notify (GtkWidget *widget,
|
2010-12-23 20:50:18 +00:00
|
|
|
|
GdkEventMotion *event);
|
Add note about GtkMenuPositionFunc API changes.
2000-11-08 Alexander Larsson <alexl@redhat.com>
* docs/Changes-2.0.txt: Add note about GtkMenuPositionFunc
API changes.
* gtk/gtkmenu.c: Add support for scrolling menus.
Remove gtk_menu_append/prepend/insert, these have been moved to
gtkcompat.h as #defines.
* gtk/gtkcompat.h.in:
Add compatibility #defines for gtk_menu_append/prepend/insert
* gtk/gtkmenu.h: Add data needed for scrolling menus.
GtkMenuPositionFunc gets an extra argument push_in.
gtk_menu_append/prepend/insert removed.
* gtk/gtkmenuitem.c (gtk_menu_item_position_menu): Change menu
positioning behaviour to fit to scrolling menus.
* gtk/gtkmenuitem.c (gtk_menu_item_forall): Don't recurse
into menuitem->submeny. That is wrong, and broke torn
off submenus of torn off menus, since they were unrealized
when the first menu was unrealized.
* gtk/gtkmenushell.[ch]: Virtualize gtk_menu_shell_insert() and
gtk_menu_shell_select_item() since these need to be overridden in
GtkMenu.
* gtk/gtkoptionmenu.c (gtk_opttion_menu_position): Change menu
positioning behaviour to fit to scrolling menus.
(gtk_option_menu_key_press, gtk_option_menu_button_press): Select
the current item so that it is prelighted when the menu pops up.
This is a workaround to the fact that the menu doesn't get the
initial enter event (due to grabs).
* gtk/gtkfilesel.c, gtk/gtkinputdialog.c, gtk/testgtk.c:
s/gtk_menu_append/gtk_menu_shell_append/
* gtk/gtknotebook.c:
s/gtk_menu_insert/gtk_menu_shell_insert/
* gtk/testgtk.c (create_menu, create_menus):
Create the first menu with 50 items so that menu scrolling
can be tested.
Patch from Jonathan Blandford <jrb@redhat.com>
* gtk/gtkmenuitem.[ch] (gtk_menu_item_toggle_size_request): new
system to handle size requests. First, we ask what the size of
the toggle is. Then, when allocating the size, we allocate the
toggle_size first. This way we can have multiple menu-item
classes w/o needing a seperate class for each.
* gtk/gtkmenu.c (gtk_menu_size_request): Actually use the new system.
* gtk/gtkmenu.c (gtk_menu_size_allocate): Use the new system.
* gtk/gtkcheckmenuitem.c
(gtk_check_menu_item_toggle_size_request): New function to handle
the toggle size-request.
2000-11-08 17:34:52 +00:00
|
|
|
|
static gboolean gtk_menu_enter_notify (GtkWidget *widget,
|
2010-12-23 20:50:18 +00:00
|
|
|
|
GdkEventCrossing *event);
|
Add note about GtkMenuPositionFunc API changes.
2000-11-08 Alexander Larsson <alexl@redhat.com>
* docs/Changes-2.0.txt: Add note about GtkMenuPositionFunc
API changes.
* gtk/gtkmenu.c: Add support for scrolling menus.
Remove gtk_menu_append/prepend/insert, these have been moved to
gtkcompat.h as #defines.
* gtk/gtkcompat.h.in:
Add compatibility #defines for gtk_menu_append/prepend/insert
* gtk/gtkmenu.h: Add data needed for scrolling menus.
GtkMenuPositionFunc gets an extra argument push_in.
gtk_menu_append/prepend/insert removed.
* gtk/gtkmenuitem.c (gtk_menu_item_position_menu): Change menu
positioning behaviour to fit to scrolling menus.
* gtk/gtkmenuitem.c (gtk_menu_item_forall): Don't recurse
into menuitem->submeny. That is wrong, and broke torn
off submenus of torn off menus, since they were unrealized
when the first menu was unrealized.
* gtk/gtkmenushell.[ch]: Virtualize gtk_menu_shell_insert() and
gtk_menu_shell_select_item() since these need to be overridden in
GtkMenu.
* gtk/gtkoptionmenu.c (gtk_opttion_menu_position): Change menu
positioning behaviour to fit to scrolling menus.
(gtk_option_menu_key_press, gtk_option_menu_button_press): Select
the current item so that it is prelighted when the menu pops up.
This is a workaround to the fact that the menu doesn't get the
initial enter event (due to grabs).
* gtk/gtkfilesel.c, gtk/gtkinputdialog.c, gtk/testgtk.c:
s/gtk_menu_append/gtk_menu_shell_append/
* gtk/gtknotebook.c:
s/gtk_menu_insert/gtk_menu_shell_insert/
* gtk/testgtk.c (create_menu, create_menus):
Create the first menu with 50 items so that menu scrolling
can be tested.
Patch from Jonathan Blandford <jrb@redhat.com>
* gtk/gtkmenuitem.[ch] (gtk_menu_item_toggle_size_request): new
system to handle size requests. First, we ask what the size of
the toggle is. Then, when allocating the size, we allocate the
toggle_size first. This way we can have multiple menu-item
classes w/o needing a seperate class for each.
* gtk/gtkmenu.c (gtk_menu_size_request): Actually use the new system.
* gtk/gtkmenu.c (gtk_menu_size_allocate): Use the new system.
* gtk/gtkcheckmenuitem.c
(gtk_check_menu_item_toggle_size_request): New function to handle
the toggle size-request.
2000-11-08 17:34:52 +00:00
|
|
|
|
static gboolean gtk_menu_leave_notify (GtkWidget *widget,
|
2010-12-23 20:50:18 +00:00
|
|
|
|
GdkEventCrossing *event);
|
Add note about GtkMenuPositionFunc API changes.
2000-11-08 Alexander Larsson <alexl@redhat.com>
* docs/Changes-2.0.txt: Add note about GtkMenuPositionFunc
API changes.
* gtk/gtkmenu.c: Add support for scrolling menus.
Remove gtk_menu_append/prepend/insert, these have been moved to
gtkcompat.h as #defines.
* gtk/gtkcompat.h.in:
Add compatibility #defines for gtk_menu_append/prepend/insert
* gtk/gtkmenu.h: Add data needed for scrolling menus.
GtkMenuPositionFunc gets an extra argument push_in.
gtk_menu_append/prepend/insert removed.
* gtk/gtkmenuitem.c (gtk_menu_item_position_menu): Change menu
positioning behaviour to fit to scrolling menus.
* gtk/gtkmenuitem.c (gtk_menu_item_forall): Don't recurse
into menuitem->submeny. That is wrong, and broke torn
off submenus of torn off menus, since they were unrealized
when the first menu was unrealized.
* gtk/gtkmenushell.[ch]: Virtualize gtk_menu_shell_insert() and
gtk_menu_shell_select_item() since these need to be overridden in
GtkMenu.
* gtk/gtkoptionmenu.c (gtk_opttion_menu_position): Change menu
positioning behaviour to fit to scrolling menus.
(gtk_option_menu_key_press, gtk_option_menu_button_press): Select
the current item so that it is prelighted when the menu pops up.
This is a workaround to the fact that the menu doesn't get the
initial enter event (due to grabs).
* gtk/gtkfilesel.c, gtk/gtkinputdialog.c, gtk/testgtk.c:
s/gtk_menu_append/gtk_menu_shell_append/
* gtk/gtknotebook.c:
s/gtk_menu_insert/gtk_menu_shell_insert/
* gtk/testgtk.c (create_menu, create_menus):
Create the first menu with 50 items so that menu scrolling
can be tested.
Patch from Jonathan Blandford <jrb@redhat.com>
* gtk/gtkmenuitem.[ch] (gtk_menu_item_toggle_size_request): new
system to handle size requests. First, we ask what the size of
the toggle is. Then, when allocating the size, we allocate the
toggle_size first. This way we can have multiple menu-item
classes w/o needing a seperate class for each.
* gtk/gtkmenu.c (gtk_menu_size_request): Actually use the new system.
* gtk/gtkmenu.c (gtk_menu_size_allocate): Use the new system.
* gtk/gtkcheckmenuitem.c
(gtk_check_menu_item_toggle_size_request): New function to handle
the toggle size-request.
2000-11-08 17:34:52 +00:00
|
|
|
|
static void gtk_menu_scroll_to (GtkMenu *menu,
|
2019-01-17 18:27:51 +00:00
|
|
|
|
gint offset,
|
|
|
|
|
GtkMenuScrollFlag flags);
|
2005-06-27 17:36:34 +00:00
|
|
|
|
static void gtk_menu_grab_notify (GtkWidget *widget,
|
2010-12-23 20:50:18 +00:00
|
|
|
|
gboolean was_grabbed);
|
2011-12-12 17:11:57 +00:00
|
|
|
|
static gboolean gtk_menu_captured_event (GtkWidget *widget,
|
|
|
|
|
GdkEvent *event);
|
|
|
|
|
|
2002-11-09 20:52:31 +00:00
|
|
|
|
|
2006-02-22 10:10:23 +00:00
|
|
|
|
static void gtk_menu_stop_scrolling (GtkMenu *menu);
|
|
|
|
|
static void gtk_menu_remove_scroll_timeout (GtkMenu *menu);
|
|
|
|
|
static gboolean gtk_menu_scroll_timeout (gpointer data);
|
2002-11-09 20:52:31 +00:00
|
|
|
|
|
2001-09-22 14:55:02 +00:00
|
|
|
|
static void gtk_menu_scroll_item_visible (GtkMenuShell *menu_shell,
|
2010-12-23 20:50:18 +00:00
|
|
|
|
GtkWidget *menu_item);
|
Add note about GtkMenuPositionFunc API changes.
2000-11-08 Alexander Larsson <alexl@redhat.com>
* docs/Changes-2.0.txt: Add note about GtkMenuPositionFunc
API changes.
* gtk/gtkmenu.c: Add support for scrolling menus.
Remove gtk_menu_append/prepend/insert, these have been moved to
gtkcompat.h as #defines.
* gtk/gtkcompat.h.in:
Add compatibility #defines for gtk_menu_append/prepend/insert
* gtk/gtkmenu.h: Add data needed for scrolling menus.
GtkMenuPositionFunc gets an extra argument push_in.
gtk_menu_append/prepend/insert removed.
* gtk/gtkmenuitem.c (gtk_menu_item_position_menu): Change menu
positioning behaviour to fit to scrolling menus.
* gtk/gtkmenuitem.c (gtk_menu_item_forall): Don't recurse
into menuitem->submeny. That is wrong, and broke torn
off submenus of torn off menus, since they were unrealized
when the first menu was unrealized.
* gtk/gtkmenushell.[ch]: Virtualize gtk_menu_shell_insert() and
gtk_menu_shell_select_item() since these need to be overridden in
GtkMenu.
* gtk/gtkoptionmenu.c (gtk_opttion_menu_position): Change menu
positioning behaviour to fit to scrolling menus.
(gtk_option_menu_key_press, gtk_option_menu_button_press): Select
the current item so that it is prelighted when the menu pops up.
This is a workaround to the fact that the menu doesn't get the
initial enter event (due to grabs).
* gtk/gtkfilesel.c, gtk/gtkinputdialog.c, gtk/testgtk.c:
s/gtk_menu_append/gtk_menu_shell_append/
* gtk/gtknotebook.c:
s/gtk_menu_insert/gtk_menu_shell_insert/
* gtk/testgtk.c (create_menu, create_menus):
Create the first menu with 50 items so that menu scrolling
can be tested.
Patch from Jonathan Blandford <jrb@redhat.com>
* gtk/gtkmenuitem.[ch] (gtk_menu_item_toggle_size_request): new
system to handle size requests. First, we ask what the size of
the toggle is. Then, when allocating the size, we allocate the
toggle_size first. This way we can have multiple menu-item
classes w/o needing a seperate class for each.
* gtk/gtkmenu.c (gtk_menu_size_request): Actually use the new system.
* gtk/gtkmenu.c (gtk_menu_size_allocate): Use the new system.
* gtk/gtkcheckmenuitem.c
(gtk_check_menu_item_toggle_size_request): New function to handle
the toggle size-request.
2000-11-08 17:34:52 +00:00
|
|
|
|
static void gtk_menu_select_item (GtkMenuShell *menu_shell,
|
2010-12-23 20:50:18 +00:00
|
|
|
|
GtkWidget *menu_item);
|
2001-08-23 23:30:43 +00:00
|
|
|
|
static void gtk_menu_real_insert (GtkMenuShell *menu_shell,
|
2010-12-23 20:50:18 +00:00
|
|
|
|
GtkWidget *child,
|
|
|
|
|
gint position);
|
Add note about GtkMenuPositionFunc API changes.
2000-11-08 Alexander Larsson <alexl@redhat.com>
* docs/Changes-2.0.txt: Add note about GtkMenuPositionFunc
API changes.
* gtk/gtkmenu.c: Add support for scrolling menus.
Remove gtk_menu_append/prepend/insert, these have been moved to
gtkcompat.h as #defines.
* gtk/gtkcompat.h.in:
Add compatibility #defines for gtk_menu_append/prepend/insert
* gtk/gtkmenu.h: Add data needed for scrolling menus.
GtkMenuPositionFunc gets an extra argument push_in.
gtk_menu_append/prepend/insert removed.
* gtk/gtkmenuitem.c (gtk_menu_item_position_menu): Change menu
positioning behaviour to fit to scrolling menus.
* gtk/gtkmenuitem.c (gtk_menu_item_forall): Don't recurse
into menuitem->submeny. That is wrong, and broke torn
off submenus of torn off menus, since they were unrealized
when the first menu was unrealized.
* gtk/gtkmenushell.[ch]: Virtualize gtk_menu_shell_insert() and
gtk_menu_shell_select_item() since these need to be overridden in
GtkMenu.
* gtk/gtkoptionmenu.c (gtk_opttion_menu_position): Change menu
positioning behaviour to fit to scrolling menus.
(gtk_option_menu_key_press, gtk_option_menu_button_press): Select
the current item so that it is prelighted when the menu pops up.
This is a workaround to the fact that the menu doesn't get the
initial enter event (due to grabs).
* gtk/gtkfilesel.c, gtk/gtkinputdialog.c, gtk/testgtk.c:
s/gtk_menu_append/gtk_menu_shell_append/
* gtk/gtknotebook.c:
s/gtk_menu_insert/gtk_menu_shell_insert/
* gtk/testgtk.c (create_menu, create_menus):
Create the first menu with 50 items so that menu scrolling
can be tested.
Patch from Jonathan Blandford <jrb@redhat.com>
* gtk/gtkmenuitem.[ch] (gtk_menu_item_toggle_size_request): new
system to handle size requests. First, we ask what the size of
the toggle is. Then, when allocating the size, we allocate the
toggle_size first. This way we can have multiple menu-item
classes w/o needing a seperate class for each.
* gtk/gtkmenu.c (gtk_menu_size_request): Actually use the new system.
* gtk/gtkmenu.c (gtk_menu_size_allocate): Use the new system.
* gtk/gtkcheckmenuitem.c
(gtk_check_menu_item_toggle_size_request): New function to handle
the toggle size-request.
2000-11-08 17:34:52 +00:00
|
|
|
|
static void gtk_menu_scrollbar_changed (GtkAdjustment *adjustment,
|
2010-12-23 20:50:18 +00:00
|
|
|
|
GtkMenu *menu);
|
Add note about GtkMenuPositionFunc API changes.
2000-11-08 Alexander Larsson <alexl@redhat.com>
* docs/Changes-2.0.txt: Add note about GtkMenuPositionFunc
API changes.
* gtk/gtkmenu.c: Add support for scrolling menus.
Remove gtk_menu_append/prepend/insert, these have been moved to
gtkcompat.h as #defines.
* gtk/gtkcompat.h.in:
Add compatibility #defines for gtk_menu_append/prepend/insert
* gtk/gtkmenu.h: Add data needed for scrolling menus.
GtkMenuPositionFunc gets an extra argument push_in.
gtk_menu_append/prepend/insert removed.
* gtk/gtkmenuitem.c (gtk_menu_item_position_menu): Change menu
positioning behaviour to fit to scrolling menus.
* gtk/gtkmenuitem.c (gtk_menu_item_forall): Don't recurse
into menuitem->submeny. That is wrong, and broke torn
off submenus of torn off menus, since they were unrealized
when the first menu was unrealized.
* gtk/gtkmenushell.[ch]: Virtualize gtk_menu_shell_insert() and
gtk_menu_shell_select_item() since these need to be overridden in
GtkMenu.
* gtk/gtkoptionmenu.c (gtk_opttion_menu_position): Change menu
positioning behaviour to fit to scrolling menus.
(gtk_option_menu_key_press, gtk_option_menu_button_press): Select
the current item so that it is prelighted when the menu pops up.
This is a workaround to the fact that the menu doesn't get the
initial enter event (due to grabs).
* gtk/gtkfilesel.c, gtk/gtkinputdialog.c, gtk/testgtk.c:
s/gtk_menu_append/gtk_menu_shell_append/
* gtk/gtknotebook.c:
s/gtk_menu_insert/gtk_menu_shell_insert/
* gtk/testgtk.c (create_menu, create_menus):
Create the first menu with 50 items so that menu scrolling
can be tested.
Patch from Jonathan Blandford <jrb@redhat.com>
* gtk/gtkmenuitem.[ch] (gtk_menu_item_toggle_size_request): new
system to handle size requests. First, we ask what the size of
the toggle is. Then, when allocating the size, we allocate the
toggle_size first. This way we can have multiple menu-item
classes w/o needing a seperate class for each.
* gtk/gtkmenu.c (gtk_menu_size_request): Actually use the new system.
* gtk/gtkmenu.c (gtk_menu_size_allocate): Use the new system.
* gtk/gtkcheckmenuitem.c
(gtk_check_menu_item_toggle_size_request): New function to handle
the toggle size-request.
2000-11-08 17:34:52 +00:00
|
|
|
|
static void gtk_menu_handle_scrolling (GtkMenu *menu,
|
2010-12-23 20:50:18 +00:00
|
|
|
|
gint event_x,
|
|
|
|
|
gint event_y,
|
|
|
|
|
gboolean enter,
|
2006-02-22 10:10:23 +00:00
|
|
|
|
gboolean motion);
|
Add note about GtkMenuPositionFunc API changes.
2000-11-08 Alexander Larsson <alexl@redhat.com>
* docs/Changes-2.0.txt: Add note about GtkMenuPositionFunc
API changes.
* gtk/gtkmenu.c: Add support for scrolling menus.
Remove gtk_menu_append/prepend/insert, these have been moved to
gtkcompat.h as #defines.
* gtk/gtkcompat.h.in:
Add compatibility #defines for gtk_menu_append/prepend/insert
* gtk/gtkmenu.h: Add data needed for scrolling menus.
GtkMenuPositionFunc gets an extra argument push_in.
gtk_menu_append/prepend/insert removed.
* gtk/gtkmenuitem.c (gtk_menu_item_position_menu): Change menu
positioning behaviour to fit to scrolling menus.
* gtk/gtkmenuitem.c (gtk_menu_item_forall): Don't recurse
into menuitem->submeny. That is wrong, and broke torn
off submenus of torn off menus, since they were unrealized
when the first menu was unrealized.
* gtk/gtkmenushell.[ch]: Virtualize gtk_menu_shell_insert() and
gtk_menu_shell_select_item() since these need to be overridden in
GtkMenu.
* gtk/gtkoptionmenu.c (gtk_opttion_menu_position): Change menu
positioning behaviour to fit to scrolling menus.
(gtk_option_menu_key_press, gtk_option_menu_button_press): Select
the current item so that it is prelighted when the menu pops up.
This is a workaround to the fact that the menu doesn't get the
initial enter event (due to grabs).
* gtk/gtkfilesel.c, gtk/gtkinputdialog.c, gtk/testgtk.c:
s/gtk_menu_append/gtk_menu_shell_append/
* gtk/gtknotebook.c:
s/gtk_menu_insert/gtk_menu_shell_insert/
* gtk/testgtk.c (create_menu, create_menus):
Create the first menu with 50 items so that menu scrolling
can be tested.
Patch from Jonathan Blandford <jrb@redhat.com>
* gtk/gtkmenuitem.[ch] (gtk_menu_item_toggle_size_request): new
system to handle size requests. First, we ask what the size of
the toggle is. Then, when allocating the size, we allocate the
toggle_size first. This way we can have multiple menu-item
classes w/o needing a seperate class for each.
* gtk/gtkmenu.c (gtk_menu_size_request): Actually use the new system.
* gtk/gtkmenu.c (gtk_menu_size_allocate): Use the new system.
* gtk/gtkcheckmenuitem.c
(gtk_check_menu_item_toggle_size_request): New function to handle
the toggle size-request.
2000-11-08 17:34:52 +00:00
|
|
|
|
static void gtk_menu_set_tearoff_hints (GtkMenu *menu,
|
2010-12-23 20:50:18 +00:00
|
|
|
|
gint width);
|
2002-10-01 09:57:55 +00:00
|
|
|
|
static gboolean gtk_menu_focus (GtkWidget *widget,
|
2010-12-23 20:50:18 +00:00
|
|
|
|
GtkDirectionType direction);
|
2002-12-14 22:43:52 +00:00
|
|
|
|
static gint gtk_menu_get_popup_delay (GtkMenuShell *menu_shell);
|
The table menu patch! Turns GtkMenu into a table, so you can attach menu
Wed Sep 10 22:25:04 2003 Kristian Rietveld <kris@gtk.org>
The table menu patch! Turns GtkMenu into a table, so you can attach
menu items in numerous new ways! Be creative!
Contains some bug fixes and RTL adaptions from Matthias Clasen.
* gtk/gtkmenu.c [toplevel]: introduce ATTACH_INFO_KEY, extend
GtkMenuPrivate, introduce AttachInfo, add child properties enum,
(gtk_menu_free_private), (gtk_menu_get_private): we have to free
the heights array in the private struct,
(gtk_menu_class_init): reorder code a bit, install child properties,
(get_attach_info), (get_child_attach): new utility functions,
(gtk_menu_set_child_property), (gtk_menu_get_child_property): introduce
child properties, for the attach info,
(gtk_menu_remove): remove AttachInfo from menu item,
(gtk_menu_real_insert): implemented algorithm to automagically place
inserted menu items at the correct place in the table,
(gtk_menu_size_request), (gtk_menu_size_allocate),
(compute_child_offset): reworked/rewritten to support table menus,
(gtk_menu_attach): new function,
(find_child_containing), (gtk_menu_move_current): new functions to
get table menu keynav right.
* gtk/gtkmenu.h: add gtk_menu_attach() prototype.
2003-09-10 20:32:33 +00:00
|
|
|
|
static void gtk_menu_move_current (GtkMenuShell *menu_shell,
|
|
|
|
|
GtkMenuDirectionType direction);
|
2002-12-14 22:43:52 +00:00
|
|
|
|
static void gtk_menu_real_move_scroll (GtkMenu *menu,
|
2010-12-23 20:50:18 +00:00
|
|
|
|
GtkScrollType type);
|
2000-09-02 02:43:50 +00:00
|
|
|
|
|
|
|
|
|
static void gtk_menu_stop_navigating_submenu (GtkMenu *menu);
|
|
|
|
|
static gboolean gtk_menu_stop_navigating_submenu_cb (gpointer user_data);
|
|
|
|
|
static gboolean gtk_menu_navigating_submenu (GtkMenu *menu,
|
2010-12-23 20:50:18 +00:00
|
|
|
|
gint event_x,
|
|
|
|
|
gint event_y);
|
2000-09-02 02:43:50 +00:00
|
|
|
|
static void gtk_menu_set_submenu_navigation_region (GtkMenu *menu,
|
2010-12-23 20:50:18 +00:00
|
|
|
|
GtkMenuItem *menu_item,
|
|
|
|
|
GdkEventCrossing *event);
|
2000-09-02 02:43:50 +00:00
|
|
|
|
|
2010-12-23 20:50:18 +00:00
|
|
|
|
static void gtk_menu_deactivate (GtkMenuShell *menu_shell);
|
GTK_MENU_DIR_CHILD: check for the existance of
Thu Sep 3 04:22:20 1998 Tim Janik <timj@gtk.org>
* gtk/gtkmenushell.c (gtk_real_menu_shell_move_current):
GTK_MENU_DIR_CHILD: check for the existance of
menu_shell->active_menu_item before accessing its child.
GTK_MENU_DIR_PREV:
GTK_MENU_DIR_NEXT: if we haven't had an active item and still
don't, make a default selection.
Wed Sep 2 00:28:58 1998 Tim Janik <timj@gtk.org>
* gtk/gtkwidget.c (gtk_widget_propagate_state): iterate
the children with _forall for sensitivity changes and with
_foreach on pure state changes. this fixes a lot of the
old inclusions of internal widgets into _foreach calls.
* gtk/gtktree.c: removed gtk_tree_foreach, let gtk_tree_forall
do the work. don't walk the subtrees of first level children.
* gtk/gtktreeitem.c: provide a _forall implementation,
which walks the subtrees as well for include_internals.
* gtk/gtkmenuitem.c: provide a _forall implementation, which walks
the submenus as well for include_internals.
* gtk/gtkscrolledwindow.c: removed gtk_scrolled_window_foreach and
implemented gtk_scrolled_window_forall, which will iterate over
the viewport and the scrollbars for gtk_container_forall or
iterate over the viewports children for gtk_container_foreach.
* gtk/gtktoolbar.c:
* gtk/gtktable.c:
* gtk/gtkpaned.c:
* gtk/gtkpacker.c:
* gtk/gtkmenushell.c:
* gtk/gtklist.c:
* gtk/gtkfixed.c:
* gtk/gtkclist.c:
* gtk/gtkbox.c:
* gtk/gtkbin.c:
* gtk/gtknotebook.c:
removed the old gtk_*_foreach functions and provided gtk_*_forall.
* gtk/gtknotebook.c:
(gtk_notebook_real_switch_page): expose tabs.
(gtk_notebook_page_num): new function to return the page number
of a distinct child.
(gtk_notebook_focus): minor fixups. foxus handling is still screwed
under some circumstances.
* gtk/gtktreeitem.c:
(gtk_real_tree_item_select):
(gtk_real_tree_item_deselect): major fixes.
some general fixups wrt queue_redraw, and tree items not being
NO_WINDOW widgets.
* gtk/gtklistitem.c:
(gtk_real_list_item_select):
(gtk_real_list_item_deselect):
(gtk_real_list_item_toggle):
removed unneccessary queue_redraw calls.
Wed Aug 30 09:42:07 1998 Tim Janik <timj@gtk.org>
* gtk/gtkoptionmenu.c: allow optionmenus to have the focus and
automatically popup the menu on space bar.
Wed Aug 26 06:40:34 1998 Tim Janik <timj@gtk.org>
* gtk/gtkcontainer.h:
* gtk/gtkcontainer.c: implemented gtk_container_forall() (as a class
method), which acts similar to gtk_container_foreach(), but iterates
over internal children. the GtkContainer::foreach signal vanished in
favour of a new class method ->forall() that optionally includes
internal widgets.
* gtk/gtkclist.c (gtk_clist_init): provide no _foreach implementation
but a _forall implementation, since all child widgets we have are
internal ones.
(column_button_create): set the parent window prior
to gtk_widget_set_parent().
* gtk/gtkwidget.c:
exchanged all calls to gtk_container_foreach() with
gtk_container_forall().
* gtk/gtkwidget.h:
* gtk/gtkwidget.c: added the GTK_COMPOSITE_CHILD, exported through
the GtkWidget::composite_child argument. to have a widget created
with the flag initially, two new functions got added to wrap a widgets
creation:
gtk_widget_push_composite_flag() and gtk_widget_pop_composite_flag().
Wed Aug 25 23:37:39 1998 Tim Janik <timj@gtk.org>
* gtk/gtktooltips.h:
* gtk/gtktooltips.c: exported gtk_tooltips_create_window() as
gtk_tooltips_force_window(), so tooltips->tip_window can be accessed
prior to the first tip being set.
don't put an extra reference on the window, since it is a toplevel,
it wont get destroyed from anywhere else.
* overall macro and GtkType fixups.
1998-09-03 02:38:53 +00:00
|
|
|
|
static void gtk_menu_show_all (GtkWidget *widget);
|
2010-10-31 19:52:32 +00:00
|
|
|
|
static void gtk_menu_position (GtkMenu *menu,
|
|
|
|
|
gboolean set_scroll_offset);
|
2010-12-23 20:50:18 +00:00
|
|
|
|
static void gtk_menu_reparent (GtkMenu *menu,
|
|
|
|
|
GtkWidget *new_parent,
|
|
|
|
|
gboolean unrealize);
|
Get rid of a bunch of g_strdup_printf("%s%s") in favor of g_strconcat().
Fri Feb 2 12:26:50 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkrc.c (gtk_rc_add_initial_default_files): Get rid of
a bunch of g_strdup_printf("%s%s") in favor of g_strconcat().
* gtk/gtkrc.c Makefile.am: Use $(libdir), not $(exe_prefix),
since some people set $(libdir) separately. (#1290, David Kaelbling)
Thu Feb 1 18:25:46 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkfilesel.c: If PATH_MAX and MAXPATHLEN are not
defined, define MAXPATHLEN to 2048. (The Hurd doesn't have
MAXPATHLEN, but the code here depends on a fixed value.)
(#4524)
Wed Jan 31 22:01:04 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkhandlebox.c (gtk_handle_box_button_changed): Handle the case
where child == NULL and handle_position == RIGHT or BOTTOM. (#8041g)
Wed Jan 31 21:20:39 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkctree.c (real_tree_move): If the node being moved isn't
viewable there is no way that moving the node will cause the
focus row to become not viewable, so omit check on the visibility
of new_sibling, which is irrelevant. (Fixes #8002, David Helder)
Wed Jan 31 20:38:17 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkentry.c (gtk_entry_commit_cb): Delete the current
selection before inserting new text.
Wed Jan 31 18:49:33 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkoptionmenu.c (gtk_option_menu_item_state_changed_cb):
Make the sensitivity of the reparented child track that of
the original parent menu item. (#34218, David Hodson)
* gtk/gtkoptionmenu.c (gtk_option_menu_item_destroy_cb): Handle
the case where the current item is destroyed properly.
* gtk/gtkoptionmenu.c: Some additional code cleanups and fix
some edge cases with child-less menuitems.
Wed Jan 31 17:16:13 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkcombo.c (gtk_combo_window_key_press): Make Return
key pop down window. (#12074, Jon K Hellan)
Wed Jan 31 16:21:42 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtklist.c (gtk_list_signal_item_toggle): Don't allow
toggling of rows off in BROWSE or EXTENDED mode. (#12072, Jon K Hellan)
The solution here isn't perfect - you get an extraneous
emission of "toggle", which could conceivably confuse an app,
but better than the current situation. LXR search seems to
indicate that no apps in GNOME CVS connect to "toggle".
Wed Jan 31 15:46:13 2001 Owen Taylor <otaylor@redhat.com>
* gtk/Makefile.am (libgtkinclude_HEADERS): Move gtkcompat.h from
gtk_public_h_sources to directly here to avoid warning when
building srcdir != builddir. (#9656)
Tue Jan 30 19:49:02 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkrange.c: Patch from Kipp Hickman to make the event
handlers in gtkrange.c return the proper values (TRUE == handled)
(#10316).
This is just the tip of the iceberg, but gtkrange.c is the
most common place where the propagation is problematical,
and also a place where it is almost certainly safe to change
this in the stable branch.
(You don't want right click popups on a range control or anything...)
Tue Jan 30 18:57:59 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtktext.c (clear_focus_area): We need to clear the focus
area on focus out, even if a background pixmap isn't set.
(#13941)
Tue Jan 30 18:24:10 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtknotebook.c (gtk_notebook_set_shape): Fix from Sean Cunningham
to deal with setting the shape properly when scrolling arrows are
turned on, but not visible because there is sufficient space.
(#13432)
Tue Jan 30 16:39:25 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkitemfactory.c (gtk_item_factory_delete_item): For menu
items with submenus, destroy the item along with the submenu.
(#7841, Brian Masney(?)) Also, handle paths of the form '<foo>/abcd...'
properly.
* gtk/testgtk.c (menu_items): Add a dummy branch that we delete
later.
Tue Jan 30 15:51:25 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwindow.c (gtk_window_real_set_focus): Fix a problem where
the focus widget sometimes wasn't drawn with the default if there
was no default widget.
* gtk/gtkstyle.c (gtk_style_real_unrealize): free colors,
unreference pixmaps.
* gtk/gtkstyle.c (gtk_style_realize): Reference colormap
for some extra safety.
Mon Jan 29 19:00:01 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtk{ctree.c,clist.c} (set_cell_contents): Handle setting
the text of a cell to the old pointer value better, by
copying the new text before freeing the old text. Some code
cleanup. (#8079, Karl Nelson)
Mon Jan 29 16:50:19 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtklabel.[ch] gtk/gtkframe.[ch]: Make gtk_label_get_text()
gtk_frame_get_label() non strdup'ing, and G_CONST_RETURN.
Mon Jan 29 15:22:51 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkmenu.c (gtk_menu_remove): When removing an
item from a menu, check to see if it matches
menu->old_active_menu_item, and if so, unref and clear
old_active_menu_item (Patch from Pavel Cisler)
* gtk/gtkmenushell.c (gtk_menu_shell_remove): Unset
menu_shell->active_menu_item, if it is the child being
removed. (Patch based on that of Gene Ragan, #50337)
2001-02-02 17:53:29 +00:00
|
|
|
|
static void gtk_menu_remove (GtkContainer *menu,
|
2010-12-23 20:50:18 +00:00
|
|
|
|
GtkWidget *widget);
|
1997-11-24 22:37:52 +00:00
|
|
|
|
|
2001-12-27 20:22:16 +00:00
|
|
|
|
static void gtk_menu_update_title (GtkMenu *menu);
|
|
|
|
|
|
2002-02-02 21:50:46 +00:00
|
|
|
|
static void menu_grab_transfer_window_destroy (GtkMenu *menu);
|
|
|
|
|
static GdkWindow *menu_grab_transfer_window_get (GtkMenu *menu);
|
|
|
|
|
|
2003-11-27 15:51:32 +00:00
|
|
|
|
static gboolean gtk_menu_real_can_activate_accel (GtkWidget *widget,
|
|
|
|
|
guint signal_id);
|
2001-11-20 23:43:03 +00:00
|
|
|
|
static void _gtk_menu_refresh_accel_paths (GtkMenu *menu,
|
2010-12-23 20:50:18 +00:00
|
|
|
|
gboolean group_changed);
|
2001-11-20 23:43:03 +00:00
|
|
|
|
|
2010-09-21 14:35:17 +00:00
|
|
|
|
static void gtk_menu_get_preferred_width (GtkWidget *widget,
|
|
|
|
|
gint *minimum_size,
|
|
|
|
|
gint *natural_size);
|
|
|
|
|
static void gtk_menu_get_preferred_height (GtkWidget *widget,
|
|
|
|
|
gint *minimum_size,
|
|
|
|
|
gint *natural_size);
|
|
|
|
|
static void gtk_menu_get_preferred_height_for_width (GtkWidget *widget,
|
|
|
|
|
gint for_size,
|
|
|
|
|
gint *minimum_size,
|
|
|
|
|
gint *natural_size);
|
2010-08-18 23:42:02 +00:00
|
|
|
|
|
|
|
|
|
|
2008-09-03 15:23:17 +00:00
|
|
|
|
static const gchar attach_data_key[] = "gtk-menu-attach-data";
|
1998-02-03 14:13:05 +00:00
|
|
|
|
|
2002-12-14 22:43:52 +00:00
|
|
|
|
static guint menu_signals[LAST_SIGNAL] = { 0 };
|
|
|
|
|
|
2013-06-27 19:02:52 +00:00
|
|
|
|
G_DEFINE_TYPE_WITH_PRIVATE (GtkMenu, gtk_menu, GTK_TYPE_MENU_SHELL)
|
1997-11-24 22:37:52 +00:00
|
|
|
|
|
2004-03-15 02:03:59 +00:00
|
|
|
|
static void
|
|
|
|
|
menu_queue_resize (GtkMenu *menu)
|
|
|
|
|
{
|
2010-12-23 20:50:18 +00:00
|
|
|
|
GtkMenuPrivate *priv = menu->priv;
|
2004-03-15 02:03:59 +00:00
|
|
|
|
|
|
|
|
|
priv->have_layout = FALSE;
|
|
|
|
|
gtk_widget_queue_resize (GTK_WIDGET (menu));
|
|
|
|
|
}
|
|
|
|
|
|
2008-05-25 22:33:34 +00:00
|
|
|
|
static void
|
|
|
|
|
attach_info_free (AttachInfo *info)
|
|
|
|
|
{
|
|
|
|
|
g_slice_free (AttachInfo, info);
|
|
|
|
|
}
|
|
|
|
|
|
2004-03-15 02:03:59 +00:00
|
|
|
|
static AttachInfo *
|
|
|
|
|
get_attach_info (GtkWidget *child)
|
|
|
|
|
{
|
|
|
|
|
GObject *object = G_OBJECT (child);
|
|
|
|
|
AttachInfo *ai = g_object_get_data (object, ATTACH_INFO_KEY);
|
|
|
|
|
|
|
|
|
|
if (!ai)
|
|
|
|
|
{
|
2008-05-25 22:33:34 +00:00
|
|
|
|
ai = g_slice_new0 (AttachInfo);
|
2008-05-30 12:12:19 +00:00
|
|
|
|
g_object_set_data_full (object, I_(ATTACH_INFO_KEY), ai,
|
|
|
|
|
(GDestroyNotify) attach_info_free);
|
2004-03-15 02:03:59 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return ai;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
|
is_grid_attached (AttachInfo *ai)
|
|
|
|
|
{
|
|
|
|
|
return (ai->left_attach >= 0 &&
|
2010-12-23 20:50:18 +00:00
|
|
|
|
ai->right_attach >= 0 &&
|
|
|
|
|
ai->top_attach >= 0 &&
|
|
|
|
|
ai->bottom_attach >= 0);
|
2004-03-15 02:03:59 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
menu_ensure_layout (GtkMenu *menu)
|
|
|
|
|
{
|
2011-01-04 17:32:22 +00:00
|
|
|
|
GtkMenuPrivate *priv = menu->priv;
|
2004-03-15 02:03:59 +00:00
|
|
|
|
|
|
|
|
|
if (!priv->have_layout)
|
|
|
|
|
{
|
|
|
|
|
GtkMenuShell *menu_shell = GTK_MENU_SHELL (menu);
|
|
|
|
|
GList *l;
|
|
|
|
|
gchar *row_occupied;
|
|
|
|
|
gint current_row;
|
2010-12-23 23:21:53 +00:00
|
|
|
|
gint max_right_attach;
|
2004-03-15 02:03:59 +00:00
|
|
|
|
gint max_bottom_attach;
|
|
|
|
|
|
|
|
|
|
/* Find extents of gridded portion
|
|
|
|
|
*/
|
|
|
|
|
max_right_attach = 1;
|
|
|
|
|
max_bottom_attach = 0;
|
|
|
|
|
|
2010-12-23 23:21:53 +00:00
|
|
|
|
for (l = menu_shell->priv->children; l; l = l->next)
|
2010-12-23 20:50:18 +00:00
|
|
|
|
{
|
|
|
|
|
GtkWidget *child = l->data;
|
|
|
|
|
AttachInfo *ai = get_attach_info (child);
|
|
|
|
|
|
|
|
|
|
if (is_grid_attached (ai))
|
|
|
|
|
{
|
|
|
|
|
max_bottom_attach = MAX (max_bottom_attach, ai->bottom_attach);
|
|
|
|
|
max_right_attach = MAX (max_right_attach, ai->right_attach);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Find empty rows */
|
2004-03-15 02:03:59 +00:00
|
|
|
|
row_occupied = g_malloc0 (max_bottom_attach);
|
|
|
|
|
|
2010-12-23 23:21:53 +00:00
|
|
|
|
for (l = menu_shell->priv->children; l; l = l->next)
|
2010-12-23 20:50:18 +00:00
|
|
|
|
{
|
|
|
|
|
GtkWidget *child = l->data;
|
|
|
|
|
AttachInfo *ai = get_attach_info (child);
|
2004-03-15 02:03:59 +00:00
|
|
|
|
|
2010-12-23 20:50:18 +00:00
|
|
|
|
if (is_grid_attached (ai))
|
|
|
|
|
{
|
|
|
|
|
gint i;
|
2004-03-15 02:03:59 +00:00
|
|
|
|
|
2010-12-23 20:50:18 +00:00
|
|
|
|
for (i = ai->top_attach; i < ai->bottom_attach; i++)
|
|
|
|
|
row_occupied[i] = TRUE;
|
|
|
|
|
}
|
|
|
|
|
}
|
2004-03-15 02:03:59 +00:00
|
|
|
|
|
|
|
|
|
/* Lay non-grid-items out in those rows
|
|
|
|
|
*/
|
|
|
|
|
current_row = 0;
|
2010-12-23 23:21:53 +00:00
|
|
|
|
for (l = menu_shell->priv->children; l; l = l->next)
|
2010-12-23 20:50:18 +00:00
|
|
|
|
{
|
|
|
|
|
GtkWidget *child = l->data;
|
|
|
|
|
AttachInfo *ai = get_attach_info (child);
|
|
|
|
|
|
|
|
|
|
if (!is_grid_attached (ai))
|
|
|
|
|
{
|
|
|
|
|
while (current_row < max_bottom_attach && row_occupied[current_row])
|
|
|
|
|
current_row++;
|
|
|
|
|
|
|
|
|
|
ai->effective_left_attach = 0;
|
|
|
|
|
ai->effective_right_attach = max_right_attach;
|
|
|
|
|
ai->effective_top_attach = current_row;
|
|
|
|
|
ai->effective_bottom_attach = current_row + 1;
|
|
|
|
|
|
|
|
|
|
current_row++;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
ai->effective_left_attach = ai->left_attach;
|
|
|
|
|
ai->effective_right_attach = ai->right_attach;
|
|
|
|
|
ai->effective_top_attach = ai->top_attach;
|
|
|
|
|
ai->effective_bottom_attach = ai->bottom_attach;
|
|
|
|
|
}
|
|
|
|
|
}
|
2004-03-15 02:03:59 +00:00
|
|
|
|
|
|
|
|
|
g_free (row_occupied);
|
|
|
|
|
|
|
|
|
|
priv->n_rows = MAX (current_row, max_bottom_attach);
|
|
|
|
|
priv->n_columns = max_right_attach;
|
|
|
|
|
priv->have_layout = TRUE;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static gint
|
|
|
|
|
gtk_menu_get_n_columns (GtkMenu *menu)
|
|
|
|
|
{
|
2011-01-04 17:32:22 +00:00
|
|
|
|
GtkMenuPrivate *priv = menu->priv;
|
2004-03-15 02:03:59 +00:00
|
|
|
|
|
|
|
|
|
menu_ensure_layout (menu);
|
|
|
|
|
|
|
|
|
|
return priv->n_columns;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static gint
|
|
|
|
|
gtk_menu_get_n_rows (GtkMenu *menu)
|
|
|
|
|
{
|
2011-01-04 17:32:22 +00:00
|
|
|
|
GtkMenuPrivate *priv = menu->priv;
|
2004-03-15 02:03:59 +00:00
|
|
|
|
|
|
|
|
|
menu_ensure_layout (menu);
|
|
|
|
|
|
|
|
|
|
return priv->n_rows;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
get_effective_child_attach (GtkWidget *child,
|
2010-12-23 20:50:18 +00:00
|
|
|
|
int *l,
|
|
|
|
|
int *r,
|
|
|
|
|
int *t,
|
|
|
|
|
int *b)
|
2004-03-15 02:03:59 +00:00
|
|
|
|
{
|
2010-08-11 21:08:37 +00:00
|
|
|
|
GtkMenu *menu = GTK_MENU (gtk_widget_get_parent (child));
|
2004-03-15 02:03:59 +00:00
|
|
|
|
AttachInfo *ai;
|
|
|
|
|
|
|
|
|
|
menu_ensure_layout (menu);
|
|
|
|
|
|
|
|
|
|
ai = get_attach_info (child);
|
|
|
|
|
|
|
|
|
|
if (l)
|
|
|
|
|
*l = ai->effective_left_attach;
|
|
|
|
|
if (r)
|
|
|
|
|
*r = ai->effective_right_attach;
|
|
|
|
|
if (t)
|
|
|
|
|
*t = ai->effective_top_attach;
|
|
|
|
|
if (b)
|
|
|
|
|
*b = ai->effective_bottom_attach;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
|
static void
|
|
|
|
|
gtk_menu_class_init (GtkMenuClass *class)
|
|
|
|
|
{
|
added gtkaccelmap.sgml. other updates.
Mon Nov 12 23:06:38 2001 Tim Janik <timj@gtk.org>
* added gtkaccelmap.sgml. other updates.
Mon Nov 12 23:08:37 2001 Tim Janik <timj@gtk.org>
* gtk/maketypes.awk: fix type utils generation on unix.
* gtk/gtkaccelmap.[hc]: new files, implementing a global accelerator
registry.
* gtk/gtkaccelgroup.[hc]: major API/implementation revamp:
removed GTK_ACCEL_SIGNAL_VISIBLE, gtk_accel_group_get_default,
gtk_accel_group_get_entry, gtk_accel_group_(un)lock_entry,
gtk_accel_group_add/remove, gtk_accel_group_handle_add/remove,
gtk_accel_group_create_add/remove, gtk_accel_group_entries_from_object.
introduced ::accel_changed signal for change notification, and
gtk_accel_group_connect/disconnect to connect closures to accel groups.
made gtk_accel_group_attach/detach and gtk_accel_group_activate private
functions.
deprecated gtk_accel_group_ref/unref.
* gtk/gtkaccellabel.[hc]: changes to make accellabels pay attention
to accel group changed notification and basically operate on closures.
removed gtk_accel_label_get_accel_object and
gtk_accel_label_set_accel_object.
introduced gtk_accel_label_set_accel_closure, and for convenience,
gtk_accel_label_set_accel_widget.
* gtk/gtkitemfactory.[hc]: removed accelerator propagation code
which mostly moved into gtkaccelmap.[hc].
removed gtk_item_factory_parse_rc*, gtk_item_factory_dump_*
and gtk_item_factory_print_func.
* gtk/gtkmain.c: call _gtk_accel_map_init().
* gtk/gtkmenuitem.[hc]: introduced gtk_menu_item_set_accel_path(),
that associates an accelerator path with menu items, through which
persistent accelerator settings on menu items are enabled.
* gtk/gtkmenu.[hc]: added gtk_menu_set_accel_path() so accelerator
paths of menu item can be default constructed to allow installation
of accelerators on menu items that don't come with an accelerator
binding by default.
* gtk/gtksettings.c: fix STRING type rc settings by special casing
them appropriately in the parser.
* gtk/gtksignal.[hc]: allow a class function offset of 0 for
gtk_signal_newv().
* gtk/gtkwidget.[hc]: accelerator API revamp.
removed ::accelerator_add/remove signals, gtk_widget_accelerator_signal,
gtk_widget_accelerators_locked, gtk_widget_remove_accelerators and
gtk_widget_(un)lock_accelerators.
accelerators maintained through gtk_widget_add/remove_accelerator()
are not runtime changable now, the correct sequence to setup a
widget for runtime changable accelerators is now:
gtk_accel_map_add_entry(accel_path, key, mods);
_gtk_widget_set_accel_path(widget, accel_path, accel_group);
* gtk/gtkwindow.[hc]: accelerator changes, proxy and coalesce accel
group changes (as well as mnemonic changes) through the new signal
::accels_changed.
Sat Nov 10 12:08:56 2001 Tim Janik <timj@gtk.org>
* gtk/gtksettings.c (_gtk_settings_parse_convert): properly handle
GString->string conversions.
2001-11-13 00:53:47 +00:00
|
|
|
|
GObjectClass *gobject_class = G_OBJECT_CLASS (class);
|
|
|
|
|
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (class);
|
|
|
|
|
GtkContainerClass *container_class = GTK_CONTAINER_CLASS (class);
|
|
|
|
|
GtkMenuShellClass *menu_shell_class = GTK_MENU_SHELL_CLASS (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;
|
fixed an assertment.
Sat Jun 6 06:01:24 1998 Tim Janik <timj@gtk.org>
* gtk/gtksignal.c (gtk_signal_emitv): fixed an assertment.
* gtk/makeenums.awk: a script to generate the GtkEnumValue arrays from,
this should eventually be done by gentypeinfo.el somewhen.
* gtk/gtkenumvalues.c: new generated file to hold GtkEnumValue arrays.
* gtk/gtktypeutils.h: new function gtk_enum_values() to retrive all the
enum values of an enum type.
* gtk/gtk.defs:
* gtk/gtkcurve.h:
* gtk/gtkobject.h:
* gtk/gtkprivate.h:
* gtk/gtkwidget.h:
* gtk/gtkenums.h:
brought enum/flags definitions in sync, added a few more enum
definitions for bindings and pattern matching.
* some more macro and GtkType fixups in various places.
* gdk/gdktypes.h (enum): added a new value GDK_AFTER_MASK, which is used
as a key-release modifier for the binding system.
Fri Jun 5 06:06:06 1998 Tim Janik <timj@gtk.org>
* gtk/gtkmenu.h (struct _GtkMenu): removed GList*children, since it
was a stale list pointer that is already present in GtkMenuShell.
* gtk/gtkmenushell.h (struct _GtkMenuShellClass): added a signal
GtkMenuShell::selection_done which is emitted after the menu shell
poped down again and all possible menu items have been activated.
Thu Jun 4 02:20:42 1998 Tim Janik <timj@gtk.org>
* gtk/gtkmenushell.c (gtk_menu_shell_button_release): flush the x-queue
before activation of the menuitem, so the menu is actually taken off the
screen prior to any menu item activation.
* gtk/gtkctree.c (gtk_ctree_get_row_data): allow function invokation
for NULL nodes.
* gtk/gtkwidget.h:
* gtk/gtkwidget.c: new function gtk_widget_stop_accelerator to stop
the emission of the "add-accelerator" signal on a widget. this is
usefull to prevent accelerator installation on certain widgets.
* gtk/gtknotebook.c (gtk_notebook_menu_item_create): keep the menu
labels left justified, by setting their alignment. stop accelerator
installation for the menu items, since we use dynamic menus.
Wed Jun 3 06:41:22 1998 Tim Janik <timj@gtk.org>
* gtk/gtkmenufactory.c: adaptions to use the new accel groups. people
should *really* use GtkItemFactory. this is only for preserving source
compatibility where possible, use of GtkMenuFactory is deprecated as of
now.
* gtk/gtkobject.h (gtk_object_class_add_user_signal): new function
to create user signals of type GTK_RUN_NO_RECURSE. don't know why i
missed this possibility when i added gtk_object_class_add_user_signal
in late january.
* gtk/gtkmain.c (gtk_init): ignore subsequent function calls.
Sun May 31 07:31:09 1998 Tim Janik <timj@gtk.org>
* gtk/gtkaccelgroup.h:
* gtk/gtkaccelgroup.c: new implementation of the accelerator concept.
* gtk/gtkaccellabel.h:
* gtk/gtkaccellabel.c: new widget derived from GtkLabel whitch features
display of the accelerators associated with a certain widget.
* gtk/gtkitemfactory.h:
* gtk/gtkitemfactory.c: new widget, item factory with automatic rc
parsing and accelerator handling.
* gtk/gtkmenu.c (gtk_menu_reposition): new function to care for
positioning a menu.
(gtk_menu_map): removed the allocation code.
(gtk_menu_size_allocate): care for redrawing of children and resize
our widget->window correctly.
(gtk_menu_key_press): feature the new accelerator groups.
* gtk/gtkmenuitem.c (gtk_menu_item_size_allocate): reposition the
submenu if neccessary.
* gtk/gtkmenuitem.c:
* gtk/gtkcheckmenuitem.c:
* gtk/gtkradiomenuitem.c: use GtkAccelLabel in the *_new_with_label()
function variants.
* gdk/gdk.c:
(gdk_keyval_from_name):
(gdk_keyval_name): new functions for keyval<->key-name associations.
(gdk_keyval_to_upper):
(gdk_keyval_to_lower):
(gdk_keyval_is_upper):
(gdk_keyval_is_lower): new functions to check/translate keyvalues with
regards to their cases.
Wed May 27 00:48:10 1998 Tim Janik <timj@gtk.org>
* gtk/gtkwidget.c (gtk_widget_class_path): new function to calculate a
widget's class path.
(gtk_widget_path): new function to calculate a widget's name path.
* gtk/gtkrc.c: newly introduced GtkPatternSpec structures to speed up
pattern matching, features reversed pattern matches.
1998-06-07 06:48:56 +00:00
|
|
|
|
|
2001-08-25 03:15:26 +00:00
|
|
|
|
gobject_class->set_property = gtk_menu_set_property;
|
|
|
|
|
gobject_class->get_property = gtk_menu_get_property;
|
2016-06-05 23:34:30 +00:00
|
|
|
|
gobject_class->finalize = gtk_menu_finalize;
|
2001-08-25 03:15:26 +00:00
|
|
|
|
|
2010-09-18 23:55:42 +00:00
|
|
|
|
widget_class->destroy = gtk_menu_destroy;
|
The table menu patch! Turns GtkMenu into a table, so you can attach menu
Wed Sep 10 22:25:04 2003 Kristian Rietveld <kris@gtk.org>
The table menu patch! Turns GtkMenu into a table, so you can attach
menu items in numerous new ways! Be creative!
Contains some bug fixes and RTL adaptions from Matthias Clasen.
* gtk/gtkmenu.c [toplevel]: introduce ATTACH_INFO_KEY, extend
GtkMenuPrivate, introduce AttachInfo, add child properties enum,
(gtk_menu_free_private), (gtk_menu_get_private): we have to free
the heights array in the private struct,
(gtk_menu_class_init): reorder code a bit, install child properties,
(get_attach_info), (get_child_attach): new utility functions,
(gtk_menu_set_child_property), (gtk_menu_get_child_property): introduce
child properties, for the attach info,
(gtk_menu_remove): remove AttachInfo from menu item,
(gtk_menu_real_insert): implemented algorithm to automagically place
inserted menu items at the correct place in the table,
(gtk_menu_size_request), (gtk_menu_size_allocate),
(compute_child_offset): reworked/rewritten to support table menus,
(gtk_menu_attach): new function,
(find_child_containing), (gtk_menu_move_current): new functions to
get table menu keynav right.
* gtk/gtkmenu.h: add gtk_menu_attach() prototype.
2003-09-10 20:32:33 +00:00
|
|
|
|
widget_class->realize = gtk_menu_realize;
|
|
|
|
|
widget_class->unrealize = gtk_menu_unrealize;
|
|
|
|
|
widget_class->size_allocate = gtk_menu_size_allocate;
|
|
|
|
|
widget_class->show = gtk_menu_show;
|
2010-09-06 15:32:30 +00:00
|
|
|
|
widget_class->draw = gtk_menu_draw;
|
2004-12-13 18:22:02 +00:00
|
|
|
|
widget_class->scroll_event = gtk_menu_scroll;
|
The table menu patch! Turns GtkMenu into a table, so you can attach menu
Wed Sep 10 22:25:04 2003 Kristian Rietveld <kris@gtk.org>
The table menu patch! Turns GtkMenu into a table, so you can attach
menu items in numerous new ways! Be creative!
Contains some bug fixes and RTL adaptions from Matthias Clasen.
* gtk/gtkmenu.c [toplevel]: introduce ATTACH_INFO_KEY, extend
GtkMenuPrivate, introduce AttachInfo, add child properties enum,
(gtk_menu_free_private), (gtk_menu_get_private): we have to free
the heights array in the private struct,
(gtk_menu_class_init): reorder code a bit, install child properties,
(get_attach_info), (get_child_attach): new utility functions,
(gtk_menu_set_child_property), (gtk_menu_get_child_property): introduce
child properties, for the attach info,
(gtk_menu_remove): remove AttachInfo from menu item,
(gtk_menu_real_insert): implemented algorithm to automagically place
inserted menu items at the correct place in the table,
(gtk_menu_size_request), (gtk_menu_size_allocate),
(compute_child_offset): reworked/rewritten to support table menus,
(gtk_menu_attach): new function,
(find_child_containing), (gtk_menu_move_current): new functions to
get table menu keynav right.
* gtk/gtkmenu.h: add gtk_menu_attach() prototype.
2003-09-10 20:32:33 +00:00
|
|
|
|
widget_class->key_press_event = gtk_menu_key_press;
|
|
|
|
|
widget_class->button_press_event = gtk_menu_button_press;
|
|
|
|
|
widget_class->button_release_event = gtk_menu_button_release;
|
|
|
|
|
widget_class->motion_notify_event = gtk_menu_motion_notify;
|
|
|
|
|
widget_class->show_all = gtk_menu_show_all;
|
|
|
|
|
widget_class->enter_notify_event = gtk_menu_enter_notify;
|
|
|
|
|
widget_class->leave_notify_event = gtk_menu_leave_notify;
|
|
|
|
|
widget_class->focus = gtk_menu_focus;
|
2003-11-27 15:51:32 +00:00
|
|
|
|
widget_class->can_activate_accel = gtk_menu_real_can_activate_accel;
|
2005-06-27 17:36:34 +00:00
|
|
|
|
widget_class->grab_notify = gtk_menu_grab_notify;
|
2010-09-21 14:35:17 +00:00
|
|
|
|
widget_class->get_preferred_width = gtk_menu_get_preferred_width;
|
|
|
|
|
widget_class->get_preferred_height = gtk_menu_get_preferred_height;
|
|
|
|
|
widget_class->get_preferred_height_for_width = gtk_menu_get_preferred_height_for_width;
|
The table menu patch! Turns GtkMenu into a table, so you can attach menu
Wed Sep 10 22:25:04 2003 Kristian Rietveld <kris@gtk.org>
The table menu patch! Turns GtkMenu into a table, so you can attach
menu items in numerous new ways! Be creative!
Contains some bug fixes and RTL adaptions from Matthias Clasen.
* gtk/gtkmenu.c [toplevel]: introduce ATTACH_INFO_KEY, extend
GtkMenuPrivate, introduce AttachInfo, add child properties enum,
(gtk_menu_free_private), (gtk_menu_get_private): we have to free
the heights array in the private struct,
(gtk_menu_class_init): reorder code a bit, install child properties,
(get_attach_info), (get_child_attach): new utility functions,
(gtk_menu_set_child_property), (gtk_menu_get_child_property): introduce
child properties, for the attach info,
(gtk_menu_remove): remove AttachInfo from menu item,
(gtk_menu_real_insert): implemented algorithm to automagically place
inserted menu items at the correct place in the table,
(gtk_menu_size_request), (gtk_menu_size_allocate),
(compute_child_offset): reworked/rewritten to support table menus,
(gtk_menu_attach): new function,
(find_child_containing), (gtk_menu_move_current): new functions to
get table menu keynav right.
* gtk/gtkmenu.h: add gtk_menu_attach() prototype.
2003-09-10 20:32:33 +00:00
|
|
|
|
|
|
|
|
|
container_class->remove = gtk_menu_remove;
|
|
|
|
|
container_class->get_child_property = gtk_menu_get_child_property;
|
|
|
|
|
container_class->set_child_property = gtk_menu_set_child_property;
|
|
|
|
|
|
|
|
|
|
menu_shell_class->submenu_placement = GTK_LEFT_RIGHT;
|
|
|
|
|
menu_shell_class->deactivate = gtk_menu_deactivate;
|
|
|
|
|
menu_shell_class->select_item = gtk_menu_select_item;
|
|
|
|
|
menu_shell_class->insert = gtk_menu_real_insert;
|
|
|
|
|
menu_shell_class->get_popup_delay = gtk_menu_get_popup_delay;
|
|
|
|
|
menu_shell_class->move_current = gtk_menu_move_current;
|
|
|
|
|
|
2011-01-15 13:51:11 +00:00
|
|
|
|
/**
|
|
|
|
|
* GtkMenu::move-scroll:
|
|
|
|
|
* @menu: a #GtkMenu
|
|
|
|
|
* @scroll_type: a #GtkScrollType
|
|
|
|
|
*/
|
2002-12-14 22:43:52 +00:00
|
|
|
|
menu_signals[MOVE_SCROLL] =
|
2008-08-11 11:52:06 +00:00
|
|
|
|
g_signal_new_class_handler (I_("move-scroll"),
|
2010-09-18 23:55:42 +00:00
|
|
|
|
G_OBJECT_CLASS_TYPE (gobject_class),
|
2008-07-21 09:48:20 +00:00
|
|
|
|
G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
|
|
|
|
|
G_CALLBACK (gtk_menu_real_move_scroll),
|
|
|
|
|
NULL, NULL,
|
2016-08-29 14:00:17 +00:00
|
|
|
|
NULL,
|
2008-07-21 09:48:20 +00:00
|
|
|
|
G_TYPE_NONE, 1,
|
|
|
|
|
GTK_TYPE_SCROLL_TYPE);
|
2008-06-20 11:06:52 +00:00
|
|
|
|
|
2016-06-14 19:42:13 +00:00
|
|
|
|
/**
|
|
|
|
|
* GtkMenu::popped-up:
|
|
|
|
|
* @menu: the #GtkMenu that popped up
|
|
|
|
|
* @flipped_rect: (nullable): the position of @menu after any possible
|
|
|
|
|
* flipping or %NULL if the backend can't obtain it
|
|
|
|
|
* @final_rect: (nullable): the final position of @menu or %NULL if the
|
|
|
|
|
* backend can't obtain it
|
|
|
|
|
* @flipped_x: %TRUE if the anchors were flipped horizontally
|
|
|
|
|
* @flipped_y: %TRUE if the anchors were flipped vertically
|
|
|
|
|
*
|
|
|
|
|
* Emitted when the position of @menu is finalized after being popped up
|
|
|
|
|
* using gtk_menu_popup_at_rect (), gtk_menu_popup_at_widget (), or
|
|
|
|
|
* gtk_menu_popup_at_pointer ().
|
|
|
|
|
*
|
|
|
|
|
* @menu might be flipped over the anchor rectangle in order to keep it
|
|
|
|
|
* on-screen, in which case @flipped_x and @flipped_y will be set to %TRUE
|
|
|
|
|
* accordingly.
|
|
|
|
|
*
|
|
|
|
|
* @flipped_rect is the ideal position of @menu after any possible flipping,
|
|
|
|
|
* but before any possible sliding. @final_rect is @flipped_rect, but possibly
|
|
|
|
|
* translated in the case that flipping is still ineffective in keeping @menu
|
|
|
|
|
* on-screen.
|
|
|
|
|
*
|
|
|
|
|
* ![](popup-slide.png)
|
|
|
|
|
*
|
|
|
|
|
* The blue menu is @menu's ideal position, the green menu is @flipped_rect,
|
|
|
|
|
* and the red menu is @final_rect.
|
|
|
|
|
*
|
|
|
|
|
* See gtk_menu_popup_at_rect (), gtk_menu_popup_at_widget (),
|
|
|
|
|
* gtk_menu_popup_at_pointer (), #GtkMenu:anchor-hints,
|
|
|
|
|
* #GtkMenu:rect-anchor-dx, #GtkMenu:rect-anchor-dy, and
|
|
|
|
|
* #GtkMenu:menu-type-hint.
|
|
|
|
|
*
|
|
|
|
|
* Since: 3.22
|
|
|
|
|
*/
|
|
|
|
|
menu_signals[POPPED_UP] =
|
|
|
|
|
g_signal_new_class_handler (I_("popped-up"),
|
|
|
|
|
G_OBJECT_CLASS_TYPE (gobject_class),
|
|
|
|
|
G_SIGNAL_RUN_FIRST,
|
|
|
|
|
NULL,
|
|
|
|
|
NULL,
|
|
|
|
|
NULL,
|
|
|
|
|
_gtk_marshal_VOID__POINTER_POINTER_BOOLEAN_BOOLEAN,
|
|
|
|
|
G_TYPE_NONE,
|
|
|
|
|
4,
|
|
|
|
|
G_TYPE_POINTER,
|
|
|
|
|
G_TYPE_POINTER,
|
|
|
|
|
G_TYPE_BOOLEAN,
|
|
|
|
|
G_TYPE_BOOLEAN);
|
|
|
|
|
|
2008-06-20 11:06:52 +00:00
|
|
|
|
/**
|
|
|
|
|
* GtkMenu:active:
|
|
|
|
|
*
|
2008-07-04 21:20:25 +00:00
|
|
|
|
* The index of the currently selected menu item, or -1 if no
|
|
|
|
|
* menu item is selected.
|
2008-06-20 11:06:52 +00:00
|
|
|
|
*
|
2008-06-20 13:54:31 +00:00
|
|
|
|
* Since: 2.14
|
2008-06-20 11:06:52 +00:00
|
|
|
|
**/
|
|
|
|
|
g_object_class_install_property (gobject_class,
|
|
|
|
|
PROP_ACTIVE,
|
2008-07-04 21:20:25 +00:00
|
|
|
|
g_param_spec_int ("active",
|
2010-12-23 20:50:18 +00:00
|
|
|
|
P_("Active"),
|
|
|
|
|
P_("The currently selected menu item"),
|
|
|
|
|
-1, G_MAXINT, -1,
|
|
|
|
|
GTK_PARAM_READWRITE));
|
2008-06-20 11:06:52 +00:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* GtkMenu:accel-group:
|
|
|
|
|
*
|
|
|
|
|
* The accel group holding accelerators for the menu.
|
|
|
|
|
*
|
2008-06-20 13:54:31 +00:00
|
|
|
|
* Since: 2.14
|
2008-06-20 11:06:52 +00:00
|
|
|
|
**/
|
|
|
|
|
g_object_class_install_property (gobject_class,
|
|
|
|
|
PROP_ACCEL_GROUP,
|
|
|
|
|
g_param_spec_object ("accel-group",
|
2010-12-23 20:50:18 +00:00
|
|
|
|
P_("Accel Group"),
|
|
|
|
|
P_("The accel group holding accelerators for the menu"),
|
|
|
|
|
GTK_TYPE_ACCEL_GROUP,
|
|
|
|
|
GTK_PARAM_READWRITE));
|
2008-06-20 11:06:52 +00:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* GtkMenu:accel-path:
|
|
|
|
|
*
|
|
|
|
|
* An accel path used to conveniently construct accel paths of child items.
|
|
|
|
|
*
|
2008-06-20 13:54:31 +00:00
|
|
|
|
* Since: 2.14
|
2008-06-20 11:06:52 +00:00
|
|
|
|
**/
|
|
|
|
|
g_object_class_install_property (gobject_class,
|
|
|
|
|
PROP_ACCEL_PATH,
|
|
|
|
|
g_param_spec_string ("accel-path",
|
2010-12-23 20:50:18 +00:00
|
|
|
|
P_("Accel Path"),
|
|
|
|
|
P_("An accel path used to conveniently construct accel paths of child items"),
|
|
|
|
|
NULL,
|
|
|
|
|
GTK_PARAM_READWRITE));
|
2008-06-20 11:06:52 +00:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* GtkMenu:attach-widget:
|
|
|
|
|
*
|
2008-07-04 20:01:50 +00:00
|
|
|
|
* The widget the menu is attached to. Setting this property attaches
|
|
|
|
|
* the menu without a #GtkMenuDetachFunc. If you need to use a detacher,
|
|
|
|
|
* use gtk_menu_attach_to_widget() directly.
|
2008-06-20 11:06:52 +00:00
|
|
|
|
*
|
2008-06-20 13:54:31 +00:00
|
|
|
|
* Since: 2.14
|
2008-06-20 11:06:52 +00:00
|
|
|
|
**/
|
|
|
|
|
g_object_class_install_property (gobject_class,
|
2008-07-04 20:01:50 +00:00
|
|
|
|
PROP_ATTACH_WIDGET,
|
|
|
|
|
g_param_spec_object ("attach-widget",
|
2010-12-23 20:50:18 +00:00
|
|
|
|
P_("Attach Widget"),
|
|
|
|
|
P_("The widget the menu is attached to"),
|
|
|
|
|
GTK_TYPE_WIDGET,
|
|
|
|
|
GTK_PARAM_READWRITE));
|
2008-06-20 11:06:52 +00:00
|
|
|
|
|
2013-07-18 02:52:53 +00:00
|
|
|
|
/**
|
|
|
|
|
* GtkMenu:tearoff-title:
|
|
|
|
|
*
|
|
|
|
|
* A title that may be displayed by the window manager when this
|
|
|
|
|
* menu is torn-off.
|
|
|
|
|
*
|
|
|
|
|
* Deprecated: 3.10
|
|
|
|
|
**/
|
2001-08-25 03:15:26 +00:00
|
|
|
|
g_object_class_install_property (gobject_class,
|
|
|
|
|
PROP_TEAROFF_TITLE,
|
|
|
|
|
g_param_spec_string ("tearoff-title",
|
2004-01-16 23:10:05 +00:00
|
|
|
|
P_("Tearoff Title"),
|
|
|
|
|
P_("A title that may be displayed by the window manager when this menu is torn-off"),
|
2007-12-28 17:10:33 +00:00
|
|
|
|
NULL,
|
2013-08-13 22:09:47 +00:00
|
|
|
|
GTK_PARAM_READWRITE | G_PARAM_DEPRECATED));
|
2004-05-07 04:43:56 +00:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* GtkMenu:tearoff-state:
|
|
|
|
|
*
|
|
|
|
|
* A boolean that indicates whether the menu is torn-off.
|
|
|
|
|
*
|
|
|
|
|
* Since: 2.6
|
2013-07-18 02:52:53 +00:00
|
|
|
|
*
|
|
|
|
|
* Deprecated: 3.10
|
2004-05-07 04:43:56 +00:00
|
|
|
|
**/
|
|
|
|
|
g_object_class_install_property (gobject_class,
|
|
|
|
|
PROP_TEAROFF_STATE,
|
|
|
|
|
g_param_spec_boolean ("tearoff-state",
|
2010-12-23 20:50:18 +00:00
|
|
|
|
P_("Tearoff State"),
|
|
|
|
|
P_("A boolean that indicates whether the menu is torn-off"),
|
|
|
|
|
FALSE,
|
2013-08-13 22:09:47 +00:00
|
|
|
|
GTK_PARAM_READWRITE | G_PARAM_DEPRECATED));
|
2002-10-05 01:51:16 +00:00
|
|
|
|
|
2008-06-20 11:06:52 +00:00
|
|
|
|
/**
|
|
|
|
|
* GtkMenu:monitor:
|
|
|
|
|
*
|
|
|
|
|
* The monitor the menu will be popped up on.
|
|
|
|
|
*
|
2008-06-20 13:54:31 +00:00
|
|
|
|
* Since: 2.14
|
2008-06-20 11:06:52 +00:00
|
|
|
|
**/
|
|
|
|
|
g_object_class_install_property (gobject_class,
|
|
|
|
|
PROP_MONITOR,
|
|
|
|
|
g_param_spec_int ("monitor",
|
2010-12-23 20:50:18 +00:00
|
|
|
|
P_("Monitor"),
|
|
|
|
|
P_("The monitor the menu will be popped up on"),
|
|
|
|
|
-1, G_MAXINT, -1,
|
2014-06-09 13:04:53 +00:00
|
|
|
|
GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY));
|
2008-06-20 11:06:52 +00:00
|
|
|
|
|
2009-06-24 05:01:51 +00:00
|
|
|
|
/**
|
|
|
|
|
* GtkMenu:reserve-toggle-size:
|
|
|
|
|
*
|
|
|
|
|
* A boolean that indicates whether the menu reserves space for
|
|
|
|
|
* toggles and icons, regardless of their actual presence.
|
|
|
|
|
*
|
|
|
|
|
* This property should only be changed from its default value
|
|
|
|
|
* for special-purposes such as tabular menus. Regular menus that
|
|
|
|
|
* are connected to a menu bar or context menus should reserve
|
|
|
|
|
* toggle space for consistency.
|
|
|
|
|
*
|
|
|
|
|
* Since: 2.18
|
|
|
|
|
*/
|
|
|
|
|
g_object_class_install_property (gobject_class,
|
|
|
|
|
PROP_RESERVE_TOGGLE_SIZE,
|
|
|
|
|
g_param_spec_boolean ("reserve-toggle-size",
|
2010-12-23 20:50:18 +00:00
|
|
|
|
P_("Reserve Toggle Size"),
|
|
|
|
|
P_("A boolean that indicates whether the menu reserves space for toggles and icons"),
|
|
|
|
|
TRUE,
|
2014-06-09 13:04:53 +00:00
|
|
|
|
GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY));
|
2009-06-24 05:01:51 +00:00
|
|
|
|
|
2016-06-14 19:42:13 +00:00
|
|
|
|
/**
|
|
|
|
|
* GtkMenu:anchor-hints:
|
|
|
|
|
*
|
|
|
|
|
* Positioning hints for aligning the menu relative to a rectangle.
|
|
|
|
|
*
|
|
|
|
|
* These hints determine how the menu should be positioned in the case that
|
|
|
|
|
* the menu would fall off-screen if placed in its ideal position.
|
|
|
|
|
*
|
|
|
|
|
* ![](popup-flip.png)
|
|
|
|
|
*
|
|
|
|
|
* For example, %GDK_ANCHOR_FLIP_Y will replace %GDK_GRAVITY_NORTH_WEST with
|
|
|
|
|
* %GDK_GRAVITY_SOUTH_WEST and vice versa if the menu extends beyond the
|
|
|
|
|
* bottom edge of the monitor.
|
|
|
|
|
*
|
|
|
|
|
* See gtk_menu_popup_at_rect (), gtk_menu_popup_at_widget (),
|
|
|
|
|
* gtk_menu_popup_at_pointer (), #GtkMenu:rect-anchor-dx,
|
|
|
|
|
* #GtkMenu:rect-anchor-dy, #GtkMenu:menu-type-hint, and #GtkMenu::popped-up.
|
|
|
|
|
*
|
|
|
|
|
* Since: 3.22
|
|
|
|
|
*/
|
|
|
|
|
g_object_class_install_property (gobject_class,
|
|
|
|
|
PROP_ANCHOR_HINTS,
|
|
|
|
|
g_param_spec_flags ("anchor-hints",
|
|
|
|
|
P_("Anchor hints"),
|
|
|
|
|
P_("Positioning hints for when the menu might fall off-screen"),
|
|
|
|
|
GDK_TYPE_ANCHOR_HINTS,
|
|
|
|
|
GDK_ANCHOR_FLIP |
|
|
|
|
|
GDK_ANCHOR_SLIDE |
|
|
|
|
|
GDK_ANCHOR_RESIZE,
|
|
|
|
|
G_PARAM_READWRITE |
|
|
|
|
|
G_PARAM_CONSTRUCT |
|
|
|
|
|
G_PARAM_STATIC_NAME |
|
|
|
|
|
G_PARAM_STATIC_NICK |
|
2016-08-03 03:42:11 +00:00
|
|
|
|
G_PARAM_STATIC_BLURB |
|
|
|
|
|
G_PARAM_EXPLICIT_NOTIFY));
|
2016-06-14 19:42:13 +00:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* GtkMenu:rect-anchor-dx:
|
|
|
|
|
*
|
|
|
|
|
* Horizontal offset to apply to the menu, i.e. the rectangle or widget
|
|
|
|
|
* anchor.
|
|
|
|
|
*
|
|
|
|
|
* See gtk_menu_popup_at_rect (), gtk_menu_popup_at_widget (),
|
|
|
|
|
* gtk_menu_popup_at_pointer (), #GtkMenu:anchor-hints,
|
|
|
|
|
* #GtkMenu:rect-anchor-dy, #GtkMenu:menu-type-hint, and #GtkMenu::popped-up.
|
|
|
|
|
*
|
|
|
|
|
* Since: 3.22
|
|
|
|
|
*/
|
|
|
|
|
g_object_class_install_property (gobject_class,
|
|
|
|
|
PROP_RECT_ANCHOR_DX,
|
|
|
|
|
g_param_spec_int ("rect-anchor-dx",
|
|
|
|
|
P_("Rect anchor dx"),
|
|
|
|
|
P_("Rect anchor horizontal offset"),
|
|
|
|
|
G_MININT,
|
|
|
|
|
G_MAXINT,
|
|
|
|
|
0,
|
|
|
|
|
G_PARAM_READWRITE |
|
|
|
|
|
G_PARAM_CONSTRUCT |
|
|
|
|
|
G_PARAM_STATIC_NAME |
|
|
|
|
|
G_PARAM_STATIC_NICK |
|
2016-08-03 03:42:11 +00:00
|
|
|
|
G_PARAM_STATIC_BLURB |
|
|
|
|
|
G_PARAM_EXPLICIT_NOTIFY));
|
2016-06-14 19:42:13 +00:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* GtkMenu:rect-anchor-dy:
|
|
|
|
|
*
|
|
|
|
|
* Vertical offset to apply to the menu, i.e. the rectangle or widget anchor.
|
|
|
|
|
*
|
|
|
|
|
* See gtk_menu_popup_at_rect (), gtk_menu_popup_at_widget (),
|
|
|
|
|
* gtk_menu_popup_at_pointer (), #GtkMenu:anchor-hints,
|
|
|
|
|
* #GtkMenu:rect-anchor-dx, #GtkMenu:menu-type-hint, and #GtkMenu::popped-up.
|
|
|
|
|
*
|
|
|
|
|
* Since: 3.22
|
|
|
|
|
*/
|
|
|
|
|
g_object_class_install_property (gobject_class,
|
|
|
|
|
PROP_RECT_ANCHOR_DY,
|
|
|
|
|
g_param_spec_int ("rect-anchor-dy",
|
|
|
|
|
P_("Rect anchor dy"),
|
|
|
|
|
P_("Rect anchor vertical offset"),
|
|
|
|
|
G_MININT,
|
|
|
|
|
G_MAXINT,
|
|
|
|
|
0,
|
|
|
|
|
G_PARAM_READWRITE |
|
|
|
|
|
G_PARAM_CONSTRUCT |
|
|
|
|
|
G_PARAM_STATIC_NAME |
|
|
|
|
|
G_PARAM_STATIC_NICK |
|
2016-08-03 03:42:11 +00:00
|
|
|
|
G_PARAM_STATIC_BLURB |
|
|
|
|
|
G_PARAM_EXPLICIT_NOTIFY));
|
2016-06-14 19:42:13 +00:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* GtkMenu:menu-type-hint:
|
|
|
|
|
*
|
|
|
|
|
* The #GdkWindowTypeHint to use for the menu's #GdkWindow.
|
|
|
|
|
*
|
|
|
|
|
* See gtk_menu_popup_at_rect (), gtk_menu_popup_at_widget (),
|
|
|
|
|
* gtk_menu_popup_at_pointer (), #GtkMenu:anchor-hints,
|
|
|
|
|
* #GtkMenu:rect-anchor-dx, #GtkMenu:rect-anchor-dy, and #GtkMenu::popped-up.
|
|
|
|
|
*
|
|
|
|
|
* Since: 3.22
|
|
|
|
|
*/
|
|
|
|
|
g_object_class_install_property (gobject_class,
|
|
|
|
|
PROP_MENU_TYPE_HINT,
|
|
|
|
|
g_param_spec_enum ("menu-type-hint",
|
|
|
|
|
P_("Menu type hint"),
|
|
|
|
|
P_("Menu window type hint"),
|
|
|
|
|
GDK_TYPE_WINDOW_TYPE_HINT,
|
|
|
|
|
GDK_WINDOW_TYPE_HINT_POPUP_MENU,
|
|
|
|
|
G_PARAM_READWRITE |
|
|
|
|
|
G_PARAM_CONSTRUCT |
|
|
|
|
|
G_PARAM_STATIC_NAME |
|
|
|
|
|
G_PARAM_STATIC_NICK |
|
2016-08-03 03:42:11 +00:00
|
|
|
|
G_PARAM_STATIC_BLURB |
|
|
|
|
|
G_PARAM_EXPLICIT_NOTIFY));
|
2016-06-14 19:42:13 +00:00
|
|
|
|
|
2012-11-27 14:04:12 +00:00
|
|
|
|
/**
|
|
|
|
|
* GtkMenu:horizontal-padding:
|
|
|
|
|
*
|
|
|
|
|
* Extra space at the left and right edges of the menu.
|
|
|
|
|
*
|
|
|
|
|
* Deprecated: 3.8: use the standard padding CSS property (through objects
|
|
|
|
|
* like #GtkStyleContext and #GtkCssProvider); the value of this style
|
|
|
|
|
* property is ignored.
|
|
|
|
|
*/
|
2005-12-02 19:49:10 +00:00
|
|
|
|
gtk_widget_class_install_style_property (widget_class,
|
|
|
|
|
g_param_spec_int ("horizontal-padding",
|
|
|
|
|
P_("Horizontal Padding"),
|
|
|
|
|
P_("Extra space at the left and right edges of the menu"),
|
|
|
|
|
0,
|
|
|
|
|
G_MAXINT,
|
|
|
|
|
0,
|
2012-11-27 14:04:12 +00:00
|
|
|
|
GTK_PARAM_READABLE |
|
|
|
|
|
G_PARAM_DEPRECATED));
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* GtkMenu:vertical-padding:
|
|
|
|
|
*
|
|
|
|
|
* Extra space at the top and bottom of the menu.
|
|
|
|
|
*
|
|
|
|
|
* Deprecated: 3.8: use the standard padding CSS property (through objects
|
|
|
|
|
* like #GtkStyleContext and #GtkCssProvider); the value of this style
|
|
|
|
|
* property is ignored.
|
|
|
|
|
*/
|
|
|
|
|
gtk_widget_class_install_style_property (widget_class,
|
|
|
|
|
g_param_spec_int ("vertical-padding",
|
|
|
|
|
P_("Vertical Padding"),
|
|
|
|
|
P_("Extra space at the top and bottom of the menu"),
|
|
|
|
|
0,
|
|
|
|
|
G_MAXINT,
|
|
|
|
|
1,
|
|
|
|
|
GTK_PARAM_READABLE |
|
|
|
|
|
G_PARAM_DEPRECATED));
|
2005-12-02 19:49:10 +00:00
|
|
|
|
|
2003-07-12 23:25:14 +00:00
|
|
|
|
gtk_widget_class_install_style_property (widget_class,
|
2010-12-23 20:50:18 +00:00
|
|
|
|
g_param_spec_int ("vertical-offset",
|
|
|
|
|
P_("Vertical Offset"),
|
|
|
|
|
P_("When the menu is a submenu, position it this number of pixels offset vertically"),
|
|
|
|
|
G_MININT,
|
|
|
|
|
G_MAXINT,
|
|
|
|
|
0,
|
|
|
|
|
GTK_PARAM_READABLE));
|
2003-07-12 23:25:14 +00:00
|
|
|
|
|
|
|
|
|
gtk_widget_class_install_style_property (widget_class,
|
2010-12-23 20:50:18 +00:00
|
|
|
|
g_param_spec_int ("horizontal-offset",
|
|
|
|
|
P_("Horizontal Offset"),
|
|
|
|
|
P_("When the menu is a submenu, position it this number of pixels offset horizontally"),
|
|
|
|
|
G_MININT,
|
|
|
|
|
G_MAXINT,
|
|
|
|
|
-2,
|
|
|
|
|
GTK_PARAM_READABLE));
|
2003-07-12 23:25:14 +00:00
|
|
|
|
|
2015-12-21 02:44:10 +00:00
|
|
|
|
/**
|
|
|
|
|
* GtkMenu:double-arrows:
|
|
|
|
|
*
|
|
|
|
|
* When %TRUE, both arrows are shown when scrolling.
|
|
|
|
|
*
|
|
|
|
|
* Deprecated: 3.20: the value of this style property is ignored.
|
|
|
|
|
**/
|
2006-02-22 10:10:23 +00:00
|
|
|
|
gtk_widget_class_install_style_property (widget_class,
|
|
|
|
|
g_param_spec_boolean ("double-arrows",
|
|
|
|
|
P_("Double Arrows"),
|
|
|
|
|
P_("When scrolling, always show both arrows."),
|
|
|
|
|
TRUE,
|
2015-12-21 02:44:10 +00:00
|
|
|
|
GTK_PARAM_READABLE|G_PARAM_DEPRECATED));
|
2006-02-22 10:10:23 +00:00
|
|
|
|
|
2008-10-08 02:16:08 +00:00
|
|
|
|
/**
|
|
|
|
|
* GtkMenu:arrow-placement:
|
|
|
|
|
*
|
|
|
|
|
* Indicates where scroll arrows should be placed.
|
|
|
|
|
*
|
|
|
|
|
* Since: 2.16
|
2015-12-20 19:19:23 +00:00
|
|
|
|
*
|
|
|
|
|
* Deprecated: 3.20: the value of this style property is ignored.
|
2008-10-08 02:16:08 +00:00
|
|
|
|
**/
|
|
|
|
|
gtk_widget_class_install_style_property (widget_class,
|
|
|
|
|
g_param_spec_enum ("arrow-placement",
|
|
|
|
|
P_("Arrow Placement"),
|
|
|
|
|
P_("Indicates where scroll arrows should be placed"),
|
|
|
|
|
GTK_TYPE_ARROW_PLACEMENT,
|
|
|
|
|
GTK_ARROWS_BOTH,
|
2015-12-20 19:19:23 +00:00
|
|
|
|
GTK_PARAM_READABLE|G_PARAM_DEPRECATED));
|
Get rid of a bunch of g_strdup_printf("%s%s") in favor of g_strconcat().
Fri Feb 2 12:26:50 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkrc.c (gtk_rc_add_initial_default_files): Get rid of
a bunch of g_strdup_printf("%s%s") in favor of g_strconcat().
* gtk/gtkrc.c Makefile.am: Use $(libdir), not $(exe_prefix),
since some people set $(libdir) separately. (#1290, David Kaelbling)
Thu Feb 1 18:25:46 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkfilesel.c: If PATH_MAX and MAXPATHLEN are not
defined, define MAXPATHLEN to 2048. (The Hurd doesn't have
MAXPATHLEN, but the code here depends on a fixed value.)
(#4524)
Wed Jan 31 22:01:04 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkhandlebox.c (gtk_handle_box_button_changed): Handle the case
where child == NULL and handle_position == RIGHT or BOTTOM. (#8041g)
Wed Jan 31 21:20:39 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkctree.c (real_tree_move): If the node being moved isn't
viewable there is no way that moving the node will cause the
focus row to become not viewable, so omit check on the visibility
of new_sibling, which is irrelevant. (Fixes #8002, David Helder)
Wed Jan 31 20:38:17 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkentry.c (gtk_entry_commit_cb): Delete the current
selection before inserting new text.
Wed Jan 31 18:49:33 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkoptionmenu.c (gtk_option_menu_item_state_changed_cb):
Make the sensitivity of the reparented child track that of
the original parent menu item. (#34218, David Hodson)
* gtk/gtkoptionmenu.c (gtk_option_menu_item_destroy_cb): Handle
the case where the current item is destroyed properly.
* gtk/gtkoptionmenu.c: Some additional code cleanups and fix
some edge cases with child-less menuitems.
Wed Jan 31 17:16:13 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkcombo.c (gtk_combo_window_key_press): Make Return
key pop down window. (#12074, Jon K Hellan)
Wed Jan 31 16:21:42 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtklist.c (gtk_list_signal_item_toggle): Don't allow
toggling of rows off in BROWSE or EXTENDED mode. (#12072, Jon K Hellan)
The solution here isn't perfect - you get an extraneous
emission of "toggle", which could conceivably confuse an app,
but better than the current situation. LXR search seems to
indicate that no apps in GNOME CVS connect to "toggle".
Wed Jan 31 15:46:13 2001 Owen Taylor <otaylor@redhat.com>
* gtk/Makefile.am (libgtkinclude_HEADERS): Move gtkcompat.h from
gtk_public_h_sources to directly here to avoid warning when
building srcdir != builddir. (#9656)
Tue Jan 30 19:49:02 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkrange.c: Patch from Kipp Hickman to make the event
handlers in gtkrange.c return the proper values (TRUE == handled)
(#10316).
This is just the tip of the iceberg, but gtkrange.c is the
most common place where the propagation is problematical,
and also a place where it is almost certainly safe to change
this in the stable branch.
(You don't want right click popups on a range control or anything...)
Tue Jan 30 18:57:59 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtktext.c (clear_focus_area): We need to clear the focus
area on focus out, even if a background pixmap isn't set.
(#13941)
Tue Jan 30 18:24:10 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtknotebook.c (gtk_notebook_set_shape): Fix from Sean Cunningham
to deal with setting the shape properly when scrolling arrows are
turned on, but not visible because there is sufficient space.
(#13432)
Tue Jan 30 16:39:25 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkitemfactory.c (gtk_item_factory_delete_item): For menu
items with submenus, destroy the item along with the submenu.
(#7841, Brian Masney(?)) Also, handle paths of the form '<foo>/abcd...'
properly.
* gtk/testgtk.c (menu_items): Add a dummy branch that we delete
later.
Tue Jan 30 15:51:25 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwindow.c (gtk_window_real_set_focus): Fix a problem where
the focus widget sometimes wasn't drawn with the default if there
was no default widget.
* gtk/gtkstyle.c (gtk_style_real_unrealize): free colors,
unreference pixmaps.
* gtk/gtkstyle.c (gtk_style_realize): Reference colormap
for some extra safety.
Mon Jan 29 19:00:01 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtk{ctree.c,clist.c} (set_cell_contents): Handle setting
the text of a cell to the old pointer value better, by
copying the new text before freeing the old text. Some code
cleanup. (#8079, Karl Nelson)
Mon Jan 29 16:50:19 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtklabel.[ch] gtk/gtkframe.[ch]: Make gtk_label_get_text()
gtk_frame_get_label() non strdup'ing, and G_CONST_RETURN.
Mon Jan 29 15:22:51 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkmenu.c (gtk_menu_remove): When removing an
item from a menu, check to see if it matches
menu->old_active_menu_item, and if so, unref and clear
old_active_menu_item (Patch from Pavel Cisler)
* gtk/gtkmenushell.c (gtk_menu_shell_remove): Unset
menu_shell->active_menu_item, if it is the child being
removed. (Patch based on that of Gene Ragan, #50337)
2001-02-02 17:53:29 +00:00
|
|
|
|
|
The table menu patch! Turns GtkMenu into a table, so you can attach menu
Wed Sep 10 22:25:04 2003 Kristian Rietveld <kris@gtk.org>
The table menu patch! Turns GtkMenu into a table, so you can attach
menu items in numerous new ways! Be creative!
Contains some bug fixes and RTL adaptions from Matthias Clasen.
* gtk/gtkmenu.c [toplevel]: introduce ATTACH_INFO_KEY, extend
GtkMenuPrivate, introduce AttachInfo, add child properties enum,
(gtk_menu_free_private), (gtk_menu_get_private): we have to free
the heights array in the private struct,
(gtk_menu_class_init): reorder code a bit, install child properties,
(get_attach_info), (get_child_attach): new utility functions,
(gtk_menu_set_child_property), (gtk_menu_get_child_property): introduce
child properties, for the attach info,
(gtk_menu_remove): remove AttachInfo from menu item,
(gtk_menu_real_insert): implemented algorithm to automagically place
inserted menu items at the correct place in the table,
(gtk_menu_size_request), (gtk_menu_size_allocate),
(compute_child_offset): reworked/rewritten to support table menus,
(gtk_menu_attach): new function,
(find_child_containing), (gtk_menu_move_current): new functions to
get table menu keynav right.
* gtk/gtkmenu.h: add gtk_menu_attach() prototype.
2003-09-10 20:32:33 +00:00
|
|
|
|
gtk_container_class_install_child_property (container_class,
|
|
|
|
|
CHILD_PROP_LEFT_ATTACH,
|
2010-12-23 20:50:18 +00:00
|
|
|
|
g_param_spec_int ("left-attach",
|
2004-01-16 23:10:05 +00:00
|
|
|
|
P_("Left Attach"),
|
|
|
|
|
P_("The column number to attach the left side of the child to"),
|
2010-12-23 20:50:18 +00:00
|
|
|
|
-1, INT_MAX, -1,
|
2005-03-22 02:14:55 +00:00
|
|
|
|
GTK_PARAM_READWRITE));
|
The table menu patch! Turns GtkMenu into a table, so you can attach menu
Wed Sep 10 22:25:04 2003 Kristian Rietveld <kris@gtk.org>
The table menu patch! Turns GtkMenu into a table, so you can attach
menu items in numerous new ways! Be creative!
Contains some bug fixes and RTL adaptions from Matthias Clasen.
* gtk/gtkmenu.c [toplevel]: introduce ATTACH_INFO_KEY, extend
GtkMenuPrivate, introduce AttachInfo, add child properties enum,
(gtk_menu_free_private), (gtk_menu_get_private): we have to free
the heights array in the private struct,
(gtk_menu_class_init): reorder code a bit, install child properties,
(get_attach_info), (get_child_attach): new utility functions,
(gtk_menu_set_child_property), (gtk_menu_get_child_property): introduce
child properties, for the attach info,
(gtk_menu_remove): remove AttachInfo from menu item,
(gtk_menu_real_insert): implemented algorithm to automagically place
inserted menu items at the correct place in the table,
(gtk_menu_size_request), (gtk_menu_size_allocate),
(compute_child_offset): reworked/rewritten to support table menus,
(gtk_menu_attach): new function,
(find_child_containing), (gtk_menu_move_current): new functions to
get table menu keynav right.
* gtk/gtkmenu.h: add gtk_menu_attach() prototype.
2003-09-10 20:32:33 +00:00
|
|
|
|
|
|
|
|
|
gtk_container_class_install_child_property (container_class,
|
|
|
|
|
CHILD_PROP_RIGHT_ATTACH,
|
2010-12-23 20:50:18 +00:00
|
|
|
|
g_param_spec_int ("right-attach",
|
2004-01-16 23:10:05 +00:00
|
|
|
|
P_("Right Attach"),
|
|
|
|
|
P_("The column number to attach the right side of the child to"),
|
2010-12-23 20:50:18 +00:00
|
|
|
|
-1, INT_MAX, -1,
|
2005-03-22 02:14:55 +00:00
|
|
|
|
GTK_PARAM_READWRITE));
|
The table menu patch! Turns GtkMenu into a table, so you can attach menu
Wed Sep 10 22:25:04 2003 Kristian Rietveld <kris@gtk.org>
The table menu patch! Turns GtkMenu into a table, so you can attach
menu items in numerous new ways! Be creative!
Contains some bug fixes and RTL adaptions from Matthias Clasen.
* gtk/gtkmenu.c [toplevel]: introduce ATTACH_INFO_KEY, extend
GtkMenuPrivate, introduce AttachInfo, add child properties enum,
(gtk_menu_free_private), (gtk_menu_get_private): we have to free
the heights array in the private struct,
(gtk_menu_class_init): reorder code a bit, install child properties,
(get_attach_info), (get_child_attach): new utility functions,
(gtk_menu_set_child_property), (gtk_menu_get_child_property): introduce
child properties, for the attach info,
(gtk_menu_remove): remove AttachInfo from menu item,
(gtk_menu_real_insert): implemented algorithm to automagically place
inserted menu items at the correct place in the table,
(gtk_menu_size_request), (gtk_menu_size_allocate),
(compute_child_offset): reworked/rewritten to support table menus,
(gtk_menu_attach): new function,
(find_child_containing), (gtk_menu_move_current): new functions to
get table menu keynav right.
* gtk/gtkmenu.h: add gtk_menu_attach() prototype.
2003-09-10 20:32:33 +00:00
|
|
|
|
|
|
|
|
|
gtk_container_class_install_child_property (container_class,
|
|
|
|
|
CHILD_PROP_TOP_ATTACH,
|
2010-12-23 20:50:18 +00:00
|
|
|
|
g_param_spec_int ("top-attach",
|
2004-01-16 23:10:05 +00:00
|
|
|
|
P_("Top Attach"),
|
|
|
|
|
P_("The row number to attach the top of the child to"),
|
2010-12-23 20:50:18 +00:00
|
|
|
|
-1, INT_MAX, -1,
|
2005-03-22 02:14:55 +00:00
|
|
|
|
GTK_PARAM_READWRITE));
|
The table menu patch! Turns GtkMenu into a table, so you can attach menu
Wed Sep 10 22:25:04 2003 Kristian Rietveld <kris@gtk.org>
The table menu patch! Turns GtkMenu into a table, so you can attach
menu items in numerous new ways! Be creative!
Contains some bug fixes and RTL adaptions from Matthias Clasen.
* gtk/gtkmenu.c [toplevel]: introduce ATTACH_INFO_KEY, extend
GtkMenuPrivate, introduce AttachInfo, add child properties enum,
(gtk_menu_free_private), (gtk_menu_get_private): we have to free
the heights array in the private struct,
(gtk_menu_class_init): reorder code a bit, install child properties,
(get_attach_info), (get_child_attach): new utility functions,
(gtk_menu_set_child_property), (gtk_menu_get_child_property): introduce
child properties, for the attach info,
(gtk_menu_remove): remove AttachInfo from menu item,
(gtk_menu_real_insert): implemented algorithm to automagically place
inserted menu items at the correct place in the table,
(gtk_menu_size_request), (gtk_menu_size_allocate),
(compute_child_offset): reworked/rewritten to support table menus,
(gtk_menu_attach): new function,
(find_child_containing), (gtk_menu_move_current): new functions to
get table menu keynav right.
* gtk/gtkmenu.h: add gtk_menu_attach() prototype.
2003-09-10 20:32:33 +00:00
|
|
|
|
|
|
|
|
|
gtk_container_class_install_child_property (container_class,
|
|
|
|
|
CHILD_PROP_BOTTOM_ATTACH,
|
2010-12-23 20:50:18 +00:00
|
|
|
|
g_param_spec_int ("bottom-attach",
|
2004-01-16 23:10:05 +00:00
|
|
|
|
P_("Bottom Attach"),
|
|
|
|
|
P_("The row number to attach the bottom of the child to"),
|
2010-12-23 20:50:18 +00:00
|
|
|
|
-1, INT_MAX, -1,
|
2005-03-22 02:14:55 +00:00
|
|
|
|
GTK_PARAM_READWRITE));
|
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
|
|
|
|
|
2008-09-24 08:56:10 +00:00
|
|
|
|
/**
|
2012-04-13 00:07:28 +00:00
|
|
|
|
* GtkMenu:arrow-scaling:
|
2008-09-24 08:56:10 +00:00
|
|
|
|
*
|
|
|
|
|
* Arbitrary constant to scale down the size of the scroll arrow.
|
|
|
|
|
*
|
|
|
|
|
* Since: 2.16
|
2015-12-21 01:30:52 +00:00
|
|
|
|
*
|
|
|
|
|
* Deprecated: 3.20: use the standard min-width/min-height CSS properties on
|
|
|
|
|
* the arrow node; the value of this style property is ignored.
|
2008-09-24 08:56:10 +00:00
|
|
|
|
*/
|
|
|
|
|
gtk_widget_class_install_style_property (widget_class,
|
|
|
|
|
g_param_spec_float ("arrow-scaling",
|
|
|
|
|
P_("Arrow Scaling"),
|
|
|
|
|
P_("Arbitrary constant to scale down the size of the scroll arrow"),
|
|
|
|
|
0.0, 1.0, 0.7,
|
2015-12-21 01:30:52 +00:00
|
|
|
|
GTK_PARAM_READABLE|G_PARAM_DEPRECATED));
|
2008-09-24 08:56:10 +00:00
|
|
|
|
|
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-12-23 20:50:18 +00:00
|
|
|
|
GDK_KEY_Up, 0,
|
|
|
|
|
I_("move-current"), 1,
|
|
|
|
|
GTK_TYPE_MENU_DIRECTION_TYPE,
|
|
|
|
|
GTK_MENU_DIR_PREV);
|
Clip the retrieved image data to the screen, using a server grab to avoid
2001-06-28 Havoc Pennington <hp@pobox.com>
* gdk/x11/gdkimage-x11.c (_gdk_x11_get_image): Clip the retrieved
image data to the screen, using a server grab to avoid race
conditions.
* gtk/gtkitemfactory.c (gtk_item_factory_create_item): remove
check for NULL return from gtk_image_new_from_stock(), it never
returns NULL.
(gtk_item_factory_create_item): fix bug where we parsed the stock
ID as an inline pixbuf
* gtk/gtktext.c (gtk_text_key_press): numeric keypad support
* gtk/gtkspinbutton.c (gtk_spin_button_key_press): numeric keypad
support (should be using binding set here)
* gtk/gtkoptionmenu.c (gtk_option_menu_key_press): numeric keypad
support (should be using binding set here)
* gtk/gtkmenushell.c (gtk_menu_shell_class_init): numeric keypad
support
* gtk/gtkmenu.c (gtk_menu_class_init): numeric keypad support
* gtk/gtkmenubar.c (gtk_menu_bar_class_init): numeric keypad
* gtk/gtklistitem.c (gtk_list_item_class_init): numeric keypad
* gtk/gtkimcontextsimple.c
(gtk_im_context_simple_filter_keypress): keypad
* gtk/gtkfilesel.c (gtk_file_selection_key_press): keypad
* gtk/gtkentry.c (gtk_entry_class_init): numeric keypad fixes
* gtk/gtkctree.c (gtk_ctree_class_init): numeric keypad support
* gtk/gtkcolorsel.c (palette_activate): keypad support (of course,
should be binding-setted)
* gtk/gtkwindow.c (gtk_window_class_init): numeric keypad fixes
* gtk/gtkclist.c (gtk_clist_class_init): numeric keypad fixes
* gtk/gtkcalendar.c: numeric keypad fixes
* gtk/gtktextview.c (gtk_text_view_class_init): numeric keypad
support
* gdk/gdkwindow.c (gdk_window_get_clip_region): fix infinite loop
screwup
* gdk/gdkpixbuf-render.c (gdk_pixbuf_render_to_drawable_alpha):
clip the render area to the drawable's clip region in advance,
so we don't get data from the server that we don't need.
* gdk/gdkpixbuf-render.c (gdk_pixbuf_render_to_drawable_alpha):
check return value of gdk_pixbuf_get_from_drawable(), fall back
to bilevel alpha if we can't get the pixbuf to composite against.
* gdk/gdkdraw.c (gdk_drawable_get_image): set the image colormap
* gdk/gdkimage.c (gdk_image_get_colormap): add
gdk_image_set_colormap, gdk_image_get_colormap
* gdk/gdkpixbuf-drawable.c (rgbconvert): Change all converters to
take a region of the image, instead of converting the entire
image.
* gtk/gtkwidget.h (struct _GtkWidgetClass): add show_help
keybinding signal. Add default bindings for it. Add default
handler for show_help that shows the tooltip for the widget.
* gtk/gtkdialog.c (gtk_dialog_class_init): add binding set and
"close" keybinding signal, remove key press handler.
* gtk/gtktooltips.c (gtk_tooltips_set_colors): Just remove this,
it's not our usual practice to leave a deprecated function around
with a runtime warning, plus we don't want it to appear in docs,
plus if we make them yellow no one will want to change them
anyhow.
2001-06-29 01:59:02 +00:00
|
|
|
|
gtk_binding_entry_add_signal (binding_set,
|
2010-12-23 20:50:18 +00:00
|
|
|
|
GDK_KEY_KP_Up, 0,
|
|
|
|
|
"move-current", 1,
|
|
|
|
|
GTK_TYPE_MENU_DIRECTION_TYPE,
|
|
|
|
|
GTK_MENU_DIR_PREV);
|
Added gdk_text/string_extents() - too calculate all the metrics at once of
Tue Jul 21 12:42:01 1998 Owen Taylor <otaylor@redhat.com>
* gdk/gdk.h gdk/gdkfont.c: Added gdk_text/string_extents() -
too calculate all the metrics at once of a string, including
things which weren't calculated before.
* gtk/Makefile.am gtk/gtk.h gtk/gtktearoffmenu.[ch]: New
MenuItem type, that when put as the first thing in a
menu, makes the menu tearoff. Currently drawn as a
dashed line.
* gtk/gtkmenuitem.h gtk/gtkcheckmenuitem.c: Added a flag
"hide_on_activate" to the MenuItem class structure to allow
check and radio buttons to be changed with <Space> without
hiding the menu.
* gtk/gtkaccellabel.[ch]: Added new capabilities to set
a underline_group and underline_mods for the label -
accelerators added in the underline group matching
underline_mods will be displayed as an underline character.
This doesn't work - Save As needs to be underlined
as Save _As.
* gtk/gtkitemfactory.c:
- Create a AccelGroup for each MenuShell we create.
- If an '&' appears before a character 'c' in the path,
then make 'c' an accelerator in the menu's accel group,
and if the menuitem is menubar <alt>C an accelerator
in the itemfactory's accel group.
* gtk/gtklabel.[ch]: Add support for a pattern arg -
which is a string. If an '_' appears in this string,
the corresponding position in the label is underlined.
Add gtk_label_parse_uline() convenience function which
takes a string with embedded underlines, sets the
pattern and label, and returns the accelerator keyval.
* gtk/gtkmenu.[ch]: Make menus no longer a toplevel widget.
Instead, they create a GtkWindow and add themselves
to that. (When torn off, another new feature, they
create another GtkWindow to hold the torn off menu)
New function gtk_menu_set_tearoff_state()
* gtk/gtkenums.h gtk/gtkmenushell.[ch] gtk/gtkenums.h:
Added action signals for keyboard navigation of menus.
* gtk/gtkmenushell.c: Key press handler which activates
bindings for navigation, and accelerators, for handling
underline accelerators. Exported functions to select
and activate menu items in a menushell.
* gtk/testgtk.c: Added a new "Item Factory" test which
tests GtkItemFactory and the new keyboard navigation
of menus.
1998-08-12 16:49:13 +00:00
|
|
|
|
gtk_binding_entry_add_signal (binding_set,
|
2010-12-23 20:50:18 +00:00
|
|
|
|
GDK_KEY_Down, 0,
|
|
|
|
|
"move-current", 1,
|
|
|
|
|
GTK_TYPE_MENU_DIRECTION_TYPE,
|
|
|
|
|
GTK_MENU_DIR_NEXT);
|
Clip the retrieved image data to the screen, using a server grab to avoid
2001-06-28 Havoc Pennington <hp@pobox.com>
* gdk/x11/gdkimage-x11.c (_gdk_x11_get_image): Clip the retrieved
image data to the screen, using a server grab to avoid race
conditions.
* gtk/gtkitemfactory.c (gtk_item_factory_create_item): remove
check for NULL return from gtk_image_new_from_stock(), it never
returns NULL.
(gtk_item_factory_create_item): fix bug where we parsed the stock
ID as an inline pixbuf
* gtk/gtktext.c (gtk_text_key_press): numeric keypad support
* gtk/gtkspinbutton.c (gtk_spin_button_key_press): numeric keypad
support (should be using binding set here)
* gtk/gtkoptionmenu.c (gtk_option_menu_key_press): numeric keypad
support (should be using binding set here)
* gtk/gtkmenushell.c (gtk_menu_shell_class_init): numeric keypad
support
* gtk/gtkmenu.c (gtk_menu_class_init): numeric keypad support
* gtk/gtkmenubar.c (gtk_menu_bar_class_init): numeric keypad
* gtk/gtklistitem.c (gtk_list_item_class_init): numeric keypad
* gtk/gtkimcontextsimple.c
(gtk_im_context_simple_filter_keypress): keypad
* gtk/gtkfilesel.c (gtk_file_selection_key_press): keypad
* gtk/gtkentry.c (gtk_entry_class_init): numeric keypad fixes
* gtk/gtkctree.c (gtk_ctree_class_init): numeric keypad support
* gtk/gtkcolorsel.c (palette_activate): keypad support (of course,
should be binding-setted)
* gtk/gtkwindow.c (gtk_window_class_init): numeric keypad fixes
* gtk/gtkclist.c (gtk_clist_class_init): numeric keypad fixes
* gtk/gtkcalendar.c: numeric keypad fixes
* gtk/gtktextview.c (gtk_text_view_class_init): numeric keypad
support
* gdk/gdkwindow.c (gdk_window_get_clip_region): fix infinite loop
screwup
* gdk/gdkpixbuf-render.c (gdk_pixbuf_render_to_drawable_alpha):
clip the render area to the drawable's clip region in advance,
so we don't get data from the server that we don't need.
* gdk/gdkpixbuf-render.c (gdk_pixbuf_render_to_drawable_alpha):
check return value of gdk_pixbuf_get_from_drawable(), fall back
to bilevel alpha if we can't get the pixbuf to composite against.
* gdk/gdkdraw.c (gdk_drawable_get_image): set the image colormap
* gdk/gdkimage.c (gdk_image_get_colormap): add
gdk_image_set_colormap, gdk_image_get_colormap
* gdk/gdkpixbuf-drawable.c (rgbconvert): Change all converters to
take a region of the image, instead of converting the entire
image.
* gtk/gtkwidget.h (struct _GtkWidgetClass): add show_help
keybinding signal. Add default bindings for it. Add default
handler for show_help that shows the tooltip for the widget.
* gtk/gtkdialog.c (gtk_dialog_class_init): add binding set and
"close" keybinding signal, remove key press handler.
* gtk/gtktooltips.c (gtk_tooltips_set_colors): Just remove this,
it's not our usual practice to leave a deprecated function around
with a runtime warning, plus we don't want it to appear in docs,
plus if we make them yellow no one will want to change them
anyhow.
2001-06-29 01:59:02 +00:00
|
|
|
|
gtk_binding_entry_add_signal (binding_set,
|
2010-12-23 20:50:18 +00:00
|
|
|
|
GDK_KEY_KP_Down, 0,
|
|
|
|
|
"move-current", 1,
|
|
|
|
|
GTK_TYPE_MENU_DIRECTION_TYPE,
|
|
|
|
|
GTK_MENU_DIR_NEXT);
|
Added gdk_text/string_extents() - too calculate all the metrics at once of
Tue Jul 21 12:42:01 1998 Owen Taylor <otaylor@redhat.com>
* gdk/gdk.h gdk/gdkfont.c: Added gdk_text/string_extents() -
too calculate all the metrics at once of a string, including
things which weren't calculated before.
* gtk/Makefile.am gtk/gtk.h gtk/gtktearoffmenu.[ch]: New
MenuItem type, that when put as the first thing in a
menu, makes the menu tearoff. Currently drawn as a
dashed line.
* gtk/gtkmenuitem.h gtk/gtkcheckmenuitem.c: Added a flag
"hide_on_activate" to the MenuItem class structure to allow
check and radio buttons to be changed with <Space> without
hiding the menu.
* gtk/gtkaccellabel.[ch]: Added new capabilities to set
a underline_group and underline_mods for the label -
accelerators added in the underline group matching
underline_mods will be displayed as an underline character.
This doesn't work - Save As needs to be underlined
as Save _As.
* gtk/gtkitemfactory.c:
- Create a AccelGroup for each MenuShell we create.
- If an '&' appears before a character 'c' in the path,
then make 'c' an accelerator in the menu's accel group,
and if the menuitem is menubar <alt>C an accelerator
in the itemfactory's accel group.
* gtk/gtklabel.[ch]: Add support for a pattern arg -
which is a string. If an '_' appears in this string,
the corresponding position in the label is underlined.
Add gtk_label_parse_uline() convenience function which
takes a string with embedded underlines, sets the
pattern and label, and returns the accelerator keyval.
* gtk/gtkmenu.[ch]: Make menus no longer a toplevel widget.
Instead, they create a GtkWindow and add themselves
to that. (When torn off, another new feature, they
create another GtkWindow to hold the torn off menu)
New function gtk_menu_set_tearoff_state()
* gtk/gtkenums.h gtk/gtkmenushell.[ch] gtk/gtkenums.h:
Added action signals for keyboard navigation of menus.
* gtk/gtkmenushell.c: Key press handler which activates
bindings for navigation, and accelerators, for handling
underline accelerators. Exported functions to select
and activate menu items in a menushell.
* gtk/testgtk.c: Added a new "Item Factory" test which
tests GtkItemFactory and the new keyboard navigation
of menus.
1998-08-12 16:49:13 +00:00
|
|
|
|
gtk_binding_entry_add_signal (binding_set,
|
2010-12-23 20:50:18 +00:00
|
|
|
|
GDK_KEY_Left, 0,
|
|
|
|
|
"move-current", 1,
|
|
|
|
|
GTK_TYPE_MENU_DIRECTION_TYPE,
|
|
|
|
|
GTK_MENU_DIR_PARENT);
|
Clip the retrieved image data to the screen, using a server grab to avoid
2001-06-28 Havoc Pennington <hp@pobox.com>
* gdk/x11/gdkimage-x11.c (_gdk_x11_get_image): Clip the retrieved
image data to the screen, using a server grab to avoid race
conditions.
* gtk/gtkitemfactory.c (gtk_item_factory_create_item): remove
check for NULL return from gtk_image_new_from_stock(), it never
returns NULL.
(gtk_item_factory_create_item): fix bug where we parsed the stock
ID as an inline pixbuf
* gtk/gtktext.c (gtk_text_key_press): numeric keypad support
* gtk/gtkspinbutton.c (gtk_spin_button_key_press): numeric keypad
support (should be using binding set here)
* gtk/gtkoptionmenu.c (gtk_option_menu_key_press): numeric keypad
support (should be using binding set here)
* gtk/gtkmenushell.c (gtk_menu_shell_class_init): numeric keypad
support
* gtk/gtkmenu.c (gtk_menu_class_init): numeric keypad support
* gtk/gtkmenubar.c (gtk_menu_bar_class_init): numeric keypad
* gtk/gtklistitem.c (gtk_list_item_class_init): numeric keypad
* gtk/gtkimcontextsimple.c
(gtk_im_context_simple_filter_keypress): keypad
* gtk/gtkfilesel.c (gtk_file_selection_key_press): keypad
* gtk/gtkentry.c (gtk_entry_class_init): numeric keypad fixes
* gtk/gtkctree.c (gtk_ctree_class_init): numeric keypad support
* gtk/gtkcolorsel.c (palette_activate): keypad support (of course,
should be binding-setted)
* gtk/gtkwindow.c (gtk_window_class_init): numeric keypad fixes
* gtk/gtkclist.c (gtk_clist_class_init): numeric keypad fixes
* gtk/gtkcalendar.c: numeric keypad fixes
* gtk/gtktextview.c (gtk_text_view_class_init): numeric keypad
support
* gdk/gdkwindow.c (gdk_window_get_clip_region): fix infinite loop
screwup
* gdk/gdkpixbuf-render.c (gdk_pixbuf_render_to_drawable_alpha):
clip the render area to the drawable's clip region in advance,
so we don't get data from the server that we don't need.
* gdk/gdkpixbuf-render.c (gdk_pixbuf_render_to_drawable_alpha):
check return value of gdk_pixbuf_get_from_drawable(), fall back
to bilevel alpha if we can't get the pixbuf to composite against.
* gdk/gdkdraw.c (gdk_drawable_get_image): set the image colormap
* gdk/gdkimage.c (gdk_image_get_colormap): add
gdk_image_set_colormap, gdk_image_get_colormap
* gdk/gdkpixbuf-drawable.c (rgbconvert): Change all converters to
take a region of the image, instead of converting the entire
image.
* gtk/gtkwidget.h (struct _GtkWidgetClass): add show_help
keybinding signal. Add default bindings for it. Add default
handler for show_help that shows the tooltip for the widget.
* gtk/gtkdialog.c (gtk_dialog_class_init): add binding set and
"close" keybinding signal, remove key press handler.
* gtk/gtktooltips.c (gtk_tooltips_set_colors): Just remove this,
it's not our usual practice to leave a deprecated function around
with a runtime warning, plus we don't want it to appear in docs,
plus if we make them yellow no one will want to change them
anyhow.
2001-06-29 01:59:02 +00:00
|
|
|
|
gtk_binding_entry_add_signal (binding_set,
|
2010-12-23 20:50:18 +00:00
|
|
|
|
GDK_KEY_KP_Left, 0,
|
|
|
|
|
"move-current", 1,
|
|
|
|
|
GTK_TYPE_MENU_DIRECTION_TYPE,
|
|
|
|
|
GTK_MENU_DIR_PARENT);
|
Added gdk_text/string_extents() - too calculate all the metrics at once of
Tue Jul 21 12:42:01 1998 Owen Taylor <otaylor@redhat.com>
* gdk/gdk.h gdk/gdkfont.c: Added gdk_text/string_extents() -
too calculate all the metrics at once of a string, including
things which weren't calculated before.
* gtk/Makefile.am gtk/gtk.h gtk/gtktearoffmenu.[ch]: New
MenuItem type, that when put as the first thing in a
menu, makes the menu tearoff. Currently drawn as a
dashed line.
* gtk/gtkmenuitem.h gtk/gtkcheckmenuitem.c: Added a flag
"hide_on_activate" to the MenuItem class structure to allow
check and radio buttons to be changed with <Space> without
hiding the menu.
* gtk/gtkaccellabel.[ch]: Added new capabilities to set
a underline_group and underline_mods for the label -
accelerators added in the underline group matching
underline_mods will be displayed as an underline character.
This doesn't work - Save As needs to be underlined
as Save _As.
* gtk/gtkitemfactory.c:
- Create a AccelGroup for each MenuShell we create.
- If an '&' appears before a character 'c' in the path,
then make 'c' an accelerator in the menu's accel group,
and if the menuitem is menubar <alt>C an accelerator
in the itemfactory's accel group.
* gtk/gtklabel.[ch]: Add support for a pattern arg -
which is a string. If an '_' appears in this string,
the corresponding position in the label is underlined.
Add gtk_label_parse_uline() convenience function which
takes a string with embedded underlines, sets the
pattern and label, and returns the accelerator keyval.
* gtk/gtkmenu.[ch]: Make menus no longer a toplevel widget.
Instead, they create a GtkWindow and add themselves
to that. (When torn off, another new feature, they
create another GtkWindow to hold the torn off menu)
New function gtk_menu_set_tearoff_state()
* gtk/gtkenums.h gtk/gtkmenushell.[ch] gtk/gtkenums.h:
Added action signals for keyboard navigation of menus.
* gtk/gtkmenushell.c: Key press handler which activates
bindings for navigation, and accelerators, for handling
underline accelerators. Exported functions to select
and activate menu items in a menushell.
* gtk/testgtk.c: Added a new "Item Factory" test which
tests GtkItemFactory and the new keyboard navigation
of menus.
1998-08-12 16:49:13 +00:00
|
|
|
|
gtk_binding_entry_add_signal (binding_set,
|
2010-12-23 20:50:18 +00:00
|
|
|
|
GDK_KEY_Right, 0,
|
|
|
|
|
"move-current", 1,
|
|
|
|
|
GTK_TYPE_MENU_DIRECTION_TYPE,
|
|
|
|
|
GTK_MENU_DIR_CHILD);
|
Clip the retrieved image data to the screen, using a server grab to avoid
2001-06-28 Havoc Pennington <hp@pobox.com>
* gdk/x11/gdkimage-x11.c (_gdk_x11_get_image): Clip the retrieved
image data to the screen, using a server grab to avoid race
conditions.
* gtk/gtkitemfactory.c (gtk_item_factory_create_item): remove
check for NULL return from gtk_image_new_from_stock(), it never
returns NULL.
(gtk_item_factory_create_item): fix bug where we parsed the stock
ID as an inline pixbuf
* gtk/gtktext.c (gtk_text_key_press): numeric keypad support
* gtk/gtkspinbutton.c (gtk_spin_button_key_press): numeric keypad
support (should be using binding set here)
* gtk/gtkoptionmenu.c (gtk_option_menu_key_press): numeric keypad
support (should be using binding set here)
* gtk/gtkmenushell.c (gtk_menu_shell_class_init): numeric keypad
support
* gtk/gtkmenu.c (gtk_menu_class_init): numeric keypad support
* gtk/gtkmenubar.c (gtk_menu_bar_class_init): numeric keypad
* gtk/gtklistitem.c (gtk_list_item_class_init): numeric keypad
* gtk/gtkimcontextsimple.c
(gtk_im_context_simple_filter_keypress): keypad
* gtk/gtkfilesel.c (gtk_file_selection_key_press): keypad
* gtk/gtkentry.c (gtk_entry_class_init): numeric keypad fixes
* gtk/gtkctree.c (gtk_ctree_class_init): numeric keypad support
* gtk/gtkcolorsel.c (palette_activate): keypad support (of course,
should be binding-setted)
* gtk/gtkwindow.c (gtk_window_class_init): numeric keypad fixes
* gtk/gtkclist.c (gtk_clist_class_init): numeric keypad fixes
* gtk/gtkcalendar.c: numeric keypad fixes
* gtk/gtktextview.c (gtk_text_view_class_init): numeric keypad
support
* gdk/gdkwindow.c (gdk_window_get_clip_region): fix infinite loop
screwup
* gdk/gdkpixbuf-render.c (gdk_pixbuf_render_to_drawable_alpha):
clip the render area to the drawable's clip region in advance,
so we don't get data from the server that we don't need.
* gdk/gdkpixbuf-render.c (gdk_pixbuf_render_to_drawable_alpha):
check return value of gdk_pixbuf_get_from_drawable(), fall back
to bilevel alpha if we can't get the pixbuf to composite against.
* gdk/gdkdraw.c (gdk_drawable_get_image): set the image colormap
* gdk/gdkimage.c (gdk_image_get_colormap): add
gdk_image_set_colormap, gdk_image_get_colormap
* gdk/gdkpixbuf-drawable.c (rgbconvert): Change all converters to
take a region of the image, instead of converting the entire
image.
* gtk/gtkwidget.h (struct _GtkWidgetClass): add show_help
keybinding signal. Add default bindings for it. Add default
handler for show_help that shows the tooltip for the widget.
* gtk/gtkdialog.c (gtk_dialog_class_init): add binding set and
"close" keybinding signal, remove key press handler.
* gtk/gtktooltips.c (gtk_tooltips_set_colors): Just remove this,
it's not our usual practice to leave a deprecated function around
with a runtime warning, plus we don't want it to appear in docs,
plus if we make them yellow no one will want to change them
anyhow.
2001-06-29 01:59:02 +00:00
|
|
|
|
gtk_binding_entry_add_signal (binding_set,
|
2010-12-23 20:50:18 +00:00
|
|
|
|
GDK_KEY_KP_Right, 0,
|
|
|
|
|
"move-current", 1,
|
|
|
|
|
GTK_TYPE_MENU_DIRECTION_TYPE,
|
|
|
|
|
GTK_MENU_DIR_CHILD);
|
2002-12-14 22:43:52 +00:00
|
|
|
|
gtk_binding_entry_add_signal (binding_set,
|
2010-12-23 20:50:18 +00:00
|
|
|
|
GDK_KEY_Home, 0,
|
|
|
|
|
"move-scroll", 1,
|
|
|
|
|
GTK_TYPE_SCROLL_TYPE,
|
|
|
|
|
GTK_SCROLL_START);
|
2002-12-14 22:43:52 +00:00
|
|
|
|
gtk_binding_entry_add_signal (binding_set,
|
2010-12-23 20:50:18 +00:00
|
|
|
|
GDK_KEY_KP_Home, 0,
|
|
|
|
|
"move-scroll", 1,
|
|
|
|
|
GTK_TYPE_SCROLL_TYPE,
|
|
|
|
|
GTK_SCROLL_START);
|
2002-12-14 22:43:52 +00:00
|
|
|
|
gtk_binding_entry_add_signal (binding_set,
|
2010-12-23 20:50:18 +00:00
|
|
|
|
GDK_KEY_End, 0,
|
|
|
|
|
"move-scroll", 1,
|
|
|
|
|
GTK_TYPE_SCROLL_TYPE,
|
|
|
|
|
GTK_SCROLL_END);
|
2002-12-14 22:43:52 +00:00
|
|
|
|
gtk_binding_entry_add_signal (binding_set,
|
2010-12-23 20:50:18 +00:00
|
|
|
|
GDK_KEY_KP_End, 0,
|
|
|
|
|
"move-scroll", 1,
|
|
|
|
|
GTK_TYPE_SCROLL_TYPE,
|
|
|
|
|
GTK_SCROLL_END);
|
2002-12-14 22:43:52 +00:00
|
|
|
|
gtk_binding_entry_add_signal (binding_set,
|
2010-12-23 20:50:18 +00:00
|
|
|
|
GDK_KEY_Page_Up, 0,
|
|
|
|
|
"move-scroll", 1,
|
|
|
|
|
GTK_TYPE_SCROLL_TYPE,
|
|
|
|
|
GTK_SCROLL_PAGE_UP);
|
2002-12-14 22:43:52 +00:00
|
|
|
|
gtk_binding_entry_add_signal (binding_set,
|
2010-12-23 20:50:18 +00:00
|
|
|
|
GDK_KEY_KP_Page_Up, 0,
|
|
|
|
|
"move-scroll", 1,
|
|
|
|
|
GTK_TYPE_SCROLL_TYPE,
|
|
|
|
|
GTK_SCROLL_PAGE_UP);
|
2002-12-14 22:43:52 +00:00
|
|
|
|
gtk_binding_entry_add_signal (binding_set,
|
2010-12-23 20:50:18 +00:00
|
|
|
|
GDK_KEY_Page_Down, 0,
|
|
|
|
|
"move-scroll", 1,
|
|
|
|
|
GTK_TYPE_SCROLL_TYPE,
|
|
|
|
|
GTK_SCROLL_PAGE_DOWN);
|
2002-12-14 22:43:52 +00:00
|
|
|
|
gtk_binding_entry_add_signal (binding_set,
|
2010-12-23 20:50:18 +00:00
|
|
|
|
GDK_KEY_KP_Page_Down, 0,
|
|
|
|
|
"move-scroll", 1,
|
|
|
|
|
GTK_TYPE_SCROLL_TYPE,
|
|
|
|
|
GTK_SCROLL_PAGE_DOWN);
|
2002-02-02 22:52:22 +00:00
|
|
|
|
|
2011-07-02 02:30:54 +00:00
|
|
|
|
gtk_widget_class_set_accessible_type (widget_class, GTK_TYPE_MENU_ACCESSIBLE);
|
2015-11-03 01:45:46 +00:00
|
|
|
|
gtk_widget_class_set_css_name (widget_class, "menu");
|
1997-11-24 22:37:52 +00:00
|
|
|
|
}
|
|
|
|
|
|
2001-08-25 03:15:26 +00:00
|
|
|
|
|
2008-09-03 13:18:34 +00:00
|
|
|
|
static void
|
2001-08-25 03:15:26 +00:00
|
|
|
|
gtk_menu_set_property (GObject *object,
|
2010-12-23 20:50:18 +00:00
|
|
|
|
guint prop_id,
|
|
|
|
|
const GValue *value,
|
|
|
|
|
GParamSpec *pspec)
|
2001-08-25 03:15:26 +00:00
|
|
|
|
{
|
2008-09-03 13:18:34 +00:00
|
|
|
|
GtkMenu *menu = GTK_MENU (object);
|
|
|
|
|
|
2001-08-25 03:15:26 +00:00
|
|
|
|
switch (prop_id)
|
|
|
|
|
{
|
2008-06-20 11:06:52 +00:00
|
|
|
|
case PROP_ACTIVE:
|
2008-07-04 21:20:25 +00:00
|
|
|
|
gtk_menu_set_active (menu, g_value_get_int (value));
|
2008-06-20 11:06:52 +00:00
|
|
|
|
break;
|
|
|
|
|
case PROP_ACCEL_GROUP:
|
|
|
|
|
gtk_menu_set_accel_group (menu, g_value_get_object (value));
|
|
|
|
|
break;
|
|
|
|
|
case PROP_ACCEL_PATH:
|
|
|
|
|
gtk_menu_set_accel_path (menu, g_value_get_string (value));
|
|
|
|
|
break;
|
|
|
|
|
case PROP_ATTACH_WIDGET:
|
2008-07-04 20:09:57 +00:00
|
|
|
|
{
|
|
|
|
|
GtkWidget *widget;
|
|
|
|
|
|
|
|
|
|
widget = gtk_menu_get_attach_widget (menu);
|
|
|
|
|
if (widget)
|
|
|
|
|
gtk_menu_detach (menu);
|
|
|
|
|
|
|
|
|
|
widget = (GtkWidget*) g_value_get_object (value);
|
|
|
|
|
if (widget)
|
|
|
|
|
gtk_menu_attach_to_widget (menu, widget, NULL);
|
|
|
|
|
}
|
2008-06-20 11:06:52 +00:00
|
|
|
|
break;
|
2004-05-07 04:43:56 +00:00
|
|
|
|
case PROP_TEAROFF_STATE:
|
2013-08-20 04:14:00 +00:00
|
|
|
|
G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
|
2004-05-07 04:43:56 +00:00
|
|
|
|
gtk_menu_set_tearoff_state (menu, g_value_get_boolean (value));
|
2013-08-20 04:14:00 +00:00
|
|
|
|
G_GNUC_END_IGNORE_DEPRECATIONS;
|
2004-05-07 04:43:56 +00:00
|
|
|
|
break;
|
2001-08-25 03:15:26 +00:00
|
|
|
|
case PROP_TEAROFF_TITLE:
|
2013-08-20 04:14:00 +00:00
|
|
|
|
G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
|
2001-08-25 03:15:26 +00:00
|
|
|
|
gtk_menu_set_title (menu, g_value_get_string (value));
|
2013-08-20 04:14:00 +00:00
|
|
|
|
G_GNUC_END_IGNORE_DEPRECATIONS;
|
2008-06-20 11:06:52 +00:00
|
|
|
|
break;
|
|
|
|
|
case PROP_MONITOR:
|
|
|
|
|
gtk_menu_set_monitor (menu, g_value_get_int (value));
|
|
|
|
|
break;
|
2009-06-24 05:01:51 +00:00
|
|
|
|
case PROP_RESERVE_TOGGLE_SIZE:
|
|
|
|
|
gtk_menu_set_reserve_toggle_size (menu, g_value_get_boolean (value));
|
|
|
|
|
break;
|
2016-06-14 19:42:13 +00:00
|
|
|
|
case PROP_ANCHOR_HINTS:
|
2016-08-03 03:42:11 +00:00
|
|
|
|
if (menu->priv->anchor_hints != g_value_get_flags (value))
|
|
|
|
|
{
|
|
|
|
|
menu->priv->anchor_hints = g_value_get_flags (value);
|
|
|
|
|
g_object_notify_by_pspec (object, pspec);
|
|
|
|
|
}
|
2016-06-14 19:42:13 +00:00
|
|
|
|
break;
|
|
|
|
|
case PROP_RECT_ANCHOR_DX:
|
2016-08-03 03:42:11 +00:00
|
|
|
|
if (menu->priv->rect_anchor_dx != g_value_get_int (value))
|
|
|
|
|
{
|
|
|
|
|
menu->priv->rect_anchor_dx = g_value_get_int (value);
|
|
|
|
|
g_object_notify_by_pspec (object, pspec);
|
|
|
|
|
}
|
2016-06-14 19:42:13 +00:00
|
|
|
|
break;
|
|
|
|
|
case PROP_RECT_ANCHOR_DY:
|
2016-08-03 03:42:11 +00:00
|
|
|
|
if (menu->priv->rect_anchor_dy != g_value_get_int (value))
|
|
|
|
|
{
|
|
|
|
|
menu->priv->rect_anchor_dy = g_value_get_int (value);
|
|
|
|
|
g_object_notify_by_pspec (object, pspec);
|
|
|
|
|
}
|
2016-06-14 19:42:13 +00:00
|
|
|
|
break;
|
|
|
|
|
case PROP_MENU_TYPE_HINT:
|
2016-08-03 03:42:11 +00:00
|
|
|
|
if (menu->priv->menu_type_hint != g_value_get_enum (value))
|
|
|
|
|
{
|
|
|
|
|
menu->priv->menu_type_hint = g_value_get_enum (value);
|
|
|
|
|
g_object_notify_by_pspec (object, pspec);
|
|
|
|
|
}
|
2016-06-14 19:42:13 +00:00
|
|
|
|
break;
|
2001-08-25 03:15:26 +00:00
|
|
|
|
default:
|
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2008-09-03 13:18:34 +00:00
|
|
|
|
static void
|
2001-08-25 03:15:26 +00:00
|
|
|
|
gtk_menu_get_property (GObject *object,
|
2010-12-23 20:50:18 +00:00
|
|
|
|
guint prop_id,
|
|
|
|
|
GValue *value,
|
|
|
|
|
GParamSpec *pspec)
|
2001-08-25 03:15:26 +00:00
|
|
|
|
{
|
2008-09-03 13:18:34 +00:00
|
|
|
|
GtkMenu *menu = GTK_MENU (object);
|
|
|
|
|
|
2001-08-25 03:15:26 +00:00
|
|
|
|
switch (prop_id)
|
|
|
|
|
{
|
2008-06-20 11:06:52 +00:00
|
|
|
|
case PROP_ACTIVE:
|
2010-12-23 23:21:53 +00:00
|
|
|
|
g_value_set_int (value, g_list_index (GTK_MENU_SHELL (menu)->priv->children, gtk_menu_get_active (menu)));
|
2008-06-20 11:06:52 +00:00
|
|
|
|
break;
|
|
|
|
|
case PROP_ACCEL_GROUP:
|
|
|
|
|
g_value_set_object (value, gtk_menu_get_accel_group (menu));
|
|
|
|
|
break;
|
|
|
|
|
case PROP_ACCEL_PATH:
|
|
|
|
|
g_value_set_string (value, gtk_menu_get_accel_path (menu));
|
|
|
|
|
break;
|
|
|
|
|
case PROP_ATTACH_WIDGET:
|
|
|
|
|
g_value_set_object (value, gtk_menu_get_attach_widget (menu));
|
|
|
|
|
break;
|
2004-05-07 04:43:56 +00:00
|
|
|
|
case PROP_TEAROFF_STATE:
|
2013-08-20 04:14:00 +00:00
|
|
|
|
G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
|
2004-05-07 04:43:56 +00:00
|
|
|
|
g_value_set_boolean (value, gtk_menu_get_tearoff_state (menu));
|
2013-08-20 04:14:00 +00:00
|
|
|
|
G_GNUC_END_IGNORE_DEPRECATIONS;
|
2004-05-07 04:43:56 +00:00
|
|
|
|
break;
|
2001-08-25 03:15:26 +00:00
|
|
|
|
case PROP_TEAROFF_TITLE:
|
2013-08-20 04:14:00 +00:00
|
|
|
|
G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
|
2001-12-27 20:22:16 +00:00
|
|
|
|
g_value_set_string (value, gtk_menu_get_title (menu));
|
2013-08-20 04:14:00 +00:00
|
|
|
|
G_GNUC_END_IGNORE_DEPRECATIONS;
|
2001-08-25 03:15:26 +00:00
|
|
|
|
break;
|
2008-06-20 11:06:52 +00:00
|
|
|
|
case PROP_MONITOR:
|
|
|
|
|
g_value_set_int (value, gtk_menu_get_monitor (menu));
|
|
|
|
|
break;
|
2009-06-24 05:01:51 +00:00
|
|
|
|
case PROP_RESERVE_TOGGLE_SIZE:
|
|
|
|
|
g_value_set_boolean (value, gtk_menu_get_reserve_toggle_size (menu));
|
|
|
|
|
break;
|
2016-06-14 19:42:13 +00:00
|
|
|
|
case PROP_ANCHOR_HINTS:
|
|
|
|
|
g_value_set_flags (value, menu->priv->anchor_hints);
|
|
|
|
|
break;
|
|
|
|
|
case PROP_RECT_ANCHOR_DX:
|
|
|
|
|
g_value_set_int (value, menu->priv->rect_anchor_dx);
|
|
|
|
|
break;
|
|
|
|
|
case PROP_RECT_ANCHOR_DY:
|
|
|
|
|
g_value_set_int (value, menu->priv->rect_anchor_dy);
|
|
|
|
|
break;
|
|
|
|
|
case PROP_MENU_TYPE_HINT:
|
|
|
|
|
g_value_set_enum (value, menu->priv->menu_type_hint);
|
|
|
|
|
break;
|
2001-08-25 03:15:26 +00:00
|
|
|
|
default:
|
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
The table menu patch! Turns GtkMenu into a table, so you can attach menu
Wed Sep 10 22:25:04 2003 Kristian Rietveld <kris@gtk.org>
The table menu patch! Turns GtkMenu into a table, so you can attach
menu items in numerous new ways! Be creative!
Contains some bug fixes and RTL adaptions from Matthias Clasen.
* gtk/gtkmenu.c [toplevel]: introduce ATTACH_INFO_KEY, extend
GtkMenuPrivate, introduce AttachInfo, add child properties enum,
(gtk_menu_free_private), (gtk_menu_get_private): we have to free
the heights array in the private struct,
(gtk_menu_class_init): reorder code a bit, install child properties,
(get_attach_info), (get_child_attach): new utility functions,
(gtk_menu_set_child_property), (gtk_menu_get_child_property): introduce
child properties, for the attach info,
(gtk_menu_remove): remove AttachInfo from menu item,
(gtk_menu_real_insert): implemented algorithm to automagically place
inserted menu items at the correct place in the table,
(gtk_menu_size_request), (gtk_menu_size_allocate),
(compute_child_offset): reworked/rewritten to support table menus,
(gtk_menu_attach): new function,
(find_child_containing), (gtk_menu_move_current): new functions to
get table menu keynav right.
* gtk/gtkmenu.h: add gtk_menu_attach() prototype.
2003-09-10 20:32:33 +00:00
|
|
|
|
static void
|
|
|
|
|
gtk_menu_set_child_property (GtkContainer *container,
|
|
|
|
|
GtkWidget *child,
|
|
|
|
|
guint property_id,
|
|
|
|
|
const GValue *value,
|
|
|
|
|
GParamSpec *pspec)
|
|
|
|
|
{
|
|
|
|
|
GtkMenu *menu = GTK_MENU (container);
|
2004-03-15 02:03:59 +00:00
|
|
|
|
AttachInfo *ai = get_attach_info (child);
|
The table menu patch! Turns GtkMenu into a table, so you can attach menu
Wed Sep 10 22:25:04 2003 Kristian Rietveld <kris@gtk.org>
The table menu patch! Turns GtkMenu into a table, so you can attach
menu items in numerous new ways! Be creative!
Contains some bug fixes and RTL adaptions from Matthias Clasen.
* gtk/gtkmenu.c [toplevel]: introduce ATTACH_INFO_KEY, extend
GtkMenuPrivate, introduce AttachInfo, add child properties enum,
(gtk_menu_free_private), (gtk_menu_get_private): we have to free
the heights array in the private struct,
(gtk_menu_class_init): reorder code a bit, install child properties,
(get_attach_info), (get_child_attach): new utility functions,
(gtk_menu_set_child_property), (gtk_menu_get_child_property): introduce
child properties, for the attach info,
(gtk_menu_remove): remove AttachInfo from menu item,
(gtk_menu_real_insert): implemented algorithm to automagically place
inserted menu items at the correct place in the table,
(gtk_menu_size_request), (gtk_menu_size_allocate),
(compute_child_offset): reworked/rewritten to support table menus,
(gtk_menu_attach): new function,
(find_child_containing), (gtk_menu_move_current): new functions to
get table menu keynav right.
* gtk/gtkmenu.h: add gtk_menu_attach() prototype.
2003-09-10 20:32:33 +00:00
|
|
|
|
|
|
|
|
|
switch (property_id)
|
|
|
|
|
{
|
2004-03-15 02:03:59 +00:00
|
|
|
|
case CHILD_PROP_LEFT_ATTACH:
|
|
|
|
|
ai->left_attach = g_value_get_int (value);
|
|
|
|
|
break;
|
|
|
|
|
case CHILD_PROP_RIGHT_ATTACH:
|
|
|
|
|
ai->right_attach = g_value_get_int (value);
|
|
|
|
|
break;
|
|
|
|
|
case CHILD_PROP_TOP_ATTACH:
|
2010-12-23 20:50:18 +00:00
|
|
|
|
ai->top_attach = g_value_get_int (value);
|
2004-03-15 02:03:59 +00:00
|
|
|
|
break;
|
|
|
|
|
case CHILD_PROP_BOTTOM_ATTACH:
|
|
|
|
|
ai->bottom_attach = g_value_get_int (value);
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
GTK_CONTAINER_WARN_INVALID_CHILD_PROPERTY_ID (container, property_id, pspec);
|
|
|
|
|
return;
|
The table menu patch! Turns GtkMenu into a table, so you can attach menu
Wed Sep 10 22:25:04 2003 Kristian Rietveld <kris@gtk.org>
The table menu patch! Turns GtkMenu into a table, so you can attach
menu items in numerous new ways! Be creative!
Contains some bug fixes and RTL adaptions from Matthias Clasen.
* gtk/gtkmenu.c [toplevel]: introduce ATTACH_INFO_KEY, extend
GtkMenuPrivate, introduce AttachInfo, add child properties enum,
(gtk_menu_free_private), (gtk_menu_get_private): we have to free
the heights array in the private struct,
(gtk_menu_class_init): reorder code a bit, install child properties,
(get_attach_info), (get_child_attach): new utility functions,
(gtk_menu_set_child_property), (gtk_menu_get_child_property): introduce
child properties, for the attach info,
(gtk_menu_remove): remove AttachInfo from menu item,
(gtk_menu_real_insert): implemented algorithm to automagically place
inserted menu items at the correct place in the table,
(gtk_menu_size_request), (gtk_menu_size_allocate),
(compute_child_offset): reworked/rewritten to support table menus,
(gtk_menu_attach): new function,
(find_child_containing), (gtk_menu_move_current): new functions to
get table menu keynav right.
* gtk/gtkmenu.h: add gtk_menu_attach() prototype.
2003-09-10 20:32:33 +00:00
|
|
|
|
}
|
|
|
|
|
|
2004-03-15 02:03:59 +00:00
|
|
|
|
menu_queue_resize (menu);
|
The table menu patch! Turns GtkMenu into a table, so you can attach menu
Wed Sep 10 22:25:04 2003 Kristian Rietveld <kris@gtk.org>
The table menu patch! Turns GtkMenu into a table, so you can attach
menu items in numerous new ways! Be creative!
Contains some bug fixes and RTL adaptions from Matthias Clasen.
* gtk/gtkmenu.c [toplevel]: introduce ATTACH_INFO_KEY, extend
GtkMenuPrivate, introduce AttachInfo, add child properties enum,
(gtk_menu_free_private), (gtk_menu_get_private): we have to free
the heights array in the private struct,
(gtk_menu_class_init): reorder code a bit, install child properties,
(get_attach_info), (get_child_attach): new utility functions,
(gtk_menu_set_child_property), (gtk_menu_get_child_property): introduce
child properties, for the attach info,
(gtk_menu_remove): remove AttachInfo from menu item,
(gtk_menu_real_insert): implemented algorithm to automagically place
inserted menu items at the correct place in the table,
(gtk_menu_size_request), (gtk_menu_size_allocate),
(compute_child_offset): reworked/rewritten to support table menus,
(gtk_menu_attach): new function,
(find_child_containing), (gtk_menu_move_current): new functions to
get table menu keynav right.
* gtk/gtkmenu.h: add gtk_menu_attach() prototype.
2003-09-10 20:32:33 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
gtk_menu_get_child_property (GtkContainer *container,
|
|
|
|
|
GtkWidget *child,
|
|
|
|
|
guint property_id,
|
|
|
|
|
GValue *value,
|
|
|
|
|
GParamSpec *pspec)
|
|
|
|
|
{
|
2004-03-15 02:03:59 +00:00
|
|
|
|
AttachInfo *ai = get_attach_info (child);
|
The table menu patch! Turns GtkMenu into a table, so you can attach menu
Wed Sep 10 22:25:04 2003 Kristian Rietveld <kris@gtk.org>
The table menu patch! Turns GtkMenu into a table, so you can attach
menu items in numerous new ways! Be creative!
Contains some bug fixes and RTL adaptions from Matthias Clasen.
* gtk/gtkmenu.c [toplevel]: introduce ATTACH_INFO_KEY, extend
GtkMenuPrivate, introduce AttachInfo, add child properties enum,
(gtk_menu_free_private), (gtk_menu_get_private): we have to free
the heights array in the private struct,
(gtk_menu_class_init): reorder code a bit, install child properties,
(get_attach_info), (get_child_attach): new utility functions,
(gtk_menu_set_child_property), (gtk_menu_get_child_property): introduce
child properties, for the attach info,
(gtk_menu_remove): remove AttachInfo from menu item,
(gtk_menu_real_insert): implemented algorithm to automagically place
inserted menu items at the correct place in the table,
(gtk_menu_size_request), (gtk_menu_size_allocate),
(compute_child_offset): reworked/rewritten to support table menus,
(gtk_menu_attach): new function,
(find_child_containing), (gtk_menu_move_current): new functions to
get table menu keynav right.
* gtk/gtkmenu.h: add gtk_menu_attach() prototype.
2003-09-10 20:32:33 +00:00
|
|
|
|
|
|
|
|
|
switch (property_id)
|
|
|
|
|
{
|
2004-03-15 02:03:59 +00:00
|
|
|
|
case CHILD_PROP_LEFT_ATTACH:
|
|
|
|
|
g_value_set_int (value, ai->left_attach);
|
|
|
|
|
break;
|
|
|
|
|
case CHILD_PROP_RIGHT_ATTACH:
|
|
|
|
|
g_value_set_int (value, ai->right_attach);
|
|
|
|
|
break;
|
|
|
|
|
case CHILD_PROP_TOP_ATTACH:
|
|
|
|
|
g_value_set_int (value, ai->top_attach);
|
|
|
|
|
break;
|
|
|
|
|
case CHILD_PROP_BOTTOM_ATTACH:
|
|
|
|
|
g_value_set_int (value, ai->bottom_attach);
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
GTK_CONTAINER_WARN_INVALID_CHILD_PROPERTY_ID (container, property_id, pspec);
|
|
|
|
|
return;
|
The table menu patch! Turns GtkMenu into a table, so you can attach menu
Wed Sep 10 22:25:04 2003 Kristian Rietveld <kris@gtk.org>
The table menu patch! Turns GtkMenu into a table, so you can attach
menu items in numerous new ways! Be creative!
Contains some bug fixes and RTL adaptions from Matthias Clasen.
* gtk/gtkmenu.c [toplevel]: introduce ATTACH_INFO_KEY, extend
GtkMenuPrivate, introduce AttachInfo, add child properties enum,
(gtk_menu_free_private), (gtk_menu_get_private): we have to free
the heights array in the private struct,
(gtk_menu_class_init): reorder code a bit, install child properties,
(get_attach_info), (get_child_attach): new utility functions,
(gtk_menu_set_child_property), (gtk_menu_get_child_property): introduce
child properties, for the attach info,
(gtk_menu_remove): remove AttachInfo from menu item,
(gtk_menu_real_insert): implemented algorithm to automagically place
inserted menu items at the correct place in the table,
(gtk_menu_size_request), (gtk_menu_size_allocate),
(compute_child_offset): reworked/rewritten to support table menus,
(gtk_menu_attach): new function,
(find_child_containing), (gtk_menu_move_current): new functions to
get table menu keynav right.
* gtk/gtkmenu.h: add gtk_menu_attach() prototype.
2003-09-10 20:32:33 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2000-09-02 02:43:50 +00:00
|
|
|
|
static gboolean
|
Tue Mar 16 17:43:33 1999 Tim Janik <timj@gtk.org>
Wed Mar 17 01:46:28 1999 Tim Janik <timj@gtk.org>
* merges from gtk-1-2:
Tue Mar 16 17:43:33 1999 Tim Janik <timj@gtk.org>
* gtk/gtkitemfactory.c (gtk_item_factory_parse_rc_string): ensure the
item factory class has been created.
(gtk_item_factory_parse_rc): likewise.
* gtk/gtkmenu.c:
keep proper references for old_active_menu_item.
(gtk_menu_reparent): unset the usize of the new parent,
so the menu can sanely be size requested and we don't get nasty screen
artefacts upon next reparentation.
(gtk_menu_motion_notify): set send_event to TRUE if we synthesize an
enter notify. only synthesize enter notifies if the pointer really is
inside the event window.
(gtk_menu_popdown): use gtk_menu_shell_deselect().
(gtk_menu_popup): move the background setting stuff into
gtk_menu_tearoff_bg_copy() so it can be called from other places as well.
* gtk/gtkmenushell.c (gtk_menu_shell_button_press): use
gtk_menu_shell_select_item() to select the new item.
(gtk_menu_shell_deselect): export this function, so gtkmenu.c can
do the right thing for deselection as well.
Sat Mar 15 20:10:33 1999 Tim Janik <timj@gtk.org>
* gtk/gtkwidget.[hc]:
(gtk_widget_accelerators_locked): return whether a widget's accelerators
are locked.
* gtk/gtkmenu.c (gtk_menu_key_press): don't remove or install new or
existing accelerators if the widget's accelerators are locked.
Sat Mar 14 19:44:05 1999 Tim Janik <timj@gtk.org>
* gtk/gtkitemfactory.[hc]: allow managing of foreign menu items.
* gtk/gtkmenu.c: truely forward key press and key release events to
the menu widget from the toplevel or tearoff window. we can't simply
connect to that, we need to stop further processing of the events as
well.
Sat Mar 13 13:14:17 1999 Tim Janik <timj@gtk.org>
* gtk/gtkmenu.c:
(gtk_menu_key_press): pass event->keyval, event->state to
gtk_accelerator_valid, instead of event->keyval twice.
refuse to install single letter accelerators for menus that use
single letter shortcuts.
* gtk/gtkitemfactory.c (gtk_item_factory_create_item): use
gtk_menu_ensure_uline_accel_group().
* gtk/gtkmenu.[hc]: added gtk_menu_ensure_uline_accel_group()
which will always return an uline accel group, made
gtk_menu_get_uline_accel_group() return NULL if the group isn't
yet created.
Mon Mar 15 01:03:27 1999 Lars Hamann <lars@gtk.org>
* gtk/gtkclist.h (struct _GtkCListColumn): added button_passive flag.
* gtk/gtkclist.c (gtk_clist_column_title_passive):
Leave button sensitive, trap button_press, button_release,
motion_notify, enter_notify and leave_notify events instead.
(gtk_clist_column_title_active): disconnect event handler.
(gtk_clist_drag_data_get): fixed memory leak. Reported by
Guillaume Laurent <glaurent@worldnet.fr>
Wed Mar 10 23:49:55 1999 Lars Hamann <lars@gtk.org>
* gtk/gtklayout.c (gtk_layout_adjustment_changed): fixed a few
width/height mixups.
* gtk/gtkctree.c (tree_delete): emit an tree_unselect_row signal
if needed.
Wed Mar 10 00:11:32 1999 Tim Janik <timj@gtk.org>
* gtk/testgtk.c (create_item_factory): unref the item factory after
window's destruction.
* gtk/gtkmenushell.c (gtk_menu_shell_activate_item): keep a reference
count on the menu shell around the menu item's activation, since the
signal emission may cause menu shell destruction.
* gtk/gtkitemfactory.c:
the previous code leaked one accel group per menu. we use
gtk_menu_get_uline_accel_group() now to fix that, and with that
also create the underline accelerator group of the menus only if
required (i.e. an underline accelerator has been specified).
(gtk_item_factory_construct):
(gtk_item_factory_create_item): removed code that would create an
extra accel group for the menu (and leak references).
(gtk_item_factory_create_item): adapted the underline accelerator
installation code to properly feature gtk_menu_get_uline_accel_group().
* gtk/gtkmenu.[hc]: added gtk_menu_get_accel_group() to retrive
menu->accel_group, this may return NULL if the accelerator group
hasn't been set yet.
added gtk_menu_get_uline_accel_group() to retrive the underline
accelerator group of the menu, this will be created on demand
and proper care is taken about its reference count.
* gtk/gtkitemfactory.h:
* gtk/gtkitemfactory.c:
dumped the approach of keeping a widgets by action list on the
factory since the factory<->widget destroy negotiation didn't work
and would be hard to get going at all. instead we keep a list of
GtkItemFactoryItem items on the factory (GtkItemFactoryItems are
persistant throughout a program's life time).
also, i removed the static const gchar *key_* variables, and made
them inline strings (they weren't actually used anyways).
(gtk_item_factory_add_item): update ifactory->items.
(gtk_item_factory_destroy): destroy ifactory->items (and remove
the item factory pointer from the remaining ifactory widgets).
(gtk_item_factory_get_widget_by_action): walk the GtkItemFactoryItem
list to find the widget.
(gtk_item_factory_get_item): new function that works around
gtk_item_factory_get_widget() limitations, this function will only
return menu items, even for <Branch> entries.
Tue Mar 9 01:01:28 1999 Tim Janik <timj@gtk.org>
* gdk/gdkfont.c (gdk_font_load): first lookup the xfont ID in our
font hash table, if we have a GdkFontPrivate entry for this font
already, simply increment its reference count, provided by Olaf Dietsche
<olaf.dietsche+list.gtk@netcologne.de>.
* gtk/gtkstyle.c (gtk_style_copy): plug a GdkFont reference leak, fix
provided by Olaf Dietsche <olaf.dietsche+list.gtk@netcologne.de>.
Sun Mar 7 06:13:29 1999 Tim Janik <timj@gtk.org>
* gtk/gtkcontainer.c:
(gtk_container_add_with_args):
(gtk_container_addv):
(gtk_container_add): before adding a child to a conatiner, make sure
it is (default) constructed, this is neccessary because under certain
circumstances the child will get relized and mapped immediatedly, in
which case it has to be constructed already.
Mon Mar 1 17:58:21 1999 Tim Janik <timj@gtk.org>
* gtk/gtksignal.c (gtk_signal_connect_by_type): count object_signal
values > 1 as TRUE also.
1999-03-17 01:39:42 +00:00
|
|
|
|
gtk_menu_window_event (GtkWidget *window,
|
2010-12-23 20:50:18 +00:00
|
|
|
|
GdkEvent *event,
|
|
|
|
|
GtkWidget *menu)
|
Tue Mar 16 17:43:33 1999 Tim Janik <timj@gtk.org>
Wed Mar 17 01:46:28 1999 Tim Janik <timj@gtk.org>
* merges from gtk-1-2:
Tue Mar 16 17:43:33 1999 Tim Janik <timj@gtk.org>
* gtk/gtkitemfactory.c (gtk_item_factory_parse_rc_string): ensure the
item factory class has been created.
(gtk_item_factory_parse_rc): likewise.
* gtk/gtkmenu.c:
keep proper references for old_active_menu_item.
(gtk_menu_reparent): unset the usize of the new parent,
so the menu can sanely be size requested and we don't get nasty screen
artefacts upon next reparentation.
(gtk_menu_motion_notify): set send_event to TRUE if we synthesize an
enter notify. only synthesize enter notifies if the pointer really is
inside the event window.
(gtk_menu_popdown): use gtk_menu_shell_deselect().
(gtk_menu_popup): move the background setting stuff into
gtk_menu_tearoff_bg_copy() so it can be called from other places as well.
* gtk/gtkmenushell.c (gtk_menu_shell_button_press): use
gtk_menu_shell_select_item() to select the new item.
(gtk_menu_shell_deselect): export this function, so gtkmenu.c can
do the right thing for deselection as well.
Sat Mar 15 20:10:33 1999 Tim Janik <timj@gtk.org>
* gtk/gtkwidget.[hc]:
(gtk_widget_accelerators_locked): return whether a widget's accelerators
are locked.
* gtk/gtkmenu.c (gtk_menu_key_press): don't remove or install new or
existing accelerators if the widget's accelerators are locked.
Sat Mar 14 19:44:05 1999 Tim Janik <timj@gtk.org>
* gtk/gtkitemfactory.[hc]: allow managing of foreign menu items.
* gtk/gtkmenu.c: truely forward key press and key release events to
the menu widget from the toplevel or tearoff window. we can't simply
connect to that, we need to stop further processing of the events as
well.
Sat Mar 13 13:14:17 1999 Tim Janik <timj@gtk.org>
* gtk/gtkmenu.c:
(gtk_menu_key_press): pass event->keyval, event->state to
gtk_accelerator_valid, instead of event->keyval twice.
refuse to install single letter accelerators for menus that use
single letter shortcuts.
* gtk/gtkitemfactory.c (gtk_item_factory_create_item): use
gtk_menu_ensure_uline_accel_group().
* gtk/gtkmenu.[hc]: added gtk_menu_ensure_uline_accel_group()
which will always return an uline accel group, made
gtk_menu_get_uline_accel_group() return NULL if the group isn't
yet created.
Mon Mar 15 01:03:27 1999 Lars Hamann <lars@gtk.org>
* gtk/gtkclist.h (struct _GtkCListColumn): added button_passive flag.
* gtk/gtkclist.c (gtk_clist_column_title_passive):
Leave button sensitive, trap button_press, button_release,
motion_notify, enter_notify and leave_notify events instead.
(gtk_clist_column_title_active): disconnect event handler.
(gtk_clist_drag_data_get): fixed memory leak. Reported by
Guillaume Laurent <glaurent@worldnet.fr>
Wed Mar 10 23:49:55 1999 Lars Hamann <lars@gtk.org>
* gtk/gtklayout.c (gtk_layout_adjustment_changed): fixed a few
width/height mixups.
* gtk/gtkctree.c (tree_delete): emit an tree_unselect_row signal
if needed.
Wed Mar 10 00:11:32 1999 Tim Janik <timj@gtk.org>
* gtk/testgtk.c (create_item_factory): unref the item factory after
window's destruction.
* gtk/gtkmenushell.c (gtk_menu_shell_activate_item): keep a reference
count on the menu shell around the menu item's activation, since the
signal emission may cause menu shell destruction.
* gtk/gtkitemfactory.c:
the previous code leaked one accel group per menu. we use
gtk_menu_get_uline_accel_group() now to fix that, and with that
also create the underline accelerator group of the menus only if
required (i.e. an underline accelerator has been specified).
(gtk_item_factory_construct):
(gtk_item_factory_create_item): removed code that would create an
extra accel group for the menu (and leak references).
(gtk_item_factory_create_item): adapted the underline accelerator
installation code to properly feature gtk_menu_get_uline_accel_group().
* gtk/gtkmenu.[hc]: added gtk_menu_get_accel_group() to retrive
menu->accel_group, this may return NULL if the accelerator group
hasn't been set yet.
added gtk_menu_get_uline_accel_group() to retrive the underline
accelerator group of the menu, this will be created on demand
and proper care is taken about its reference count.
* gtk/gtkitemfactory.h:
* gtk/gtkitemfactory.c:
dumped the approach of keeping a widgets by action list on the
factory since the factory<->widget destroy negotiation didn't work
and would be hard to get going at all. instead we keep a list of
GtkItemFactoryItem items on the factory (GtkItemFactoryItems are
persistant throughout a program's life time).
also, i removed the static const gchar *key_* variables, and made
them inline strings (they weren't actually used anyways).
(gtk_item_factory_add_item): update ifactory->items.
(gtk_item_factory_destroy): destroy ifactory->items (and remove
the item factory pointer from the remaining ifactory widgets).
(gtk_item_factory_get_widget_by_action): walk the GtkItemFactoryItem
list to find the widget.
(gtk_item_factory_get_item): new function that works around
gtk_item_factory_get_widget() limitations, this function will only
return menu items, even for <Branch> entries.
Tue Mar 9 01:01:28 1999 Tim Janik <timj@gtk.org>
* gdk/gdkfont.c (gdk_font_load): first lookup the xfont ID in our
font hash table, if we have a GdkFontPrivate entry for this font
already, simply increment its reference count, provided by Olaf Dietsche
<olaf.dietsche+list.gtk@netcologne.de>.
* gtk/gtkstyle.c (gtk_style_copy): plug a GdkFont reference leak, fix
provided by Olaf Dietsche <olaf.dietsche+list.gtk@netcologne.de>.
Sun Mar 7 06:13:29 1999 Tim Janik <timj@gtk.org>
* gtk/gtkcontainer.c:
(gtk_container_add_with_args):
(gtk_container_addv):
(gtk_container_add): before adding a child to a conatiner, make sure
it is (default) constructed, this is neccessary because under certain
circumstances the child will get relized and mapped immediatedly, in
which case it has to be constructed already.
Mon Mar 1 17:58:21 1999 Tim Janik <timj@gtk.org>
* gtk/gtksignal.c (gtk_signal_connect_by_type): count object_signal
values > 1 as TRUE also.
1999-03-17 01:39:42 +00:00
|
|
|
|
{
|
|
|
|
|
gboolean handled = FALSE;
|
|
|
|
|
|
2002-10-05 01:51:16 +00:00
|
|
|
|
g_object_ref (window);
|
|
|
|
|
g_object_ref (menu);
|
Tue Mar 16 17:43:33 1999 Tim Janik <timj@gtk.org>
Wed Mar 17 01:46:28 1999 Tim Janik <timj@gtk.org>
* merges from gtk-1-2:
Tue Mar 16 17:43:33 1999 Tim Janik <timj@gtk.org>
* gtk/gtkitemfactory.c (gtk_item_factory_parse_rc_string): ensure the
item factory class has been created.
(gtk_item_factory_parse_rc): likewise.
* gtk/gtkmenu.c:
keep proper references for old_active_menu_item.
(gtk_menu_reparent): unset the usize of the new parent,
so the menu can sanely be size requested and we don't get nasty screen
artefacts upon next reparentation.
(gtk_menu_motion_notify): set send_event to TRUE if we synthesize an
enter notify. only synthesize enter notifies if the pointer really is
inside the event window.
(gtk_menu_popdown): use gtk_menu_shell_deselect().
(gtk_menu_popup): move the background setting stuff into
gtk_menu_tearoff_bg_copy() so it can be called from other places as well.
* gtk/gtkmenushell.c (gtk_menu_shell_button_press): use
gtk_menu_shell_select_item() to select the new item.
(gtk_menu_shell_deselect): export this function, so gtkmenu.c can
do the right thing for deselection as well.
Sat Mar 15 20:10:33 1999 Tim Janik <timj@gtk.org>
* gtk/gtkwidget.[hc]:
(gtk_widget_accelerators_locked): return whether a widget's accelerators
are locked.
* gtk/gtkmenu.c (gtk_menu_key_press): don't remove or install new or
existing accelerators if the widget's accelerators are locked.
Sat Mar 14 19:44:05 1999 Tim Janik <timj@gtk.org>
* gtk/gtkitemfactory.[hc]: allow managing of foreign menu items.
* gtk/gtkmenu.c: truely forward key press and key release events to
the menu widget from the toplevel or tearoff window. we can't simply
connect to that, we need to stop further processing of the events as
well.
Sat Mar 13 13:14:17 1999 Tim Janik <timj@gtk.org>
* gtk/gtkmenu.c:
(gtk_menu_key_press): pass event->keyval, event->state to
gtk_accelerator_valid, instead of event->keyval twice.
refuse to install single letter accelerators for menus that use
single letter shortcuts.
* gtk/gtkitemfactory.c (gtk_item_factory_create_item): use
gtk_menu_ensure_uline_accel_group().
* gtk/gtkmenu.[hc]: added gtk_menu_ensure_uline_accel_group()
which will always return an uline accel group, made
gtk_menu_get_uline_accel_group() return NULL if the group isn't
yet created.
Mon Mar 15 01:03:27 1999 Lars Hamann <lars@gtk.org>
* gtk/gtkclist.h (struct _GtkCListColumn): added button_passive flag.
* gtk/gtkclist.c (gtk_clist_column_title_passive):
Leave button sensitive, trap button_press, button_release,
motion_notify, enter_notify and leave_notify events instead.
(gtk_clist_column_title_active): disconnect event handler.
(gtk_clist_drag_data_get): fixed memory leak. Reported by
Guillaume Laurent <glaurent@worldnet.fr>
Wed Mar 10 23:49:55 1999 Lars Hamann <lars@gtk.org>
* gtk/gtklayout.c (gtk_layout_adjustment_changed): fixed a few
width/height mixups.
* gtk/gtkctree.c (tree_delete): emit an tree_unselect_row signal
if needed.
Wed Mar 10 00:11:32 1999 Tim Janik <timj@gtk.org>
* gtk/testgtk.c (create_item_factory): unref the item factory after
window's destruction.
* gtk/gtkmenushell.c (gtk_menu_shell_activate_item): keep a reference
count on the menu shell around the menu item's activation, since the
signal emission may cause menu shell destruction.
* gtk/gtkitemfactory.c:
the previous code leaked one accel group per menu. we use
gtk_menu_get_uline_accel_group() now to fix that, and with that
also create the underline accelerator group of the menus only if
required (i.e. an underline accelerator has been specified).
(gtk_item_factory_construct):
(gtk_item_factory_create_item): removed code that would create an
extra accel group for the menu (and leak references).
(gtk_item_factory_create_item): adapted the underline accelerator
installation code to properly feature gtk_menu_get_uline_accel_group().
* gtk/gtkmenu.[hc]: added gtk_menu_get_accel_group() to retrive
menu->accel_group, this may return NULL if the accelerator group
hasn't been set yet.
added gtk_menu_get_uline_accel_group() to retrive the underline
accelerator group of the menu, this will be created on demand
and proper care is taken about its reference count.
* gtk/gtkitemfactory.h:
* gtk/gtkitemfactory.c:
dumped the approach of keeping a widgets by action list on the
factory since the factory<->widget destroy negotiation didn't work
and would be hard to get going at all. instead we keep a list of
GtkItemFactoryItem items on the factory (GtkItemFactoryItems are
persistant throughout a program's life time).
also, i removed the static const gchar *key_* variables, and made
them inline strings (they weren't actually used anyways).
(gtk_item_factory_add_item): update ifactory->items.
(gtk_item_factory_destroy): destroy ifactory->items (and remove
the item factory pointer from the remaining ifactory widgets).
(gtk_item_factory_get_widget_by_action): walk the GtkItemFactoryItem
list to find the widget.
(gtk_item_factory_get_item): new function that works around
gtk_item_factory_get_widget() limitations, this function will only
return menu items, even for <Branch> entries.
Tue Mar 9 01:01:28 1999 Tim Janik <timj@gtk.org>
* gdk/gdkfont.c (gdk_font_load): first lookup the xfont ID in our
font hash table, if we have a GdkFontPrivate entry for this font
already, simply increment its reference count, provided by Olaf Dietsche
<olaf.dietsche+list.gtk@netcologne.de>.
* gtk/gtkstyle.c (gtk_style_copy): plug a GdkFont reference leak, fix
provided by Olaf Dietsche <olaf.dietsche+list.gtk@netcologne.de>.
Sun Mar 7 06:13:29 1999 Tim Janik <timj@gtk.org>
* gtk/gtkcontainer.c:
(gtk_container_add_with_args):
(gtk_container_addv):
(gtk_container_add): before adding a child to a conatiner, make sure
it is (default) constructed, this is neccessary because under certain
circumstances the child will get relized and mapped immediatedly, in
which case it has to be constructed already.
Mon Mar 1 17:58:21 1999 Tim Janik <timj@gtk.org>
* gtk/gtksignal.c (gtk_signal_connect_by_type): count object_signal
values > 1 as TRUE also.
1999-03-17 01:39:42 +00:00
|
|
|
|
|
|
|
|
|
switch (event->type)
|
|
|
|
|
{
|
|
|
|
|
case GDK_KEY_PRESS:
|
|
|
|
|
case GDK_KEY_RELEASE:
|
Add note about GtkMenuPositionFunc API changes.
2000-11-08 Alexander Larsson <alexl@redhat.com>
* docs/Changes-2.0.txt: Add note about GtkMenuPositionFunc
API changes.
* gtk/gtkmenu.c: Add support for scrolling menus.
Remove gtk_menu_append/prepend/insert, these have been moved to
gtkcompat.h as #defines.
* gtk/gtkcompat.h.in:
Add compatibility #defines for gtk_menu_append/prepend/insert
* gtk/gtkmenu.h: Add data needed for scrolling menus.
GtkMenuPositionFunc gets an extra argument push_in.
gtk_menu_append/prepend/insert removed.
* gtk/gtkmenuitem.c (gtk_menu_item_position_menu): Change menu
positioning behaviour to fit to scrolling menus.
* gtk/gtkmenuitem.c (gtk_menu_item_forall): Don't recurse
into menuitem->submeny. That is wrong, and broke torn
off submenus of torn off menus, since they were unrealized
when the first menu was unrealized.
* gtk/gtkmenushell.[ch]: Virtualize gtk_menu_shell_insert() and
gtk_menu_shell_select_item() since these need to be overridden in
GtkMenu.
* gtk/gtkoptionmenu.c (gtk_opttion_menu_position): Change menu
positioning behaviour to fit to scrolling menus.
(gtk_option_menu_key_press, gtk_option_menu_button_press): Select
the current item so that it is prelighted when the menu pops up.
This is a workaround to the fact that the menu doesn't get the
initial enter event (due to grabs).
* gtk/gtkfilesel.c, gtk/gtkinputdialog.c, gtk/testgtk.c:
s/gtk_menu_append/gtk_menu_shell_append/
* gtk/gtknotebook.c:
s/gtk_menu_insert/gtk_menu_shell_insert/
* gtk/testgtk.c (create_menu, create_menus):
Create the first menu with 50 items so that menu scrolling
can be tested.
Patch from Jonathan Blandford <jrb@redhat.com>
* gtk/gtkmenuitem.[ch] (gtk_menu_item_toggle_size_request): new
system to handle size requests. First, we ask what the size of
the toggle is. Then, when allocating the size, we allocate the
toggle_size first. This way we can have multiple menu-item
classes w/o needing a seperate class for each.
* gtk/gtkmenu.c (gtk_menu_size_request): Actually use the new system.
* gtk/gtkmenu.c (gtk_menu_size_allocate): Use the new system.
* gtk/gtkcheckmenuitem.c
(gtk_check_menu_item_toggle_size_request): New function to handle
the toggle size-request.
2000-11-08 17:34:52 +00:00
|
|
|
|
handled = gtk_widget_event (menu, event);
|
Tue Mar 16 17:43:33 1999 Tim Janik <timj@gtk.org>
Wed Mar 17 01:46:28 1999 Tim Janik <timj@gtk.org>
* merges from gtk-1-2:
Tue Mar 16 17:43:33 1999 Tim Janik <timj@gtk.org>
* gtk/gtkitemfactory.c (gtk_item_factory_parse_rc_string): ensure the
item factory class has been created.
(gtk_item_factory_parse_rc): likewise.
* gtk/gtkmenu.c:
keep proper references for old_active_menu_item.
(gtk_menu_reparent): unset the usize of the new parent,
so the menu can sanely be size requested and we don't get nasty screen
artefacts upon next reparentation.
(gtk_menu_motion_notify): set send_event to TRUE if we synthesize an
enter notify. only synthesize enter notifies if the pointer really is
inside the event window.
(gtk_menu_popdown): use gtk_menu_shell_deselect().
(gtk_menu_popup): move the background setting stuff into
gtk_menu_tearoff_bg_copy() so it can be called from other places as well.
* gtk/gtkmenushell.c (gtk_menu_shell_button_press): use
gtk_menu_shell_select_item() to select the new item.
(gtk_menu_shell_deselect): export this function, so gtkmenu.c can
do the right thing for deselection as well.
Sat Mar 15 20:10:33 1999 Tim Janik <timj@gtk.org>
* gtk/gtkwidget.[hc]:
(gtk_widget_accelerators_locked): return whether a widget's accelerators
are locked.
* gtk/gtkmenu.c (gtk_menu_key_press): don't remove or install new or
existing accelerators if the widget's accelerators are locked.
Sat Mar 14 19:44:05 1999 Tim Janik <timj@gtk.org>
* gtk/gtkitemfactory.[hc]: allow managing of foreign menu items.
* gtk/gtkmenu.c: truely forward key press and key release events to
the menu widget from the toplevel or tearoff window. we can't simply
connect to that, we need to stop further processing of the events as
well.
Sat Mar 13 13:14:17 1999 Tim Janik <timj@gtk.org>
* gtk/gtkmenu.c:
(gtk_menu_key_press): pass event->keyval, event->state to
gtk_accelerator_valid, instead of event->keyval twice.
refuse to install single letter accelerators for menus that use
single letter shortcuts.
* gtk/gtkitemfactory.c (gtk_item_factory_create_item): use
gtk_menu_ensure_uline_accel_group().
* gtk/gtkmenu.[hc]: added gtk_menu_ensure_uline_accel_group()
which will always return an uline accel group, made
gtk_menu_get_uline_accel_group() return NULL if the group isn't
yet created.
Mon Mar 15 01:03:27 1999 Lars Hamann <lars@gtk.org>
* gtk/gtkclist.h (struct _GtkCListColumn): added button_passive flag.
* gtk/gtkclist.c (gtk_clist_column_title_passive):
Leave button sensitive, trap button_press, button_release,
motion_notify, enter_notify and leave_notify events instead.
(gtk_clist_column_title_active): disconnect event handler.
(gtk_clist_drag_data_get): fixed memory leak. Reported by
Guillaume Laurent <glaurent@worldnet.fr>
Wed Mar 10 23:49:55 1999 Lars Hamann <lars@gtk.org>
* gtk/gtklayout.c (gtk_layout_adjustment_changed): fixed a few
width/height mixups.
* gtk/gtkctree.c (tree_delete): emit an tree_unselect_row signal
if needed.
Wed Mar 10 00:11:32 1999 Tim Janik <timj@gtk.org>
* gtk/testgtk.c (create_item_factory): unref the item factory after
window's destruction.
* gtk/gtkmenushell.c (gtk_menu_shell_activate_item): keep a reference
count on the menu shell around the menu item's activation, since the
signal emission may cause menu shell destruction.
* gtk/gtkitemfactory.c:
the previous code leaked one accel group per menu. we use
gtk_menu_get_uline_accel_group() now to fix that, and with that
also create the underline accelerator group of the menus only if
required (i.e. an underline accelerator has been specified).
(gtk_item_factory_construct):
(gtk_item_factory_create_item): removed code that would create an
extra accel group for the menu (and leak references).
(gtk_item_factory_create_item): adapted the underline accelerator
installation code to properly feature gtk_menu_get_uline_accel_group().
* gtk/gtkmenu.[hc]: added gtk_menu_get_accel_group() to retrive
menu->accel_group, this may return NULL if the accelerator group
hasn't been set yet.
added gtk_menu_get_uline_accel_group() to retrive the underline
accelerator group of the menu, this will be created on demand
and proper care is taken about its reference count.
* gtk/gtkitemfactory.h:
* gtk/gtkitemfactory.c:
dumped the approach of keeping a widgets by action list on the
factory since the factory<->widget destroy negotiation didn't work
and would be hard to get going at all. instead we keep a list of
GtkItemFactoryItem items on the factory (GtkItemFactoryItems are
persistant throughout a program's life time).
also, i removed the static const gchar *key_* variables, and made
them inline strings (they weren't actually used anyways).
(gtk_item_factory_add_item): update ifactory->items.
(gtk_item_factory_destroy): destroy ifactory->items (and remove
the item factory pointer from the remaining ifactory widgets).
(gtk_item_factory_get_widget_by_action): walk the GtkItemFactoryItem
list to find the widget.
(gtk_item_factory_get_item): new function that works around
gtk_item_factory_get_widget() limitations, this function will only
return menu items, even for <Branch> entries.
Tue Mar 9 01:01:28 1999 Tim Janik <timj@gtk.org>
* gdk/gdkfont.c (gdk_font_load): first lookup the xfont ID in our
font hash table, if we have a GdkFontPrivate entry for this font
already, simply increment its reference count, provided by Olaf Dietsche
<olaf.dietsche+list.gtk@netcologne.de>.
* gtk/gtkstyle.c (gtk_style_copy): plug a GdkFont reference leak, fix
provided by Olaf Dietsche <olaf.dietsche+list.gtk@netcologne.de>.
Sun Mar 7 06:13:29 1999 Tim Janik <timj@gtk.org>
* gtk/gtkcontainer.c:
(gtk_container_add_with_args):
(gtk_container_addv):
(gtk_container_add): before adding a child to a conatiner, make sure
it is (default) constructed, this is neccessary because under certain
circumstances the child will get relized and mapped immediatedly, in
which case it has to be constructed already.
Mon Mar 1 17:58:21 1999 Tim Janik <timj@gtk.org>
* gtk/gtksignal.c (gtk_signal_connect_by_type): count object_signal
values > 1 as TRUE also.
1999-03-17 01:39:42 +00:00
|
|
|
|
break;
|
2012-02-27 12:35:25 +00:00
|
|
|
|
case GDK_WINDOW_STATE:
|
|
|
|
|
/* Window for the menu has been closed by the display server or by GDK.
|
|
|
|
|
* Update the internal state as if the user had clicked outside the
|
|
|
|
|
* menu
|
|
|
|
|
*/
|
|
|
|
|
if (event->window_state.new_window_state & GDK_WINDOW_STATE_WITHDRAWN &&
|
|
|
|
|
event->window_state.changed_mask & GDK_WINDOW_STATE_WITHDRAWN)
|
|
|
|
|
gtk_menu_shell_deactivate (GTK_MENU_SHELL(menu));
|
|
|
|
|
break;
|
Tue Mar 16 17:43:33 1999 Tim Janik <timj@gtk.org>
Wed Mar 17 01:46:28 1999 Tim Janik <timj@gtk.org>
* merges from gtk-1-2:
Tue Mar 16 17:43:33 1999 Tim Janik <timj@gtk.org>
* gtk/gtkitemfactory.c (gtk_item_factory_parse_rc_string): ensure the
item factory class has been created.
(gtk_item_factory_parse_rc): likewise.
* gtk/gtkmenu.c:
keep proper references for old_active_menu_item.
(gtk_menu_reparent): unset the usize of the new parent,
so the menu can sanely be size requested and we don't get nasty screen
artefacts upon next reparentation.
(gtk_menu_motion_notify): set send_event to TRUE if we synthesize an
enter notify. only synthesize enter notifies if the pointer really is
inside the event window.
(gtk_menu_popdown): use gtk_menu_shell_deselect().
(gtk_menu_popup): move the background setting stuff into
gtk_menu_tearoff_bg_copy() so it can be called from other places as well.
* gtk/gtkmenushell.c (gtk_menu_shell_button_press): use
gtk_menu_shell_select_item() to select the new item.
(gtk_menu_shell_deselect): export this function, so gtkmenu.c can
do the right thing for deselection as well.
Sat Mar 15 20:10:33 1999 Tim Janik <timj@gtk.org>
* gtk/gtkwidget.[hc]:
(gtk_widget_accelerators_locked): return whether a widget's accelerators
are locked.
* gtk/gtkmenu.c (gtk_menu_key_press): don't remove or install new or
existing accelerators if the widget's accelerators are locked.
Sat Mar 14 19:44:05 1999 Tim Janik <timj@gtk.org>
* gtk/gtkitemfactory.[hc]: allow managing of foreign menu items.
* gtk/gtkmenu.c: truely forward key press and key release events to
the menu widget from the toplevel or tearoff window. we can't simply
connect to that, we need to stop further processing of the events as
well.
Sat Mar 13 13:14:17 1999 Tim Janik <timj@gtk.org>
* gtk/gtkmenu.c:
(gtk_menu_key_press): pass event->keyval, event->state to
gtk_accelerator_valid, instead of event->keyval twice.
refuse to install single letter accelerators for menus that use
single letter shortcuts.
* gtk/gtkitemfactory.c (gtk_item_factory_create_item): use
gtk_menu_ensure_uline_accel_group().
* gtk/gtkmenu.[hc]: added gtk_menu_ensure_uline_accel_group()
which will always return an uline accel group, made
gtk_menu_get_uline_accel_group() return NULL if the group isn't
yet created.
Mon Mar 15 01:03:27 1999 Lars Hamann <lars@gtk.org>
* gtk/gtkclist.h (struct _GtkCListColumn): added button_passive flag.
* gtk/gtkclist.c (gtk_clist_column_title_passive):
Leave button sensitive, trap button_press, button_release,
motion_notify, enter_notify and leave_notify events instead.
(gtk_clist_column_title_active): disconnect event handler.
(gtk_clist_drag_data_get): fixed memory leak. Reported by
Guillaume Laurent <glaurent@worldnet.fr>
Wed Mar 10 23:49:55 1999 Lars Hamann <lars@gtk.org>
* gtk/gtklayout.c (gtk_layout_adjustment_changed): fixed a few
width/height mixups.
* gtk/gtkctree.c (tree_delete): emit an tree_unselect_row signal
if needed.
Wed Mar 10 00:11:32 1999 Tim Janik <timj@gtk.org>
* gtk/testgtk.c (create_item_factory): unref the item factory after
window's destruction.
* gtk/gtkmenushell.c (gtk_menu_shell_activate_item): keep a reference
count on the menu shell around the menu item's activation, since the
signal emission may cause menu shell destruction.
* gtk/gtkitemfactory.c:
the previous code leaked one accel group per menu. we use
gtk_menu_get_uline_accel_group() now to fix that, and with that
also create the underline accelerator group of the menus only if
required (i.e. an underline accelerator has been specified).
(gtk_item_factory_construct):
(gtk_item_factory_create_item): removed code that would create an
extra accel group for the menu (and leak references).
(gtk_item_factory_create_item): adapted the underline accelerator
installation code to properly feature gtk_menu_get_uline_accel_group().
* gtk/gtkmenu.[hc]: added gtk_menu_get_accel_group() to retrive
menu->accel_group, this may return NULL if the accelerator group
hasn't been set yet.
added gtk_menu_get_uline_accel_group() to retrive the underline
accelerator group of the menu, this will be created on demand
and proper care is taken about its reference count.
* gtk/gtkitemfactory.h:
* gtk/gtkitemfactory.c:
dumped the approach of keeping a widgets by action list on the
factory since the factory<->widget destroy negotiation didn't work
and would be hard to get going at all. instead we keep a list of
GtkItemFactoryItem items on the factory (GtkItemFactoryItems are
persistant throughout a program's life time).
also, i removed the static const gchar *key_* variables, and made
them inline strings (they weren't actually used anyways).
(gtk_item_factory_add_item): update ifactory->items.
(gtk_item_factory_destroy): destroy ifactory->items (and remove
the item factory pointer from the remaining ifactory widgets).
(gtk_item_factory_get_widget_by_action): walk the GtkItemFactoryItem
list to find the widget.
(gtk_item_factory_get_item): new function that works around
gtk_item_factory_get_widget() limitations, this function will only
return menu items, even for <Branch> entries.
Tue Mar 9 01:01:28 1999 Tim Janik <timj@gtk.org>
* gdk/gdkfont.c (gdk_font_load): first lookup the xfont ID in our
font hash table, if we have a GdkFontPrivate entry for this font
already, simply increment its reference count, provided by Olaf Dietsche
<olaf.dietsche+list.gtk@netcologne.de>.
* gtk/gtkstyle.c (gtk_style_copy): plug a GdkFont reference leak, fix
provided by Olaf Dietsche <olaf.dietsche+list.gtk@netcologne.de>.
Sun Mar 7 06:13:29 1999 Tim Janik <timj@gtk.org>
* gtk/gtkcontainer.c:
(gtk_container_add_with_args):
(gtk_container_addv):
(gtk_container_add): before adding a child to a conatiner, make sure
it is (default) constructed, this is neccessary because under certain
circumstances the child will get relized and mapped immediatedly, in
which case it has to be constructed already.
Mon Mar 1 17:58:21 1999 Tim Janik <timj@gtk.org>
* gtk/gtksignal.c (gtk_signal_connect_by_type): count object_signal
values > 1 as TRUE also.
1999-03-17 01:39:42 +00:00
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
2002-10-05 01:51:16 +00:00
|
|
|
|
g_object_unref (window);
|
|
|
|
|
g_object_unref (menu);
|
Tue Mar 16 17:43:33 1999 Tim Janik <timj@gtk.org>
Wed Mar 17 01:46:28 1999 Tim Janik <timj@gtk.org>
* merges from gtk-1-2:
Tue Mar 16 17:43:33 1999 Tim Janik <timj@gtk.org>
* gtk/gtkitemfactory.c (gtk_item_factory_parse_rc_string): ensure the
item factory class has been created.
(gtk_item_factory_parse_rc): likewise.
* gtk/gtkmenu.c:
keep proper references for old_active_menu_item.
(gtk_menu_reparent): unset the usize of the new parent,
so the menu can sanely be size requested and we don't get nasty screen
artefacts upon next reparentation.
(gtk_menu_motion_notify): set send_event to TRUE if we synthesize an
enter notify. only synthesize enter notifies if the pointer really is
inside the event window.
(gtk_menu_popdown): use gtk_menu_shell_deselect().
(gtk_menu_popup): move the background setting stuff into
gtk_menu_tearoff_bg_copy() so it can be called from other places as well.
* gtk/gtkmenushell.c (gtk_menu_shell_button_press): use
gtk_menu_shell_select_item() to select the new item.
(gtk_menu_shell_deselect): export this function, so gtkmenu.c can
do the right thing for deselection as well.
Sat Mar 15 20:10:33 1999 Tim Janik <timj@gtk.org>
* gtk/gtkwidget.[hc]:
(gtk_widget_accelerators_locked): return whether a widget's accelerators
are locked.
* gtk/gtkmenu.c (gtk_menu_key_press): don't remove or install new or
existing accelerators if the widget's accelerators are locked.
Sat Mar 14 19:44:05 1999 Tim Janik <timj@gtk.org>
* gtk/gtkitemfactory.[hc]: allow managing of foreign menu items.
* gtk/gtkmenu.c: truely forward key press and key release events to
the menu widget from the toplevel or tearoff window. we can't simply
connect to that, we need to stop further processing of the events as
well.
Sat Mar 13 13:14:17 1999 Tim Janik <timj@gtk.org>
* gtk/gtkmenu.c:
(gtk_menu_key_press): pass event->keyval, event->state to
gtk_accelerator_valid, instead of event->keyval twice.
refuse to install single letter accelerators for menus that use
single letter shortcuts.
* gtk/gtkitemfactory.c (gtk_item_factory_create_item): use
gtk_menu_ensure_uline_accel_group().
* gtk/gtkmenu.[hc]: added gtk_menu_ensure_uline_accel_group()
which will always return an uline accel group, made
gtk_menu_get_uline_accel_group() return NULL if the group isn't
yet created.
Mon Mar 15 01:03:27 1999 Lars Hamann <lars@gtk.org>
* gtk/gtkclist.h (struct _GtkCListColumn): added button_passive flag.
* gtk/gtkclist.c (gtk_clist_column_title_passive):
Leave button sensitive, trap button_press, button_release,
motion_notify, enter_notify and leave_notify events instead.
(gtk_clist_column_title_active): disconnect event handler.
(gtk_clist_drag_data_get): fixed memory leak. Reported by
Guillaume Laurent <glaurent@worldnet.fr>
Wed Mar 10 23:49:55 1999 Lars Hamann <lars@gtk.org>
* gtk/gtklayout.c (gtk_layout_adjustment_changed): fixed a few
width/height mixups.
* gtk/gtkctree.c (tree_delete): emit an tree_unselect_row signal
if needed.
Wed Mar 10 00:11:32 1999 Tim Janik <timj@gtk.org>
* gtk/testgtk.c (create_item_factory): unref the item factory after
window's destruction.
* gtk/gtkmenushell.c (gtk_menu_shell_activate_item): keep a reference
count on the menu shell around the menu item's activation, since the
signal emission may cause menu shell destruction.
* gtk/gtkitemfactory.c:
the previous code leaked one accel group per menu. we use
gtk_menu_get_uline_accel_group() now to fix that, and with that
also create the underline accelerator group of the menus only if
required (i.e. an underline accelerator has been specified).
(gtk_item_factory_construct):
(gtk_item_factory_create_item): removed code that would create an
extra accel group for the menu (and leak references).
(gtk_item_factory_create_item): adapted the underline accelerator
installation code to properly feature gtk_menu_get_uline_accel_group().
* gtk/gtkmenu.[hc]: added gtk_menu_get_accel_group() to retrive
menu->accel_group, this may return NULL if the accelerator group
hasn't been set yet.
added gtk_menu_get_uline_accel_group() to retrive the underline
accelerator group of the menu, this will be created on demand
and proper care is taken about its reference count.
* gtk/gtkitemfactory.h:
* gtk/gtkitemfactory.c:
dumped the approach of keeping a widgets by action list on the
factory since the factory<->widget destroy negotiation didn't work
and would be hard to get going at all. instead we keep a list of
GtkItemFactoryItem items on the factory (GtkItemFactoryItems are
persistant throughout a program's life time).
also, i removed the static const gchar *key_* variables, and made
them inline strings (they weren't actually used anyways).
(gtk_item_factory_add_item): update ifactory->items.
(gtk_item_factory_destroy): destroy ifactory->items (and remove
the item factory pointer from the remaining ifactory widgets).
(gtk_item_factory_get_widget_by_action): walk the GtkItemFactoryItem
list to find the widget.
(gtk_item_factory_get_item): new function that works around
gtk_item_factory_get_widget() limitations, this function will only
return menu items, even for <Branch> entries.
Tue Mar 9 01:01:28 1999 Tim Janik <timj@gtk.org>
* gdk/gdkfont.c (gdk_font_load): first lookup the xfont ID in our
font hash table, if we have a GdkFontPrivate entry for this font
already, simply increment its reference count, provided by Olaf Dietsche
<olaf.dietsche+list.gtk@netcologne.de>.
* gtk/gtkstyle.c (gtk_style_copy): plug a GdkFont reference leak, fix
provided by Olaf Dietsche <olaf.dietsche+list.gtk@netcologne.de>.
Sun Mar 7 06:13:29 1999 Tim Janik <timj@gtk.org>
* gtk/gtkcontainer.c:
(gtk_container_add_with_args):
(gtk_container_addv):
(gtk_container_add): before adding a child to a conatiner, make sure
it is (default) constructed, this is neccessary because under certain
circumstances the child will get relized and mapped immediatedly, in
which case it has to be constructed already.
Mon Mar 1 17:58:21 1999 Tim Janik <timj@gtk.org>
* gtk/gtksignal.c (gtk_signal_connect_by_type): count object_signal
values > 1 as TRUE also.
1999-03-17 01:39:42 +00:00
|
|
|
|
|
|
|
|
|
return handled;
|
|
|
|
|
}
|
|
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
|
static void
|
|
|
|
|
gtk_menu_init (GtkMenu *menu)
|
|
|
|
|
{
|
2010-12-23 20:50:18 +00:00
|
|
|
|
GtkMenuPrivate *priv;
|
2015-12-21 01:30:52 +00:00
|
|
|
|
GtkCssNode *top_arrow_node, *bottom_arrow_node, *widget_node;
|
2004-02-17 22:25:13 +00:00
|
|
|
|
|
2013-06-27 19:02:52 +00:00
|
|
|
|
priv = gtk_menu_get_instance_private (menu);
|
2010-12-23 20:50:18 +00:00
|
|
|
|
|
|
|
|
|
menu->priv = priv;
|
|
|
|
|
|
|
|
|
|
priv->toplevel = g_object_connect (g_object_new (GTK_TYPE_WINDOW,
|
|
|
|
|
"type", GTK_WINDOW_POPUP,
|
|
|
|
|
"child", menu,
|
|
|
|
|
NULL),
|
|
|
|
|
"signal::event", gtk_menu_window_event, menu,
|
|
|
|
|
"signal::destroy", gtk_widget_destroyed, &priv->toplevel,
|
|
|
|
|
NULL);
|
|
|
|
|
gtk_window_set_resizable (GTK_WINDOW (priv->toplevel), FALSE);
|
|
|
|
|
gtk_window_set_mnemonic_modifier (GTK_WINDOW (priv->toplevel), 0);
|
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
|
|
|
|
|
2014-06-07 01:30:55 +00:00
|
|
|
|
_gtk_window_request_csd (GTK_WINDOW (priv->toplevel));
|
2014-06-12 13:09:30 +00:00
|
|
|
|
gtk_style_context_add_class (gtk_widget_get_style_context (priv->toplevel),
|
|
|
|
|
GTK_STYLE_CLASS_POPUP);
|
2014-06-06 23:06:15 +00:00
|
|
|
|
|
1998-09-01 18:41:26 +00:00
|
|
|
|
/* Refloat the menu, so that reference counting for the menu isn't
|
|
|
|
|
* affected by it being a child of the toplevel
|
|
|
|
|
*/
|
2005-11-23 18:06:58 +00:00
|
|
|
|
g_object_force_floating (G_OBJECT (menu));
|
2010-12-23 20:50:18 +00:00
|
|
|
|
priv->needs_destruction_ref = TRUE;
|
1998-09-01 18:41:26 +00:00
|
|
|
|
|
2008-07-04 21:20:25 +00:00
|
|
|
|
priv->monitor_num = -1;
|
2011-12-12 17:11:57 +00:00
|
|
|
|
priv->drag_start_y = -1;
|
2010-11-21 18:40:28 +00:00
|
|
|
|
|
2016-08-03 03:42:11 +00:00
|
|
|
|
priv->anchor_hints = GDK_ANCHOR_FLIP | GDK_ANCHOR_SLIDE | GDK_ANCHOR_RESIZE;
|
|
|
|
|
priv->rect_anchor_dx = 0;
|
|
|
|
|
priv->rect_anchor_dy = 0;
|
|
|
|
|
priv->menu_type_hint = GDK_WINDOW_TYPE_HINT_POPUP_MENU;
|
|
|
|
|
|
2011-12-12 17:11:57 +00:00
|
|
|
|
_gtk_widget_set_captured_event_handler (GTK_WIDGET (menu), gtk_menu_captured_event);
|
2015-11-03 01:45:46 +00:00
|
|
|
|
|
|
|
|
|
widget_node = gtk_widget_get_css_node (GTK_WIDGET (menu));
|
2015-12-21 01:30:52 +00:00
|
|
|
|
priv->top_arrow_gadget = gtk_builtin_icon_new ("arrow",
|
|
|
|
|
GTK_WIDGET (menu),
|
|
|
|
|
NULL, NULL);
|
|
|
|
|
gtk_css_gadget_add_class (priv->top_arrow_gadget, GTK_STYLE_CLASS_TOP);
|
|
|
|
|
top_arrow_node = gtk_css_gadget_get_node (priv->top_arrow_gadget);
|
|
|
|
|
gtk_css_node_set_parent (top_arrow_node, widget_node);
|
|
|
|
|
gtk_css_node_set_visible (top_arrow_node, FALSE);
|
|
|
|
|
gtk_css_node_set_state (top_arrow_node, gtk_css_node_get_state (widget_node));
|
|
|
|
|
|
|
|
|
|
priv->bottom_arrow_gadget = gtk_builtin_icon_new ("arrow",
|
|
|
|
|
GTK_WIDGET (menu),
|
|
|
|
|
NULL, NULL);
|
|
|
|
|
gtk_css_gadget_add_class (priv->bottom_arrow_gadget, GTK_STYLE_CLASS_BOTTOM);
|
|
|
|
|
bottom_arrow_node = gtk_css_gadget_get_node (priv->bottom_arrow_gadget);
|
|
|
|
|
gtk_css_node_set_parent (bottom_arrow_node, widget_node);
|
|
|
|
|
gtk_css_node_set_visible (bottom_arrow_node, FALSE);
|
|
|
|
|
gtk_css_node_set_state (bottom_arrow_node, gtk_css_node_get_state (widget_node));
|
GTK_RESIZE_NEEDED is a private flag now.
Mon Feb 2 04:15:08 1998 Tim Janik <timj@gimp.org>
* gtk/gtkcontainer.h:
* gtk/gtkcontainer.c: GTK_RESIZE_NEEDED is a private flag now.
(gtk_container_register_toplevel): new function.
(gtk_container_unregister_toplevel): new function.
* gtk/gtkmain.c: GTK_LEAVE_PENDING is a private flag now.
* gtk/gtkmenu.c: call gtk_container_register_toplevel in
gtk_menu_class_init instead of this dirty gtk_widget_set_parent(,NULL)
hack. new default handler gtk_menu_destroy for calling
gtk_container_unregister_toplevel. removed GTK_ANCHORED, GTK_UNMAPPED.
* gtk/gtkobject.h: macro cleanups, added GTK_DESTROYED flag.
* gtk/gtkobject.c: only emit DESTROY signal if !GTK_OBJECT_DESTROYED
(object).
* gtk/gtkprivate.h: new file that will not be automatically included.
it holds the private flags for GtkWidget along with it's SET/UNSET
and examination macros.
* gtk/gtkwidget.c: private flags: GTK_RESIZE_NEEDED, GTK_REDRAW_PENDING,
GTK_RESIZE_PENDING, GTK_IN_REPARENT, GTK_USER_STYLE. GTK_ANCHORED is
replaced by GTK_TOPLEVEL. added missing UNSET for GTK_IN_REPARENT.
removed the gtk_widget_set_parent(, NULL) hack for toplevels.
upon destroy free memory for widgets with GTK_WIDGET_HAS_SHAPE_MASK.
* gtk/gtkwidget.h: split up the widget flags into a public and a private
portion. added an extra field private_flags to GtkWidget without making
it bigger by using an alignment gap of 16 bit. macro cleanups.
* gtk/gtkwindow.c: removed GTK_ANCHORED. new function gtk_window_destroy
for calling gtk_container_unregister_toplevel. removed the
gtk_widget_set_parent(,NULL), call gtk_container_register_toplevel
instead. remove GTK_UNMAPPED. GTK_RESIZE_NEEDED is private now.
* gtk/gtksignal.c (gtk_signal_disconnect): removed a bug on
removal that cut off the handler list -> living_objects == 0
with testgtk. made some warnings more descriptive.
new function gtk_signal_connect_object_while_alive, which
will automatically destroy the connection once one of the objects
is destroyed. didn't include this before removal of the above
mentioned bug.
* reflected refcounting revolution in ChangeLog
1998-02-02 04:54:25 +00:00
|
|
|
|
}
|
|
|
|
|
|
2016-06-14 19:42:13 +00:00
|
|
|
|
static void
|
|
|
|
|
moved_to_rect_cb (GdkWindow *window,
|
|
|
|
|
const GdkRectangle *flipped_rect,
|
|
|
|
|
const GdkRectangle *final_rect,
|
|
|
|
|
gboolean flipped_x,
|
|
|
|
|
gboolean flipped_y,
|
|
|
|
|
GtkMenu *menu)
|
|
|
|
|
{
|
2019-02-06 18:30:54 +00:00
|
|
|
|
GtkMenuPrivate *priv = menu->priv;
|
|
|
|
|
|
|
|
|
|
gtk_window_fixate_size (GTK_WINDOW (priv->toplevel));
|
|
|
|
|
|
|
|
|
|
if (!priv->emulated_move_to_rect)
|
|
|
|
|
g_signal_emit (menu,
|
|
|
|
|
menu_signals[POPPED_UP],
|
|
|
|
|
0,
|
|
|
|
|
flipped_rect,
|
|
|
|
|
final_rect,
|
|
|
|
|
flipped_x,
|
|
|
|
|
flipped_y);
|
2016-06-14 19:42:13 +00:00
|
|
|
|
}
|
|
|
|
|
|
GTK_RESIZE_NEEDED is a private flag now.
Mon Feb 2 04:15:08 1998 Tim Janik <timj@gimp.org>
* gtk/gtkcontainer.h:
* gtk/gtkcontainer.c: GTK_RESIZE_NEEDED is a private flag now.
(gtk_container_register_toplevel): new function.
(gtk_container_unregister_toplevel): new function.
* gtk/gtkmain.c: GTK_LEAVE_PENDING is a private flag now.
* gtk/gtkmenu.c: call gtk_container_register_toplevel in
gtk_menu_class_init instead of this dirty gtk_widget_set_parent(,NULL)
hack. new default handler gtk_menu_destroy for calling
gtk_container_unregister_toplevel. removed GTK_ANCHORED, GTK_UNMAPPED.
* gtk/gtkobject.h: macro cleanups, added GTK_DESTROYED flag.
* gtk/gtkobject.c: only emit DESTROY signal if !GTK_OBJECT_DESTROYED
(object).
* gtk/gtkprivate.h: new file that will not be automatically included.
it holds the private flags for GtkWidget along with it's SET/UNSET
and examination macros.
* gtk/gtkwidget.c: private flags: GTK_RESIZE_NEEDED, GTK_REDRAW_PENDING,
GTK_RESIZE_PENDING, GTK_IN_REPARENT, GTK_USER_STYLE. GTK_ANCHORED is
replaced by GTK_TOPLEVEL. added missing UNSET for GTK_IN_REPARENT.
removed the gtk_widget_set_parent(, NULL) hack for toplevels.
upon destroy free memory for widgets with GTK_WIDGET_HAS_SHAPE_MASK.
* gtk/gtkwidget.h: split up the widget flags into a public and a private
portion. added an extra field private_flags to GtkWidget without making
it bigger by using an alignment gap of 16 bit. macro cleanups.
* gtk/gtkwindow.c: removed GTK_ANCHORED. new function gtk_window_destroy
for calling gtk_container_unregister_toplevel. removed the
gtk_widget_set_parent(,NULL), call gtk_container_register_toplevel
instead. remove GTK_UNMAPPED. GTK_RESIZE_NEEDED is private now.
* gtk/gtksignal.c (gtk_signal_disconnect): removed a bug on
removal that cut off the handler list -> living_objects == 0
with testgtk. made some warnings more descriptive.
new function gtk_signal_connect_object_while_alive, which
will automatically destroy the connection once one of the objects
is destroyed. didn't include this before removal of the above
mentioned bug.
* reflected refcounting revolution in ChangeLog
1998-02-02 04:54:25 +00:00
|
|
|
|
static void
|
2010-09-18 23:55:42 +00:00
|
|
|
|
gtk_menu_destroy (GtkWidget *widget)
|
GTK_RESIZE_NEEDED is a private flag now.
Mon Feb 2 04:15:08 1998 Tim Janik <timj@gimp.org>
* gtk/gtkcontainer.h:
* gtk/gtkcontainer.c: GTK_RESIZE_NEEDED is a private flag now.
(gtk_container_register_toplevel): new function.
(gtk_container_unregister_toplevel): new function.
* gtk/gtkmain.c: GTK_LEAVE_PENDING is a private flag now.
* gtk/gtkmenu.c: call gtk_container_register_toplevel in
gtk_menu_class_init instead of this dirty gtk_widget_set_parent(,NULL)
hack. new default handler gtk_menu_destroy for calling
gtk_container_unregister_toplevel. removed GTK_ANCHORED, GTK_UNMAPPED.
* gtk/gtkobject.h: macro cleanups, added GTK_DESTROYED flag.
* gtk/gtkobject.c: only emit DESTROY signal if !GTK_OBJECT_DESTROYED
(object).
* gtk/gtkprivate.h: new file that will not be automatically included.
it holds the private flags for GtkWidget along with it's SET/UNSET
and examination macros.
* gtk/gtkwidget.c: private flags: GTK_RESIZE_NEEDED, GTK_REDRAW_PENDING,
GTK_RESIZE_PENDING, GTK_IN_REPARENT, GTK_USER_STYLE. GTK_ANCHORED is
replaced by GTK_TOPLEVEL. added missing UNSET for GTK_IN_REPARENT.
removed the gtk_widget_set_parent(, NULL) hack for toplevels.
upon destroy free memory for widgets with GTK_WIDGET_HAS_SHAPE_MASK.
* gtk/gtkwidget.h: split up the widget flags into a public and a private
portion. added an extra field private_flags to GtkWidget without making
it bigger by using an alignment gap of 16 bit. macro cleanups.
* gtk/gtkwindow.c: removed GTK_ANCHORED. new function gtk_window_destroy
for calling gtk_container_unregister_toplevel. removed the
gtk_widget_set_parent(,NULL), call gtk_container_register_toplevel
instead. remove GTK_UNMAPPED. GTK_RESIZE_NEEDED is private now.
* gtk/gtksignal.c (gtk_signal_disconnect): removed a bug on
removal that cut off the handler list -> living_objects == 0
with testgtk. made some warnings more descriptive.
new function gtk_signal_connect_object_while_alive, which
will automatically destroy the connection once one of the objects
is destroyed. didn't include this before removal of the above
mentioned bug.
* reflected refcounting revolution in ChangeLog
1998-02-02 04:54:25 +00:00
|
|
|
|
{
|
2010-09-18 23:55:42 +00:00
|
|
|
|
GtkMenu *menu = GTK_MENU (widget);
|
2010-12-23 20:50:18 +00:00
|
|
|
|
GtkMenuPrivate *priv = menu->priv;
|
1998-02-03 14:13:05 +00:00
|
|
|
|
GtkMenuAttachData *data;
|
Add note about GtkMenuPositionFunc API changes.
2000-11-08 Alexander Larsson <alexl@redhat.com>
* docs/Changes-2.0.txt: Add note about GtkMenuPositionFunc
API changes.
* gtk/gtkmenu.c: Add support for scrolling menus.
Remove gtk_menu_append/prepend/insert, these have been moved to
gtkcompat.h as #defines.
* gtk/gtkcompat.h.in:
Add compatibility #defines for gtk_menu_append/prepend/insert
* gtk/gtkmenu.h: Add data needed for scrolling menus.
GtkMenuPositionFunc gets an extra argument push_in.
gtk_menu_append/prepend/insert removed.
* gtk/gtkmenuitem.c (gtk_menu_item_position_menu): Change menu
positioning behaviour to fit to scrolling menus.
* gtk/gtkmenuitem.c (gtk_menu_item_forall): Don't recurse
into menuitem->submeny. That is wrong, and broke torn
off submenus of torn off menus, since they were unrealized
when the first menu was unrealized.
* gtk/gtkmenushell.[ch]: Virtualize gtk_menu_shell_insert() and
gtk_menu_shell_select_item() since these need to be overridden in
GtkMenu.
* gtk/gtkoptionmenu.c (gtk_opttion_menu_position): Change menu
positioning behaviour to fit to scrolling menus.
(gtk_option_menu_key_press, gtk_option_menu_button_press): Select
the current item so that it is prelighted when the menu pops up.
This is a workaround to the fact that the menu doesn't get the
initial enter event (due to grabs).
* gtk/gtkfilesel.c, gtk/gtkinputdialog.c, gtk/testgtk.c:
s/gtk_menu_append/gtk_menu_shell_append/
* gtk/gtknotebook.c:
s/gtk_menu_insert/gtk_menu_shell_insert/
* gtk/testgtk.c (create_menu, create_menus):
Create the first menu with 50 items so that menu scrolling
can be tested.
Patch from Jonathan Blandford <jrb@redhat.com>
* gtk/gtkmenuitem.[ch] (gtk_menu_item_toggle_size_request): new
system to handle size requests. First, we ask what the size of
the toggle is. Then, when allocating the size, we allocate the
toggle_size first. This way we can have multiple menu-item
classes w/o needing a seperate class for each.
* gtk/gtkmenu.c (gtk_menu_size_request): Actually use the new system.
* gtk/gtkmenu.c (gtk_menu_size_allocate): Use the new system.
* gtk/gtkcheckmenuitem.c
(gtk_check_menu_item_toggle_size_request): New function to handle
the toggle size-request.
2000-11-08 17:34:52 +00:00
|
|
|
|
|
2006-07-20 19:07:51 +00:00
|
|
|
|
gtk_menu_remove_scroll_timeout (menu);
|
2010-12-23 20:50:18 +00:00
|
|
|
|
|
2010-09-18 23:55:42 +00:00
|
|
|
|
data = g_object_get_data (G_OBJECT (widget), attach_data_key);
|
1998-02-03 14:13:05 +00:00
|
|
|
|
if (data)
|
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_menu_detach (menu);
|
2010-12-23 20:50:18 +00:00
|
|
|
|
|
2000-09-02 02:43:50 +00:00
|
|
|
|
gtk_menu_stop_navigating_submenu (menu);
|
|
|
|
|
|
2014-07-14 15:02:13 +00:00
|
|
|
|
g_clear_object (&priv->old_active_menu_item);
|
Tue Mar 16 17:43:33 1999 Tim Janik <timj@gtk.org>
Wed Mar 17 01:46:28 1999 Tim Janik <timj@gtk.org>
* merges from gtk-1-2:
Tue Mar 16 17:43:33 1999 Tim Janik <timj@gtk.org>
* gtk/gtkitemfactory.c (gtk_item_factory_parse_rc_string): ensure the
item factory class has been created.
(gtk_item_factory_parse_rc): likewise.
* gtk/gtkmenu.c:
keep proper references for old_active_menu_item.
(gtk_menu_reparent): unset the usize of the new parent,
so the menu can sanely be size requested and we don't get nasty screen
artefacts upon next reparentation.
(gtk_menu_motion_notify): set send_event to TRUE if we synthesize an
enter notify. only synthesize enter notifies if the pointer really is
inside the event window.
(gtk_menu_popdown): use gtk_menu_shell_deselect().
(gtk_menu_popup): move the background setting stuff into
gtk_menu_tearoff_bg_copy() so it can be called from other places as well.
* gtk/gtkmenushell.c (gtk_menu_shell_button_press): use
gtk_menu_shell_select_item() to select the new item.
(gtk_menu_shell_deselect): export this function, so gtkmenu.c can
do the right thing for deselection as well.
Sat Mar 15 20:10:33 1999 Tim Janik <timj@gtk.org>
* gtk/gtkwidget.[hc]:
(gtk_widget_accelerators_locked): return whether a widget's accelerators
are locked.
* gtk/gtkmenu.c (gtk_menu_key_press): don't remove or install new or
existing accelerators if the widget's accelerators are locked.
Sat Mar 14 19:44:05 1999 Tim Janik <timj@gtk.org>
* gtk/gtkitemfactory.[hc]: allow managing of foreign menu items.
* gtk/gtkmenu.c: truely forward key press and key release events to
the menu widget from the toplevel or tearoff window. we can't simply
connect to that, we need to stop further processing of the events as
well.
Sat Mar 13 13:14:17 1999 Tim Janik <timj@gtk.org>
* gtk/gtkmenu.c:
(gtk_menu_key_press): pass event->keyval, event->state to
gtk_accelerator_valid, instead of event->keyval twice.
refuse to install single letter accelerators for menus that use
single letter shortcuts.
* gtk/gtkitemfactory.c (gtk_item_factory_create_item): use
gtk_menu_ensure_uline_accel_group().
* gtk/gtkmenu.[hc]: added gtk_menu_ensure_uline_accel_group()
which will always return an uline accel group, made
gtk_menu_get_uline_accel_group() return NULL if the group isn't
yet created.
Mon Mar 15 01:03:27 1999 Lars Hamann <lars@gtk.org>
* gtk/gtkclist.h (struct _GtkCListColumn): added button_passive flag.
* gtk/gtkclist.c (gtk_clist_column_title_passive):
Leave button sensitive, trap button_press, button_release,
motion_notify, enter_notify and leave_notify events instead.
(gtk_clist_column_title_active): disconnect event handler.
(gtk_clist_drag_data_get): fixed memory leak. Reported by
Guillaume Laurent <glaurent@worldnet.fr>
Wed Mar 10 23:49:55 1999 Lars Hamann <lars@gtk.org>
* gtk/gtklayout.c (gtk_layout_adjustment_changed): fixed a few
width/height mixups.
* gtk/gtkctree.c (tree_delete): emit an tree_unselect_row signal
if needed.
Wed Mar 10 00:11:32 1999 Tim Janik <timj@gtk.org>
* gtk/testgtk.c (create_item_factory): unref the item factory after
window's destruction.
* gtk/gtkmenushell.c (gtk_menu_shell_activate_item): keep a reference
count on the menu shell around the menu item's activation, since the
signal emission may cause menu shell destruction.
* gtk/gtkitemfactory.c:
the previous code leaked one accel group per menu. we use
gtk_menu_get_uline_accel_group() now to fix that, and with that
also create the underline accelerator group of the menus only if
required (i.e. an underline accelerator has been specified).
(gtk_item_factory_construct):
(gtk_item_factory_create_item): removed code that would create an
extra accel group for the menu (and leak references).
(gtk_item_factory_create_item): adapted the underline accelerator
installation code to properly feature gtk_menu_get_uline_accel_group().
* gtk/gtkmenu.[hc]: added gtk_menu_get_accel_group() to retrive
menu->accel_group, this may return NULL if the accelerator group
hasn't been set yet.
added gtk_menu_get_uline_accel_group() to retrive the underline
accelerator group of the menu, this will be created on demand
and proper care is taken about its reference count.
* gtk/gtkitemfactory.h:
* gtk/gtkitemfactory.c:
dumped the approach of keeping a widgets by action list on the
factory since the factory<->widget destroy negotiation didn't work
and would be hard to get going at all. instead we keep a list of
GtkItemFactoryItem items on the factory (GtkItemFactoryItems are
persistant throughout a program's life time).
also, i removed the static const gchar *key_* variables, and made
them inline strings (they weren't actually used anyways).
(gtk_item_factory_add_item): update ifactory->items.
(gtk_item_factory_destroy): destroy ifactory->items (and remove
the item factory pointer from the remaining ifactory widgets).
(gtk_item_factory_get_widget_by_action): walk the GtkItemFactoryItem
list to find the widget.
(gtk_item_factory_get_item): new function that works around
gtk_item_factory_get_widget() limitations, this function will only
return menu items, even for <Branch> entries.
Tue Mar 9 01:01:28 1999 Tim Janik <timj@gtk.org>
* gdk/gdkfont.c (gdk_font_load): first lookup the xfont ID in our
font hash table, if we have a GdkFontPrivate entry for this font
already, simply increment its reference count, provided by Olaf Dietsche
<olaf.dietsche+list.gtk@netcologne.de>.
* gtk/gtkstyle.c (gtk_style_copy): plug a GdkFont reference leak, fix
provided by Olaf Dietsche <olaf.dietsche+list.gtk@netcologne.de>.
Sun Mar 7 06:13:29 1999 Tim Janik <timj@gtk.org>
* gtk/gtkcontainer.c:
(gtk_container_add_with_args):
(gtk_container_addv):
(gtk_container_add): before adding a child to a conatiner, make sure
it is (default) constructed, this is neccessary because under certain
circumstances the child will get relized and mapped immediatedly, in
which case it has to be constructed already.
Mon Mar 1 17:58:21 1999 Tim Janik <timj@gtk.org>
* gtk/gtksignal.c (gtk_signal_connect_by_type): count object_signal
values > 1 as TRUE also.
1999-03-17 01:39:42 +00:00
|
|
|
|
|
1998-09-01 18:41:26 +00:00
|
|
|
|
/* Add back the reference count for being a child */
|
2010-12-23 20:50:18 +00:00
|
|
|
|
if (priv->needs_destruction_ref)
|
documented necessary changes for 1.4 transition.
Fri May 12 17:13:32 2000 Tim Janik <timj@gtk.org>
* docs/Changes-1.4.txt: documented necessary changes for 1.4 transition.
* gtk/gtktext.c: made the adjustments no-construct args, simply
provide default adjustments.
(gtk_text_destroy): release adjustments.
* gtk/gtkprogressbar.c (gtk_progress_bar_class_init): made the
adjustment argument non-construct.
* gtk/gtkprogress.c (gtk_progress_destroy): release adjustment here,
instead of in finalize.
(gtk_progress_get_text_from_value):
(gtk_progress_get_current_text):
(gtk_progress_set_value):
(gtk_progress_get_percentage_from_value):
(gtk_progress_get_current_percentage):
(gtk_progress_set_percentage):
(gtk_progress_configure): ensure an adjustment is present.
Thu May 11 01:24:08 2000 Tim Janik <timj@gtk.org>
* gtk/gtkcolorsel.[hc]:
* gtk/gtkcolorseldialog.[hc]:
* gtk/gtkhsv.[hc]: major code cleanups, destroy handlers need to chain
their parent implementation, use bit fields for boolean values, don't
create unused widgets, usage of glib types, braces go on their own
lines, function argument alignment, #include directives etc. etc. etc..
* gtk/Makefile.am (gtk_public_h_sources): install gtkhsv.h.
Wed May 10 23:29:52 2000 Tim Janik <timj@gtk.org>
* gtk/gtktoolbar.c (gtk_toolbar_destroy): don't unref a NULL tooltips.
* gtk/gtkfilesel.c (gtk_file_selection_destroy): don't free a cmpl_state
of NULL.
* gtk/gtkcombo.c (gtk_combo_item_destroy): don#t keep references
to freed data.
(gtk_combo_destroy): don't keep a pointer to a destroyed window.
* gtk/gtkmenu.c (gtk_menu_init): reset the menu's toplevel pointer
to NULL when the toplevel is getting destroyed.
(gtk_menu_set_tearoff_state): same here for the tearoff_window.
(gtk_menu_destroy):
(gtk_menu_init): store the information of whether we have to
readd the initial child ref_count during destruction in a new
GtkMenu field needs_destruction_ref_count.
* gtk/gtkviewport.c: SHAME! ok this one is tricky, so i note it
here, those reading: learn from my mistake! ;)
in order for set_?adjustment to support a default adjustemnt if
invoked with an adjustment pointer of NULL, the code read (pseudo):
if (v->adjustment) unref (v->adjustment);
if (!adjustment) adjustment = adjustment_new ();
if (v->adjustment != adjustment) v->adjustment = ref (adjustment);
now imagine the first unref to actually free the old adjustment and
adjustment_new() creating a new adjustment from the very same memory
portion. here, the latter comparision will unintendedly fail, and
all hell breaks loose.
(gtk_viewport_set_hadjustment):
(gtk_viewport_set_vadjustment): reset viewport->?adjustment to NULL
after unreferencing it.
* gtk/gtkcontainer.[hc]: removed toplevel registration
functions: gtk_container_register_toplevel(),
gtk_container_unregister_toplevel() and
gtk_container_get_toplevels() which had wrong semantics
anyways: it didn't reference and copy the list.
* gtk/gtkwindow.c: we take over the container toplevel registration
bussiness now. windows are registered across multiple destructions,
untill they are finalized. the initial implicit reference count
users are holding on windows is removed with the first destruction
though.
(gtk_window_init): ref & sink and set has_user_ref_count, got
rid of gtk_container_register_toplevel() call. add window to
toplevel_list.
(gtk_window_destroy): unref the window if has_user_ref_count
is still set, got rid of call to
gtk_container_unregister_toplevel().
(gtk_window_finalize): remove window from toplevel list.
(gtk_window_list_toplevels): new function to return a newly
created list with referenced toplevels.
(gtk_window_read_rcfiles): use gtk_window_list_toplevels().
* gtk/gtkhscale.c (gtk_hscale_class_init): made the GtkRange
adjustment a non-construct arg.
* gtk/gtkvscale.c (gtk_vscale_class_init): likewise.
* gtk/gtkhscrollbar.c (gtk_vscrollbar_class_init): likewise.
* gtk/gtkvscrollbar.c (gtk_vscrollbar_class_init): likewise.
* gtk/gtkrange.c: added some realized checks.
(gtk_range_destroy): get rid of the h/v adjustments in the
destroy handler instead of finalize. remove timer.
(gtk_range_get_adjustment): demand create adjustment.
* gtk/gtkviewport.c: made h/v adjustment non-construct args.
we simply create them on demand now and get rid of them in
the destroy handler.
(gtk_viewport_destroy): get rid of the h/v adjustments in the
destroy handler instead of finalize.
(gtk_viewport_get_hadjustment):
(gtk_viewport_get_vadjustment):
(gtk_viewport_size_allocate): demand create h/v adjustment
if required.
* gtk/gtkwidget.c (gtk_widget_finalize): duplicate part of the
gtk_widget_real_destroy () functionality.
(gtk_widget_real_destroy): reinitialize with a new style, instead
of setting widget->style to NULL.
Fri May 5 13:02:09 2000 Tim Janik <timj@gtk.org>
* gtk/gtkcalendar.c:
* gtk/gtkbutton.c: ported _get_type() implementation over to
GType, either to preserve memchunks allocation facilities,
or because Gtk+ 1.0 GtkTypeInfo was still being used.
* gtk/gtkobject.[hc]: derive from GObject. ported various functions
over. prepare for ::destroy to be emitted multiple times.
removed reference tracer magic. chain into GObjectClass.shutdown()
to emit ::destroy signal.
* gtk/gtksignal.c: removed assumptions about GTK_TYPE_OBJECT being
fundamental.
* gtk/gtkmain.c: removed gtk_object_post_arg_parsing_init()
cludge.
* gtk/gtksocket.c:
* gtk/gtkplug.c:
* gtk/gtklayout.c:
* gtk/gtklabel.c:
* gtk/gtkargcollector.c:
* gtk/gtkarg.c: various fixups to work with GTK_TYPE_OBJECT
not being a fundamental anymore, and to work with the new
type system (nuked fundamental type varargs clutter).
* gtk/*.c: install finalize handlers in the GObjectClass
part of the class structure.
changed direct GTK_OBJECT()->klass accesses to
GTK_*_GET_CLASS().
changed direct object_class->type accesses to GTK_CLASS_TYPE().
* gtktypeutils.[hc]: use the reserved fundamental ids provided by
GType. made most of the GTK_*() type macros and Gtk* typedefs
simple wrappers around macros and types provided by GType.
most notably, a significant portion of the old API vanished:
GTK_TYPE_MAKE(),
GTK_TYPE_SEQNO(),
GTK_TYPE_FLAT_FIRST, GTK_TYPE_FLAT_LAST,
GTK_TYPE_STRUCTURED_FIRST, GTK_TYPE_STRUCTURED_LAST,
GTK_TYPE_ARGS,
GTK_TYPE_CALLBACK,
GTK_TYPE_C_CALLBACK,
GTK_TYPE_FOREIGN,
GtkTypeQuery,
gtk_type_query(),
gtk_type_set_varargs_type(),
gtk_type_get_varargs_type(),
gtk_type_check_object_cast(),
gtk_type_check_class_cast(),
gtk_type_describe_tree(),
gtk_type_describe_heritage(),
gtk_type_free(),
gtk_type_children_types(),
gtk_type_set_chunk_alloc(),
gtk_type_register_enum(),
gtk_type_register_flags(),
gtk_type_parent_class().
replacements, where available are described in ../docs/Changes-1.4.txt.
implemented compatibility functions for the remaining API.
* configure.in: depend on glib 1.3.1, use gobject module.
2000-05-12 15:25:50 +00:00
|
|
|
|
{
|
2010-12-23 20:50:18 +00:00
|
|
|
|
priv->needs_destruction_ref = FALSE;
|
2010-09-18 23:55:42 +00:00
|
|
|
|
g_object_ref (widget);
|
documented necessary changes for 1.4 transition.
Fri May 12 17:13:32 2000 Tim Janik <timj@gtk.org>
* docs/Changes-1.4.txt: documented necessary changes for 1.4 transition.
* gtk/gtktext.c: made the adjustments no-construct args, simply
provide default adjustments.
(gtk_text_destroy): release adjustments.
* gtk/gtkprogressbar.c (gtk_progress_bar_class_init): made the
adjustment argument non-construct.
* gtk/gtkprogress.c (gtk_progress_destroy): release adjustment here,
instead of in finalize.
(gtk_progress_get_text_from_value):
(gtk_progress_get_current_text):
(gtk_progress_set_value):
(gtk_progress_get_percentage_from_value):
(gtk_progress_get_current_percentage):
(gtk_progress_set_percentage):
(gtk_progress_configure): ensure an adjustment is present.
Thu May 11 01:24:08 2000 Tim Janik <timj@gtk.org>
* gtk/gtkcolorsel.[hc]:
* gtk/gtkcolorseldialog.[hc]:
* gtk/gtkhsv.[hc]: major code cleanups, destroy handlers need to chain
their parent implementation, use bit fields for boolean values, don't
create unused widgets, usage of glib types, braces go on their own
lines, function argument alignment, #include directives etc. etc. etc..
* gtk/Makefile.am (gtk_public_h_sources): install gtkhsv.h.
Wed May 10 23:29:52 2000 Tim Janik <timj@gtk.org>
* gtk/gtktoolbar.c (gtk_toolbar_destroy): don't unref a NULL tooltips.
* gtk/gtkfilesel.c (gtk_file_selection_destroy): don't free a cmpl_state
of NULL.
* gtk/gtkcombo.c (gtk_combo_item_destroy): don#t keep references
to freed data.
(gtk_combo_destroy): don't keep a pointer to a destroyed window.
* gtk/gtkmenu.c (gtk_menu_init): reset the menu's toplevel pointer
to NULL when the toplevel is getting destroyed.
(gtk_menu_set_tearoff_state): same here for the tearoff_window.
(gtk_menu_destroy):
(gtk_menu_init): store the information of whether we have to
readd the initial child ref_count during destruction in a new
GtkMenu field needs_destruction_ref_count.
* gtk/gtkviewport.c: SHAME! ok this one is tricky, so i note it
here, those reading: learn from my mistake! ;)
in order for set_?adjustment to support a default adjustemnt if
invoked with an adjustment pointer of NULL, the code read (pseudo):
if (v->adjustment) unref (v->adjustment);
if (!adjustment) adjustment = adjustment_new ();
if (v->adjustment != adjustment) v->adjustment = ref (adjustment);
now imagine the first unref to actually free the old adjustment and
adjustment_new() creating a new adjustment from the very same memory
portion. here, the latter comparision will unintendedly fail, and
all hell breaks loose.
(gtk_viewport_set_hadjustment):
(gtk_viewport_set_vadjustment): reset viewport->?adjustment to NULL
after unreferencing it.
* gtk/gtkcontainer.[hc]: removed toplevel registration
functions: gtk_container_register_toplevel(),
gtk_container_unregister_toplevel() and
gtk_container_get_toplevels() which had wrong semantics
anyways: it didn't reference and copy the list.
* gtk/gtkwindow.c: we take over the container toplevel registration
bussiness now. windows are registered across multiple destructions,
untill they are finalized. the initial implicit reference count
users are holding on windows is removed with the first destruction
though.
(gtk_window_init): ref & sink and set has_user_ref_count, got
rid of gtk_container_register_toplevel() call. add window to
toplevel_list.
(gtk_window_destroy): unref the window if has_user_ref_count
is still set, got rid of call to
gtk_container_unregister_toplevel().
(gtk_window_finalize): remove window from toplevel list.
(gtk_window_list_toplevels): new function to return a newly
created list with referenced toplevels.
(gtk_window_read_rcfiles): use gtk_window_list_toplevels().
* gtk/gtkhscale.c (gtk_hscale_class_init): made the GtkRange
adjustment a non-construct arg.
* gtk/gtkvscale.c (gtk_vscale_class_init): likewise.
* gtk/gtkhscrollbar.c (gtk_vscrollbar_class_init): likewise.
* gtk/gtkvscrollbar.c (gtk_vscrollbar_class_init): likewise.
* gtk/gtkrange.c: added some realized checks.
(gtk_range_destroy): get rid of the h/v adjustments in the
destroy handler instead of finalize. remove timer.
(gtk_range_get_adjustment): demand create adjustment.
* gtk/gtkviewport.c: made h/v adjustment non-construct args.
we simply create them on demand now and get rid of them in
the destroy handler.
(gtk_viewport_destroy): get rid of the h/v adjustments in the
destroy handler instead of finalize.
(gtk_viewport_get_hadjustment):
(gtk_viewport_get_vadjustment):
(gtk_viewport_size_allocate): demand create h/v adjustment
if required.
* gtk/gtkwidget.c (gtk_widget_finalize): duplicate part of the
gtk_widget_real_destroy () functionality.
(gtk_widget_real_destroy): reinitialize with a new style, instead
of setting widget->style to NULL.
Fri May 5 13:02:09 2000 Tim Janik <timj@gtk.org>
* gtk/gtkcalendar.c:
* gtk/gtkbutton.c: ported _get_type() implementation over to
GType, either to preserve memchunks allocation facilities,
or because Gtk+ 1.0 GtkTypeInfo was still being used.
* gtk/gtkobject.[hc]: derive from GObject. ported various functions
over. prepare for ::destroy to be emitted multiple times.
removed reference tracer magic. chain into GObjectClass.shutdown()
to emit ::destroy signal.
* gtk/gtksignal.c: removed assumptions about GTK_TYPE_OBJECT being
fundamental.
* gtk/gtkmain.c: removed gtk_object_post_arg_parsing_init()
cludge.
* gtk/gtksocket.c:
* gtk/gtkplug.c:
* gtk/gtklayout.c:
* gtk/gtklabel.c:
* gtk/gtkargcollector.c:
* gtk/gtkarg.c: various fixups to work with GTK_TYPE_OBJECT
not being a fundamental anymore, and to work with the new
type system (nuked fundamental type varargs clutter).
* gtk/*.c: install finalize handlers in the GObjectClass
part of the class structure.
changed direct GTK_OBJECT()->klass accesses to
GTK_*_GET_CLASS().
changed direct object_class->type accesses to GTK_CLASS_TYPE().
* gtktypeutils.[hc]: use the reserved fundamental ids provided by
GType. made most of the GTK_*() type macros and Gtk* typedefs
simple wrappers around macros and types provided by GType.
most notably, a significant portion of the old API vanished:
GTK_TYPE_MAKE(),
GTK_TYPE_SEQNO(),
GTK_TYPE_FLAT_FIRST, GTK_TYPE_FLAT_LAST,
GTK_TYPE_STRUCTURED_FIRST, GTK_TYPE_STRUCTURED_LAST,
GTK_TYPE_ARGS,
GTK_TYPE_CALLBACK,
GTK_TYPE_C_CALLBACK,
GTK_TYPE_FOREIGN,
GtkTypeQuery,
gtk_type_query(),
gtk_type_set_varargs_type(),
gtk_type_get_varargs_type(),
gtk_type_check_object_cast(),
gtk_type_check_class_cast(),
gtk_type_describe_tree(),
gtk_type_describe_heritage(),
gtk_type_free(),
gtk_type_children_types(),
gtk_type_set_chunk_alloc(),
gtk_type_register_enum(),
gtk_type_register_flags(),
gtk_type_parent_class().
replacements, where available are described in ../docs/Changes-1.4.txt.
implemented compatibility functions for the remaining API.
* configure.in: depend on glib 1.3.1, use gobject module.
2000-05-12 15:25:50 +00:00
|
|
|
|
}
|
added gtkaccelmap.sgml. other updates.
Mon Nov 12 23:06:38 2001 Tim Janik <timj@gtk.org>
* added gtkaccelmap.sgml. other updates.
Mon Nov 12 23:08:37 2001 Tim Janik <timj@gtk.org>
* gtk/maketypes.awk: fix type utils generation on unix.
* gtk/gtkaccelmap.[hc]: new files, implementing a global accelerator
registry.
* gtk/gtkaccelgroup.[hc]: major API/implementation revamp:
removed GTK_ACCEL_SIGNAL_VISIBLE, gtk_accel_group_get_default,
gtk_accel_group_get_entry, gtk_accel_group_(un)lock_entry,
gtk_accel_group_add/remove, gtk_accel_group_handle_add/remove,
gtk_accel_group_create_add/remove, gtk_accel_group_entries_from_object.
introduced ::accel_changed signal for change notification, and
gtk_accel_group_connect/disconnect to connect closures to accel groups.
made gtk_accel_group_attach/detach and gtk_accel_group_activate private
functions.
deprecated gtk_accel_group_ref/unref.
* gtk/gtkaccellabel.[hc]: changes to make accellabels pay attention
to accel group changed notification and basically operate on closures.
removed gtk_accel_label_get_accel_object and
gtk_accel_label_set_accel_object.
introduced gtk_accel_label_set_accel_closure, and for convenience,
gtk_accel_label_set_accel_widget.
* gtk/gtkitemfactory.[hc]: removed accelerator propagation code
which mostly moved into gtkaccelmap.[hc].
removed gtk_item_factory_parse_rc*, gtk_item_factory_dump_*
and gtk_item_factory_print_func.
* gtk/gtkmain.c: call _gtk_accel_map_init().
* gtk/gtkmenuitem.[hc]: introduced gtk_menu_item_set_accel_path(),
that associates an accelerator path with menu items, through which
persistent accelerator settings on menu items are enabled.
* gtk/gtkmenu.[hc]: added gtk_menu_set_accel_path() so accelerator
paths of menu item can be default constructed to allow installation
of accelerators on menu items that don't come with an accelerator
binding by default.
* gtk/gtksettings.c: fix STRING type rc settings by special casing
them appropriately in the parser.
* gtk/gtksignal.[hc]: allow a class function offset of 0 for
gtk_signal_newv().
* gtk/gtkwidget.[hc]: accelerator API revamp.
removed ::accelerator_add/remove signals, gtk_widget_accelerator_signal,
gtk_widget_accelerators_locked, gtk_widget_remove_accelerators and
gtk_widget_(un)lock_accelerators.
accelerators maintained through gtk_widget_add/remove_accelerator()
are not runtime changable now, the correct sequence to setup a
widget for runtime changable accelerators is now:
gtk_accel_map_add_entry(accel_path, key, mods);
_gtk_widget_set_accel_path(widget, accel_path, accel_group);
* gtk/gtkwindow.[hc]: accelerator changes, proxy and coalesce accel
group changes (as well as mnemonic changes) through the new signal
::accels_changed.
Sat Nov 10 12:08:56 2001 Tim Janik <timj@gtk.org>
* gtk/gtksettings.c (_gtk_settings_parse_convert): properly handle
GString->string conversions.
2001-11-13 00:53:47 +00:00
|
|
|
|
|
2014-07-14 15:02:13 +00:00
|
|
|
|
g_clear_object (&priv->accel_group);
|
2005-11-21 16:15:11 +00:00
|
|
|
|
|
2010-12-23 20:50:18 +00:00
|
|
|
|
if (priv->toplevel)
|
2016-06-14 19:42:13 +00:00
|
|
|
|
{
|
|
|
|
|
g_signal_handlers_disconnect_by_func (priv->toplevel, moved_to_rect_cb, menu);
|
|
|
|
|
gtk_widget_destroy (priv->toplevel);
|
|
|
|
|
}
|
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
|
|
|
|
|
2010-12-23 20:50:18 +00:00
|
|
|
|
if (priv->tearoff_window)
|
|
|
|
|
gtk_widget_destroy (priv->tearoff_window);
|
2005-11-21 16:15:11 +00:00
|
|
|
|
|
2014-07-14 15:02:13 +00:00
|
|
|
|
g_clear_pointer (&priv->heights, g_free);
|
2005-11-21 16:15:11 +00:00
|
|
|
|
|
2014-07-14 15:02:13 +00:00
|
|
|
|
g_clear_pointer (&priv->title, g_free);
|
2005-11-21 16:15:11 +00:00
|
|
|
|
|
2010-09-24 17:52:49 +00:00
|
|
|
|
if (priv->position_func_data_destroy)
|
|
|
|
|
{
|
2010-12-23 20:50:18 +00:00
|
|
|
|
priv->position_func_data_destroy (priv->position_func_data);
|
|
|
|
|
priv->position_func_data = NULL;
|
2010-09-24 17:52:49 +00:00
|
|
|
|
priv->position_func_data_destroy = NULL;
|
|
|
|
|
}
|
|
|
|
|
|
2016-06-05 23:34:30 +00:00
|
|
|
|
GTK_WIDGET_CLASS (gtk_menu_parent_class)->destroy (widget);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
gtk_menu_finalize (GObject *object)
|
|
|
|
|
{
|
|
|
|
|
GtkMenu *menu = GTK_MENU (object);
|
|
|
|
|
GtkMenuPrivate *priv = menu->priv;
|
|
|
|
|
|
2015-12-21 01:30:52 +00:00
|
|
|
|
g_clear_object (&priv->top_arrow_gadget);
|
|
|
|
|
g_clear_object (&priv->bottom_arrow_gadget);
|
|
|
|
|
|
2016-06-05 23:34:30 +00:00
|
|
|
|
G_OBJECT_CLASS (gtk_menu_parent_class)->finalize (object);
|
1998-02-03 14:13:05 +00:00
|
|
|
|
}
|
|
|
|
|
|
2002-12-14 04:07:08 +00:00
|
|
|
|
static void
|
|
|
|
|
menu_change_screen (GtkMenu *menu,
|
2010-12-23 20:50:18 +00:00
|
|
|
|
GdkScreen *new_screen)
|
2002-12-14 04:07:08 +00:00
|
|
|
|
{
|
2010-12-23 20:50:18 +00:00
|
|
|
|
GtkMenuPrivate *priv = menu->priv;
|
2004-01-27 00:49:03 +00:00
|
|
|
|
|
2004-11-07 05:23:31 +00:00
|
|
|
|
if (gtk_widget_has_screen (GTK_WIDGET (menu)))
|
2004-11-05 15:58:36 +00:00
|
|
|
|
{
|
2004-11-07 05:23:31 +00:00
|
|
|
|
if (new_screen == gtk_widget_get_screen (GTK_WIDGET (menu)))
|
2010-12-23 20:50:18 +00:00
|
|
|
|
return;
|
2004-11-05 15:58:36 +00:00
|
|
|
|
}
|
|
|
|
|
|
2010-12-23 20:50:18 +00:00
|
|
|
|
if (priv->torn_off)
|
2002-12-14 04:07:08 +00:00
|
|
|
|
{
|
2010-12-23 20:50:18 +00:00
|
|
|
|
gtk_window_set_screen (GTK_WINDOW (priv->tearoff_window), new_screen);
|
2010-10-31 19:52:32 +00:00
|
|
|
|
gtk_menu_position (menu, TRUE);
|
2002-12-14 04:07:08 +00:00
|
|
|
|
}
|
|
|
|
|
|
2010-12-23 20:50:18 +00:00
|
|
|
|
gtk_window_set_screen (GTK_WINDOW (priv->toplevel), new_screen);
|
|
|
|
|
priv->monitor_num = -1;
|
2002-12-14 04:07:08 +00:00
|
|
|
|
}
|
|
|
|
|
|
2002-11-14 05:46:34 +00:00
|
|
|
|
static void
|
|
|
|
|
attach_widget_screen_changed (GtkWidget *attach_widget,
|
2010-12-23 20:50:18 +00:00
|
|
|
|
GdkScreen *previous_screen,
|
|
|
|
|
GtkMenu *menu)
|
2002-11-14 05:46:34 +00:00
|
|
|
|
{
|
|
|
|
|
if (gtk_widget_has_screen (attach_widget) &&
|
|
|
|
|
!g_object_get_data (G_OBJECT (menu), "gtk-menu-explicit-screen"))
|
2010-12-23 20:50:18 +00:00
|
|
|
|
menu_change_screen (menu, gtk_widget_get_screen (attach_widget));
|
2002-11-14 05:46:34 +00:00
|
|
|
|
}
|
|
|
|
|
|
2015-07-23 06:34:12 +00:00
|
|
|
|
static void
|
|
|
|
|
menu_toplevel_attached_to (GtkWindow *toplevel, GParamSpec *pspec, GtkMenu *menu)
|
|
|
|
|
{
|
|
|
|
|
GtkMenuAttachData *data;
|
|
|
|
|
|
|
|
|
|
data = g_object_get_data (G_OBJECT (menu), attach_data_key);
|
|
|
|
|
|
|
|
|
|
g_return_if_fail (data);
|
|
|
|
|
|
|
|
|
|
gtk_menu_detach (menu);
|
|
|
|
|
}
|
|
|
|
|
|
2011-01-15 13:51:11 +00:00
|
|
|
|
/**
|
2011-03-03 21:06:28 +00:00
|
|
|
|
* gtk_menu_attach_to_widget:
|
2011-01-15 13:51:11 +00:00
|
|
|
|
* @menu: a #GtkMenu
|
|
|
|
|
* @attach_widget: the #GtkWidget that the menu will be attached to
|
2011-03-03 21:06:28 +00:00
|
|
|
|
* @detacher: (scope async)(allow-none): the user supplied callback function
|
|
|
|
|
* that will be called when the menu calls gtk_menu_detach()
|
2011-01-15 13:51:11 +00:00
|
|
|
|
*
|
|
|
|
|
* Attaches the menu to the widget and provides a callback function
|
|
|
|
|
* that will be invoked when the menu calls gtk_menu_detach() during
|
|
|
|
|
* its destruction.
|
2013-07-22 12:08:11 +00:00
|
|
|
|
*
|
|
|
|
|
* If the menu is attached to the widget then it will be destroyed
|
|
|
|
|
* when the widget is destroyed, as if it was a child widget.
|
|
|
|
|
* An attached menu will also move between screens correctly if the
|
|
|
|
|
* widgets moves between screens.
|
2011-01-15 13:51:11 +00:00
|
|
|
|
*/
|
1998-02-03 14:13:05 +00:00
|
|
|
|
void
|
2010-12-23 20:50:18 +00:00
|
|
|
|
gtk_menu_attach_to_widget (GtkMenu *menu,
|
|
|
|
|
GtkWidget *attach_widget,
|
|
|
|
|
GtkMenuDetachFunc detacher)
|
1998-02-03 14:13:05 +00:00
|
|
|
|
{
|
|
|
|
|
GtkMenuAttachData *data;
|
2004-05-06 07:35:26 +00:00
|
|
|
|
GList *list;
|
2010-12-23 20:50:18 +00:00
|
|
|
|
|
1998-02-03 14:13:05 +00:00
|
|
|
|
g_return_if_fail (GTK_IS_MENU (menu));
|
|
|
|
|
g_return_if_fail (GTK_IS_WIDGET (attach_widget));
|
2010-12-23 20:50:18 +00:00
|
|
|
|
|
|
|
|
|
/* keep this function in sync with gtk_widget_set_parent() */
|
2002-10-05 01:51:16 +00:00
|
|
|
|
data = g_object_get_data (G_OBJECT (menu), attach_data_key);
|
1998-02-03 14:13:05 +00:00
|
|
|
|
if (data)
|
|
|
|
|
{
|
|
|
|
|
g_warning ("gtk_menu_attach_to_widget(): menu already attached to %s",
|
2010-12-23 20:50:18 +00:00
|
|
|
|
g_type_name (G_TYPE_FROM_INSTANCE (data->attach_widget)));
|
2002-11-14 05:46:34 +00:00
|
|
|
|
return;
|
1998-02-03 14:13:05 +00:00
|
|
|
|
}
|
2010-12-23 20:50:18 +00:00
|
|
|
|
|
2005-11-23 18:06:58 +00:00
|
|
|
|
g_object_ref_sink (menu);
|
2010-12-23 20:50:18 +00:00
|
|
|
|
|
2008-05-25 22:33:34 +00:00
|
|
|
|
data = g_slice_new (GtkMenuAttachData);
|
1998-02-03 14:13:05 +00:00
|
|
|
|
data->attach_widget = attach_widget;
|
2010-12-23 20:50:18 +00:00
|
|
|
|
|
2008-08-11 11:52:06 +00:00
|
|
|
|
g_signal_connect (attach_widget, "screen-changed",
|
2010-12-23 20:50:18 +00:00
|
|
|
|
G_CALLBACK (attach_widget_screen_changed), menu);
|
2002-11-14 05:46:34 +00:00
|
|
|
|
attach_widget_screen_changed (attach_widget, NULL, menu);
|
2010-12-23 20:50:18 +00:00
|
|
|
|
|
1998-02-03 14:13:05 +00:00
|
|
|
|
data->detacher = detacher;
|
2005-09-01 05:11:46 +00:00
|
|
|
|
g_object_set_data (G_OBJECT (menu), I_(attach_data_key), data);
|
2004-08-25 20:06:29 +00:00
|
|
|
|
list = g_object_steal_data (G_OBJECT (attach_widget), ATTACHED_MENUS);
|
2004-05-06 07:35:26 +00:00
|
|
|
|
if (!g_list_find (list, menu))
|
2010-12-23 20:50:18 +00:00
|
|
|
|
list = g_list_prepend (list, menu);
|
|
|
|
|
|
2008-06-18 09:12:32 +00:00
|
|
|
|
g_object_set_data_full (G_OBJECT (attach_widget), I_(ATTACHED_MENUS), list,
|
|
|
|
|
(GDestroyNotify) g_list_free);
|
|
|
|
|
|
2012-01-12 18:29:52 +00:00
|
|
|
|
/* Attach the widget to the toplevel window. */
|
|
|
|
|
gtk_window_set_attached_to (GTK_WINDOW (menu->priv->toplevel), attach_widget);
|
2015-07-23 06:34:12 +00:00
|
|
|
|
g_signal_connect (GTK_WINDOW (menu->priv->toplevel), "notify::attached-to",
|
|
|
|
|
G_CALLBACK (menu_toplevel_attached_to), menu);
|
2001-12-27 20:22:16 +00:00
|
|
|
|
|
2012-08-17 22:09:35 +00:00
|
|
|
|
_gtk_widget_update_parent_muxer (GTK_WIDGET (menu));
|
|
|
|
|
|
2001-12-27 20:22:16 +00:00
|
|
|
|
/* Fallback title for menu comes from attach widget */
|
|
|
|
|
gtk_menu_update_title (menu);
|
2010-06-16 18:18:39 +00:00
|
|
|
|
|
|
|
|
|
g_object_notify (G_OBJECT (menu), "attach-widget");
|
1998-02-03 14:13:05 +00:00
|
|
|
|
}
|
|
|
|
|
|
2011-01-15 13:51:11 +00:00
|
|
|
|
/**
|
|
|
|
|
* gtk_menu_get_attach_widget:
|
|
|
|
|
* @menu: a #GtkMenu
|
|
|
|
|
*
|
|
|
|
|
* Returns the #GtkWidget that the menu is attached to.
|
|
|
|
|
*
|
2011-01-18 09:01:17 +00:00
|
|
|
|
* Returns: (transfer none): the #GtkWidget that the menu is attached to
|
2011-01-15 13:51:11 +00:00
|
|
|
|
*/
|
1998-02-08 19:00:01 +00:00
|
|
|
|
GtkWidget*
|
documented necessary changes for 1.4 transition.
Fri May 12 17:13:32 2000 Tim Janik <timj@gtk.org>
* docs/Changes-1.4.txt: documented necessary changes for 1.4 transition.
* gtk/gtktext.c: made the adjustments no-construct args, simply
provide default adjustments.
(gtk_text_destroy): release adjustments.
* gtk/gtkprogressbar.c (gtk_progress_bar_class_init): made the
adjustment argument non-construct.
* gtk/gtkprogress.c (gtk_progress_destroy): release adjustment here,
instead of in finalize.
(gtk_progress_get_text_from_value):
(gtk_progress_get_current_text):
(gtk_progress_set_value):
(gtk_progress_get_percentage_from_value):
(gtk_progress_get_current_percentage):
(gtk_progress_set_percentage):
(gtk_progress_configure): ensure an adjustment is present.
Thu May 11 01:24:08 2000 Tim Janik <timj@gtk.org>
* gtk/gtkcolorsel.[hc]:
* gtk/gtkcolorseldialog.[hc]:
* gtk/gtkhsv.[hc]: major code cleanups, destroy handlers need to chain
their parent implementation, use bit fields for boolean values, don't
create unused widgets, usage of glib types, braces go on their own
lines, function argument alignment, #include directives etc. etc. etc..
* gtk/Makefile.am (gtk_public_h_sources): install gtkhsv.h.
Wed May 10 23:29:52 2000 Tim Janik <timj@gtk.org>
* gtk/gtktoolbar.c (gtk_toolbar_destroy): don't unref a NULL tooltips.
* gtk/gtkfilesel.c (gtk_file_selection_destroy): don't free a cmpl_state
of NULL.
* gtk/gtkcombo.c (gtk_combo_item_destroy): don#t keep references
to freed data.
(gtk_combo_destroy): don't keep a pointer to a destroyed window.
* gtk/gtkmenu.c (gtk_menu_init): reset the menu's toplevel pointer
to NULL when the toplevel is getting destroyed.
(gtk_menu_set_tearoff_state): same here for the tearoff_window.
(gtk_menu_destroy):
(gtk_menu_init): store the information of whether we have to
readd the initial child ref_count during destruction in a new
GtkMenu field needs_destruction_ref_count.
* gtk/gtkviewport.c: SHAME! ok this one is tricky, so i note it
here, those reading: learn from my mistake! ;)
in order for set_?adjustment to support a default adjustemnt if
invoked with an adjustment pointer of NULL, the code read (pseudo):
if (v->adjustment) unref (v->adjustment);
if (!adjustment) adjustment = adjustment_new ();
if (v->adjustment != adjustment) v->adjustment = ref (adjustment);
now imagine the first unref to actually free the old adjustment and
adjustment_new() creating a new adjustment from the very same memory
portion. here, the latter comparision will unintendedly fail, and
all hell breaks loose.
(gtk_viewport_set_hadjustment):
(gtk_viewport_set_vadjustment): reset viewport->?adjustment to NULL
after unreferencing it.
* gtk/gtkcontainer.[hc]: removed toplevel registration
functions: gtk_container_register_toplevel(),
gtk_container_unregister_toplevel() and
gtk_container_get_toplevels() which had wrong semantics
anyways: it didn't reference and copy the list.
* gtk/gtkwindow.c: we take over the container toplevel registration
bussiness now. windows are registered across multiple destructions,
untill they are finalized. the initial implicit reference count
users are holding on windows is removed with the first destruction
though.
(gtk_window_init): ref & sink and set has_user_ref_count, got
rid of gtk_container_register_toplevel() call. add window to
toplevel_list.
(gtk_window_destroy): unref the window if has_user_ref_count
is still set, got rid of call to
gtk_container_unregister_toplevel().
(gtk_window_finalize): remove window from toplevel list.
(gtk_window_list_toplevels): new function to return a newly
created list with referenced toplevels.
(gtk_window_read_rcfiles): use gtk_window_list_toplevels().
* gtk/gtkhscale.c (gtk_hscale_class_init): made the GtkRange
adjustment a non-construct arg.
* gtk/gtkvscale.c (gtk_vscale_class_init): likewise.
* gtk/gtkhscrollbar.c (gtk_vscrollbar_class_init): likewise.
* gtk/gtkvscrollbar.c (gtk_vscrollbar_class_init): likewise.
* gtk/gtkrange.c: added some realized checks.
(gtk_range_destroy): get rid of the h/v adjustments in the
destroy handler instead of finalize. remove timer.
(gtk_range_get_adjustment): demand create adjustment.
* gtk/gtkviewport.c: made h/v adjustment non-construct args.
we simply create them on demand now and get rid of them in
the destroy handler.
(gtk_viewport_destroy): get rid of the h/v adjustments in the
destroy handler instead of finalize.
(gtk_viewport_get_hadjustment):
(gtk_viewport_get_vadjustment):
(gtk_viewport_size_allocate): demand create h/v adjustment
if required.
* gtk/gtkwidget.c (gtk_widget_finalize): duplicate part of the
gtk_widget_real_destroy () functionality.
(gtk_widget_real_destroy): reinitialize with a new style, instead
of setting widget->style to NULL.
Fri May 5 13:02:09 2000 Tim Janik <timj@gtk.org>
* gtk/gtkcalendar.c:
* gtk/gtkbutton.c: ported _get_type() implementation over to
GType, either to preserve memchunks allocation facilities,
or because Gtk+ 1.0 GtkTypeInfo was still being used.
* gtk/gtkobject.[hc]: derive from GObject. ported various functions
over. prepare for ::destroy to be emitted multiple times.
removed reference tracer magic. chain into GObjectClass.shutdown()
to emit ::destroy signal.
* gtk/gtksignal.c: removed assumptions about GTK_TYPE_OBJECT being
fundamental.
* gtk/gtkmain.c: removed gtk_object_post_arg_parsing_init()
cludge.
* gtk/gtksocket.c:
* gtk/gtkplug.c:
* gtk/gtklayout.c:
* gtk/gtklabel.c:
* gtk/gtkargcollector.c:
* gtk/gtkarg.c: various fixups to work with GTK_TYPE_OBJECT
not being a fundamental anymore, and to work with the new
type system (nuked fundamental type varargs clutter).
* gtk/*.c: install finalize handlers in the GObjectClass
part of the class structure.
changed direct GTK_OBJECT()->klass accesses to
GTK_*_GET_CLASS().
changed direct object_class->type accesses to GTK_CLASS_TYPE().
* gtktypeutils.[hc]: use the reserved fundamental ids provided by
GType. made most of the GTK_*() type macros and Gtk* typedefs
simple wrappers around macros and types provided by GType.
most notably, a significant portion of the old API vanished:
GTK_TYPE_MAKE(),
GTK_TYPE_SEQNO(),
GTK_TYPE_FLAT_FIRST, GTK_TYPE_FLAT_LAST,
GTK_TYPE_STRUCTURED_FIRST, GTK_TYPE_STRUCTURED_LAST,
GTK_TYPE_ARGS,
GTK_TYPE_CALLBACK,
GTK_TYPE_C_CALLBACK,
GTK_TYPE_FOREIGN,
GtkTypeQuery,
gtk_type_query(),
gtk_type_set_varargs_type(),
gtk_type_get_varargs_type(),
gtk_type_check_object_cast(),
gtk_type_check_class_cast(),
gtk_type_describe_tree(),
gtk_type_describe_heritage(),
gtk_type_free(),
gtk_type_children_types(),
gtk_type_set_chunk_alloc(),
gtk_type_register_enum(),
gtk_type_register_flags(),
gtk_type_parent_class().
replacements, where available are described in ../docs/Changes-1.4.txt.
implemented compatibility functions for the remaining API.
* configure.in: depend on glib 1.3.1, use gobject module.
2000-05-12 15:25:50 +00:00
|
|
|
|
gtk_menu_get_attach_widget (GtkMenu *menu)
|
1998-02-08 19:00:01 +00:00
|
|
|
|
{
|
|
|
|
|
GtkMenuAttachData *data;
|
2010-12-23 20:50:18 +00:00
|
|
|
|
|
1998-02-08 19:00:01 +00:00
|
|
|
|
g_return_val_if_fail (GTK_IS_MENU (menu), NULL);
|
2010-12-23 20:50:18 +00:00
|
|
|
|
|
2002-10-05 01:51:16 +00:00
|
|
|
|
data = g_object_get_data (G_OBJECT (menu), attach_data_key);
|
1998-02-08 19:00:01 +00:00
|
|
|
|
if (data)
|
|
|
|
|
return data->attach_widget;
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
|
2011-01-15 13:51:11 +00:00
|
|
|
|
/**
|
|
|
|
|
* gtk_menu_detach:
|
|
|
|
|
* @menu: a #GtkMenu
|
|
|
|
|
*
|
|
|
|
|
* Detaches the menu from the widget to which it had been attached.
|
|
|
|
|
* This function will call the callback function, @detacher, provided
|
|
|
|
|
* when the gtk_menu_attach_to_widget() function was called.
|
|
|
|
|
*/
|
1998-02-03 14:13:05 +00:00
|
|
|
|
void
|
documented necessary changes for 1.4 transition.
Fri May 12 17:13:32 2000 Tim Janik <timj@gtk.org>
* docs/Changes-1.4.txt: documented necessary changes for 1.4 transition.
* gtk/gtktext.c: made the adjustments no-construct args, simply
provide default adjustments.
(gtk_text_destroy): release adjustments.
* gtk/gtkprogressbar.c (gtk_progress_bar_class_init): made the
adjustment argument non-construct.
* gtk/gtkprogress.c (gtk_progress_destroy): release adjustment here,
instead of in finalize.
(gtk_progress_get_text_from_value):
(gtk_progress_get_current_text):
(gtk_progress_set_value):
(gtk_progress_get_percentage_from_value):
(gtk_progress_get_current_percentage):
(gtk_progress_set_percentage):
(gtk_progress_configure): ensure an adjustment is present.
Thu May 11 01:24:08 2000 Tim Janik <timj@gtk.org>
* gtk/gtkcolorsel.[hc]:
* gtk/gtkcolorseldialog.[hc]:
* gtk/gtkhsv.[hc]: major code cleanups, destroy handlers need to chain
their parent implementation, use bit fields for boolean values, don't
create unused widgets, usage of glib types, braces go on their own
lines, function argument alignment, #include directives etc. etc. etc..
* gtk/Makefile.am (gtk_public_h_sources): install gtkhsv.h.
Wed May 10 23:29:52 2000 Tim Janik <timj@gtk.org>
* gtk/gtktoolbar.c (gtk_toolbar_destroy): don't unref a NULL tooltips.
* gtk/gtkfilesel.c (gtk_file_selection_destroy): don't free a cmpl_state
of NULL.
* gtk/gtkcombo.c (gtk_combo_item_destroy): don#t keep references
to freed data.
(gtk_combo_destroy): don't keep a pointer to a destroyed window.
* gtk/gtkmenu.c (gtk_menu_init): reset the menu's toplevel pointer
to NULL when the toplevel is getting destroyed.
(gtk_menu_set_tearoff_state): same here for the tearoff_window.
(gtk_menu_destroy):
(gtk_menu_init): store the information of whether we have to
readd the initial child ref_count during destruction in a new
GtkMenu field needs_destruction_ref_count.
* gtk/gtkviewport.c: SHAME! ok this one is tricky, so i note it
here, those reading: learn from my mistake! ;)
in order for set_?adjustment to support a default adjustemnt if
invoked with an adjustment pointer of NULL, the code read (pseudo):
if (v->adjustment) unref (v->adjustment);
if (!adjustment) adjustment = adjustment_new ();
if (v->adjustment != adjustment) v->adjustment = ref (adjustment);
now imagine the first unref to actually free the old adjustment and
adjustment_new() creating a new adjustment from the very same memory
portion. here, the latter comparision will unintendedly fail, and
all hell breaks loose.
(gtk_viewport_set_hadjustment):
(gtk_viewport_set_vadjustment): reset viewport->?adjustment to NULL
after unreferencing it.
* gtk/gtkcontainer.[hc]: removed toplevel registration
functions: gtk_container_register_toplevel(),
gtk_container_unregister_toplevel() and
gtk_container_get_toplevels() which had wrong semantics
anyways: it didn't reference and copy the list.
* gtk/gtkwindow.c: we take over the container toplevel registration
bussiness now. windows are registered across multiple destructions,
untill they are finalized. the initial implicit reference count
users are holding on windows is removed with the first destruction
though.
(gtk_window_init): ref & sink and set has_user_ref_count, got
rid of gtk_container_register_toplevel() call. add window to
toplevel_list.
(gtk_window_destroy): unref the window if has_user_ref_count
is still set, got rid of call to
gtk_container_unregister_toplevel().
(gtk_window_finalize): remove window from toplevel list.
(gtk_window_list_toplevels): new function to return a newly
created list with referenced toplevels.
(gtk_window_read_rcfiles): use gtk_window_list_toplevels().
* gtk/gtkhscale.c (gtk_hscale_class_init): made the GtkRange
adjustment a non-construct arg.
* gtk/gtkvscale.c (gtk_vscale_class_init): likewise.
* gtk/gtkhscrollbar.c (gtk_vscrollbar_class_init): likewise.
* gtk/gtkvscrollbar.c (gtk_vscrollbar_class_init): likewise.
* gtk/gtkrange.c: added some realized checks.
(gtk_range_destroy): get rid of the h/v adjustments in the
destroy handler instead of finalize. remove timer.
(gtk_range_get_adjustment): demand create adjustment.
* gtk/gtkviewport.c: made h/v adjustment non-construct args.
we simply create them on demand now and get rid of them in
the destroy handler.
(gtk_viewport_destroy): get rid of the h/v adjustments in the
destroy handler instead of finalize.
(gtk_viewport_get_hadjustment):
(gtk_viewport_get_vadjustment):
(gtk_viewport_size_allocate): demand create h/v adjustment
if required.
* gtk/gtkwidget.c (gtk_widget_finalize): duplicate part of the
gtk_widget_real_destroy () functionality.
(gtk_widget_real_destroy): reinitialize with a new style, instead
of setting widget->style to NULL.
Fri May 5 13:02:09 2000 Tim Janik <timj@gtk.org>
* gtk/gtkcalendar.c:
* gtk/gtkbutton.c: ported _get_type() implementation over to
GType, either to preserve memchunks allocation facilities,
or because Gtk+ 1.0 GtkTypeInfo was still being used.
* gtk/gtkobject.[hc]: derive from GObject. ported various functions
over. prepare for ::destroy to be emitted multiple times.
removed reference tracer magic. chain into GObjectClass.shutdown()
to emit ::destroy signal.
* gtk/gtksignal.c: removed assumptions about GTK_TYPE_OBJECT being
fundamental.
* gtk/gtkmain.c: removed gtk_object_post_arg_parsing_init()
cludge.
* gtk/gtksocket.c:
* gtk/gtkplug.c:
* gtk/gtklayout.c:
* gtk/gtklabel.c:
* gtk/gtkargcollector.c:
* gtk/gtkarg.c: various fixups to work with GTK_TYPE_OBJECT
not being a fundamental anymore, and to work with the new
type system (nuked fundamental type varargs clutter).
* gtk/*.c: install finalize handlers in the GObjectClass
part of the class structure.
changed direct GTK_OBJECT()->klass accesses to
GTK_*_GET_CLASS().
changed direct object_class->type accesses to GTK_CLASS_TYPE().
* gtktypeutils.[hc]: use the reserved fundamental ids provided by
GType. made most of the GTK_*() type macros and Gtk* typedefs
simple wrappers around macros and types provided by GType.
most notably, a significant portion of the old API vanished:
GTK_TYPE_MAKE(),
GTK_TYPE_SEQNO(),
GTK_TYPE_FLAT_FIRST, GTK_TYPE_FLAT_LAST,
GTK_TYPE_STRUCTURED_FIRST, GTK_TYPE_STRUCTURED_LAST,
GTK_TYPE_ARGS,
GTK_TYPE_CALLBACK,
GTK_TYPE_C_CALLBACK,
GTK_TYPE_FOREIGN,
GtkTypeQuery,
gtk_type_query(),
gtk_type_set_varargs_type(),
gtk_type_get_varargs_type(),
gtk_type_check_object_cast(),
gtk_type_check_class_cast(),
gtk_type_describe_tree(),
gtk_type_describe_heritage(),
gtk_type_free(),
gtk_type_children_types(),
gtk_type_set_chunk_alloc(),
gtk_type_register_enum(),
gtk_type_register_flags(),
gtk_type_parent_class().
replacements, where available are described in ../docs/Changes-1.4.txt.
implemented compatibility functions for the remaining API.
* configure.in: depend on glib 1.3.1, use gobject module.
2000-05-12 15:25:50 +00:00
|
|
|
|
gtk_menu_detach (GtkMenu *menu)
|
1998-02-03 14:13:05 +00:00
|
|
|
|
{
|
2015-07-23 06:34:12 +00:00
|
|
|
|
GtkWindow *toplevel;
|
1998-02-03 14:13:05 +00:00
|
|
|
|
GtkMenuAttachData *data;
|
2004-05-06 07:35:26 +00:00
|
|
|
|
GList *list;
|
2010-12-23 20:50:18 +00:00
|
|
|
|
|
1998-02-03 14:13:05 +00:00
|
|
|
|
g_return_if_fail (GTK_IS_MENU (menu));
|
2015-07-23 06:34:12 +00:00
|
|
|
|
toplevel = GTK_WINDOW (menu->priv->toplevel);
|
2010-12-23 20:50:18 +00:00
|
|
|
|
|
|
|
|
|
/* keep this function in sync with gtk_widget_unparent() */
|
2002-10-05 01:51:16 +00:00
|
|
|
|
data = g_object_get_data (G_OBJECT (menu), attach_data_key);
|
1998-02-03 14:13:05 +00:00
|
|
|
|
if (!data)
|
|
|
|
|
{
|
|
|
|
|
g_warning ("gtk_menu_detach(): menu is not attached");
|
|
|
|
|
return;
|
|
|
|
|
}
|
2005-09-01 05:11:46 +00:00
|
|
|
|
g_object_set_data (G_OBJECT (menu), I_(attach_data_key), NULL);
|
2010-12-23 20:50:18 +00:00
|
|
|
|
|
2012-01-12 18:29:52 +00:00
|
|
|
|
/* Detach the toplevel window. */
|
2017-09-26 05:10:39 +00:00
|
|
|
|
if (toplevel)
|
|
|
|
|
{
|
|
|
|
|
g_signal_handlers_disconnect_by_func (toplevel,
|
|
|
|
|
(gpointer) menu_toplevel_attached_to,
|
|
|
|
|
menu);
|
|
|
|
|
if (gtk_window_get_attached_to (toplevel) == data->attach_widget)
|
|
|
|
|
gtk_window_set_attached_to (toplevel, NULL);
|
|
|
|
|
}
|
2012-01-12 18:29:52 +00:00
|
|
|
|
|
2002-11-14 05:46:34 +00:00
|
|
|
|
g_signal_handlers_disconnect_by_func (data->attach_widget,
|
2010-12-23 20:50:18 +00:00
|
|
|
|
(gpointer) attach_widget_screen_changed,
|
|
|
|
|
menu);
|
2002-11-14 05:46:34 +00:00
|
|
|
|
|
2005-12-06 17:33:46 +00:00
|
|
|
|
if (data->detacher)
|
|
|
|
|
data->detacher (data->attach_widget, menu);
|
2004-05-06 07:35:26 +00:00
|
|
|
|
list = g_object_steal_data (G_OBJECT (data->attach_widget), ATTACHED_MENUS);
|
|
|
|
|
list = g_list_remove (list, menu);
|
|
|
|
|
if (list)
|
2008-06-18 09:12:32 +00:00
|
|
|
|
g_object_set_data_full (G_OBJECT (data->attach_widget), I_(ATTACHED_MENUS), list,
|
|
|
|
|
(GDestroyNotify) g_list_free);
|
2004-05-06 07:35:26 +00:00
|
|
|
|
else
|
2005-09-01 05:11:46 +00:00
|
|
|
|
g_object_set_data (G_OBJECT (data->attach_widget), I_(ATTACHED_MENUS), NULL);
|
2010-12-23 20:50:18 +00:00
|
|
|
|
|
2010-03-02 06:16:02 +00:00
|
|
|
|
if (gtk_widget_get_realized (GTK_WIDGET (menu)))
|
1998-02-03 14:13:05 +00:00
|
|
|
|
gtk_widget_unrealize (GTK_WIDGET (menu));
|
2010-12-23 20:50:18 +00:00
|
|
|
|
|
2008-05-25 22:33:34 +00:00
|
|
|
|
g_slice_free (GtkMenuAttachData, data);
|
2010-12-23 20:50:18 +00:00
|
|
|
|
|
2012-08-17 22:09:35 +00:00
|
|
|
|
_gtk_widget_update_parent_muxer (GTK_WIDGET (menu));
|
|
|
|
|
|
2001-12-27 20:22:16 +00:00
|
|
|
|
/* Fallback title for menu comes from attach widget */
|
|
|
|
|
gtk_menu_update_title (menu);
|
|
|
|
|
|
2012-07-05 17:21:03 +00:00
|
|
|
|
g_object_notify (G_OBJECT (menu), "attach-widget");
|
2002-10-05 01:51:16 +00:00
|
|
|
|
g_object_unref (menu);
|
1997-11-24 22:37:52 +00:00
|
|
|
|
}
|
|
|
|
|
|
2004-01-20 21:11:30 +00:00
|
|
|
|
static void
|
2001-07-12 17:50:14 +00:00
|
|
|
|
gtk_menu_remove (GtkContainer *container,
|
2010-12-23 20:50:18 +00:00
|
|
|
|
GtkWidget *widget)
|
Get rid of a bunch of g_strdup_printf("%s%s") in favor of g_strconcat().
Fri Feb 2 12:26:50 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkrc.c (gtk_rc_add_initial_default_files): Get rid of
a bunch of g_strdup_printf("%s%s") in favor of g_strconcat().
* gtk/gtkrc.c Makefile.am: Use $(libdir), not $(exe_prefix),
since some people set $(libdir) separately. (#1290, David Kaelbling)
Thu Feb 1 18:25:46 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkfilesel.c: If PATH_MAX and MAXPATHLEN are not
defined, define MAXPATHLEN to 2048. (The Hurd doesn't have
MAXPATHLEN, but the code here depends on a fixed value.)
(#4524)
Wed Jan 31 22:01:04 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkhandlebox.c (gtk_handle_box_button_changed): Handle the case
where child == NULL and handle_position == RIGHT or BOTTOM. (#8041g)
Wed Jan 31 21:20:39 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkctree.c (real_tree_move): If the node being moved isn't
viewable there is no way that moving the node will cause the
focus row to become not viewable, so omit check on the visibility
of new_sibling, which is irrelevant. (Fixes #8002, David Helder)
Wed Jan 31 20:38:17 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkentry.c (gtk_entry_commit_cb): Delete the current
selection before inserting new text.
Wed Jan 31 18:49:33 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkoptionmenu.c (gtk_option_menu_item_state_changed_cb):
Make the sensitivity of the reparented child track that of
the original parent menu item. (#34218, David Hodson)
* gtk/gtkoptionmenu.c (gtk_option_menu_item_destroy_cb): Handle
the case where the current item is destroyed properly.
* gtk/gtkoptionmenu.c: Some additional code cleanups and fix
some edge cases with child-less menuitems.
Wed Jan 31 17:16:13 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkcombo.c (gtk_combo_window_key_press): Make Return
key pop down window. (#12074, Jon K Hellan)
Wed Jan 31 16:21:42 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtklist.c (gtk_list_signal_item_toggle): Don't allow
toggling of rows off in BROWSE or EXTENDED mode. (#12072, Jon K Hellan)
The solution here isn't perfect - you get an extraneous
emission of "toggle", which could conceivably confuse an app,
but better than the current situation. LXR search seems to
indicate that no apps in GNOME CVS connect to "toggle".
Wed Jan 31 15:46:13 2001 Owen Taylor <otaylor@redhat.com>
* gtk/Makefile.am (libgtkinclude_HEADERS): Move gtkcompat.h from
gtk_public_h_sources to directly here to avoid warning when
building srcdir != builddir. (#9656)
Tue Jan 30 19:49:02 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkrange.c: Patch from Kipp Hickman to make the event
handlers in gtkrange.c return the proper values (TRUE == handled)
(#10316).
This is just the tip of the iceberg, but gtkrange.c is the
most common place where the propagation is problematical,
and also a place where it is almost certainly safe to change
this in the stable branch.
(You don't want right click popups on a range control or anything...)
Tue Jan 30 18:57:59 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtktext.c (clear_focus_area): We need to clear the focus
area on focus out, even if a background pixmap isn't set.
(#13941)
Tue Jan 30 18:24:10 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtknotebook.c (gtk_notebook_set_shape): Fix from Sean Cunningham
to deal with setting the shape properly when scrolling arrows are
turned on, but not visible because there is sufficient space.
(#13432)
Tue Jan 30 16:39:25 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkitemfactory.c (gtk_item_factory_delete_item): For menu
items with submenus, destroy the item along with the submenu.
(#7841, Brian Masney(?)) Also, handle paths of the form '<foo>/abcd...'
properly.
* gtk/testgtk.c (menu_items): Add a dummy branch that we delete
later.
Tue Jan 30 15:51:25 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwindow.c (gtk_window_real_set_focus): Fix a problem where
the focus widget sometimes wasn't drawn with the default if there
was no default widget.
* gtk/gtkstyle.c (gtk_style_real_unrealize): free colors,
unreference pixmaps.
* gtk/gtkstyle.c (gtk_style_realize): Reference colormap
for some extra safety.
Mon Jan 29 19:00:01 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtk{ctree.c,clist.c} (set_cell_contents): Handle setting
the text of a cell to the old pointer value better, by
copying the new text before freeing the old text. Some code
cleanup. (#8079, Karl Nelson)
Mon Jan 29 16:50:19 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtklabel.[ch] gtk/gtkframe.[ch]: Make gtk_label_get_text()
gtk_frame_get_label() non strdup'ing, and G_CONST_RETURN.
Mon Jan 29 15:22:51 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkmenu.c (gtk_menu_remove): When removing an
item from a menu, check to see if it matches
menu->old_active_menu_item, and if so, unref and clear
old_active_menu_item (Patch from Pavel Cisler)
* gtk/gtkmenushell.c (gtk_menu_shell_remove): Unset
menu_shell->active_menu_item, if it is the child being
removed. (Patch based on that of Gene Ragan, #50337)
2001-02-02 17:53:29 +00:00
|
|
|
|
{
|
2008-02-07 16:59:42 +00:00
|
|
|
|
GtkMenu *menu = GTK_MENU (container);
|
2010-12-23 20:50:18 +00:00
|
|
|
|
GtkMenuPrivate *priv = menu->priv;
|
The table menu patch! Turns GtkMenu into a table, so you can attach menu
Wed Sep 10 22:25:04 2003 Kristian Rietveld <kris@gtk.org>
The table menu patch! Turns GtkMenu into a table, so you can attach
menu items in numerous new ways! Be creative!
Contains some bug fixes and RTL adaptions from Matthias Clasen.
* gtk/gtkmenu.c [toplevel]: introduce ATTACH_INFO_KEY, extend
GtkMenuPrivate, introduce AttachInfo, add child properties enum,
(gtk_menu_free_private), (gtk_menu_get_private): we have to free
the heights array in the private struct,
(gtk_menu_class_init): reorder code a bit, install child properties,
(get_attach_info), (get_child_attach): new utility functions,
(gtk_menu_set_child_property), (gtk_menu_get_child_property): introduce
child properties, for the attach info,
(gtk_menu_remove): remove AttachInfo from menu item,
(gtk_menu_real_insert): implemented algorithm to automagically place
inserted menu items at the correct place in the table,
(gtk_menu_size_request), (gtk_menu_size_allocate),
(compute_child_offset): reworked/rewritten to support table menus,
(gtk_menu_attach): new function,
(find_child_containing), (gtk_menu_move_current): new functions to
get table menu keynav right.
* gtk/gtkmenu.h: add gtk_menu_attach() prototype.
2003-09-10 20:32:33 +00:00
|
|
|
|
|
2010-12-23 20:50:18 +00:00
|
|
|
|
/* Clear out old_active_menu_item if it matches the item we are removing */
|
|
|
|
|
if (priv->old_active_menu_item == widget)
|
|
|
|
|
g_clear_object (&priv->old_active_menu_item);
|
Get rid of a bunch of g_strdup_printf("%s%s") in favor of g_strconcat().
Fri Feb 2 12:26:50 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkrc.c (gtk_rc_add_initial_default_files): Get rid of
a bunch of g_strdup_printf("%s%s") in favor of g_strconcat().
* gtk/gtkrc.c Makefile.am: Use $(libdir), not $(exe_prefix),
since some people set $(libdir) separately. (#1290, David Kaelbling)
Thu Feb 1 18:25:46 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkfilesel.c: If PATH_MAX and MAXPATHLEN are not
defined, define MAXPATHLEN to 2048. (The Hurd doesn't have
MAXPATHLEN, but the code here depends on a fixed value.)
(#4524)
Wed Jan 31 22:01:04 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkhandlebox.c (gtk_handle_box_button_changed): Handle the case
where child == NULL and handle_position == RIGHT or BOTTOM. (#8041g)
Wed Jan 31 21:20:39 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkctree.c (real_tree_move): If the node being moved isn't
viewable there is no way that moving the node will cause the
focus row to become not viewable, so omit check on the visibility
of new_sibling, which is irrelevant. (Fixes #8002, David Helder)
Wed Jan 31 20:38:17 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkentry.c (gtk_entry_commit_cb): Delete the current
selection before inserting new text.
Wed Jan 31 18:49:33 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkoptionmenu.c (gtk_option_menu_item_state_changed_cb):
Make the sensitivity of the reparented child track that of
the original parent menu item. (#34218, David Hodson)
* gtk/gtkoptionmenu.c (gtk_option_menu_item_destroy_cb): Handle
the case where the current item is destroyed properly.
* gtk/gtkoptionmenu.c: Some additional code cleanups and fix
some edge cases with child-less menuitems.
Wed Jan 31 17:16:13 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkcombo.c (gtk_combo_window_key_press): Make Return
key pop down window. (#12074, Jon K Hellan)
Wed Jan 31 16:21:42 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtklist.c (gtk_list_signal_item_toggle): Don't allow
toggling of rows off in BROWSE or EXTENDED mode. (#12072, Jon K Hellan)
The solution here isn't perfect - you get an extraneous
emission of "toggle", which could conceivably confuse an app,
but better than the current situation. LXR search seems to
indicate that no apps in GNOME CVS connect to "toggle".
Wed Jan 31 15:46:13 2001 Owen Taylor <otaylor@redhat.com>
* gtk/Makefile.am (libgtkinclude_HEADERS): Move gtkcompat.h from
gtk_public_h_sources to directly here to avoid warning when
building srcdir != builddir. (#9656)
Tue Jan 30 19:49:02 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkrange.c: Patch from Kipp Hickman to make the event
handlers in gtkrange.c return the proper values (TRUE == handled)
(#10316).
This is just the tip of the iceberg, but gtkrange.c is the
most common place where the propagation is problematical,
and also a place where it is almost certainly safe to change
this in the stable branch.
(You don't want right click popups on a range control or anything...)
Tue Jan 30 18:57:59 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtktext.c (clear_focus_area): We need to clear the focus
area on focus out, even if a background pixmap isn't set.
(#13941)
Tue Jan 30 18:24:10 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtknotebook.c (gtk_notebook_set_shape): Fix from Sean Cunningham
to deal with setting the shape properly when scrolling arrows are
turned on, but not visible because there is sufficient space.
(#13432)
Tue Jan 30 16:39:25 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkitemfactory.c (gtk_item_factory_delete_item): For menu
items with submenus, destroy the item along with the submenu.
(#7841, Brian Masney(?)) Also, handle paths of the form '<foo>/abcd...'
properly.
* gtk/testgtk.c (menu_items): Add a dummy branch that we delete
later.
Tue Jan 30 15:51:25 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwindow.c (gtk_window_real_set_focus): Fix a problem where
the focus widget sometimes wasn't drawn with the default if there
was no default widget.
* gtk/gtkstyle.c (gtk_style_real_unrealize): free colors,
unreference pixmaps.
* gtk/gtkstyle.c (gtk_style_realize): Reference colormap
for some extra safety.
Mon Jan 29 19:00:01 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtk{ctree.c,clist.c} (set_cell_contents): Handle setting
the text of a cell to the old pointer value better, by
copying the new text before freeing the old text. Some code
cleanup. (#8079, Karl Nelson)
Mon Jan 29 16:50:19 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtklabel.[ch] gtk/gtkframe.[ch]: Make gtk_label_get_text()
gtk_frame_get_label() non strdup'ing, and G_CONST_RETURN.
Mon Jan 29 15:22:51 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkmenu.c (gtk_menu_remove): When removing an
item from a menu, check to see if it matches
menu->old_active_menu_item, and if so, unref and clear
old_active_menu_item (Patch from Pavel Cisler)
* gtk/gtkmenushell.c (gtk_menu_shell_remove): Unset
menu_shell->active_menu_item, if it is the child being
removed. (Patch based on that of Gene Ragan, #50337)
2001-02-02 17:53:29 +00:00
|
|
|
|
|
2006-05-02 23:56:43 +00:00
|
|
|
|
GTK_CONTAINER_CLASS (gtk_menu_parent_class)->remove (container, widget);
|
2010-12-23 20:50:18 +00:00
|
|
|
|
|
2005-09-01 05:11:46 +00:00
|
|
|
|
g_object_set_data (G_OBJECT (widget), I_(ATTACH_INFO_KEY), NULL);
|
Get rid of a bunch of g_strdup_printf("%s%s") in favor of g_strconcat().
Fri Feb 2 12:26:50 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkrc.c (gtk_rc_add_initial_default_files): Get rid of
a bunch of g_strdup_printf("%s%s") in favor of g_strconcat().
* gtk/gtkrc.c Makefile.am: Use $(libdir), not $(exe_prefix),
since some people set $(libdir) separately. (#1290, David Kaelbling)
Thu Feb 1 18:25:46 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkfilesel.c: If PATH_MAX and MAXPATHLEN are not
defined, define MAXPATHLEN to 2048. (The Hurd doesn't have
MAXPATHLEN, but the code here depends on a fixed value.)
(#4524)
Wed Jan 31 22:01:04 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkhandlebox.c (gtk_handle_box_button_changed): Handle the case
where child == NULL and handle_position == RIGHT or BOTTOM. (#8041g)
Wed Jan 31 21:20:39 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkctree.c (real_tree_move): If the node being moved isn't
viewable there is no way that moving the node will cause the
focus row to become not viewable, so omit check on the visibility
of new_sibling, which is irrelevant. (Fixes #8002, David Helder)
Wed Jan 31 20:38:17 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkentry.c (gtk_entry_commit_cb): Delete the current
selection before inserting new text.
Wed Jan 31 18:49:33 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkoptionmenu.c (gtk_option_menu_item_state_changed_cb):
Make the sensitivity of the reparented child track that of
the original parent menu item. (#34218, David Hodson)
* gtk/gtkoptionmenu.c (gtk_option_menu_item_destroy_cb): Handle
the case where the current item is destroyed properly.
* gtk/gtkoptionmenu.c: Some additional code cleanups and fix
some edge cases with child-less menuitems.
Wed Jan 31 17:16:13 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkcombo.c (gtk_combo_window_key_press): Make Return
key pop down window. (#12074, Jon K Hellan)
Wed Jan 31 16:21:42 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtklist.c (gtk_list_signal_item_toggle): Don't allow
toggling of rows off in BROWSE or EXTENDED mode. (#12072, Jon K Hellan)
The solution here isn't perfect - you get an extraneous
emission of "toggle", which could conceivably confuse an app,
but better than the current situation. LXR search seems to
indicate that no apps in GNOME CVS connect to "toggle".
Wed Jan 31 15:46:13 2001 Owen Taylor <otaylor@redhat.com>
* gtk/Makefile.am (libgtkinclude_HEADERS): Move gtkcompat.h from
gtk_public_h_sources to directly here to avoid warning when
building srcdir != builddir. (#9656)
Tue Jan 30 19:49:02 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkrange.c: Patch from Kipp Hickman to make the event
handlers in gtkrange.c return the proper values (TRUE == handled)
(#10316).
This is just the tip of the iceberg, but gtkrange.c is the
most common place where the propagation is problematical,
and also a place where it is almost certainly safe to change
this in the stable branch.
(You don't want right click popups on a range control or anything...)
Tue Jan 30 18:57:59 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtktext.c (clear_focus_area): We need to clear the focus
area on focus out, even if a background pixmap isn't set.
(#13941)
Tue Jan 30 18:24:10 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtknotebook.c (gtk_notebook_set_shape): Fix from Sean Cunningham
to deal with setting the shape properly when scrolling arrows are
turned on, but not visible because there is sufficient space.
(#13432)
Tue Jan 30 16:39:25 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkitemfactory.c (gtk_item_factory_delete_item): For menu
items with submenus, destroy the item along with the submenu.
(#7841, Brian Masney(?)) Also, handle paths of the form '<foo>/abcd...'
properly.
* gtk/testgtk.c (menu_items): Add a dummy branch that we delete
later.
Tue Jan 30 15:51:25 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwindow.c (gtk_window_real_set_focus): Fix a problem where
the focus widget sometimes wasn't drawn with the default if there
was no default widget.
* gtk/gtkstyle.c (gtk_style_real_unrealize): free colors,
unreference pixmaps.
* gtk/gtkstyle.c (gtk_style_realize): Reference colormap
for some extra safety.
Mon Jan 29 19:00:01 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtk{ctree.c,clist.c} (set_cell_contents): Handle setting
the text of a cell to the old pointer value better, by
copying the new text before freeing the old text. Some code
cleanup. (#8079, Karl Nelson)
Mon Jan 29 16:50:19 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtklabel.[ch] gtk/gtkframe.[ch]: Make gtk_label_get_text()
gtk_frame_get_label() non strdup'ing, and G_CONST_RETURN.
Mon Jan 29 15:22:51 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkmenu.c (gtk_menu_remove): When removing an
item from a menu, check to see if it matches
menu->old_active_menu_item, and if so, unref and clear
old_active_menu_item (Patch from Pavel Cisler)
* gtk/gtkmenushell.c (gtk_menu_shell_remove): Unset
menu_shell->active_menu_item, if it is the child being
removed. (Patch based on that of Gene Ragan, #50337)
2001-02-02 17:53:29 +00:00
|
|
|
|
|
2004-03-15 02:03:59 +00:00
|
|
|
|
menu_queue_resize (menu);
|
|
|
|
|
}
|
Get rid of a bunch of g_strdup_printf("%s%s") in favor of g_strconcat().
Fri Feb 2 12:26:50 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkrc.c (gtk_rc_add_initial_default_files): Get rid of
a bunch of g_strdup_printf("%s%s") in favor of g_strconcat().
* gtk/gtkrc.c Makefile.am: Use $(libdir), not $(exe_prefix),
since some people set $(libdir) separately. (#1290, David Kaelbling)
Thu Feb 1 18:25:46 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkfilesel.c: If PATH_MAX and MAXPATHLEN are not
defined, define MAXPATHLEN to 2048. (The Hurd doesn't have
MAXPATHLEN, but the code here depends on a fixed value.)
(#4524)
Wed Jan 31 22:01:04 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkhandlebox.c (gtk_handle_box_button_changed): Handle the case
where child == NULL and handle_position == RIGHT or BOTTOM. (#8041g)
Wed Jan 31 21:20:39 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkctree.c (real_tree_move): If the node being moved isn't
viewable there is no way that moving the node will cause the
focus row to become not viewable, so omit check on the visibility
of new_sibling, which is irrelevant. (Fixes #8002, David Helder)
Wed Jan 31 20:38:17 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkentry.c (gtk_entry_commit_cb): Delete the current
selection before inserting new text.
Wed Jan 31 18:49:33 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkoptionmenu.c (gtk_option_menu_item_state_changed_cb):
Make the sensitivity of the reparented child track that of
the original parent menu item. (#34218, David Hodson)
* gtk/gtkoptionmenu.c (gtk_option_menu_item_destroy_cb): Handle
the case where the current item is destroyed properly.
* gtk/gtkoptionmenu.c: Some additional code cleanups and fix
some edge cases with child-less menuitems.
Wed Jan 31 17:16:13 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkcombo.c (gtk_combo_window_key_press): Make Return
key pop down window. (#12074, Jon K Hellan)
Wed Jan 31 16:21:42 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtklist.c (gtk_list_signal_item_toggle): Don't allow
toggling of rows off in BROWSE or EXTENDED mode. (#12072, Jon K Hellan)
The solution here isn't perfect - you get an extraneous
emission of "toggle", which could conceivably confuse an app,
but better than the current situation. LXR search seems to
indicate that no apps in GNOME CVS connect to "toggle".
Wed Jan 31 15:46:13 2001 Owen Taylor <otaylor@redhat.com>
* gtk/Makefile.am (libgtkinclude_HEADERS): Move gtkcompat.h from
gtk_public_h_sources to directly here to avoid warning when
building srcdir != builddir. (#9656)
Tue Jan 30 19:49:02 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkrange.c: Patch from Kipp Hickman to make the event
handlers in gtkrange.c return the proper values (TRUE == handled)
(#10316).
This is just the tip of the iceberg, but gtkrange.c is the
most common place where the propagation is problematical,
and also a place where it is almost certainly safe to change
this in the stable branch.
(You don't want right click popups on a range control or anything...)
Tue Jan 30 18:57:59 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtktext.c (clear_focus_area): We need to clear the focus
area on focus out, even if a background pixmap isn't set.
(#13941)
Tue Jan 30 18:24:10 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtknotebook.c (gtk_notebook_set_shape): Fix from Sean Cunningham
to deal with setting the shape properly when scrolling arrows are
turned on, but not visible because there is sufficient space.
(#13432)
Tue Jan 30 16:39:25 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkitemfactory.c (gtk_item_factory_delete_item): For menu
items with submenus, destroy the item along with the submenu.
(#7841, Brian Masney(?)) Also, handle paths of the form '<foo>/abcd...'
properly.
* gtk/testgtk.c (menu_items): Add a dummy branch that we delete
later.
Tue Jan 30 15:51:25 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwindow.c (gtk_window_real_set_focus): Fix a problem where
the focus widget sometimes wasn't drawn with the default if there
was no default widget.
* gtk/gtkstyle.c (gtk_style_real_unrealize): free colors,
unreference pixmaps.
* gtk/gtkstyle.c (gtk_style_realize): Reference colormap
for some extra safety.
Mon Jan 29 19:00:01 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtk{ctree.c,clist.c} (set_cell_contents): Handle setting
the text of a cell to the old pointer value better, by
copying the new text before freeing the old text. Some code
cleanup. (#8079, Karl Nelson)
Mon Jan 29 16:50:19 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtklabel.[ch] gtk/gtkframe.[ch]: Make gtk_label_get_text()
gtk_frame_get_label() non strdup'ing, and G_CONST_RETURN.
Mon Jan 29 15:22:51 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkmenu.c (gtk_menu_remove): When removing an
item from a menu, check to see if it matches
menu->old_active_menu_item, and if so, unref and clear
old_active_menu_item (Patch from Pavel Cisler)
* gtk/gtkmenushell.c (gtk_menu_shell_remove): Unset
menu_shell->active_menu_item, if it is the child being
removed. (Patch based on that of Gene Ragan, #50337)
2001-02-02 17:53:29 +00:00
|
|
|
|
|
2011-01-15 13:51:11 +00:00
|
|
|
|
/**
|
|
|
|
|
* gtk_menu_new:
|
|
|
|
|
*
|
2011-01-18 09:12:38 +00:00
|
|
|
|
* Creates a new #GtkMenu
|
2011-01-15 13:51:11 +00:00
|
|
|
|
*
|
2011-01-18 09:12:38 +00:00
|
|
|
|
* Returns: a new #GtkMenu
|
2011-01-15 13:51:11 +00:00
|
|
|
|
*/
|
1997-11-24 22:37:52 +00:00
|
|
|
|
GtkWidget*
|
1998-05-03 22:41:32 +00:00
|
|
|
|
gtk_menu_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, NULL);
|
1997-11-24 22:37:52 +00:00
|
|
|
|
}
|
|
|
|
|
|
Add note about GtkMenuPositionFunc API changes.
2000-11-08 Alexander Larsson <alexl@redhat.com>
* docs/Changes-2.0.txt: Add note about GtkMenuPositionFunc
API changes.
* gtk/gtkmenu.c: Add support for scrolling menus.
Remove gtk_menu_append/prepend/insert, these have been moved to
gtkcompat.h as #defines.
* gtk/gtkcompat.h.in:
Add compatibility #defines for gtk_menu_append/prepend/insert
* gtk/gtkmenu.h: Add data needed for scrolling menus.
GtkMenuPositionFunc gets an extra argument push_in.
gtk_menu_append/prepend/insert removed.
* gtk/gtkmenuitem.c (gtk_menu_item_position_menu): Change menu
positioning behaviour to fit to scrolling menus.
* gtk/gtkmenuitem.c (gtk_menu_item_forall): Don't recurse
into menuitem->submeny. That is wrong, and broke torn
off submenus of torn off menus, since they were unrealized
when the first menu was unrealized.
* gtk/gtkmenushell.[ch]: Virtualize gtk_menu_shell_insert() and
gtk_menu_shell_select_item() since these need to be overridden in
GtkMenu.
* gtk/gtkoptionmenu.c (gtk_opttion_menu_position): Change menu
positioning behaviour to fit to scrolling menus.
(gtk_option_menu_key_press, gtk_option_menu_button_press): Select
the current item so that it is prelighted when the menu pops up.
This is a workaround to the fact that the menu doesn't get the
initial enter event (due to grabs).
* gtk/gtkfilesel.c, gtk/gtkinputdialog.c, gtk/testgtk.c:
s/gtk_menu_append/gtk_menu_shell_append/
* gtk/gtknotebook.c:
s/gtk_menu_insert/gtk_menu_shell_insert/
* gtk/testgtk.c (create_menu, create_menus):
Create the first menu with 50 items so that menu scrolling
can be tested.
Patch from Jonathan Blandford <jrb@redhat.com>
* gtk/gtkmenuitem.[ch] (gtk_menu_item_toggle_size_request): new
system to handle size requests. First, we ask what the size of
the toggle is. Then, when allocating the size, we allocate the
toggle_size first. This way we can have multiple menu-item
classes w/o needing a seperate class for each.
* gtk/gtkmenu.c (gtk_menu_size_request): Actually use the new system.
* gtk/gtkmenu.c (gtk_menu_size_allocate): Use the new system.
* gtk/gtkcheckmenuitem.c
(gtk_check_menu_item_toggle_size_request): New function to handle
the toggle size-request.
2000-11-08 17:34:52 +00:00
|
|
|
|
static void
|
2004-03-15 02:03:59 +00:00
|
|
|
|
gtk_menu_real_insert (GtkMenuShell *menu_shell,
|
2010-12-23 20:50:18 +00:00
|
|
|
|
GtkWidget *child,
|
|
|
|
|
gint position)
|
1997-11-24 22:37:52 +00:00
|
|
|
|
{
|
2004-03-15 02:03:59 +00:00
|
|
|
|
GtkMenu *menu = GTK_MENU (menu_shell);
|
2010-12-23 20:50:18 +00:00
|
|
|
|
GtkMenuPrivate *priv = menu->priv;
|
2004-03-15 02:03:59 +00:00
|
|
|
|
AttachInfo *ai = get_attach_info (child);
|
2015-11-03 02:49:10 +00:00
|
|
|
|
GtkCssNode *widget_node, *child_node;
|
The table menu patch! Turns GtkMenu into a table, so you can attach menu
Wed Sep 10 22:25:04 2003 Kristian Rietveld <kris@gtk.org>
The table menu patch! Turns GtkMenu into a table, so you can attach
menu items in numerous new ways! Be creative!
Contains some bug fixes and RTL adaptions from Matthias Clasen.
* gtk/gtkmenu.c [toplevel]: introduce ATTACH_INFO_KEY, extend
GtkMenuPrivate, introduce AttachInfo, add child properties enum,
(gtk_menu_free_private), (gtk_menu_get_private): we have to free
the heights array in the private struct,
(gtk_menu_class_init): reorder code a bit, install child properties,
(get_attach_info), (get_child_attach): new utility functions,
(gtk_menu_set_child_property), (gtk_menu_get_child_property): introduce
child properties, for the attach info,
(gtk_menu_remove): remove AttachInfo from menu item,
(gtk_menu_real_insert): implemented algorithm to automagically place
inserted menu items at the correct place in the table,
(gtk_menu_size_request), (gtk_menu_size_allocate),
(compute_child_offset): reworked/rewritten to support table menus,
(gtk_menu_attach): new function,
(find_child_containing), (gtk_menu_move_current): new functions to
get table menu keynav right.
* gtk/gtkmenu.h: add gtk_menu_attach() prototype.
2003-09-10 20:32:33 +00:00
|
|
|
|
|
2004-03-15 02:03:59 +00:00
|
|
|
|
ai->left_attach = -1;
|
|
|
|
|
ai->right_attach = -1;
|
|
|
|
|
ai->top_attach = -1;
|
|
|
|
|
ai->bottom_attach = -1;
|
The table menu patch! Turns GtkMenu into a table, so you can attach menu
Wed Sep 10 22:25:04 2003 Kristian Rietveld <kris@gtk.org>
The table menu patch! Turns GtkMenu into a table, so you can attach
menu items in numerous new ways! Be creative!
Contains some bug fixes and RTL adaptions from Matthias Clasen.
* gtk/gtkmenu.c [toplevel]: introduce ATTACH_INFO_KEY, extend
GtkMenuPrivate, introduce AttachInfo, add child properties enum,
(gtk_menu_free_private), (gtk_menu_get_private): we have to free
the heights array in the private struct,
(gtk_menu_class_init): reorder code a bit, install child properties,
(get_attach_info), (get_child_attach): new utility functions,
(gtk_menu_set_child_property), (gtk_menu_get_child_property): introduce
child properties, for the attach info,
(gtk_menu_remove): remove AttachInfo from menu item,
(gtk_menu_real_insert): implemented algorithm to automagically place
inserted menu items at the correct place in the table,
(gtk_menu_size_request), (gtk_menu_size_allocate),
(compute_child_offset): reworked/rewritten to support table menus,
(gtk_menu_attach): new function,
(find_child_containing), (gtk_menu_move_current): new functions to
get table menu keynav right.
* gtk/gtkmenu.h: add gtk_menu_attach() prototype.
2003-09-10 20:32:33 +00:00
|
|
|
|
|
2010-03-02 06:16:02 +00:00
|
|
|
|
if (gtk_widget_get_realized (GTK_WIDGET (menu_shell)))
|
2010-12-23 20:50:18 +00:00
|
|
|
|
gtk_widget_set_parent_window (child, priv->bin_window);
|
2003-12-19 20:56:19 +00:00
|
|
|
|
|
2015-11-03 02:49:10 +00:00
|
|
|
|
widget_node = gtk_widget_get_css_node (GTK_WIDGET (menu));
|
|
|
|
|
child_node = gtk_widget_get_css_node (child);
|
2015-12-21 01:30:52 +00:00
|
|
|
|
gtk_css_node_insert_before (widget_node, child_node,
|
|
|
|
|
gtk_css_gadget_get_node (priv->bottom_arrow_gadget));
|
2015-11-03 02:49:10 +00:00
|
|
|
|
|
2006-05-02 23:56:43 +00:00
|
|
|
|
GTK_MENU_SHELL_CLASS (gtk_menu_parent_class)->insert (menu_shell, child, position);
|
2003-12-19 20:56:19 +00:00
|
|
|
|
|
2004-03-15 02:03:59 +00:00
|
|
|
|
menu_queue_resize (menu);
|
2003-12-19 20:56:19 +00:00
|
|
|
|
}
|
|
|
|
|
|
Tue Mar 16 17:43:33 1999 Tim Janik <timj@gtk.org>
Wed Mar 17 01:46:28 1999 Tim Janik <timj@gtk.org>
* merges from gtk-1-2:
Tue Mar 16 17:43:33 1999 Tim Janik <timj@gtk.org>
* gtk/gtkitemfactory.c (gtk_item_factory_parse_rc_string): ensure the
item factory class has been created.
(gtk_item_factory_parse_rc): likewise.
* gtk/gtkmenu.c:
keep proper references for old_active_menu_item.
(gtk_menu_reparent): unset the usize of the new parent,
so the menu can sanely be size requested and we don't get nasty screen
artefacts upon next reparentation.
(gtk_menu_motion_notify): set send_event to TRUE if we synthesize an
enter notify. only synthesize enter notifies if the pointer really is
inside the event window.
(gtk_menu_popdown): use gtk_menu_shell_deselect().
(gtk_menu_popup): move the background setting stuff into
gtk_menu_tearoff_bg_copy() so it can be called from other places as well.
* gtk/gtkmenushell.c (gtk_menu_shell_button_press): use
gtk_menu_shell_select_item() to select the new item.
(gtk_menu_shell_deselect): export this function, so gtkmenu.c can
do the right thing for deselection as well.
Sat Mar 15 20:10:33 1999 Tim Janik <timj@gtk.org>
* gtk/gtkwidget.[hc]:
(gtk_widget_accelerators_locked): return whether a widget's accelerators
are locked.
* gtk/gtkmenu.c (gtk_menu_key_press): don't remove or install new or
existing accelerators if the widget's accelerators are locked.
Sat Mar 14 19:44:05 1999 Tim Janik <timj@gtk.org>
* gtk/gtkitemfactory.[hc]: allow managing of foreign menu items.
* gtk/gtkmenu.c: truely forward key press and key release events to
the menu widget from the toplevel or tearoff window. we can't simply
connect to that, we need to stop further processing of the events as
well.
Sat Mar 13 13:14:17 1999 Tim Janik <timj@gtk.org>
* gtk/gtkmenu.c:
(gtk_menu_key_press): pass event->keyval, event->state to
gtk_accelerator_valid, instead of event->keyval twice.
refuse to install single letter accelerators for menus that use
single letter shortcuts.
* gtk/gtkitemfactory.c (gtk_item_factory_create_item): use
gtk_menu_ensure_uline_accel_group().
* gtk/gtkmenu.[hc]: added gtk_menu_ensure_uline_accel_group()
which will always return an uline accel group, made
gtk_menu_get_uline_accel_group() return NULL if the group isn't
yet created.
Mon Mar 15 01:03:27 1999 Lars Hamann <lars@gtk.org>
* gtk/gtkclist.h (struct _GtkCListColumn): added button_passive flag.
* gtk/gtkclist.c (gtk_clist_column_title_passive):
Leave button sensitive, trap button_press, button_release,
motion_notify, enter_notify and leave_notify events instead.
(gtk_clist_column_title_active): disconnect event handler.
(gtk_clist_drag_data_get): fixed memory leak. Reported by
Guillaume Laurent <glaurent@worldnet.fr>
Wed Mar 10 23:49:55 1999 Lars Hamann <lars@gtk.org>
* gtk/gtklayout.c (gtk_layout_adjustment_changed): fixed a few
width/height mixups.
* gtk/gtkctree.c (tree_delete): emit an tree_unselect_row signal
if needed.
Wed Mar 10 00:11:32 1999 Tim Janik <timj@gtk.org>
* gtk/testgtk.c (create_item_factory): unref the item factory after
window's destruction.
* gtk/gtkmenushell.c (gtk_menu_shell_activate_item): keep a reference
count on the menu shell around the menu item's activation, since the
signal emission may cause menu shell destruction.
* gtk/gtkitemfactory.c:
the previous code leaked one accel group per menu. we use
gtk_menu_get_uline_accel_group() now to fix that, and with that
also create the underline accelerator group of the menus only if
required (i.e. an underline accelerator has been specified).
(gtk_item_factory_construct):
(gtk_item_factory_create_item): removed code that would create an
extra accel group for the menu (and leak references).
(gtk_item_factory_create_item): adapted the underline accelerator
installation code to properly feature gtk_menu_get_uline_accel_group().
* gtk/gtkmenu.[hc]: added gtk_menu_get_accel_group() to retrive
menu->accel_group, this may return NULL if the accelerator group
hasn't been set yet.
added gtk_menu_get_uline_accel_group() to retrive the underline
accelerator group of the menu, this will be created on demand
and proper care is taken about its reference count.
* gtk/gtkitemfactory.h:
* gtk/gtkitemfactory.c:
dumped the approach of keeping a widgets by action list on the
factory since the factory<->widget destroy negotiation didn't work
and would be hard to get going at all. instead we keep a list of
GtkItemFactoryItem items on the factory (GtkItemFactoryItems are
persistant throughout a program's life time).
also, i removed the static const gchar *key_* variables, and made
them inline strings (they weren't actually used anyways).
(gtk_item_factory_add_item): update ifactory->items.
(gtk_item_factory_destroy): destroy ifactory->items (and remove
the item factory pointer from the remaining ifactory widgets).
(gtk_item_factory_get_widget_by_action): walk the GtkItemFactoryItem
list to find the widget.
(gtk_item_factory_get_item): new function that works around
gtk_item_factory_get_widget() limitations, this function will only
return menu items, even for <Branch> entries.
Tue Mar 9 01:01:28 1999 Tim Janik <timj@gtk.org>
* gdk/gdkfont.c (gdk_font_load): first lookup the xfont ID in our
font hash table, if we have a GdkFontPrivate entry for this font
already, simply increment its reference count, provided by Olaf Dietsche
<olaf.dietsche+list.gtk@netcologne.de>.
* gtk/gtkstyle.c (gtk_style_copy): plug a GdkFont reference leak, fix
provided by Olaf Dietsche <olaf.dietsche+list.gtk@netcologne.de>.
Sun Mar 7 06:13:29 1999 Tim Janik <timj@gtk.org>
* gtk/gtkcontainer.c:
(gtk_container_add_with_args):
(gtk_container_addv):
(gtk_container_add): before adding a child to a conatiner, make sure
it is (default) constructed, this is neccessary because under certain
circumstances the child will get relized and mapped immediatedly, in
which case it has to be constructed already.
Mon Mar 1 17:58:21 1999 Tim Janik <timj@gtk.org>
* gtk/gtksignal.c (gtk_signal_connect_by_type): count object_signal
values > 1 as TRUE also.
1999-03-17 01:39:42 +00:00
|
|
|
|
static void
|
|
|
|
|
gtk_menu_tearoff_bg_copy (GtkMenu *menu)
|
|
|
|
|
{
|
2010-12-23 20:50:18 +00:00
|
|
|
|
GtkMenuPrivate *priv = menu->priv;
|
Add note about GtkMenuPositionFunc API changes.
2000-11-08 Alexander Larsson <alexl@redhat.com>
* docs/Changes-2.0.txt: Add note about GtkMenuPositionFunc
API changes.
* gtk/gtkmenu.c: Add support for scrolling menus.
Remove gtk_menu_append/prepend/insert, these have been moved to
gtkcompat.h as #defines.
* gtk/gtkcompat.h.in:
Add compatibility #defines for gtk_menu_append/prepend/insert
* gtk/gtkmenu.h: Add data needed for scrolling menus.
GtkMenuPositionFunc gets an extra argument push_in.
gtk_menu_append/prepend/insert removed.
* gtk/gtkmenuitem.c (gtk_menu_item_position_menu): Change menu
positioning behaviour to fit to scrolling menus.
* gtk/gtkmenuitem.c (gtk_menu_item_forall): Don't recurse
into menuitem->submeny. That is wrong, and broke torn
off submenus of torn off menus, since they were unrealized
when the first menu was unrealized.
* gtk/gtkmenushell.[ch]: Virtualize gtk_menu_shell_insert() and
gtk_menu_shell_select_item() since these need to be overridden in
GtkMenu.
* gtk/gtkoptionmenu.c (gtk_opttion_menu_position): Change menu
positioning behaviour to fit to scrolling menus.
(gtk_option_menu_key_press, gtk_option_menu_button_press): Select
the current item so that it is prelighted when the menu pops up.
This is a workaround to the fact that the menu doesn't get the
initial enter event (due to grabs).
* gtk/gtkfilesel.c, gtk/gtkinputdialog.c, gtk/testgtk.c:
s/gtk_menu_append/gtk_menu_shell_append/
* gtk/gtknotebook.c:
s/gtk_menu_insert/gtk_menu_shell_insert/
* gtk/testgtk.c (create_menu, create_menus):
Create the first menu with 50 items so that menu scrolling
can be tested.
Patch from Jonathan Blandford <jrb@redhat.com>
* gtk/gtkmenuitem.[ch] (gtk_menu_item_toggle_size_request): new
system to handle size requests. First, we ask what the size of
the toggle is. Then, when allocating the size, we allocate the
toggle_size first. This way we can have multiple menu-item
classes w/o needing a seperate class for each.
* gtk/gtkmenu.c (gtk_menu_size_request): Actually use the new system.
* gtk/gtkmenu.c (gtk_menu_size_allocate): Use the new system.
* gtk/gtkcheckmenuitem.c
(gtk_check_menu_item_toggle_size_request): New function to handle
the toggle size-request.
2000-11-08 17:34:52 +00:00
|
|
|
|
gint width, height;
|
Tue Mar 16 17:43:33 1999 Tim Janik <timj@gtk.org>
Wed Mar 17 01:46:28 1999 Tim Janik <timj@gtk.org>
* merges from gtk-1-2:
Tue Mar 16 17:43:33 1999 Tim Janik <timj@gtk.org>
* gtk/gtkitemfactory.c (gtk_item_factory_parse_rc_string): ensure the
item factory class has been created.
(gtk_item_factory_parse_rc): likewise.
* gtk/gtkmenu.c:
keep proper references for old_active_menu_item.
(gtk_menu_reparent): unset the usize of the new parent,
so the menu can sanely be size requested and we don't get nasty screen
artefacts upon next reparentation.
(gtk_menu_motion_notify): set send_event to TRUE if we synthesize an
enter notify. only synthesize enter notifies if the pointer really is
inside the event window.
(gtk_menu_popdown): use gtk_menu_shell_deselect().
(gtk_menu_popup): move the background setting stuff into
gtk_menu_tearoff_bg_copy() so it can be called from other places as well.
* gtk/gtkmenushell.c (gtk_menu_shell_button_press): use
gtk_menu_shell_select_item() to select the new item.
(gtk_menu_shell_deselect): export this function, so gtkmenu.c can
do the right thing for deselection as well.
Sat Mar 15 20:10:33 1999 Tim Janik <timj@gtk.org>
* gtk/gtkwidget.[hc]:
(gtk_widget_accelerators_locked): return whether a widget's accelerators
are locked.
* gtk/gtkmenu.c (gtk_menu_key_press): don't remove or install new or
existing accelerators if the widget's accelerators are locked.
Sat Mar 14 19:44:05 1999 Tim Janik <timj@gtk.org>
* gtk/gtkitemfactory.[hc]: allow managing of foreign menu items.
* gtk/gtkmenu.c: truely forward key press and key release events to
the menu widget from the toplevel or tearoff window. we can't simply
connect to that, we need to stop further processing of the events as
well.
Sat Mar 13 13:14:17 1999 Tim Janik <timj@gtk.org>
* gtk/gtkmenu.c:
(gtk_menu_key_press): pass event->keyval, event->state to
gtk_accelerator_valid, instead of event->keyval twice.
refuse to install single letter accelerators for menus that use
single letter shortcuts.
* gtk/gtkitemfactory.c (gtk_item_factory_create_item): use
gtk_menu_ensure_uline_accel_group().
* gtk/gtkmenu.[hc]: added gtk_menu_ensure_uline_accel_group()
which will always return an uline accel group, made
gtk_menu_get_uline_accel_group() return NULL if the group isn't
yet created.
Mon Mar 15 01:03:27 1999 Lars Hamann <lars@gtk.org>
* gtk/gtkclist.h (struct _GtkCListColumn): added button_passive flag.
* gtk/gtkclist.c (gtk_clist_column_title_passive):
Leave button sensitive, trap button_press, button_release,
motion_notify, enter_notify and leave_notify events instead.
(gtk_clist_column_title_active): disconnect event handler.
(gtk_clist_drag_data_get): fixed memory leak. Reported by
Guillaume Laurent <glaurent@worldnet.fr>
Wed Mar 10 23:49:55 1999 Lars Hamann <lars@gtk.org>
* gtk/gtklayout.c (gtk_layout_adjustment_changed): fixed a few
width/height mixups.
* gtk/gtkctree.c (tree_delete): emit an tree_unselect_row signal
if needed.
Wed Mar 10 00:11:32 1999 Tim Janik <timj@gtk.org>
* gtk/testgtk.c (create_item_factory): unref the item factory after
window's destruction.
* gtk/gtkmenushell.c (gtk_menu_shell_activate_item): keep a reference
count on the menu shell around the menu item's activation, since the
signal emission may cause menu shell destruction.
* gtk/gtkitemfactory.c:
the previous code leaked one accel group per menu. we use
gtk_menu_get_uline_accel_group() now to fix that, and with that
also create the underline accelerator group of the menus only if
required (i.e. an underline accelerator has been specified).
(gtk_item_factory_construct):
(gtk_item_factory_create_item): removed code that would create an
extra accel group for the menu (and leak references).
(gtk_item_factory_create_item): adapted the underline accelerator
installation code to properly feature gtk_menu_get_uline_accel_group().
* gtk/gtkmenu.[hc]: added gtk_menu_get_accel_group() to retrive
menu->accel_group, this may return NULL if the accelerator group
hasn't been set yet.
added gtk_menu_get_uline_accel_group() to retrive the underline
accelerator group of the menu, this will be created on demand
and proper care is taken about its reference count.
* gtk/gtkitemfactory.h:
* gtk/gtkitemfactory.c:
dumped the approach of keeping a widgets by action list on the
factory since the factory<->widget destroy negotiation didn't work
and would be hard to get going at all. instead we keep a list of
GtkItemFactoryItem items on the factory (GtkItemFactoryItems are
persistant throughout a program's life time).
also, i removed the static const gchar *key_* variables, and made
them inline strings (they weren't actually used anyways).
(gtk_item_factory_add_item): update ifactory->items.
(gtk_item_factory_destroy): destroy ifactory->items (and remove
the item factory pointer from the remaining ifactory widgets).
(gtk_item_factory_get_widget_by_action): walk the GtkItemFactoryItem
list to find the widget.
(gtk_item_factory_get_item): new function that works around
gtk_item_factory_get_widget() limitations, this function will only
return menu items, even for <Branch> entries.
Tue Mar 9 01:01:28 1999 Tim Janik <timj@gtk.org>
* gdk/gdkfont.c (gdk_font_load): first lookup the xfont ID in our
font hash table, if we have a GdkFontPrivate entry for this font
already, simply increment its reference count, provided by Olaf Dietsche
<olaf.dietsche+list.gtk@netcologne.de>.
* gtk/gtkstyle.c (gtk_style_copy): plug a GdkFont reference leak, fix
provided by Olaf Dietsche <olaf.dietsche+list.gtk@netcologne.de>.
Sun Mar 7 06:13:29 1999 Tim Janik <timj@gtk.org>
* gtk/gtkcontainer.c:
(gtk_container_add_with_args):
(gtk_container_addv):
(gtk_container_add): before adding a child to a conatiner, make sure
it is (default) constructed, this is neccessary because under certain
circumstances the child will get relized and mapped immediatedly, in
which case it has to be constructed already.
Mon Mar 1 17:58:21 1999 Tim Janik <timj@gtk.org>
* gtk/gtksignal.c (gtk_signal_connect_by_type): count object_signal
values > 1 as TRUE also.
1999-03-17 01:39:42 +00:00
|
|
|
|
|
2010-12-23 20:50:18 +00:00
|
|
|
|
if (priv->torn_off)
|
Tue Mar 16 17:43:33 1999 Tim Janik <timj@gtk.org>
Wed Mar 17 01:46:28 1999 Tim Janik <timj@gtk.org>
* merges from gtk-1-2:
Tue Mar 16 17:43:33 1999 Tim Janik <timj@gtk.org>
* gtk/gtkitemfactory.c (gtk_item_factory_parse_rc_string): ensure the
item factory class has been created.
(gtk_item_factory_parse_rc): likewise.
* gtk/gtkmenu.c:
keep proper references for old_active_menu_item.
(gtk_menu_reparent): unset the usize of the new parent,
so the menu can sanely be size requested and we don't get nasty screen
artefacts upon next reparentation.
(gtk_menu_motion_notify): set send_event to TRUE if we synthesize an
enter notify. only synthesize enter notifies if the pointer really is
inside the event window.
(gtk_menu_popdown): use gtk_menu_shell_deselect().
(gtk_menu_popup): move the background setting stuff into
gtk_menu_tearoff_bg_copy() so it can be called from other places as well.
* gtk/gtkmenushell.c (gtk_menu_shell_button_press): use
gtk_menu_shell_select_item() to select the new item.
(gtk_menu_shell_deselect): export this function, so gtkmenu.c can
do the right thing for deselection as well.
Sat Mar 15 20:10:33 1999 Tim Janik <timj@gtk.org>
* gtk/gtkwidget.[hc]:
(gtk_widget_accelerators_locked): return whether a widget's accelerators
are locked.
* gtk/gtkmenu.c (gtk_menu_key_press): don't remove or install new or
existing accelerators if the widget's accelerators are locked.
Sat Mar 14 19:44:05 1999 Tim Janik <timj@gtk.org>
* gtk/gtkitemfactory.[hc]: allow managing of foreign menu items.
* gtk/gtkmenu.c: truely forward key press and key release events to
the menu widget from the toplevel or tearoff window. we can't simply
connect to that, we need to stop further processing of the events as
well.
Sat Mar 13 13:14:17 1999 Tim Janik <timj@gtk.org>
* gtk/gtkmenu.c:
(gtk_menu_key_press): pass event->keyval, event->state to
gtk_accelerator_valid, instead of event->keyval twice.
refuse to install single letter accelerators for menus that use
single letter shortcuts.
* gtk/gtkitemfactory.c (gtk_item_factory_create_item): use
gtk_menu_ensure_uline_accel_group().
* gtk/gtkmenu.[hc]: added gtk_menu_ensure_uline_accel_group()
which will always return an uline accel group, made
gtk_menu_get_uline_accel_group() return NULL if the group isn't
yet created.
Mon Mar 15 01:03:27 1999 Lars Hamann <lars@gtk.org>
* gtk/gtkclist.h (struct _GtkCListColumn): added button_passive flag.
* gtk/gtkclist.c (gtk_clist_column_title_passive):
Leave button sensitive, trap button_press, button_release,
motion_notify, enter_notify and leave_notify events instead.
(gtk_clist_column_title_active): disconnect event handler.
(gtk_clist_drag_data_get): fixed memory leak. Reported by
Guillaume Laurent <glaurent@worldnet.fr>
Wed Mar 10 23:49:55 1999 Lars Hamann <lars@gtk.org>
* gtk/gtklayout.c (gtk_layout_adjustment_changed): fixed a few
width/height mixups.
* gtk/gtkctree.c (tree_delete): emit an tree_unselect_row signal
if needed.
Wed Mar 10 00:11:32 1999 Tim Janik <timj@gtk.org>
* gtk/testgtk.c (create_item_factory): unref the item factory after
window's destruction.
* gtk/gtkmenushell.c (gtk_menu_shell_activate_item): keep a reference
count on the menu shell around the menu item's activation, since the
signal emission may cause menu shell destruction.
* gtk/gtkitemfactory.c:
the previous code leaked one accel group per menu. we use
gtk_menu_get_uline_accel_group() now to fix that, and with that
also create the underline accelerator group of the menus only if
required (i.e. an underline accelerator has been specified).
(gtk_item_factory_construct):
(gtk_item_factory_create_item): removed code that would create an
extra accel group for the menu (and leak references).
(gtk_item_factory_create_item): adapted the underline accelerator
installation code to properly feature gtk_menu_get_uline_accel_group().
* gtk/gtkmenu.[hc]: added gtk_menu_get_accel_group() to retrive
menu->accel_group, this may return NULL if the accelerator group
hasn't been set yet.
added gtk_menu_get_uline_accel_group() to retrive the underline
accelerator group of the menu, this will be created on demand
and proper care is taken about its reference count.
* gtk/gtkitemfactory.h:
* gtk/gtkitemfactory.c:
dumped the approach of keeping a widgets by action list on the
factory since the factory<->widget destroy negotiation didn't work
and would be hard to get going at all. instead we keep a list of
GtkItemFactoryItem items on the factory (GtkItemFactoryItems are
persistant throughout a program's life time).
also, i removed the static const gchar *key_* variables, and made
them inline strings (they weren't actually used anyways).
(gtk_item_factory_add_item): update ifactory->items.
(gtk_item_factory_destroy): destroy ifactory->items (and remove
the item factory pointer from the remaining ifactory widgets).
(gtk_item_factory_get_widget_by_action): walk the GtkItemFactoryItem
list to find the widget.
(gtk_item_factory_get_item): new function that works around
gtk_item_factory_get_widget() limitations, this function will only
return menu items, even for <Branch> entries.
Tue Mar 9 01:01:28 1999 Tim Janik <timj@gtk.org>
* gdk/gdkfont.c (gdk_font_load): first lookup the xfont ID in our
font hash table, if we have a GdkFontPrivate entry for this font
already, simply increment its reference count, provided by Olaf Dietsche
<olaf.dietsche+list.gtk@netcologne.de>.
* gtk/gtkstyle.c (gtk_style_copy): plug a GdkFont reference leak, fix
provided by Olaf Dietsche <olaf.dietsche+list.gtk@netcologne.de>.
Sun Mar 7 06:13:29 1999 Tim Janik <timj@gtk.org>
* gtk/gtkcontainer.c:
(gtk_container_add_with_args):
(gtk_container_addv):
(gtk_container_add): before adding a child to a conatiner, make sure
it is (default) constructed, this is neccessary because under certain
circumstances the child will get relized and mapped immediatedly, in
which case it has to be constructed already.
Mon Mar 1 17:58:21 1999 Tim Janik <timj@gtk.org>
* gtk/gtksignal.c (gtk_signal_connect_by_type): count object_signal
values > 1 as TRUE also.
1999-03-17 01:39:42 +00:00
|
|
|
|
{
|
2010-08-11 21:08:37 +00:00
|
|
|
|
GdkWindow *window;
|
2010-08-15 12:41:29 +00:00
|
|
|
|
cairo_surface_t *surface;
|
|
|
|
|
cairo_pattern_t *pattern;
|
2010-07-14 19:56:15 +00:00
|
|
|
|
cairo_t *cr;
|
Add note about GtkMenuPositionFunc API changes.
2000-11-08 Alexander Larsson <alexl@redhat.com>
* docs/Changes-2.0.txt: Add note about GtkMenuPositionFunc
API changes.
* gtk/gtkmenu.c: Add support for scrolling menus.
Remove gtk_menu_append/prepend/insert, these have been moved to
gtkcompat.h as #defines.
* gtk/gtkcompat.h.in:
Add compatibility #defines for gtk_menu_append/prepend/insert
* gtk/gtkmenu.h: Add data needed for scrolling menus.
GtkMenuPositionFunc gets an extra argument push_in.
gtk_menu_append/prepend/insert removed.
* gtk/gtkmenuitem.c (gtk_menu_item_position_menu): Change menu
positioning behaviour to fit to scrolling menus.
* gtk/gtkmenuitem.c (gtk_menu_item_forall): Don't recurse
into menuitem->submeny. That is wrong, and broke torn
off submenus of torn off menus, since they were unrealized
when the first menu was unrealized.
* gtk/gtkmenushell.[ch]: Virtualize gtk_menu_shell_insert() and
gtk_menu_shell_select_item() since these need to be overridden in
GtkMenu.
* gtk/gtkoptionmenu.c (gtk_opttion_menu_position): Change menu
positioning behaviour to fit to scrolling menus.
(gtk_option_menu_key_press, gtk_option_menu_button_press): Select
the current item so that it is prelighted when the menu pops up.
This is a workaround to the fact that the menu doesn't get the
initial enter event (due to grabs).
* gtk/gtkfilesel.c, gtk/gtkinputdialog.c, gtk/testgtk.c:
s/gtk_menu_append/gtk_menu_shell_append/
* gtk/gtknotebook.c:
s/gtk_menu_insert/gtk_menu_shell_insert/
* gtk/testgtk.c (create_menu, create_menus):
Create the first menu with 50 items so that menu scrolling
can be tested.
Patch from Jonathan Blandford <jrb@redhat.com>
* gtk/gtkmenuitem.[ch] (gtk_menu_item_toggle_size_request): new
system to handle size requests. First, we ask what the size of
the toggle is. Then, when allocating the size, we allocate the
toggle_size first. This way we can have multiple menu-item
classes w/o needing a seperate class for each.
* gtk/gtkmenu.c (gtk_menu_size_request): Actually use the new system.
* gtk/gtkmenu.c (gtk_menu_size_allocate): Use the new system.
* gtk/gtkcheckmenuitem.c
(gtk_check_menu_item_toggle_size_request): New function to handle
the toggle size-request.
2000-11-08 17:34:52 +00:00
|
|
|
|
|
2010-12-23 20:50:18 +00:00
|
|
|
|
priv->tearoff_active = FALSE;
|
|
|
|
|
priv->saved_scroll_offset = priv->scroll_offset;
|
2010-08-11 21:08:37 +00:00
|
|
|
|
|
2010-12-23 20:50:18 +00:00
|
|
|
|
window = gtk_widget_get_window (priv->tearoff_window);
|
2010-09-20 14:39:25 +00:00
|
|
|
|
width = gdk_window_get_width (window);
|
|
|
|
|
height = gdk_window_get_height (window);
|
2010-08-11 21:08:37 +00:00
|
|
|
|
|
2010-08-15 12:41:29 +00:00
|
|
|
|
surface = gdk_window_create_similar_surface (window,
|
|
|
|
|
CAIRO_CONTENT_COLOR,
|
|
|
|
|
width,
|
|
|
|
|
height);
|
Tue Mar 16 17:43:33 1999 Tim Janik <timj@gtk.org>
Wed Mar 17 01:46:28 1999 Tim Janik <timj@gtk.org>
* merges from gtk-1-2:
Tue Mar 16 17:43:33 1999 Tim Janik <timj@gtk.org>
* gtk/gtkitemfactory.c (gtk_item_factory_parse_rc_string): ensure the
item factory class has been created.
(gtk_item_factory_parse_rc): likewise.
* gtk/gtkmenu.c:
keep proper references for old_active_menu_item.
(gtk_menu_reparent): unset the usize of the new parent,
so the menu can sanely be size requested and we don't get nasty screen
artefacts upon next reparentation.
(gtk_menu_motion_notify): set send_event to TRUE if we synthesize an
enter notify. only synthesize enter notifies if the pointer really is
inside the event window.
(gtk_menu_popdown): use gtk_menu_shell_deselect().
(gtk_menu_popup): move the background setting stuff into
gtk_menu_tearoff_bg_copy() so it can be called from other places as well.
* gtk/gtkmenushell.c (gtk_menu_shell_button_press): use
gtk_menu_shell_select_item() to select the new item.
(gtk_menu_shell_deselect): export this function, so gtkmenu.c can
do the right thing for deselection as well.
Sat Mar 15 20:10:33 1999 Tim Janik <timj@gtk.org>
* gtk/gtkwidget.[hc]:
(gtk_widget_accelerators_locked): return whether a widget's accelerators
are locked.
* gtk/gtkmenu.c (gtk_menu_key_press): don't remove or install new or
existing accelerators if the widget's accelerators are locked.
Sat Mar 14 19:44:05 1999 Tim Janik <timj@gtk.org>
* gtk/gtkitemfactory.[hc]: allow managing of foreign menu items.
* gtk/gtkmenu.c: truely forward key press and key release events to
the menu widget from the toplevel or tearoff window. we can't simply
connect to that, we need to stop further processing of the events as
well.
Sat Mar 13 13:14:17 1999 Tim Janik <timj@gtk.org>
* gtk/gtkmenu.c:
(gtk_menu_key_press): pass event->keyval, event->state to
gtk_accelerator_valid, instead of event->keyval twice.
refuse to install single letter accelerators for menus that use
single letter shortcuts.
* gtk/gtkitemfactory.c (gtk_item_factory_create_item): use
gtk_menu_ensure_uline_accel_group().
* gtk/gtkmenu.[hc]: added gtk_menu_ensure_uline_accel_group()
which will always return an uline accel group, made
gtk_menu_get_uline_accel_group() return NULL if the group isn't
yet created.
Mon Mar 15 01:03:27 1999 Lars Hamann <lars@gtk.org>
* gtk/gtkclist.h (struct _GtkCListColumn): added button_passive flag.
* gtk/gtkclist.c (gtk_clist_column_title_passive):
Leave button sensitive, trap button_press, button_release,
motion_notify, enter_notify and leave_notify events instead.
(gtk_clist_column_title_active): disconnect event handler.
(gtk_clist_drag_data_get): fixed memory leak. Reported by
Guillaume Laurent <glaurent@worldnet.fr>
Wed Mar 10 23:49:55 1999 Lars Hamann <lars@gtk.org>
* gtk/gtklayout.c (gtk_layout_adjustment_changed): fixed a few
width/height mixups.
* gtk/gtkctree.c (tree_delete): emit an tree_unselect_row signal
if needed.
Wed Mar 10 00:11:32 1999 Tim Janik <timj@gtk.org>
* gtk/testgtk.c (create_item_factory): unref the item factory after
window's destruction.
* gtk/gtkmenushell.c (gtk_menu_shell_activate_item): keep a reference
count on the menu shell around the menu item's activation, since the
signal emission may cause menu shell destruction.
* gtk/gtkitemfactory.c:
the previous code leaked one accel group per menu. we use
gtk_menu_get_uline_accel_group() now to fix that, and with that
also create the underline accelerator group of the menus only if
required (i.e. an underline accelerator has been specified).
(gtk_item_factory_construct):
(gtk_item_factory_create_item): removed code that would create an
extra accel group for the menu (and leak references).
(gtk_item_factory_create_item): adapted the underline accelerator
installation code to properly feature gtk_menu_get_uline_accel_group().
* gtk/gtkmenu.[hc]: added gtk_menu_get_accel_group() to retrive
menu->accel_group, this may return NULL if the accelerator group
hasn't been set yet.
added gtk_menu_get_uline_accel_group() to retrive the underline
accelerator group of the menu, this will be created on demand
and proper care is taken about its reference count.
* gtk/gtkitemfactory.h:
* gtk/gtkitemfactory.c:
dumped the approach of keeping a widgets by action list on the
factory since the factory<->widget destroy negotiation didn't work
and would be hard to get going at all. instead we keep a list of
GtkItemFactoryItem items on the factory (GtkItemFactoryItems are
persistant throughout a program's life time).
also, i removed the static const gchar *key_* variables, and made
them inline strings (they weren't actually used anyways).
(gtk_item_factory_add_item): update ifactory->items.
(gtk_item_factory_destroy): destroy ifactory->items (and remove
the item factory pointer from the remaining ifactory widgets).
(gtk_item_factory_get_widget_by_action): walk the GtkItemFactoryItem
list to find the widget.
(gtk_item_factory_get_item): new function that works around
gtk_item_factory_get_widget() limitations, this function will only
return menu items, even for <Branch> entries.
Tue Mar 9 01:01:28 1999 Tim Janik <timj@gtk.org>
* gdk/gdkfont.c (gdk_font_load): first lookup the xfont ID in our
font hash table, if we have a GdkFontPrivate entry for this font
already, simply increment its reference count, provided by Olaf Dietsche
<olaf.dietsche+list.gtk@netcologne.de>.
* gtk/gtkstyle.c (gtk_style_copy): plug a GdkFont reference leak, fix
provided by Olaf Dietsche <olaf.dietsche+list.gtk@netcologne.de>.
Sun Mar 7 06:13:29 1999 Tim Janik <timj@gtk.org>
* gtk/gtkcontainer.c:
(gtk_container_add_with_args):
(gtk_container_addv):
(gtk_container_add): before adding a child to a conatiner, make sure
it is (default) constructed, this is neccessary because under certain
circumstances the child will get relized and mapped immediatedly, in
which case it has to be constructed already.
Mon Mar 1 17:58:21 1999 Tim Janik <timj@gtk.org>
* gtk/gtksignal.c (gtk_signal_connect_by_type): count object_signal
values > 1 as TRUE also.
1999-03-17 01:39:42 +00:00
|
|
|
|
|
2010-08-15 12:41:29 +00:00
|
|
|
|
cr = cairo_create (surface);
|
2010-12-23 20:50:18 +00:00
|
|
|
|
gdk_cairo_set_source_window (cr, window, 0, 0);
|
2010-07-14 19:56:15 +00:00
|
|
|
|
cairo_paint (cr);
|
|
|
|
|
cairo_destroy (cr);
|
Add note about GtkMenuPositionFunc API changes.
2000-11-08 Alexander Larsson <alexl@redhat.com>
* docs/Changes-2.0.txt: Add note about GtkMenuPositionFunc
API changes.
* gtk/gtkmenu.c: Add support for scrolling menus.
Remove gtk_menu_append/prepend/insert, these have been moved to
gtkcompat.h as #defines.
* gtk/gtkcompat.h.in:
Add compatibility #defines for gtk_menu_append/prepend/insert
* gtk/gtkmenu.h: Add data needed for scrolling menus.
GtkMenuPositionFunc gets an extra argument push_in.
gtk_menu_append/prepend/insert removed.
* gtk/gtkmenuitem.c (gtk_menu_item_position_menu): Change menu
positioning behaviour to fit to scrolling menus.
* gtk/gtkmenuitem.c (gtk_menu_item_forall): Don't recurse
into menuitem->submeny. That is wrong, and broke torn
off submenus of torn off menus, since they were unrealized
when the first menu was unrealized.
* gtk/gtkmenushell.[ch]: Virtualize gtk_menu_shell_insert() and
gtk_menu_shell_select_item() since these need to be overridden in
GtkMenu.
* gtk/gtkoptionmenu.c (gtk_opttion_menu_position): Change menu
positioning behaviour to fit to scrolling menus.
(gtk_option_menu_key_press, gtk_option_menu_button_press): Select
the current item so that it is prelighted when the menu pops up.
This is a workaround to the fact that the menu doesn't get the
initial enter event (due to grabs).
* gtk/gtkfilesel.c, gtk/gtkinputdialog.c, gtk/testgtk.c:
s/gtk_menu_append/gtk_menu_shell_append/
* gtk/gtknotebook.c:
s/gtk_menu_insert/gtk_menu_shell_insert/
* gtk/testgtk.c (create_menu, create_menus):
Create the first menu with 50 items so that menu scrolling
can be tested.
Patch from Jonathan Blandford <jrb@redhat.com>
* gtk/gtkmenuitem.[ch] (gtk_menu_item_toggle_size_request): new
system to handle size requests. First, we ask what the size of
the toggle is. Then, when allocating the size, we allocate the
toggle_size first. This way we can have multiple menu-item
classes w/o needing a seperate class for each.
* gtk/gtkmenu.c (gtk_menu_size_request): Actually use the new system.
* gtk/gtkmenu.c (gtk_menu_size_allocate): Use the new system.
* gtk/gtkcheckmenuitem.c
(gtk_check_menu_item_toggle_size_request): New function to handle
the toggle size-request.
2000-11-08 17:34:52 +00:00
|
|
|
|
|
2010-12-23 20:50:18 +00:00
|
|
|
|
gtk_widget_set_size_request (priv->tearoff_window, width, height);
|
Add note about GtkMenuPositionFunc API changes.
2000-11-08 Alexander Larsson <alexl@redhat.com>
* docs/Changes-2.0.txt: Add note about GtkMenuPositionFunc
API changes.
* gtk/gtkmenu.c: Add support for scrolling menus.
Remove gtk_menu_append/prepend/insert, these have been moved to
gtkcompat.h as #defines.
* gtk/gtkcompat.h.in:
Add compatibility #defines for gtk_menu_append/prepend/insert
* gtk/gtkmenu.h: Add data needed for scrolling menus.
GtkMenuPositionFunc gets an extra argument push_in.
gtk_menu_append/prepend/insert removed.
* gtk/gtkmenuitem.c (gtk_menu_item_position_menu): Change menu
positioning behaviour to fit to scrolling menus.
* gtk/gtkmenuitem.c (gtk_menu_item_forall): Don't recurse
into menuitem->submeny. That is wrong, and broke torn
off submenus of torn off menus, since they were unrealized
when the first menu was unrealized.
* gtk/gtkmenushell.[ch]: Virtualize gtk_menu_shell_insert() and
gtk_menu_shell_select_item() since these need to be overridden in
GtkMenu.
* gtk/gtkoptionmenu.c (gtk_opttion_menu_position): Change menu
positioning behaviour to fit to scrolling menus.
(gtk_option_menu_key_press, gtk_option_menu_button_press): Select
the current item so that it is prelighted when the menu pops up.
This is a workaround to the fact that the menu doesn't get the
initial enter event (due to grabs).
* gtk/gtkfilesel.c, gtk/gtkinputdialog.c, gtk/testgtk.c:
s/gtk_menu_append/gtk_menu_shell_append/
* gtk/gtknotebook.c:
s/gtk_menu_insert/gtk_menu_shell_insert/
* gtk/testgtk.c (create_menu, create_menus):
Create the first menu with 50 items so that menu scrolling
can be tested.
Patch from Jonathan Blandford <jrb@redhat.com>
* gtk/gtkmenuitem.[ch] (gtk_menu_item_toggle_size_request): new
system to handle size requests. First, we ask what the size of
the toggle is. Then, when allocating the size, we allocate the
toggle_size first. This way we can have multiple menu-item
classes w/o needing a seperate class for each.
* gtk/gtkmenu.c (gtk_menu_size_request): Actually use the new system.
* gtk/gtkmenu.c (gtk_menu_size_allocate): Use the new system.
* gtk/gtkcheckmenuitem.c
(gtk_check_menu_item_toggle_size_request): New function to handle
the toggle size-request.
2000-11-08 17:34:52 +00:00
|
|
|
|
|
2016-11-07 16:23:53 +00:00
|
|
|
|
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
2010-08-15 12:41:29 +00:00
|
|
|
|
pattern = cairo_pattern_create_for_surface (surface);
|
|
|
|
|
gdk_window_set_background_pattern (window, pattern);
|
2016-11-07 16:23:53 +00:00
|
|
|
|
G_GNUC_END_IGNORE_DEPRECATIONS
|
2010-08-15 12:41:29 +00:00
|
|
|
|
|
|
|
|
|
cairo_pattern_destroy (pattern);
|
|
|
|
|
cairo_surface_destroy (surface);
|
Tue Mar 16 17:43:33 1999 Tim Janik <timj@gtk.org>
Wed Mar 17 01:46:28 1999 Tim Janik <timj@gtk.org>
* merges from gtk-1-2:
Tue Mar 16 17:43:33 1999 Tim Janik <timj@gtk.org>
* gtk/gtkitemfactory.c (gtk_item_factory_parse_rc_string): ensure the
item factory class has been created.
(gtk_item_factory_parse_rc): likewise.
* gtk/gtkmenu.c:
keep proper references for old_active_menu_item.
(gtk_menu_reparent): unset the usize of the new parent,
so the menu can sanely be size requested and we don't get nasty screen
artefacts upon next reparentation.
(gtk_menu_motion_notify): set send_event to TRUE if we synthesize an
enter notify. only synthesize enter notifies if the pointer really is
inside the event window.
(gtk_menu_popdown): use gtk_menu_shell_deselect().
(gtk_menu_popup): move the background setting stuff into
gtk_menu_tearoff_bg_copy() so it can be called from other places as well.
* gtk/gtkmenushell.c (gtk_menu_shell_button_press): use
gtk_menu_shell_select_item() to select the new item.
(gtk_menu_shell_deselect): export this function, so gtkmenu.c can
do the right thing for deselection as well.
Sat Mar 15 20:10:33 1999 Tim Janik <timj@gtk.org>
* gtk/gtkwidget.[hc]:
(gtk_widget_accelerators_locked): return whether a widget's accelerators
are locked.
* gtk/gtkmenu.c (gtk_menu_key_press): don't remove or install new or
existing accelerators if the widget's accelerators are locked.
Sat Mar 14 19:44:05 1999 Tim Janik <timj@gtk.org>
* gtk/gtkitemfactory.[hc]: allow managing of foreign menu items.
* gtk/gtkmenu.c: truely forward key press and key release events to
the menu widget from the toplevel or tearoff window. we can't simply
connect to that, we need to stop further processing of the events as
well.
Sat Mar 13 13:14:17 1999 Tim Janik <timj@gtk.org>
* gtk/gtkmenu.c:
(gtk_menu_key_press): pass event->keyval, event->state to
gtk_accelerator_valid, instead of event->keyval twice.
refuse to install single letter accelerators for menus that use
single letter shortcuts.
* gtk/gtkitemfactory.c (gtk_item_factory_create_item): use
gtk_menu_ensure_uline_accel_group().
* gtk/gtkmenu.[hc]: added gtk_menu_ensure_uline_accel_group()
which will always return an uline accel group, made
gtk_menu_get_uline_accel_group() return NULL if the group isn't
yet created.
Mon Mar 15 01:03:27 1999 Lars Hamann <lars@gtk.org>
* gtk/gtkclist.h (struct _GtkCListColumn): added button_passive flag.
* gtk/gtkclist.c (gtk_clist_column_title_passive):
Leave button sensitive, trap button_press, button_release,
motion_notify, enter_notify and leave_notify events instead.
(gtk_clist_column_title_active): disconnect event handler.
(gtk_clist_drag_data_get): fixed memory leak. Reported by
Guillaume Laurent <glaurent@worldnet.fr>
Wed Mar 10 23:49:55 1999 Lars Hamann <lars@gtk.org>
* gtk/gtklayout.c (gtk_layout_adjustment_changed): fixed a few
width/height mixups.
* gtk/gtkctree.c (tree_delete): emit an tree_unselect_row signal
if needed.
Wed Mar 10 00:11:32 1999 Tim Janik <timj@gtk.org>
* gtk/testgtk.c (create_item_factory): unref the item factory after
window's destruction.
* gtk/gtkmenushell.c (gtk_menu_shell_activate_item): keep a reference
count on the menu shell around the menu item's activation, since the
signal emission may cause menu shell destruction.
* gtk/gtkitemfactory.c:
the previous code leaked one accel group per menu. we use
gtk_menu_get_uline_accel_group() now to fix that, and with that
also create the underline accelerator group of the menus only if
required (i.e. an underline accelerator has been specified).
(gtk_item_factory_construct):
(gtk_item_factory_create_item): removed code that would create an
extra accel group for the menu (and leak references).
(gtk_item_factory_create_item): adapted the underline accelerator
installation code to properly feature gtk_menu_get_uline_accel_group().
* gtk/gtkmenu.[hc]: added gtk_menu_get_accel_group() to retrive
menu->accel_group, this may return NULL if the accelerator group
hasn't been set yet.
added gtk_menu_get_uline_accel_group() to retrive the underline
accelerator group of the menu, this will be created on demand
and proper care is taken about its reference count.
* gtk/gtkitemfactory.h:
* gtk/gtkitemfactory.c:
dumped the approach of keeping a widgets by action list on the
factory since the factory<->widget destroy negotiation didn't work
and would be hard to get going at all. instead we keep a list of
GtkItemFactoryItem items on the factory (GtkItemFactoryItems are
persistant throughout a program's life time).
also, i removed the static const gchar *key_* variables, and made
them inline strings (they weren't actually used anyways).
(gtk_item_factory_add_item): update ifactory->items.
(gtk_item_factory_destroy): destroy ifactory->items (and remove
the item factory pointer from the remaining ifactory widgets).
(gtk_item_factory_get_widget_by_action): walk the GtkItemFactoryItem
list to find the widget.
(gtk_item_factory_get_item): new function that works around
gtk_item_factory_get_widget() limitations, this function will only
return menu items, even for <Branch> entries.
Tue Mar 9 01:01:28 1999 Tim Janik <timj@gtk.org>
* gdk/gdkfont.c (gdk_font_load): first lookup the xfont ID in our
font hash table, if we have a GdkFontPrivate entry for this font
already, simply increment its reference count, provided by Olaf Dietsche
<olaf.dietsche+list.gtk@netcologne.de>.
* gtk/gtkstyle.c (gtk_style_copy): plug a GdkFont reference leak, fix
provided by Olaf Dietsche <olaf.dietsche+list.gtk@netcologne.de>.
Sun Mar 7 06:13:29 1999 Tim Janik <timj@gtk.org>
* gtk/gtkcontainer.c:
(gtk_container_add_with_args):
(gtk_container_addv):
(gtk_container_add): before adding a child to a conatiner, make sure
it is (default) constructed, this is neccessary because under certain
circumstances the child will get relized and mapped immediatedly, in
which case it has to be constructed already.
Mon Mar 1 17:58:21 1999 Tim Janik <timj@gtk.org>
* gtk/gtksignal.c (gtk_signal_connect_by_type): count object_signal
values > 1 as TRUE also.
1999-03-17 01:39:42 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2002-02-02 21:50:46 +00:00
|
|
|
|
static gboolean
|
|
|
|
|
popup_grab_on_window (GdkWindow *window,
|
2015-11-26 18:54:54 +00:00
|
|
|
|
GdkDevice *pointer)
|
2002-02-02 21:50:46 +00:00
|
|
|
|
{
|
2015-11-26 18:54:54 +00:00
|
|
|
|
GdkGrabStatus status;
|
|
|
|
|
GdkSeat *seat;
|
2010-05-25 22:38:44 +00:00
|
|
|
|
|
2015-11-26 18:54:54 +00:00
|
|
|
|
seat = gdk_device_get_seat (pointer);
|
|
|
|
|
status = gdk_seat_grab (seat, window,
|
|
|
|
|
GDK_SEAT_CAPABILITY_ALL, TRUE,
|
|
|
|
|
NULL, NULL, NULL, NULL);
|
2002-02-02 21:50:46 +00:00
|
|
|
|
|
2015-11-26 18:54:54 +00:00
|
|
|
|
return status == GDK_GRAB_SUCCESS;
|
2002-02-02 21:50:46 +00:00
|
|
|
|
}
|
|
|
|
|
|
wayland: Fix GtkMenuButton popups in a terrible, hacky way
Since you can't take grabs on unmapped windows, GtkMenu takes a grab on
the menu in a convoluted way: it first grabs another window, shows the
menu window, and then transfers the grab over to the GtkMenu widget.
For normal menubars, this is perfectly fine, as the first window it grabs
is our toplevel, and that gets picked up in our transient path. For
GtkMenuButton or other spurious uses of gtk_menu_popup, it creates a new
temporary input-only window which it takes the grab on, known as the "grab
transfer window". Since this window isn't a transient-for of our new menu
widget window, the grab isn't noticed when we go to show it, and thus the
menu ends up as a new toplevel.
Add a special hack to GtkMenu and the Wayland backend which lets us notice
this "grab transfer window", and include it in our grab finding path.
It's sort of terrible to have to hack up the widgets instead of just the
backend, but the alternative would be an entirely new window type which is
managed correctly by GDK. I don't want to write that.
2014-05-15 21:20:00 +00:00
|
|
|
|
static void
|
|
|
|
|
associate_menu_grab_transfer_window (GtkMenu *menu)
|
|
|
|
|
{
|
|
|
|
|
GtkMenuPrivate *priv = menu->priv;
|
|
|
|
|
GdkWindow *toplevel_window;
|
|
|
|
|
GdkWindow *transfer_window;
|
|
|
|
|
|
|
|
|
|
toplevel_window = gtk_widget_get_window (priv->toplevel);
|
|
|
|
|
transfer_window = g_object_get_data (G_OBJECT (menu), "gtk-menu-transfer-window");
|
|
|
|
|
|
|
|
|
|
if (toplevel_window == NULL || transfer_window == NULL)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
g_object_set_data (G_OBJECT (toplevel_window), I_("gdk-attached-grab-window"), transfer_window);
|
|
|
|
|
}
|
|
|
|
|
|
2016-06-14 19:42:13 +00:00
|
|
|
|
static void
|
|
|
|
|
gtk_menu_popup_internal (GtkMenu *menu,
|
|
|
|
|
GdkDevice *device,
|
|
|
|
|
GtkWidget *parent_menu_shell,
|
|
|
|
|
GtkWidget *parent_menu_item,
|
|
|
|
|
GtkMenuPositionFunc func,
|
|
|
|
|
gpointer data,
|
|
|
|
|
GDestroyNotify destroy,
|
|
|
|
|
guint button,
|
|
|
|
|
guint32 activate_time)
|
1997-11-24 22:37:52 +00:00
|
|
|
|
{
|
2010-12-23 20:50:18 +00:00
|
|
|
|
GtkMenuPrivate *priv = menu->priv;
|
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
|
|
|
|
GtkWidget *widget;
|
1998-03-24 01:43:21 +00:00
|
|
|
|
GtkWidget *xgrab_shell;
|
|
|
|
|
GtkWidget *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
|
|
|
|
GdkEvent *current_event;
|
|
|
|
|
GtkMenuShell *menu_shell;
|
2005-03-31 17:02:19 +00:00
|
|
|
|
gboolean grab_keyboard;
|
2006-05-12 16:06:53 +00:00
|
|
|
|
GtkWidget *parent_toplevel;
|
2015-11-26 18:54:54 +00:00
|
|
|
|
GdkDevice *pointer, *source_device = NULL;
|
2015-06-15 23:46:33 +00:00
|
|
|
|
GdkDisplay *display;
|
Add note about GtkMenuPositionFunc API changes.
2000-11-08 Alexander Larsson <alexl@redhat.com>
* docs/Changes-2.0.txt: Add note about GtkMenuPositionFunc
API changes.
* gtk/gtkmenu.c: Add support for scrolling menus.
Remove gtk_menu_append/prepend/insert, these have been moved to
gtkcompat.h as #defines.
* gtk/gtkcompat.h.in:
Add compatibility #defines for gtk_menu_append/prepend/insert
* gtk/gtkmenu.h: Add data needed for scrolling menus.
GtkMenuPositionFunc gets an extra argument push_in.
gtk_menu_append/prepend/insert removed.
* gtk/gtkmenuitem.c (gtk_menu_item_position_menu): Change menu
positioning behaviour to fit to scrolling menus.
* gtk/gtkmenuitem.c (gtk_menu_item_forall): Don't recurse
into menuitem->submeny. That is wrong, and broke torn
off submenus of torn off menus, since they were unrealized
when the first menu was unrealized.
* gtk/gtkmenushell.[ch]: Virtualize gtk_menu_shell_insert() and
gtk_menu_shell_select_item() since these need to be overridden in
GtkMenu.
* gtk/gtkoptionmenu.c (gtk_opttion_menu_position): Change menu
positioning behaviour to fit to scrolling menus.
(gtk_option_menu_key_press, gtk_option_menu_button_press): Select
the current item so that it is prelighted when the menu pops up.
This is a workaround to the fact that the menu doesn't get the
initial enter event (due to grabs).
* gtk/gtkfilesel.c, gtk/gtkinputdialog.c, gtk/testgtk.c:
s/gtk_menu_append/gtk_menu_shell_append/
* gtk/gtknotebook.c:
s/gtk_menu_insert/gtk_menu_shell_insert/
* gtk/testgtk.c (create_menu, create_menus):
Create the first menu with 50 items so that menu scrolling
can be tested.
Patch from Jonathan Blandford <jrb@redhat.com>
* gtk/gtkmenuitem.[ch] (gtk_menu_item_toggle_size_request): new
system to handle size requests. First, we ask what the size of
the toggle is. Then, when allocating the size, we allocate the
toggle_size first. This way we can have multiple menu-item
classes w/o needing a seperate class for each.
* gtk/gtkmenu.c (gtk_menu_size_request): Actually use the new system.
* gtk/gtkmenu.c (gtk_menu_size_allocate): Use the new system.
* gtk/gtkcheckmenuitem.c
(gtk_check_menu_item_toggle_size_request): New function to handle
the toggle size-request.
2000-11-08 17:34:52 +00:00
|
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
|
g_return_if_fail (GTK_IS_MENU (menu));
|
2010-09-24 17:52:49 +00:00
|
|
|
|
g_return_if_fail (device == NULL || GDK_IS_DEVICE (device));
|
|
|
|
|
|
2015-06-15 23:46:33 +00:00
|
|
|
|
display = gtk_widget_get_display (GTK_WIDGET (menu));
|
|
|
|
|
|
2010-09-24 17:52:49 +00:00
|
|
|
|
if (device == NULL)
|
|
|
|
|
device = gtk_get_current_event_device ();
|
|
|
|
|
|
2015-06-15 23:46:33 +00:00
|
|
|
|
if (device && gdk_device_get_display (device) != display)
|
|
|
|
|
device = NULL;
|
|
|
|
|
|
2010-09-24 17:52:49 +00:00
|
|
|
|
if (device == NULL)
|
2015-12-16 18:24:20 +00:00
|
|
|
|
device = gdk_seat_get_pointer (gdk_display_get_default_seat (display));
|
2005-06-27 02:07:35 +00:00
|
|
|
|
|
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
|
|
|
|
widget = GTK_WIDGET (menu);
|
|
|
|
|
menu_shell = GTK_MENU_SHELL (menu);
|
2005-03-31 17:02:19 +00:00
|
|
|
|
|
2010-11-23 19:25:13 +00:00
|
|
|
|
if (gdk_device_get_source (device) == GDK_SOURCE_KEYBOARD)
|
2015-11-26 18:54:54 +00:00
|
|
|
|
pointer = gdk_device_get_associated_device (device);
|
2010-05-25 22:38:44 +00:00
|
|
|
|
else
|
2015-11-26 18:54:54 +00:00
|
|
|
|
pointer = device;
|
2010-05-25 22:38:44 +00:00
|
|
|
|
|
2010-12-23 23:21:53 +00:00
|
|
|
|
menu_shell->priv->parent_menu_shell = parent_menu_shell;
|
2004-12-22 16:52:23 +00:00
|
|
|
|
|
|
|
|
|
priv->seen_item_enter = FALSE;
|
2010-12-23 20:50:18 +00:00
|
|
|
|
|
2002-02-02 21:50:46 +00:00
|
|
|
|
/* Find the last viewable ancestor, and make an X grab on it
|
|
|
|
|
*/
|
|
|
|
|
parent = GTK_WIDGET (menu);
|
|
|
|
|
xgrab_shell = NULL;
|
|
|
|
|
while (parent)
|
|
|
|
|
{
|
|
|
|
|
gboolean viewable = TRUE;
|
|
|
|
|
GtkWidget *tmp = parent;
|
2010-12-23 20:50:18 +00:00
|
|
|
|
|
2002-02-02 21:50:46 +00:00
|
|
|
|
while (tmp)
|
2010-12-23 20:50:18 +00:00
|
|
|
|
{
|
|
|
|
|
if (!gtk_widget_get_mapped (tmp))
|
|
|
|
|
{
|
|
|
|
|
viewable = FALSE;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
tmp = gtk_widget_get_parent (tmp);
|
|
|
|
|
}
|
|
|
|
|
|
2002-02-02 21:50:46 +00:00
|
|
|
|
if (viewable)
|
2010-12-23 20:50:18 +00:00
|
|
|
|
xgrab_shell = parent;
|
|
|
|
|
|
2010-12-23 23:21:53 +00:00
|
|
|
|
parent = GTK_MENU_SHELL (parent)->priv->parent_menu_shell;
|
2002-02-02 21:50:46 +00:00
|
|
|
|
}
|
|
|
|
|
|
2010-12-23 20:50:18 +00:00
|
|
|
|
/* We want to receive events generated when we map the menu;
|
|
|
|
|
* unfortunately, since there is probably already an implicit
|
|
|
|
|
* grab in place from the button that the user used to pop up
|
|
|
|
|
* the menu, we won't receive then -- in particular, the EnterNotify
|
|
|
|
|
* when the menu pops up under the pointer.
|
2002-02-02 21:50:46 +00:00
|
|
|
|
*
|
2010-12-23 20:50:18 +00:00
|
|
|
|
* If we are grabbing on a parent menu shell, no problem; just grab
|
|
|
|
|
* on that menu shell first before popping up the window with
|
|
|
|
|
* owner_events = TRUE.
|
2002-02-02 21:50:46 +00:00
|
|
|
|
*
|
2010-12-23 20:50:18 +00:00
|
|
|
|
* When grabbing on the menu itself, things get more convoluted --
|
2002-02-02 21:50:46 +00:00
|
|
|
|
* we do an explicit grab on a specially created window with
|
2010-12-23 20:50:18 +00:00
|
|
|
|
* owner_events = TRUE, which we override further down with a
|
|
|
|
|
* grab on the menu. (We can't grab on the menu until it is mapped;
|
|
|
|
|
* we probably could just leave the grab on the other window,
|
|
|
|
|
* with a little reorganization of the code in gtkmenu*).
|
2002-02-02 21:50:46 +00:00
|
|
|
|
*/
|
2005-03-31 17:02:19 +00:00
|
|
|
|
grab_keyboard = gtk_menu_shell_get_take_focus (menu_shell);
|
2010-12-23 20:50:18 +00:00
|
|
|
|
gtk_window_set_accept_focus (GTK_WINDOW (priv->toplevel), grab_keyboard);
|
2005-03-31 17:02:19 +00:00
|
|
|
|
|
2002-02-03 00:18:41 +00:00
|
|
|
|
if (xgrab_shell && xgrab_shell != widget)
|
2002-02-02 21:50:46 +00:00
|
|
|
|
{
|
2015-11-26 18:54:54 +00:00
|
|
|
|
if (popup_grab_on_window (gtk_widget_get_window (xgrab_shell), pointer))
|
2010-05-25 22:38:44 +00:00
|
|
|
|
{
|
2010-06-15 23:09:41 +00:00
|
|
|
|
_gtk_menu_shell_set_grab_device (GTK_MENU_SHELL (xgrab_shell), pointer);
|
2010-12-23 23:21:53 +00:00
|
|
|
|
GTK_MENU_SHELL (xgrab_shell)->priv->have_xgrab = TRUE;
|
2010-05-25 22:38:44 +00:00
|
|
|
|
}
|
2002-02-02 21:50:46 +00:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
GdkWindow *transfer_window;
|
|
|
|
|
|
|
|
|
|
xgrab_shell = widget;
|
|
|
|
|
transfer_window = menu_grab_transfer_window_get (menu);
|
2015-11-26 18:54:54 +00:00
|
|
|
|
if (popup_grab_on_window (transfer_window, pointer))
|
2010-05-25 22:38:44 +00:00
|
|
|
|
{
|
2010-06-15 23:09:41 +00:00
|
|
|
|
_gtk_menu_shell_set_grab_device (GTK_MENU_SHELL (xgrab_shell), pointer);
|
2010-12-23 23:21:53 +00:00
|
|
|
|
GTK_MENU_SHELL (xgrab_shell)->priv->have_xgrab = TRUE;
|
2010-05-25 22:38:44 +00:00
|
|
|
|
}
|
2002-02-02 21:50:46 +00:00
|
|
|
|
}
|
|
|
|
|
|
2010-12-23 23:21:53 +00:00
|
|
|
|
if (!GTK_MENU_SHELL (xgrab_shell)->priv->have_xgrab)
|
2002-02-02 21:50:46 +00:00
|
|
|
|
{
|
2010-12-23 20:50:18 +00:00
|
|
|
|
/* We failed to make our pointer/keyboard grab.
|
|
|
|
|
* Rather than leaving the user with a stuck up window,
|
|
|
|
|
* we just abort here. Presumably the user will try again.
|
2002-02-02 21:50:46 +00:00
|
|
|
|
*/
|
2010-12-23 23:21:53 +00:00
|
|
|
|
menu_shell->priv->parent_menu_shell = NULL;
|
2002-05-31 16:44:03 +00:00
|
|
|
|
menu_grab_transfer_window_destroy (menu);
|
2002-02-02 21:50:46 +00:00
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2010-06-15 23:09:41 +00:00
|
|
|
|
_gtk_menu_shell_set_grab_device (GTK_MENU_SHELL (menu), pointer);
|
2010-12-23 23:21:53 +00:00
|
|
|
|
menu_shell->priv->active = TRUE;
|
|
|
|
|
menu_shell->priv->button = button;
|
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
|
|
|
|
|
|
|
|
|
/* If we are popping up the menu from something other than, a button
|
|
|
|
|
* press then, as a heuristic, we ignore enter events for the menu
|
2010-12-23 20:50:18 +00:00
|
|
|
|
* until we get a MOTION_NOTIFY.
|
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
|
|
|
|
*/
|
|
|
|
|
|
2001-07-12 17:50:14 +00:00
|
|
|
|
current_event = gtk_get_current_event ();
|
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
|
|
|
|
if (current_event)
|
|
|
|
|
{
|
|
|
|
|
if ((current_event->type != GDK_BUTTON_PRESS) &&
|
2010-12-23 20:50:18 +00:00
|
|
|
|
(current_event->type != GDK_ENTER_NOTIFY))
|
2010-12-23 23:21:53 +00:00
|
|
|
|
menu_shell->priv->ignore_enter = TRUE;
|
2002-02-04 17:46:33 +00:00
|
|
|
|
|
2011-12-12 17:21:40 +00:00
|
|
|
|
source_device = gdk_event_get_source_device (current_event);
|
2002-02-04 17:46:33 +00:00
|
|
|
|
gdk_event_free (current_event);
|
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
|
|
|
|
}
|
2003-11-12 09:09:25 +00:00
|
|
|
|
else
|
2010-12-23 23:21:53 +00:00
|
|
|
|
menu_shell->priv->ignore_enter = TRUE;
|
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
|
|
|
|
|
2010-12-23 20:50:18 +00:00
|
|
|
|
if (priv->torn_off)
|
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
|
|
|
|
{
|
Tue Mar 16 17:43:33 1999 Tim Janik <timj@gtk.org>
Wed Mar 17 01:46:28 1999 Tim Janik <timj@gtk.org>
* merges from gtk-1-2:
Tue Mar 16 17:43:33 1999 Tim Janik <timj@gtk.org>
* gtk/gtkitemfactory.c (gtk_item_factory_parse_rc_string): ensure the
item factory class has been created.
(gtk_item_factory_parse_rc): likewise.
* gtk/gtkmenu.c:
keep proper references for old_active_menu_item.
(gtk_menu_reparent): unset the usize of the new parent,
so the menu can sanely be size requested and we don't get nasty screen
artefacts upon next reparentation.
(gtk_menu_motion_notify): set send_event to TRUE if we synthesize an
enter notify. only synthesize enter notifies if the pointer really is
inside the event window.
(gtk_menu_popdown): use gtk_menu_shell_deselect().
(gtk_menu_popup): move the background setting stuff into
gtk_menu_tearoff_bg_copy() so it can be called from other places as well.
* gtk/gtkmenushell.c (gtk_menu_shell_button_press): use
gtk_menu_shell_select_item() to select the new item.
(gtk_menu_shell_deselect): export this function, so gtkmenu.c can
do the right thing for deselection as well.
Sat Mar 15 20:10:33 1999 Tim Janik <timj@gtk.org>
* gtk/gtkwidget.[hc]:
(gtk_widget_accelerators_locked): return whether a widget's accelerators
are locked.
* gtk/gtkmenu.c (gtk_menu_key_press): don't remove or install new or
existing accelerators if the widget's accelerators are locked.
Sat Mar 14 19:44:05 1999 Tim Janik <timj@gtk.org>
* gtk/gtkitemfactory.[hc]: allow managing of foreign menu items.
* gtk/gtkmenu.c: truely forward key press and key release events to
the menu widget from the toplevel or tearoff window. we can't simply
connect to that, we need to stop further processing of the events as
well.
Sat Mar 13 13:14:17 1999 Tim Janik <timj@gtk.org>
* gtk/gtkmenu.c:
(gtk_menu_key_press): pass event->keyval, event->state to
gtk_accelerator_valid, instead of event->keyval twice.
refuse to install single letter accelerators for menus that use
single letter shortcuts.
* gtk/gtkitemfactory.c (gtk_item_factory_create_item): use
gtk_menu_ensure_uline_accel_group().
* gtk/gtkmenu.[hc]: added gtk_menu_ensure_uline_accel_group()
which will always return an uline accel group, made
gtk_menu_get_uline_accel_group() return NULL if the group isn't
yet created.
Mon Mar 15 01:03:27 1999 Lars Hamann <lars@gtk.org>
* gtk/gtkclist.h (struct _GtkCListColumn): added button_passive flag.
* gtk/gtkclist.c (gtk_clist_column_title_passive):
Leave button sensitive, trap button_press, button_release,
motion_notify, enter_notify and leave_notify events instead.
(gtk_clist_column_title_active): disconnect event handler.
(gtk_clist_drag_data_get): fixed memory leak. Reported by
Guillaume Laurent <glaurent@worldnet.fr>
Wed Mar 10 23:49:55 1999 Lars Hamann <lars@gtk.org>
* gtk/gtklayout.c (gtk_layout_adjustment_changed): fixed a few
width/height mixups.
* gtk/gtkctree.c (tree_delete): emit an tree_unselect_row signal
if needed.
Wed Mar 10 00:11:32 1999 Tim Janik <timj@gtk.org>
* gtk/testgtk.c (create_item_factory): unref the item factory after
window's destruction.
* gtk/gtkmenushell.c (gtk_menu_shell_activate_item): keep a reference
count on the menu shell around the menu item's activation, since the
signal emission may cause menu shell destruction.
* gtk/gtkitemfactory.c:
the previous code leaked one accel group per menu. we use
gtk_menu_get_uline_accel_group() now to fix that, and with that
also create the underline accelerator group of the menus only if
required (i.e. an underline accelerator has been specified).
(gtk_item_factory_construct):
(gtk_item_factory_create_item): removed code that would create an
extra accel group for the menu (and leak references).
(gtk_item_factory_create_item): adapted the underline accelerator
installation code to properly feature gtk_menu_get_uline_accel_group().
* gtk/gtkmenu.[hc]: added gtk_menu_get_accel_group() to retrive
menu->accel_group, this may return NULL if the accelerator group
hasn't been set yet.
added gtk_menu_get_uline_accel_group() to retrive the underline
accelerator group of the menu, this will be created on demand
and proper care is taken about its reference count.
* gtk/gtkitemfactory.h:
* gtk/gtkitemfactory.c:
dumped the approach of keeping a widgets by action list on the
factory since the factory<->widget destroy negotiation didn't work
and would be hard to get going at all. instead we keep a list of
GtkItemFactoryItem items on the factory (GtkItemFactoryItems are
persistant throughout a program's life time).
also, i removed the static const gchar *key_* variables, and made
them inline strings (they weren't actually used anyways).
(gtk_item_factory_add_item): update ifactory->items.
(gtk_item_factory_destroy): destroy ifactory->items (and remove
the item factory pointer from the remaining ifactory widgets).
(gtk_item_factory_get_widget_by_action): walk the GtkItemFactoryItem
list to find the widget.
(gtk_item_factory_get_item): new function that works around
gtk_item_factory_get_widget() limitations, this function will only
return menu items, even for <Branch> entries.
Tue Mar 9 01:01:28 1999 Tim Janik <timj@gtk.org>
* gdk/gdkfont.c (gdk_font_load): first lookup the xfont ID in our
font hash table, if we have a GdkFontPrivate entry for this font
already, simply increment its reference count, provided by Olaf Dietsche
<olaf.dietsche+list.gtk@netcologne.de>.
* gtk/gtkstyle.c (gtk_style_copy): plug a GdkFont reference leak, fix
provided by Olaf Dietsche <olaf.dietsche+list.gtk@netcologne.de>.
Sun Mar 7 06:13:29 1999 Tim Janik <timj@gtk.org>
* gtk/gtkcontainer.c:
(gtk_container_add_with_args):
(gtk_container_addv):
(gtk_container_add): before adding a child to a conatiner, make sure
it is (default) constructed, this is neccessary because under certain
circumstances the child will get relized and mapped immediatedly, in
which case it has to be constructed already.
Mon Mar 1 17:58:21 1999 Tim Janik <timj@gtk.org>
* gtk/gtksignal.c (gtk_signal_connect_by_type): count object_signal
values > 1 as TRUE also.
1999-03-17 01:39:42 +00:00
|
|
|
|
gtk_menu_tearoff_bg_copy (menu);
|
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
|
|
|
|
|
2010-12-23 20:50:18 +00:00
|
|
|
|
gtk_menu_reparent (menu, priv->toplevel, FALSE);
|
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
|
|
|
|
}
|
2006-05-12 16:06:53 +00:00
|
|
|
|
|
|
|
|
|
parent_toplevel = NULL;
|
2010-12-23 20:50:18 +00:00
|
|
|
|
if (parent_menu_shell)
|
2006-05-12 16:06:53 +00:00
|
|
|
|
parent_toplevel = gtk_widget_get_toplevel (parent_menu_shell);
|
|
|
|
|
else if (!g_object_get_data (G_OBJECT (menu), "gtk-menu-explicit-screen"))
|
2004-03-02 20:49:15 +00:00
|
|
|
|
{
|
2006-05-12 16:06:53 +00:00
|
|
|
|
GtkWidget *attach_widget = gtk_menu_get_attach_widget (menu);
|
|
|
|
|
if (attach_widget)
|
2010-12-23 20:50:18 +00:00
|
|
|
|
parent_toplevel = gtk_widget_get_toplevel (attach_widget);
|
2004-03-02 20:49:15 +00:00
|
|
|
|
}
|
2006-05-12 16:06:53 +00:00
|
|
|
|
|
2010-12-23 20:50:18 +00:00
|
|
|
|
/* Set transient for to get the right window group and parent */
|
2008-02-06 09:53:34 +00:00
|
|
|
|
if (GTK_IS_WINDOW (parent_toplevel))
|
2010-12-23 20:50:18 +00:00
|
|
|
|
gtk_window_set_transient_for (GTK_WINDOW (priv->toplevel),
|
|
|
|
|
GTK_WINDOW (parent_toplevel));
|
|
|
|
|
|
|
|
|
|
priv->parent_menu_item = parent_menu_item;
|
|
|
|
|
priv->position_func = func;
|
|
|
|
|
priv->position_func_data = data;
|
2010-09-24 17:52:49 +00:00
|
|
|
|
priv->position_func_data_destroy = destroy;
|
2010-12-23 23:21:53 +00:00
|
|
|
|
menu_shell->priv->activate_time = activate_time;
|
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
|
|
|
|
|
2010-12-23 20:50:18 +00:00
|
|
|
|
/* We need to show the menu here rather in the init function
|
|
|
|
|
* because code expects to be able to tell if the menu is onscreen
|
|
|
|
|
* by looking at gtk_widget_get_visible (menu)
|
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
|
|
|
|
*/
|
1997-11-24 22:37:52 +00:00
|
|
|
|
gtk_widget_show (GTK_WIDGET (menu));
|
2002-02-18 22:08:41 +00:00
|
|
|
|
|
2002-03-26 19:59:34 +00:00
|
|
|
|
/* Position the menu, possibly changing the size request
|
|
|
|
|
*/
|
2010-10-31 19:52:32 +00:00
|
|
|
|
gtk_menu_position (menu, TRUE);
|
2002-03-26 19:59:34 +00:00
|
|
|
|
|
wayland: Fix GtkMenuButton popups in a terrible, hacky way
Since you can't take grabs on unmapped windows, GtkMenu takes a grab on
the menu in a convoluted way: it first grabs another window, shows the
menu window, and then transfers the grab over to the GtkMenu widget.
For normal menubars, this is perfectly fine, as the first window it grabs
is our toplevel, and that gets picked up in our transient path. For
GtkMenuButton or other spurious uses of gtk_menu_popup, it creates a new
temporary input-only window which it takes the grab on, known as the "grab
transfer window". Since this window isn't a transient-for of our new menu
widget window, the grab isn't noticed when we go to show it, and thus the
menu ends up as a new toplevel.
Add a special hack to GtkMenu and the Wayland backend which lets us notice
this "grab transfer window", and include it in our grab finding path.
It's sort of terrible to have to hack up the widgets instead of just the
backend, but the alternative would be an entirely new window type which is
managed correctly by GDK. I don't want to write that.
2014-05-15 21:20:00 +00:00
|
|
|
|
associate_menu_grab_transfer_window (menu);
|
|
|
|
|
|
2019-01-17 18:27:51 +00:00
|
|
|
|
gtk_menu_scroll_to (menu, priv->scroll_offset, GTK_MENU_SCROLL_FLAG_NONE);
|
2001-03-29 00:24:58 +00:00
|
|
|
|
|
2007-04-27 14:49:37 +00:00
|
|
|
|
/* if no item is selected, select the first one */
|
2011-12-12 17:21:40 +00:00
|
|
|
|
if (!menu_shell->priv->active_menu_item &&
|
|
|
|
|
source_device && gdk_device_get_source (source_device) == GDK_SOURCE_TOUCHSCREEN)
|
|
|
|
|
gtk_menu_shell_select_first (menu_shell, TRUE);
|
2007-04-27 14:49:37 +00:00
|
|
|
|
|
2010-12-23 20:50:18 +00:00
|
|
|
|
/* Once everything is set up correctly, map the toplevel */
|
2019-01-17 18:23:21 +00:00
|
|
|
|
gtk_window_force_resize (GTK_WINDOW (priv->toplevel));
|
2010-12-23 20:50:18 +00:00
|
|
|
|
gtk_widget_show (priv->toplevel);
|
2002-02-18 22:08:41 +00:00
|
|
|
|
|
2002-02-02 21:50:46 +00:00
|
|
|
|
if (xgrab_shell == widget)
|
2015-11-26 18:54:54 +00:00
|
|
|
|
popup_grab_on_window (gtk_widget_get_window (widget), pointer); /* Should always succeed */
|
2010-05-25 22:38:44 +00:00
|
|
|
|
|
2015-11-26 18:54:54 +00:00
|
|
|
|
gtk_grab_add (GTK_WIDGET (menu));
|
2009-12-20 08:04:52 +00:00
|
|
|
|
|
|
|
|
|
if (parent_menu_shell)
|
|
|
|
|
{
|
|
|
|
|
gboolean keyboard_mode;
|
|
|
|
|
|
|
|
|
|
keyboard_mode = _gtk_menu_shell_get_keyboard_mode (GTK_MENU_SHELL (parent_menu_shell));
|
|
|
|
|
_gtk_menu_shell_set_keyboard_mode (menu_shell, keyboard_mode);
|
|
|
|
|
}
|
2010-12-23 23:21:53 +00:00
|
|
|
|
else if (menu_shell->priv->button == 0) /* a keynav-activated context menu */
|
2009-12-20 08:04:52 +00:00
|
|
|
|
_gtk_menu_shell_set_keyboard_mode (menu_shell, TRUE);
|
|
|
|
|
|
|
|
|
|
_gtk_menu_shell_update_mnemonics (menu_shell);
|
1997-11-24 22:37:52 +00:00
|
|
|
|
}
|
|
|
|
|
|
2016-06-14 19:42:13 +00:00
|
|
|
|
/**
|
|
|
|
|
* gtk_menu_popup_for_device:
|
|
|
|
|
* @menu: a #GtkMenu
|
|
|
|
|
* @device: (allow-none): a #GdkDevice
|
|
|
|
|
* @parent_menu_shell: (allow-none): the menu shell containing the triggering
|
|
|
|
|
* menu item, or %NULL
|
|
|
|
|
* @parent_menu_item: (allow-none): the menu item whose activation triggered
|
|
|
|
|
* the popup, or %NULL
|
|
|
|
|
* @func: (allow-none): a user supplied function used to position the menu,
|
|
|
|
|
* or %NULL
|
|
|
|
|
* @data: (allow-none): user supplied data to be passed to @func
|
|
|
|
|
* @destroy: (allow-none): destroy notify for @data
|
|
|
|
|
* @button: the mouse button which was pressed to initiate the event
|
|
|
|
|
* @activate_time: the time at which the activation event occurred
|
|
|
|
|
*
|
|
|
|
|
* Displays a menu and makes it available for selection.
|
|
|
|
|
*
|
|
|
|
|
* Applications can use this function to display context-sensitive menus,
|
|
|
|
|
* and will typically supply %NULL for the @parent_menu_shell,
|
|
|
|
|
* @parent_menu_item, @func, @data and @destroy parameters. The default
|
|
|
|
|
* menu positioning function will position the menu at the current position
|
|
|
|
|
* of @device (or its corresponding pointer).
|
|
|
|
|
*
|
|
|
|
|
* The @button parameter should be the mouse button pressed to initiate
|
|
|
|
|
* the menu popup. If the menu popup was initiated by something other than
|
|
|
|
|
* a mouse button press, such as a mouse button release or a keypress,
|
|
|
|
|
* @button should be 0.
|
|
|
|
|
*
|
|
|
|
|
* The @activate_time parameter is used to conflict-resolve initiation of
|
|
|
|
|
* concurrent requests for mouse/keyboard grab requests. To function
|
|
|
|
|
* properly, this needs to be the time stamp of the user event (such as
|
|
|
|
|
* a mouse click or key press) that caused the initiation of the popup.
|
|
|
|
|
* Only if no such event is available, gtk_get_current_event_time() can
|
|
|
|
|
* be used instead.
|
|
|
|
|
*
|
2016-10-12 17:46:25 +00:00
|
|
|
|
* Note that this function does not work very well on GDK backends that
|
|
|
|
|
* do not have global coordinates, such as Wayland or Mir. You should
|
|
|
|
|
* probably use one of the gtk_menu_popup_at_ variants, which do not
|
|
|
|
|
* have this problem.
|
|
|
|
|
*
|
2016-06-14 19:42:13 +00:00
|
|
|
|
* Since: 3.0
|
2016-10-12 17:46:25 +00:00
|
|
|
|
*
|
|
|
|
|
* Deprecated: 3.22: Please use gtk_menu_popup_at_widget(),
|
|
|
|
|
* gtk_menu_popup_at_pointer(). or gtk_menu_popup_at_rect() instead
|
2016-06-14 19:42:13 +00:00
|
|
|
|
*/
|
|
|
|
|
void
|
|
|
|
|
gtk_menu_popup_for_device (GtkMenu *menu,
|
|
|
|
|
GdkDevice *device,
|
|
|
|
|
GtkWidget *parent_menu_shell,
|
|
|
|
|
GtkWidget *parent_menu_item,
|
|
|
|
|
GtkMenuPositionFunc func,
|
|
|
|
|
gpointer data,
|
|
|
|
|
GDestroyNotify destroy,
|
|
|
|
|
guint button,
|
|
|
|
|
guint32 activate_time)
|
|
|
|
|
{
|
|
|
|
|
GtkMenuPrivate *priv;
|
|
|
|
|
|
|
|
|
|
g_return_if_fail (GTK_IS_MENU (menu));
|
|
|
|
|
|
|
|
|
|
priv = menu->priv;
|
|
|
|
|
priv->rect_window = NULL;
|
|
|
|
|
priv->widget = NULL;
|
|
|
|
|
|
|
|
|
|
gtk_menu_popup_internal (menu,
|
|
|
|
|
device,
|
|
|
|
|
parent_menu_shell,
|
|
|
|
|
parent_menu_item,
|
|
|
|
|
func,
|
|
|
|
|
data,
|
|
|
|
|
destroy,
|
|
|
|
|
button,
|
|
|
|
|
activate_time);
|
|
|
|
|
}
|
|
|
|
|
|
2010-05-25 22:38:44 +00:00
|
|
|
|
/**
|
2012-03-19 17:45:48 +00:00
|
|
|
|
* gtk_menu_popup:
|
2011-01-18 05:37:11 +00:00
|
|
|
|
* @menu: a #GtkMenu
|
2010-12-23 20:50:18 +00:00
|
|
|
|
* @parent_menu_shell: (allow-none): the menu shell containing the
|
|
|
|
|
* triggering menu item, or %NULL
|
|
|
|
|
* @parent_menu_item: (allow-none): the menu item whose activation
|
|
|
|
|
* triggered the popup, or %NULL
|
2012-05-30 21:30:08 +00:00
|
|
|
|
* @func: (scope async) (allow-none): a user supplied function used to position
|
2010-12-23 20:50:18 +00:00
|
|
|
|
* the menu, or %NULL
|
2011-01-18 05:37:11 +00:00
|
|
|
|
* @data: user supplied data to be passed to @func.
|
2010-05-25 22:38:44 +00:00
|
|
|
|
* @button: the mouse button which was pressed to initiate the event.
|
|
|
|
|
* @activate_time: the time at which the activation event occurred.
|
|
|
|
|
*
|
2010-12-23 20:50:18 +00:00
|
|
|
|
* Displays a menu and makes it available for selection.
|
|
|
|
|
*
|
|
|
|
|
* Applications can use this function to display context-sensitive
|
|
|
|
|
* menus, and will typically supply %NULL for the @parent_menu_shell,
|
|
|
|
|
* @parent_menu_item, @func and @data parameters. The default menu
|
|
|
|
|
* positioning function will position the menu at the current mouse
|
|
|
|
|
* cursor position.
|
2010-05-25 22:38:44 +00:00
|
|
|
|
*
|
|
|
|
|
* The @button parameter should be the mouse button pressed to initiate
|
2010-12-23 20:50:18 +00:00
|
|
|
|
* the menu popup. If the menu popup was initiated by something other
|
|
|
|
|
* than a mouse button press, such as a mouse button release or a keypress,
|
2010-05-25 22:38:44 +00:00
|
|
|
|
* @button should be 0.
|
|
|
|
|
*
|
2010-12-23 20:50:18 +00:00
|
|
|
|
* The @activate_time parameter is used to conflict-resolve initiation
|
|
|
|
|
* of concurrent requests for mouse/keyboard grab requests. To function
|
|
|
|
|
* properly, this needs to be the timestamp of the user event (such as
|
2010-05-25 22:38:44 +00:00
|
|
|
|
* a mouse click or key press) that caused the initiation of the popup.
|
|
|
|
|
* Only if no such event is available, gtk_get_current_event_time() can
|
|
|
|
|
* be used instead.
|
2016-10-12 17:46:25 +00:00
|
|
|
|
*
|
|
|
|
|
* Note that this function does not work very well on GDK backends that
|
|
|
|
|
* do not have global coordinates, such as Wayland or Mir. You should
|
|
|
|
|
* probably use one of the gtk_menu_popup_at_ variants, which do not
|
|
|
|
|
* have this problem.
|
|
|
|
|
*
|
|
|
|
|
* Deprecated: 3.22: Please use gtk_menu_popup_at_widget(),
|
|
|
|
|
* gtk_menu_popup_at_pointer(). or gtk_menu_popup_at_rect() instead
|
2010-05-25 22:38:44 +00:00
|
|
|
|
*/
|
|
|
|
|
void
|
2010-12-23 20:50:18 +00:00
|
|
|
|
gtk_menu_popup (GtkMenu *menu,
|
|
|
|
|
GtkWidget *parent_menu_shell,
|
|
|
|
|
GtkWidget *parent_menu_item,
|
|
|
|
|
GtkMenuPositionFunc func,
|
|
|
|
|
gpointer data,
|
|
|
|
|
guint button,
|
|
|
|
|
guint32 activate_time)
|
2010-05-25 22:38:44 +00:00
|
|
|
|
{
|
|
|
|
|
g_return_if_fail (GTK_IS_MENU (menu));
|
|
|
|
|
|
2016-11-07 16:23:53 +00:00
|
|
|
|
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
2010-09-24 17:52:49 +00:00
|
|
|
|
gtk_menu_popup_for_device (menu,
|
|
|
|
|
NULL,
|
2010-05-25 22:38:44 +00:00
|
|
|
|
parent_menu_shell,
|
|
|
|
|
parent_menu_item,
|
2016-10-12 17:46:25 +00:00
|
|
|
|
|
2010-09-24 17:52:49 +00:00
|
|
|
|
func, data, NULL,
|
2010-05-25 22:38:44 +00:00
|
|
|
|
button, activate_time);
|
2016-11-07 16:23:53 +00:00
|
|
|
|
G_GNUC_END_IGNORE_DEPRECATIONS
|
2010-05-25 22:38:44 +00:00
|
|
|
|
}
|
|
|
|
|
|
2016-06-14 19:42:13 +00:00
|
|
|
|
static GdkDevice *
|
|
|
|
|
get_device_for_event (const GdkEvent *event)
|
|
|
|
|
{
|
|
|
|
|
GdkDevice *device = NULL;
|
|
|
|
|
GdkSeat *seat = NULL;
|
|
|
|
|
GdkScreen *screen = NULL;
|
|
|
|
|
GdkDisplay *display = NULL;
|
|
|
|
|
|
|
|
|
|
device = gdk_event_get_device (event);
|
|
|
|
|
|
|
|
|
|
if (device)
|
|
|
|
|
return device;
|
|
|
|
|
|
|
|
|
|
seat = gdk_event_get_seat (event);
|
|
|
|
|
|
|
|
|
|
if (!seat)
|
|
|
|
|
{
|
|
|
|
|
screen = gdk_event_get_screen (event);
|
|
|
|
|
|
|
|
|
|
if (screen)
|
|
|
|
|
display = gdk_screen_get_display (screen);
|
|
|
|
|
|
|
|
|
|
if (!display)
|
|
|
|
|
{
|
|
|
|
|
g_warning ("no display for event, using default");
|
|
|
|
|
display = gdk_display_get_default ();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (display)
|
|
|
|
|
seat = gdk_display_get_default_seat (display);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return seat ? gdk_seat_get_pointer (seat) : NULL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* gtk_menu_popup_at_rect:
|
|
|
|
|
* @menu: the #GtkMenu to pop up
|
|
|
|
|
* @rect_window: (not nullable): the #GdkWindow @rect is relative to
|
|
|
|
|
* @rect: (not nullable): the #GdkRectangle to align @menu with
|
|
|
|
|
* @rect_anchor: the point on @rect to align with @menu's anchor point
|
|
|
|
|
* @menu_anchor: the point on @menu to align with @rect's anchor point
|
|
|
|
|
* @trigger_event: (nullable): the #GdkEvent that initiated this request or
|
|
|
|
|
* %NULL if it's the current event
|
|
|
|
|
*
|
|
|
|
|
* Displays @menu and makes it available for selection.
|
|
|
|
|
*
|
|
|
|
|
* See gtk_menu_popup_at_widget () and gtk_menu_popup_at_pointer (), which
|
|
|
|
|
* handle more common cases for popping up menus.
|
|
|
|
|
*
|
|
|
|
|
* @menu will be positioned at @rect, aligning their anchor points. @rect is
|
|
|
|
|
* relative to the top-left corner of @rect_window. @rect_anchor and
|
|
|
|
|
* @menu_anchor determine anchor points on @rect and @menu to pin together.
|
|
|
|
|
* @menu can optionally be offset by #GtkMenu:rect-anchor-dx and
|
|
|
|
|
* #GtkMenu:rect-anchor-dy.
|
|
|
|
|
*
|
|
|
|
|
* Anchors should be specified under the assumption that the text direction is
|
|
|
|
|
* left-to-right; they will be flipped horizontally automatically if the text
|
|
|
|
|
* direction is right-to-left.
|
|
|
|
|
*
|
|
|
|
|
* Other properties that influence the behaviour of this function are
|
|
|
|
|
* #GtkMenu:anchor-hints and #GtkMenu:menu-type-hint. Connect to the
|
|
|
|
|
* #GtkMenu::popped-up signal to find out how it was actually positioned.
|
|
|
|
|
*
|
|
|
|
|
* Since: 3.22
|
|
|
|
|
*/
|
|
|
|
|
void
|
|
|
|
|
gtk_menu_popup_at_rect (GtkMenu *menu,
|
|
|
|
|
GdkWindow *rect_window,
|
|
|
|
|
const GdkRectangle *rect,
|
|
|
|
|
GdkGravity rect_anchor,
|
|
|
|
|
GdkGravity menu_anchor,
|
|
|
|
|
const GdkEvent *trigger_event)
|
|
|
|
|
{
|
|
|
|
|
GtkMenuPrivate *priv;
|
|
|
|
|
GdkEvent *current_event = NULL;
|
|
|
|
|
GdkDevice *device = NULL;
|
|
|
|
|
guint button = 0;
|
|
|
|
|
guint32 activate_time = GDK_CURRENT_TIME;
|
|
|
|
|
|
|
|
|
|
g_return_if_fail (GTK_IS_MENU (menu));
|
|
|
|
|
g_return_if_fail (GDK_IS_WINDOW (rect_window));
|
|
|
|
|
g_return_if_fail (rect);
|
|
|
|
|
|
|
|
|
|
priv = menu->priv;
|
|
|
|
|
priv->rect_window = rect_window;
|
|
|
|
|
priv->rect = *rect;
|
|
|
|
|
priv->widget = NULL;
|
|
|
|
|
priv->rect_anchor = rect_anchor;
|
|
|
|
|
priv->menu_anchor = menu_anchor;
|
|
|
|
|
|
|
|
|
|
if (!trigger_event)
|
|
|
|
|
{
|
|
|
|
|
current_event = gtk_get_current_event ();
|
|
|
|
|
trigger_event = current_event;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (trigger_event)
|
|
|
|
|
{
|
|
|
|
|
device = get_device_for_event (trigger_event);
|
|
|
|
|
gdk_event_get_button (trigger_event, &button);
|
|
|
|
|
activate_time = gdk_event_get_time (trigger_event);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
g_warning ("no trigger event for menu popup");
|
|
|
|
|
|
|
|
|
|
gtk_menu_popup_internal (menu,
|
|
|
|
|
device,
|
|
|
|
|
NULL,
|
|
|
|
|
NULL,
|
|
|
|
|
NULL,
|
|
|
|
|
NULL,
|
|
|
|
|
NULL,
|
|
|
|
|
button,
|
|
|
|
|
activate_time);
|
|
|
|
|
|
|
|
|
|
g_clear_pointer (¤t_event, gdk_event_free);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* gtk_menu_popup_at_widget:
|
|
|
|
|
* @menu: the #GtkMenu to pop up
|
|
|
|
|
* @widget: (not nullable): the #GtkWidget to align @menu with
|
|
|
|
|
* @widget_anchor: the point on @widget to align with @menu's anchor point
|
|
|
|
|
* @menu_anchor: the point on @menu to align with @widget's anchor point
|
|
|
|
|
* @trigger_event: (nullable): the #GdkEvent that initiated this request or
|
|
|
|
|
* %NULL if it's the current event
|
|
|
|
|
*
|
|
|
|
|
* Displays @menu and makes it available for selection.
|
|
|
|
|
*
|
|
|
|
|
* See gtk_menu_popup_at_pointer () to pop up a menu at the master pointer.
|
|
|
|
|
* gtk_menu_popup_at_rect () also allows you to position a menu at an arbitrary
|
|
|
|
|
* rectangle.
|
|
|
|
|
*
|
|
|
|
|
* ![](popup-anchors.png)
|
|
|
|
|
*
|
|
|
|
|
* @menu will be positioned at @widget, aligning their anchor points.
|
|
|
|
|
* @widget_anchor and @menu_anchor determine anchor points on @widget and @menu
|
|
|
|
|
* to pin together. @menu can optionally be offset by #GtkMenu:rect-anchor-dx
|
|
|
|
|
* and #GtkMenu:rect-anchor-dy.
|
|
|
|
|
*
|
|
|
|
|
* Anchors should be specified under the assumption that the text direction is
|
|
|
|
|
* left-to-right; they will be flipped horizontally automatically if the text
|
|
|
|
|
* direction is right-to-left.
|
|
|
|
|
*
|
|
|
|
|
* Other properties that influence the behaviour of this function are
|
|
|
|
|
* #GtkMenu:anchor-hints and #GtkMenu:menu-type-hint. Connect to the
|
|
|
|
|
* #GtkMenu::popped-up signal to find out how it was actually positioned.
|
|
|
|
|
*
|
|
|
|
|
* Since: 3.22
|
|
|
|
|
*/
|
|
|
|
|
void
|
|
|
|
|
gtk_menu_popup_at_widget (GtkMenu *menu,
|
|
|
|
|
GtkWidget *widget,
|
|
|
|
|
GdkGravity widget_anchor,
|
|
|
|
|
GdkGravity menu_anchor,
|
|
|
|
|
const GdkEvent *trigger_event)
|
|
|
|
|
{
|
|
|
|
|
GtkMenuPrivate *priv;
|
|
|
|
|
GdkEvent *current_event = NULL;
|
|
|
|
|
GdkDevice *device = NULL;
|
|
|
|
|
guint button = 0;
|
|
|
|
|
guint32 activate_time = GDK_CURRENT_TIME;
|
|
|
|
|
GtkWidget *parent_menu_shell = NULL;
|
|
|
|
|
GtkWidget *parent_menu_item = NULL;
|
|
|
|
|
|
|
|
|
|
g_return_if_fail (GTK_IS_MENU (menu));
|
|
|
|
|
g_return_if_fail (GTK_IS_WIDGET (widget));
|
|
|
|
|
|
|
|
|
|
priv = menu->priv;
|
|
|
|
|
priv->rect_window = NULL;
|
|
|
|
|
priv->widget = widget;
|
|
|
|
|
priv->rect_anchor = widget_anchor;
|
|
|
|
|
priv->menu_anchor = menu_anchor;
|
|
|
|
|
|
|
|
|
|
if (!trigger_event)
|
|
|
|
|
{
|
|
|
|
|
current_event = gtk_get_current_event ();
|
|
|
|
|
trigger_event = current_event;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (trigger_event)
|
|
|
|
|
{
|
|
|
|
|
device = get_device_for_event (trigger_event);
|
|
|
|
|
gdk_event_get_button (trigger_event, &button);
|
|
|
|
|
activate_time = gdk_event_get_time (trigger_event);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
g_warning ("no trigger event for menu popup");
|
|
|
|
|
|
|
|
|
|
if (GTK_IS_MENU_ITEM (priv->widget))
|
|
|
|
|
{
|
|
|
|
|
parent_menu_item = priv->widget;
|
|
|
|
|
|
|
|
|
|
if (GTK_IS_MENU_SHELL (gtk_widget_get_parent (parent_menu_item)))
|
|
|
|
|
parent_menu_shell = gtk_widget_get_parent (parent_menu_item);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
gtk_menu_popup_internal (menu,
|
|
|
|
|
device,
|
|
|
|
|
parent_menu_shell,
|
|
|
|
|
parent_menu_item,
|
|
|
|
|
NULL,
|
|
|
|
|
NULL,
|
|
|
|
|
NULL,
|
|
|
|
|
button,
|
|
|
|
|
activate_time);
|
|
|
|
|
|
|
|
|
|
g_clear_pointer (¤t_event, gdk_event_free);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* gtk_menu_popup_at_pointer:
|
|
|
|
|
* @menu: the #GtkMenu to pop up
|
|
|
|
|
* @trigger_event: (nullable): the #GdkEvent that initiated this request or
|
|
|
|
|
* %NULL if it's the current event
|
|
|
|
|
*
|
|
|
|
|
* Displays @menu and makes it available for selection.
|
|
|
|
|
*
|
|
|
|
|
* See gtk_menu_popup_at_widget () to pop up a menu at a widget.
|
|
|
|
|
* gtk_menu_popup_at_rect () also allows you to position a menu at an arbitrary
|
|
|
|
|
* rectangle.
|
|
|
|
|
*
|
|
|
|
|
* @menu will be positioned at the pointer associated with @trigger_event.
|
|
|
|
|
*
|
|
|
|
|
* Properties that influence the behaviour of this function are
|
|
|
|
|
* #GtkMenu:anchor-hints, #GtkMenu:rect-anchor-dx, #GtkMenu:rect-anchor-dy, and
|
|
|
|
|
* #GtkMenu:menu-type-hint. Connect to the #GtkMenu::popped-up signal to find
|
|
|
|
|
* out how it was actually positioned.
|
|
|
|
|
*
|
|
|
|
|
* Since: 3.22
|
|
|
|
|
*/
|
|
|
|
|
void
|
|
|
|
|
gtk_menu_popup_at_pointer (GtkMenu *menu,
|
|
|
|
|
const GdkEvent *trigger_event)
|
|
|
|
|
{
|
|
|
|
|
GdkEvent *current_event = NULL;
|
|
|
|
|
GdkWindow *rect_window = NULL;
|
|
|
|
|
GdkDevice *device = NULL;
|
|
|
|
|
GdkRectangle rect = { 0, 0, 1, 1 };
|
|
|
|
|
|
|
|
|
|
g_return_if_fail (GTK_IS_MENU (menu));
|
|
|
|
|
|
|
|
|
|
if (!trigger_event)
|
|
|
|
|
{
|
|
|
|
|
current_event = gtk_get_current_event ();
|
|
|
|
|
trigger_event = current_event;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (trigger_event)
|
|
|
|
|
{
|
|
|
|
|
rect_window = gdk_event_get_window (trigger_event);
|
|
|
|
|
|
|
|
|
|
if (rect_window)
|
|
|
|
|
{
|
|
|
|
|
device = get_device_for_event (trigger_event);
|
|
|
|
|
|
|
|
|
|
if (device && gdk_device_get_source (device) == GDK_SOURCE_KEYBOARD)
|
|
|
|
|
device = gdk_device_get_associated_device (device);
|
|
|
|
|
|
|
|
|
|
if (device)
|
|
|
|
|
gdk_window_get_device_position (rect_window, device, &rect.x, &rect.y, NULL);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
g_warning ("no trigger event for menu popup");
|
|
|
|
|
|
|
|
|
|
gtk_menu_popup_at_rect (menu,
|
|
|
|
|
rect_window,
|
|
|
|
|
&rect,
|
|
|
|
|
GDK_GRAVITY_SOUTH_EAST,
|
|
|
|
|
GDK_GRAVITY_NORTH_WEST,
|
|
|
|
|
trigger_event);
|
|
|
|
|
|
|
|
|
|
g_clear_pointer (¤t_event, gdk_event_free);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
get_arrows_border (GtkMenu *menu,
|
|
|
|
|
GtkBorder *border)
|
|
|
|
|
{
|
|
|
|
|
GtkMenuPrivate *priv = menu->priv;
|
|
|
|
|
gint top_arrow_height, bottom_arrow_height;
|
|
|
|
|
|
|
|
|
|
gtk_css_gadget_get_preferred_size (priv->top_arrow_gadget,
|
|
|
|
|
GTK_ORIENTATION_VERTICAL,
|
|
|
|
|
-1,
|
|
|
|
|
&top_arrow_height, NULL,
|
|
|
|
|
NULL, NULL);
|
|
|
|
|
gtk_css_gadget_get_preferred_size (priv->bottom_arrow_gadget,
|
|
|
|
|
GTK_ORIENTATION_VERTICAL,
|
|
|
|
|
-1,
|
|
|
|
|
&bottom_arrow_height, NULL,
|
|
|
|
|
NULL, NULL);
|
|
|
|
|
|
|
|
|
|
border->top = priv->upper_arrow_visible ? top_arrow_height : 0;
|
|
|
|
|
border->bottom = priv->lower_arrow_visible ? bottom_arrow_height : 0;
|
|
|
|
|
border->left = border->right = 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* gtk_menu_update_scroll_offset:
|
|
|
|
|
* @menu: the #GtkMenu that popped up
|
|
|
|
|
* @flipped_rect: (nullable): the position of @menu after any possible flipping
|
|
|
|
|
* or %NULL if unknown
|
|
|
|
|
* @final_rect: (nullable): the final position of @menu or %NULL if unknown
|
|
|
|
|
* @flipped_x: %TRUE if the anchors were flipped horizontally
|
|
|
|
|
* @flipped_y: %TRUE if the anchors were flipped vertically
|
|
|
|
|
* @user_data: user data
|
|
|
|
|
*
|
|
|
|
|
* Updates the scroll offset of @menu based on the amount of sliding done while
|
|
|
|
|
* positioning @menu. Connect this to the #GtkMenu::popped-up signal to keep the
|
|
|
|
|
* contents of the menu vertically aligned with their ideal position, for combo
|
|
|
|
|
* boxes for example.
|
|
|
|
|
*
|
|
|
|
|
* Since: 3.22
|
|
|
|
|
* Stability: Private
|
|
|
|
|
*/
|
|
|
|
|
void
|
|
|
|
|
gtk_menu_update_scroll_offset (GtkMenu *menu,
|
|
|
|
|
const GdkRectangle *flipped_rect,
|
|
|
|
|
const GdkRectangle *final_rect,
|
|
|
|
|
gboolean flipped_x,
|
|
|
|
|
gboolean flipped_y,
|
|
|
|
|
gpointer user_data)
|
|
|
|
|
{
|
|
|
|
|
GtkBorder arrows_border;
|
|
|
|
|
|
|
|
|
|
g_return_if_fail (GTK_IS_MENU (menu));
|
|
|
|
|
|
|
|
|
|
if (!flipped_rect || !final_rect)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
get_arrows_border (menu, &arrows_border);
|
|
|
|
|
menu->priv->scroll_offset = arrows_border.top + (final_rect->y - flipped_rect->y);
|
2019-01-17 18:27:51 +00:00
|
|
|
|
gtk_menu_scroll_to (menu, menu->priv->scroll_offset,
|
|
|
|
|
GTK_MENU_SCROLL_FLAG_ADAPT);
|
2016-06-14 19:42:13 +00:00
|
|
|
|
}
|
|
|
|
|
|
2011-01-15 13:51:11 +00:00
|
|
|
|
/**
|
|
|
|
|
* gtk_menu_popdown:
|
|
|
|
|
* @menu: a #GtkMenu
|
|
|
|
|
*
|
|
|
|
|
* Removes the menu from the screen.
|
|
|
|
|
*/
|
1997-11-24 22:37:52 +00:00
|
|
|
|
void
|
|
|
|
|
gtk_menu_popdown (GtkMenu *menu)
|
|
|
|
|
{
|
2010-12-23 20:50:18 +00:00
|
|
|
|
GtkMenuPrivate *priv;
|
1997-11-24 22:37:52 +00:00
|
|
|
|
GtkMenuShell *menu_shell;
|
2010-05-25 22:38:44 +00:00
|
|
|
|
GdkDevice *pointer;
|
Add note about GtkMenuPositionFunc API changes.
2000-11-08 Alexander Larsson <alexl@redhat.com>
* docs/Changes-2.0.txt: Add note about GtkMenuPositionFunc
API changes.
* gtk/gtkmenu.c: Add support for scrolling menus.
Remove gtk_menu_append/prepend/insert, these have been moved to
gtkcompat.h as #defines.
* gtk/gtkcompat.h.in:
Add compatibility #defines for gtk_menu_append/prepend/insert
* gtk/gtkmenu.h: Add data needed for scrolling menus.
GtkMenuPositionFunc gets an extra argument push_in.
gtk_menu_append/prepend/insert removed.
* gtk/gtkmenuitem.c (gtk_menu_item_position_menu): Change menu
positioning behaviour to fit to scrolling menus.
* gtk/gtkmenuitem.c (gtk_menu_item_forall): Don't recurse
into menuitem->submeny. That is wrong, and broke torn
off submenus of torn off menus, since they were unrealized
when the first menu was unrealized.
* gtk/gtkmenushell.[ch]: Virtualize gtk_menu_shell_insert() and
gtk_menu_shell_select_item() since these need to be overridden in
GtkMenu.
* gtk/gtkoptionmenu.c (gtk_opttion_menu_position): Change menu
positioning behaviour to fit to scrolling menus.
(gtk_option_menu_key_press, gtk_option_menu_button_press): Select
the current item so that it is prelighted when the menu pops up.
This is a workaround to the fact that the menu doesn't get the
initial enter event (due to grabs).
* gtk/gtkfilesel.c, gtk/gtkinputdialog.c, gtk/testgtk.c:
s/gtk_menu_append/gtk_menu_shell_append/
* gtk/gtknotebook.c:
s/gtk_menu_insert/gtk_menu_shell_insert/
* gtk/testgtk.c (create_menu, create_menus):
Create the first menu with 50 items so that menu scrolling
can be tested.
Patch from Jonathan Blandford <jrb@redhat.com>
* gtk/gtkmenuitem.[ch] (gtk_menu_item_toggle_size_request): new
system to handle size requests. First, we ask what the size of
the toggle is. Then, when allocating the size, we allocate the
toggle_size first. This way we can have multiple menu-item
classes w/o needing a seperate class for each.
* gtk/gtkmenu.c (gtk_menu_size_request): Actually use the new system.
* gtk/gtkmenu.c (gtk_menu_size_allocate): Use the new system.
* gtk/gtkcheckmenuitem.c
(gtk_check_menu_item_toggle_size_request): New function to handle
the toggle size-request.
2000-11-08 17:34:52 +00:00
|
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
|
g_return_if_fail (GTK_IS_MENU (menu));
|
2010-12-23 20:50:18 +00:00
|
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
|
menu_shell = GTK_MENU_SHELL (menu);
|
2010-12-23 20:50:18 +00:00
|
|
|
|
priv = menu->priv;
|
2006-05-12 09:47:58 +00:00
|
|
|
|
|
2010-12-23 23:21:53 +00:00
|
|
|
|
menu_shell->priv->parent_menu_shell = NULL;
|
|
|
|
|
menu_shell->priv->active = FALSE;
|
|
|
|
|
menu_shell->priv->ignore_enter = FALSE;
|
Add note about GtkMenuPositionFunc API changes.
2000-11-08 Alexander Larsson <alexl@redhat.com>
* docs/Changes-2.0.txt: Add note about GtkMenuPositionFunc
API changes.
* gtk/gtkmenu.c: Add support for scrolling menus.
Remove gtk_menu_append/prepend/insert, these have been moved to
gtkcompat.h as #defines.
* gtk/gtkcompat.h.in:
Add compatibility #defines for gtk_menu_append/prepend/insert
* gtk/gtkmenu.h: Add data needed for scrolling menus.
GtkMenuPositionFunc gets an extra argument push_in.
gtk_menu_append/prepend/insert removed.
* gtk/gtkmenuitem.c (gtk_menu_item_position_menu): Change menu
positioning behaviour to fit to scrolling menus.
* gtk/gtkmenuitem.c (gtk_menu_item_forall): Don't recurse
into menuitem->submeny. That is wrong, and broke torn
off submenus of torn off menus, since they were unrealized
when the first menu was unrealized.
* gtk/gtkmenushell.[ch]: Virtualize gtk_menu_shell_insert() and
gtk_menu_shell_select_item() since these need to be overridden in
GtkMenu.
* gtk/gtkoptionmenu.c (gtk_opttion_menu_position): Change menu
positioning behaviour to fit to scrolling menus.
(gtk_option_menu_key_press, gtk_option_menu_button_press): Select
the current item so that it is prelighted when the menu pops up.
This is a workaround to the fact that the menu doesn't get the
initial enter event (due to grabs).
* gtk/gtkfilesel.c, gtk/gtkinputdialog.c, gtk/testgtk.c:
s/gtk_menu_append/gtk_menu_shell_append/
* gtk/gtknotebook.c:
s/gtk_menu_insert/gtk_menu_shell_insert/
* gtk/testgtk.c (create_menu, create_menus):
Create the first menu with 50 items so that menu scrolling
can be tested.
Patch from Jonathan Blandford <jrb@redhat.com>
* gtk/gtkmenuitem.[ch] (gtk_menu_item_toggle_size_request): new
system to handle size requests. First, we ask what the size of
the toggle is. Then, when allocating the size, we allocate the
toggle_size first. This way we can have multiple menu-item
classes w/o needing a seperate class for each.
* gtk/gtkmenu.c (gtk_menu_size_request): Actually use the new system.
* gtk/gtkmenu.c (gtk_menu_size_allocate): Use the new system.
* gtk/gtkcheckmenuitem.c
(gtk_check_menu_item_toggle_size_request): New function to handle
the toggle size-request.
2000-11-08 17:34:52 +00:00
|
|
|
|
|
2010-12-23 20:50:18 +00:00
|
|
|
|
priv->have_position = FALSE;
|
2002-08-02 22:03:23 +00:00
|
|
|
|
|
Add note about GtkMenuPositionFunc API changes.
2000-11-08 Alexander Larsson <alexl@redhat.com>
* docs/Changes-2.0.txt: Add note about GtkMenuPositionFunc
API changes.
* gtk/gtkmenu.c: Add support for scrolling menus.
Remove gtk_menu_append/prepend/insert, these have been moved to
gtkcompat.h as #defines.
* gtk/gtkcompat.h.in:
Add compatibility #defines for gtk_menu_append/prepend/insert
* gtk/gtkmenu.h: Add data needed for scrolling menus.
GtkMenuPositionFunc gets an extra argument push_in.
gtk_menu_append/prepend/insert removed.
* gtk/gtkmenuitem.c (gtk_menu_item_position_menu): Change menu
positioning behaviour to fit to scrolling menus.
* gtk/gtkmenuitem.c (gtk_menu_item_forall): Don't recurse
into menuitem->submeny. That is wrong, and broke torn
off submenus of torn off menus, since they were unrealized
when the first menu was unrealized.
* gtk/gtkmenushell.[ch]: Virtualize gtk_menu_shell_insert() and
gtk_menu_shell_select_item() since these need to be overridden in
GtkMenu.
* gtk/gtkoptionmenu.c (gtk_opttion_menu_position): Change menu
positioning behaviour to fit to scrolling menus.
(gtk_option_menu_key_press, gtk_option_menu_button_press): Select
the current item so that it is prelighted when the menu pops up.
This is a workaround to the fact that the menu doesn't get the
initial enter event (due to grabs).
* gtk/gtkfilesel.c, gtk/gtkinputdialog.c, gtk/testgtk.c:
s/gtk_menu_append/gtk_menu_shell_append/
* gtk/gtknotebook.c:
s/gtk_menu_insert/gtk_menu_shell_insert/
* gtk/testgtk.c (create_menu, create_menus):
Create the first menu with 50 items so that menu scrolling
can be tested.
Patch from Jonathan Blandford <jrb@redhat.com>
* gtk/gtkmenuitem.[ch] (gtk_menu_item_toggle_size_request): new
system to handle size requests. First, we ask what the size of
the toggle is. Then, when allocating the size, we allocate the
toggle_size first. This way we can have multiple menu-item
classes w/o needing a seperate class for each.
* gtk/gtkmenu.c (gtk_menu_size_request): Actually use the new system.
* gtk/gtkmenu.c (gtk_menu_size_allocate): Use the new system.
* gtk/gtkcheckmenuitem.c
(gtk_check_menu_item_toggle_size_request): New function to handle
the toggle size-request.
2000-11-08 17:34:52 +00:00
|
|
|
|
gtk_menu_stop_scrolling (menu);
|
2000-09-02 02:43:50 +00:00
|
|
|
|
gtk_menu_stop_navigating_submenu (menu);
|
2010-12-23 20:50:18 +00:00
|
|
|
|
|
2010-12-23 23:21:53 +00:00
|
|
|
|
if (menu_shell->priv->active_menu_item)
|
1997-11-24 22:37:52 +00:00
|
|
|
|
{
|
2010-12-23 20:50:18 +00:00
|
|
|
|
if (priv->old_active_menu_item)
|
|
|
|
|
g_object_unref (priv->old_active_menu_item);
|
2010-12-23 23:21:53 +00:00
|
|
|
|
priv->old_active_menu_item = menu_shell->priv->active_menu_item;
|
2010-12-23 20:50:18 +00:00
|
|
|
|
g_object_ref (priv->old_active_menu_item);
|
1997-11-24 22:37:52 +00:00
|
|
|
|
}
|
Tue Mar 16 17:43:33 1999 Tim Janik <timj@gtk.org>
Wed Mar 17 01:46:28 1999 Tim Janik <timj@gtk.org>
* merges from gtk-1-2:
Tue Mar 16 17:43:33 1999 Tim Janik <timj@gtk.org>
* gtk/gtkitemfactory.c (gtk_item_factory_parse_rc_string): ensure the
item factory class has been created.
(gtk_item_factory_parse_rc): likewise.
* gtk/gtkmenu.c:
keep proper references for old_active_menu_item.
(gtk_menu_reparent): unset the usize of the new parent,
so the menu can sanely be size requested and we don't get nasty screen
artefacts upon next reparentation.
(gtk_menu_motion_notify): set send_event to TRUE if we synthesize an
enter notify. only synthesize enter notifies if the pointer really is
inside the event window.
(gtk_menu_popdown): use gtk_menu_shell_deselect().
(gtk_menu_popup): move the background setting stuff into
gtk_menu_tearoff_bg_copy() so it can be called from other places as well.
* gtk/gtkmenushell.c (gtk_menu_shell_button_press): use
gtk_menu_shell_select_item() to select the new item.
(gtk_menu_shell_deselect): export this function, so gtkmenu.c can
do the right thing for deselection as well.
Sat Mar 15 20:10:33 1999 Tim Janik <timj@gtk.org>
* gtk/gtkwidget.[hc]:
(gtk_widget_accelerators_locked): return whether a widget's accelerators
are locked.
* gtk/gtkmenu.c (gtk_menu_key_press): don't remove or install new or
existing accelerators if the widget's accelerators are locked.
Sat Mar 14 19:44:05 1999 Tim Janik <timj@gtk.org>
* gtk/gtkitemfactory.[hc]: allow managing of foreign menu items.
* gtk/gtkmenu.c: truely forward key press and key release events to
the menu widget from the toplevel or tearoff window. we can't simply
connect to that, we need to stop further processing of the events as
well.
Sat Mar 13 13:14:17 1999 Tim Janik <timj@gtk.org>
* gtk/gtkmenu.c:
(gtk_menu_key_press): pass event->keyval, event->state to
gtk_accelerator_valid, instead of event->keyval twice.
refuse to install single letter accelerators for menus that use
single letter shortcuts.
* gtk/gtkitemfactory.c (gtk_item_factory_create_item): use
gtk_menu_ensure_uline_accel_group().
* gtk/gtkmenu.[hc]: added gtk_menu_ensure_uline_accel_group()
which will always return an uline accel group, made
gtk_menu_get_uline_accel_group() return NULL if the group isn't
yet created.
Mon Mar 15 01:03:27 1999 Lars Hamann <lars@gtk.org>
* gtk/gtkclist.h (struct _GtkCListColumn): added button_passive flag.
* gtk/gtkclist.c (gtk_clist_column_title_passive):
Leave button sensitive, trap button_press, button_release,
motion_notify, enter_notify and leave_notify events instead.
(gtk_clist_column_title_active): disconnect event handler.
(gtk_clist_drag_data_get): fixed memory leak. Reported by
Guillaume Laurent <glaurent@worldnet.fr>
Wed Mar 10 23:49:55 1999 Lars Hamann <lars@gtk.org>
* gtk/gtklayout.c (gtk_layout_adjustment_changed): fixed a few
width/height mixups.
* gtk/gtkctree.c (tree_delete): emit an tree_unselect_row signal
if needed.
Wed Mar 10 00:11:32 1999 Tim Janik <timj@gtk.org>
* gtk/testgtk.c (create_item_factory): unref the item factory after
window's destruction.
* gtk/gtkmenushell.c (gtk_menu_shell_activate_item): keep a reference
count on the menu shell around the menu item's activation, since the
signal emission may cause menu shell destruction.
* gtk/gtkitemfactory.c:
the previous code leaked one accel group per menu. we use
gtk_menu_get_uline_accel_group() now to fix that, and with that
also create the underline accelerator group of the menus only if
required (i.e. an underline accelerator has been specified).
(gtk_item_factory_construct):
(gtk_item_factory_create_item): removed code that would create an
extra accel group for the menu (and leak references).
(gtk_item_factory_create_item): adapted the underline accelerator
installation code to properly feature gtk_menu_get_uline_accel_group().
* gtk/gtkmenu.[hc]: added gtk_menu_get_accel_group() to retrive
menu->accel_group, this may return NULL if the accelerator group
hasn't been set yet.
added gtk_menu_get_uline_accel_group() to retrive the underline
accelerator group of the menu, this will be created on demand
and proper care is taken about its reference count.
* gtk/gtkitemfactory.h:
* gtk/gtkitemfactory.c:
dumped the approach of keeping a widgets by action list on the
factory since the factory<->widget destroy negotiation didn't work
and would be hard to get going at all. instead we keep a list of
GtkItemFactoryItem items on the factory (GtkItemFactoryItems are
persistant throughout a program's life time).
also, i removed the static const gchar *key_* variables, and made
them inline strings (they weren't actually used anyways).
(gtk_item_factory_add_item): update ifactory->items.
(gtk_item_factory_destroy): destroy ifactory->items (and remove
the item factory pointer from the remaining ifactory widgets).
(gtk_item_factory_get_widget_by_action): walk the GtkItemFactoryItem
list to find the widget.
(gtk_item_factory_get_item): new function that works around
gtk_item_factory_get_widget() limitations, this function will only
return menu items, even for <Branch> entries.
Tue Mar 9 01:01:28 1999 Tim Janik <timj@gtk.org>
* gdk/gdkfont.c (gdk_font_load): first lookup the xfont ID in our
font hash table, if we have a GdkFontPrivate entry for this font
already, simply increment its reference count, provided by Olaf Dietsche
<olaf.dietsche+list.gtk@netcologne.de>.
* gtk/gtkstyle.c (gtk_style_copy): plug a GdkFont reference leak, fix
provided by Olaf Dietsche <olaf.dietsche+list.gtk@netcologne.de>.
Sun Mar 7 06:13:29 1999 Tim Janik <timj@gtk.org>
* gtk/gtkcontainer.c:
(gtk_container_add_with_args):
(gtk_container_addv):
(gtk_container_add): before adding a child to a conatiner, make sure
it is (default) constructed, this is neccessary because under certain
circumstances the child will get relized and mapped immediatedly, in
which case it has to be constructed already.
Mon Mar 1 17:58:21 1999 Tim Janik <timj@gtk.org>
* gtk/gtksignal.c (gtk_signal_connect_by_type): count object_signal
values > 1 as TRUE also.
1999-03-17 01:39:42 +00:00
|
|
|
|
|
|
|
|
|
gtk_menu_shell_deselect (menu_shell);
|
2010-12-23 20:50:18 +00:00
|
|
|
|
|
|
|
|
|
/* The X Grab, if present, will automatically be removed
|
|
|
|
|
* when we hide the window
|
|
|
|
|
*/
|
|
|
|
|
if (priv->toplevel)
|
2010-11-25 05:04:52 +00:00
|
|
|
|
{
|
2010-12-23 20:50:18 +00:00
|
|
|
|
gtk_widget_hide (priv->toplevel);
|
|
|
|
|
gtk_window_set_transient_for (GTK_WINDOW (priv->toplevel), NULL);
|
2010-11-25 05:04:52 +00:00
|
|
|
|
}
|
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
|
|
|
|
|
2010-06-15 23:09:41 +00:00
|
|
|
|
pointer = _gtk_menu_shell_get_grab_device (menu_shell);
|
|
|
|
|
|
2010-12-23 20:50:18 +00:00
|
|
|
|
if (priv->torn_off)
|
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
|
|
|
|
{
|
2010-12-23 20:50:18 +00:00
|
|
|
|
gtk_widget_set_size_request (priv->tearoff_window, -1, -1);
|
|
|
|
|
|
|
|
|
|
if (gtk_bin_get_child (GTK_BIN (priv->toplevel)))
|
|
|
|
|
{
|
|
|
|
|
gtk_menu_reparent (menu, priv->tearoff_hbox, TRUE);
|
|
|
|
|
}
|
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
|
|
|
|
else
|
2010-12-23 20:50:18 +00:00
|
|
|
|
{
|
2010-05-25 22:38:44 +00:00
|
|
|
|
/* We popped up the menu from the tearoff, so we need to
|
2010-12-23 20:50:18 +00:00
|
|
|
|
* release the grab - we aren't actually hiding the menu.
|
|
|
|
|
*/
|
2010-12-23 23:21:53 +00:00
|
|
|
|
if (menu_shell->priv->have_xgrab && pointer)
|
2015-11-26 18:54:54 +00:00
|
|
|
|
gdk_seat_ungrab (gdk_device_get_seat (pointer));
|
2010-12-23 20:50:18 +00:00
|
|
|
|
}
|
Add note about GtkMenuPositionFunc API changes.
2000-11-08 Alexander Larsson <alexl@redhat.com>
* docs/Changes-2.0.txt: Add note about GtkMenuPositionFunc
API changes.
* gtk/gtkmenu.c: Add support for scrolling menus.
Remove gtk_menu_append/prepend/insert, these have been moved to
gtkcompat.h as #defines.
* gtk/gtkcompat.h.in:
Add compatibility #defines for gtk_menu_append/prepend/insert
* gtk/gtkmenu.h: Add data needed for scrolling menus.
GtkMenuPositionFunc gets an extra argument push_in.
gtk_menu_append/prepend/insert removed.
* gtk/gtkmenuitem.c (gtk_menu_item_position_menu): Change menu
positioning behaviour to fit to scrolling menus.
* gtk/gtkmenuitem.c (gtk_menu_item_forall): Don't recurse
into menuitem->submeny. That is wrong, and broke torn
off submenus of torn off menus, since they were unrealized
when the first menu was unrealized.
* gtk/gtkmenushell.[ch]: Virtualize gtk_menu_shell_insert() and
gtk_menu_shell_select_item() since these need to be overridden in
GtkMenu.
* gtk/gtkoptionmenu.c (gtk_opttion_menu_position): Change menu
positioning behaviour to fit to scrolling menus.
(gtk_option_menu_key_press, gtk_option_menu_button_press): Select
the current item so that it is prelighted when the menu pops up.
This is a workaround to the fact that the menu doesn't get the
initial enter event (due to grabs).
* gtk/gtkfilesel.c, gtk/gtkinputdialog.c, gtk/testgtk.c:
s/gtk_menu_append/gtk_menu_shell_append/
* gtk/gtknotebook.c:
s/gtk_menu_insert/gtk_menu_shell_insert/
* gtk/testgtk.c (create_menu, create_menus):
Create the first menu with 50 items so that menu scrolling
can be tested.
Patch from Jonathan Blandford <jrb@redhat.com>
* gtk/gtkmenuitem.[ch] (gtk_menu_item_toggle_size_request): new
system to handle size requests. First, we ask what the size of
the toggle is. Then, when allocating the size, we allocate the
toggle_size first. This way we can have multiple menu-item
classes w/o needing a seperate class for each.
* gtk/gtkmenu.c (gtk_menu_size_request): Actually use the new system.
* gtk/gtkmenu.c (gtk_menu_size_allocate): Use the new system.
* gtk/gtkcheckmenuitem.c
(gtk_check_menu_item_toggle_size_request): New function to handle
the toggle size-request.
2000-11-08 17:34:52 +00:00
|
|
|
|
|
|
|
|
|
/* gtk_menu_popdown is called each time a menu item is selected from
|
|
|
|
|
* a torn off menu. Only scroll back to the saved position if the
|
|
|
|
|
* non-tearoff menu was popped down.
|
|
|
|
|
*/
|
2010-12-23 20:50:18 +00:00
|
|
|
|
if (!priv->tearoff_active)
|
2019-01-17 18:27:51 +00:00
|
|
|
|
gtk_menu_scroll_to (menu, priv->saved_scroll_offset,
|
|
|
|
|
GTK_MENU_SCROLL_FLAG_NONE);
|
2010-12-23 20:50:18 +00:00
|
|
|
|
priv->tearoff_active = TRUE;
|
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
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
gtk_widget_hide (GTK_WIDGET (menu));
|
2000-09-02 02:43:50 +00:00
|
|
|
|
|
2010-12-23 23:21:53 +00:00
|
|
|
|
menu_shell->priv->have_xgrab = FALSE;
|
2010-05-25 22:38:44 +00:00
|
|
|
|
|
2015-11-26 18:54:54 +00:00
|
|
|
|
gtk_grab_remove (GTK_WIDGET (menu));
|
2010-05-25 22:38:44 +00:00
|
|
|
|
|
2010-06-15 23:09:41 +00:00
|
|
|
|
_gtk_menu_shell_set_grab_device (menu_shell, NULL);
|
2002-02-02 21:50:46 +00:00
|
|
|
|
|
|
|
|
|
menu_grab_transfer_window_destroy (menu);
|
1997-11-24 22:37:52 +00:00
|
|
|
|
}
|
|
|
|
|
|
2011-01-15 13:51:11 +00:00
|
|
|
|
/**
|
|
|
|
|
* gtk_menu_get_active:
|
|
|
|
|
* @menu: a #GtkMenu
|
|
|
|
|
*
|
|
|
|
|
* Returns the selected menu item from the menu. This is used by the
|
2012-07-02 06:19:06 +00:00
|
|
|
|
* #GtkComboBox.
|
2011-01-15 13:51:11 +00:00
|
|
|
|
*
|
2011-01-18 09:01:17 +00:00
|
|
|
|
* Returns: (transfer none): the #GtkMenuItem that was last selected
|
|
|
|
|
* in the menu. If a selection has not yet been made, the
|
|
|
|
|
* first menu item is selected.
|
2011-01-15 13:51:11 +00:00
|
|
|
|
*/
|
1997-11-24 22:37:52 +00:00
|
|
|
|
GtkWidget*
|
|
|
|
|
gtk_menu_get_active (GtkMenu *menu)
|
|
|
|
|
{
|
2018-04-17 18:51:53 +00:00
|
|
|
|
GtkMenuPrivate *priv;
|
1997-11-24 22:37:52 +00:00
|
|
|
|
GtkWidget *child;
|
|
|
|
|
GList *children;
|
2010-12-23 20:50:18 +00:00
|
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
|
g_return_val_if_fail (GTK_IS_MENU (menu), NULL);
|
2010-12-23 20:50:18 +00:00
|
|
|
|
|
2018-04-17 18:51:53 +00:00
|
|
|
|
priv = menu->priv;
|
|
|
|
|
|
2010-12-23 20:50:18 +00:00
|
|
|
|
if (!priv->old_active_menu_item)
|
1997-11-24 22:37:52 +00:00
|
|
|
|
{
|
|
|
|
|
child = NULL;
|
2010-12-23 23:21:53 +00:00
|
|
|
|
children = GTK_MENU_SHELL (menu)->priv->children;
|
2010-12-23 20:50:18 +00:00
|
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
|
while (children)
|
2010-12-23 20:50:18 +00:00
|
|
|
|
{
|
|
|
|
|
child = children->data;
|
|
|
|
|
children = children->next;
|
|
|
|
|
|
|
|
|
|
if (gtk_bin_get_child (GTK_BIN (child)))
|
|
|
|
|
break;
|
|
|
|
|
child = NULL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
priv->old_active_menu_item = child;
|
|
|
|
|
if (priv->old_active_menu_item)
|
|
|
|
|
g_object_ref (priv->old_active_menu_item);
|
1997-11-24 22:37:52 +00:00
|
|
|
|
}
|
2010-12-23 20:50:18 +00:00
|
|
|
|
|
|
|
|
|
return priv->old_active_menu_item;
|
1997-11-24 22:37:52 +00:00
|
|
|
|
}
|
|
|
|
|
|
2011-01-15 13:51:11 +00:00
|
|
|
|
/**
|
|
|
|
|
* gtk_menu_set_active:
|
|
|
|
|
* @menu: a #GtkMenu
|
2014-06-09 13:04:53 +00:00
|
|
|
|
* @index: the index of the menu item to select. Index values are
|
2011-01-15 13:51:11 +00:00
|
|
|
|
* from 0 to n-1
|
|
|
|
|
*
|
|
|
|
|
* Selects the specified menu item within the menu. This is used by
|
2012-07-02 06:19:06 +00:00
|
|
|
|
* the #GtkComboBox and should not be used by anyone else.
|
2011-01-15 13:51:11 +00:00
|
|
|
|
*/
|
1997-11-24 22:37:52 +00:00
|
|
|
|
void
|
|
|
|
|
gtk_menu_set_active (GtkMenu *menu,
|
2010-12-23 20:50:18 +00:00
|
|
|
|
guint index)
|
1997-11-24 22:37:52 +00:00
|
|
|
|
{
|
2018-04-17 18:51:53 +00:00
|
|
|
|
GtkMenuPrivate *priv;
|
1997-11-24 22:37:52 +00:00
|
|
|
|
GtkWidget *child;
|
|
|
|
|
GList *tmp_list;
|
2010-12-23 20:50:18 +00:00
|
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
|
g_return_if_fail (GTK_IS_MENU (menu));
|
2010-12-23 20:50:18 +00:00
|
|
|
|
|
2018-04-17 18:51:53 +00:00
|
|
|
|
priv = menu->priv;
|
|
|
|
|
|
2010-12-23 23:21:53 +00:00
|
|
|
|
tmp_list = g_list_nth (GTK_MENU_SHELL (menu)->priv->children, index);
|
1997-11-24 22:37:52 +00:00
|
|
|
|
if (tmp_list)
|
|
|
|
|
{
|
|
|
|
|
child = tmp_list->data;
|
2010-05-24 20:31:36 +00:00
|
|
|
|
if (gtk_bin_get_child (GTK_BIN (child)))
|
2010-12-23 20:50:18 +00:00
|
|
|
|
{
|
|
|
|
|
if (priv->old_active_menu_item)
|
|
|
|
|
g_object_unref (priv->old_active_menu_item);
|
|
|
|
|
priv->old_active_menu_item = child;
|
|
|
|
|
g_object_ref (priv->old_active_menu_item);
|
|
|
|
|
}
|
1997-11-24 22:37:52 +00:00
|
|
|
|
}
|
2014-06-09 13:04:53 +00:00
|
|
|
|
g_object_notify (G_OBJECT (menu), "active");
|
1997-11-24 22:37:52 +00:00
|
|
|
|
}
|
|
|
|
|
|
2009-12-10 10:23:40 +00:00
|
|
|
|
/**
|
|
|
|
|
* gtk_menu_set_accel_group:
|
2011-01-15 13:51:11 +00:00
|
|
|
|
* @menu: a #GtkMenu
|
|
|
|
|
* @accel_group: (allow-none): the #GtkAccelGroup to be associated
|
|
|
|
|
* with the menu.
|
|
|
|
|
*
|
|
|
|
|
* Set the #GtkAccelGroup which holds global accelerators for the
|
|
|
|
|
* menu. This accelerator group needs to also be added to all windows
|
|
|
|
|
* that this menu is being used in with gtk_window_add_accel_group(),
|
|
|
|
|
* in order for those windows to support all the accelerators
|
|
|
|
|
* contained in this group.
|
2009-12-10 10:23:40 +00:00
|
|
|
|
*/
|
1997-11-24 22:37:52 +00:00
|
|
|
|
void
|
2010-12-23 20:50:18 +00:00
|
|
|
|
gtk_menu_set_accel_group (GtkMenu *menu,
|
|
|
|
|
GtkAccelGroup *accel_group)
|
1997-11-24 22:37:52 +00:00
|
|
|
|
{
|
2018-04-17 18:51:53 +00:00
|
|
|
|
GtkMenuPrivate *priv;
|
|
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
|
g_return_if_fail (GTK_IS_MENU (menu));
|
2019-02-09 16:16:01 +00:00
|
|
|
|
g_return_if_fail (!accel_group || GTK_IS_ACCEL_GROUP (accel_group));
|
2010-12-23 20:50:18 +00:00
|
|
|
|
|
2018-04-17 18:51:53 +00:00
|
|
|
|
priv = menu->priv;
|
|
|
|
|
|
2010-12-23 20:50:18 +00:00
|
|
|
|
if (priv->accel_group != accel_group)
|
1997-12-18 02:17:14 +00:00
|
|
|
|
{
|
2010-12-23 20:50:18 +00:00
|
|
|
|
if (priv->accel_group)
|
|
|
|
|
g_object_unref (priv->accel_group);
|
|
|
|
|
priv->accel_group = accel_group;
|
|
|
|
|
if (priv->accel_group)
|
|
|
|
|
g_object_ref (priv->accel_group);
|
added gtkaccelmap.sgml. other updates.
Mon Nov 12 23:06:38 2001 Tim Janik <timj@gtk.org>
* added gtkaccelmap.sgml. other updates.
Mon Nov 12 23:08:37 2001 Tim Janik <timj@gtk.org>
* gtk/maketypes.awk: fix type utils generation on unix.
* gtk/gtkaccelmap.[hc]: new files, implementing a global accelerator
registry.
* gtk/gtkaccelgroup.[hc]: major API/implementation revamp:
removed GTK_ACCEL_SIGNAL_VISIBLE, gtk_accel_group_get_default,
gtk_accel_group_get_entry, gtk_accel_group_(un)lock_entry,
gtk_accel_group_add/remove, gtk_accel_group_handle_add/remove,
gtk_accel_group_create_add/remove, gtk_accel_group_entries_from_object.
introduced ::accel_changed signal for change notification, and
gtk_accel_group_connect/disconnect to connect closures to accel groups.
made gtk_accel_group_attach/detach and gtk_accel_group_activate private
functions.
deprecated gtk_accel_group_ref/unref.
* gtk/gtkaccellabel.[hc]: changes to make accellabels pay attention
to accel group changed notification and basically operate on closures.
removed gtk_accel_label_get_accel_object and
gtk_accel_label_set_accel_object.
introduced gtk_accel_label_set_accel_closure, and for convenience,
gtk_accel_label_set_accel_widget.
* gtk/gtkitemfactory.[hc]: removed accelerator propagation code
which mostly moved into gtkaccelmap.[hc].
removed gtk_item_factory_parse_rc*, gtk_item_factory_dump_*
and gtk_item_factory_print_func.
* gtk/gtkmain.c: call _gtk_accel_map_init().
* gtk/gtkmenuitem.[hc]: introduced gtk_menu_item_set_accel_path(),
that associates an accelerator path with menu items, through which
persistent accelerator settings on menu items are enabled.
* gtk/gtkmenu.[hc]: added gtk_menu_set_accel_path() so accelerator
paths of menu item can be default constructed to allow installation
of accelerators on menu items that don't come with an accelerator
binding by default.
* gtk/gtksettings.c: fix STRING type rc settings by special casing
them appropriately in the parser.
* gtk/gtksignal.[hc]: allow a class function offset of 0 for
gtk_signal_newv().
* gtk/gtkwidget.[hc]: accelerator API revamp.
removed ::accelerator_add/remove signals, gtk_widget_accelerator_signal,
gtk_widget_accelerators_locked, gtk_widget_remove_accelerators and
gtk_widget_(un)lock_accelerators.
accelerators maintained through gtk_widget_add/remove_accelerator()
are not runtime changable now, the correct sequence to setup a
widget for runtime changable accelerators is now:
gtk_accel_map_add_entry(accel_path, key, mods);
_gtk_widget_set_accel_path(widget, accel_path, accel_group);
* gtk/gtkwindow.[hc]: accelerator changes, proxy and coalesce accel
group changes (as well as mnemonic changes) through the new signal
::accels_changed.
Sat Nov 10 12:08:56 2001 Tim Janik <timj@gtk.org>
* gtk/gtksettings.c (_gtk_settings_parse_convert): properly handle
GString->string conversions.
2001-11-13 00:53:47 +00:00
|
|
|
|
_gtk_menu_refresh_accel_paths (menu, TRUE);
|
1997-12-18 02:17:14 +00:00
|
|
|
|
}
|
1997-11-24 22:37:52 +00:00
|
|
|
|
}
|
|
|
|
|
|
2011-01-15 13:51:11 +00:00
|
|
|
|
/**
|
|
|
|
|
* gtk_menu_get_accel_group:
|
2011-02-09 04:14:46 +00:00
|
|
|
|
* @menu: a #GtkMenu
|
2011-01-15 13:51:11 +00:00
|
|
|
|
*
|
|
|
|
|
* Gets the #GtkAccelGroup which holds global accelerators for the
|
2011-02-09 04:14:46 +00:00
|
|
|
|
* menu. See gtk_menu_set_accel_group().
|
2011-01-15 13:51:11 +00:00
|
|
|
|
*
|
2011-02-09 04:14:46 +00:00
|
|
|
|
* Returns: (transfer none): the #GtkAccelGroup associated with the menu
|
2011-01-15 13:51:11 +00:00
|
|
|
|
*/
|
Tue Mar 16 17:43:33 1999 Tim Janik <timj@gtk.org>
Wed Mar 17 01:46:28 1999 Tim Janik <timj@gtk.org>
* merges from gtk-1-2:
Tue Mar 16 17:43:33 1999 Tim Janik <timj@gtk.org>
* gtk/gtkitemfactory.c (gtk_item_factory_parse_rc_string): ensure the
item factory class has been created.
(gtk_item_factory_parse_rc): likewise.
* gtk/gtkmenu.c:
keep proper references for old_active_menu_item.
(gtk_menu_reparent): unset the usize of the new parent,
so the menu can sanely be size requested and we don't get nasty screen
artefacts upon next reparentation.
(gtk_menu_motion_notify): set send_event to TRUE if we synthesize an
enter notify. only synthesize enter notifies if the pointer really is
inside the event window.
(gtk_menu_popdown): use gtk_menu_shell_deselect().
(gtk_menu_popup): move the background setting stuff into
gtk_menu_tearoff_bg_copy() so it can be called from other places as well.
* gtk/gtkmenushell.c (gtk_menu_shell_button_press): use
gtk_menu_shell_select_item() to select the new item.
(gtk_menu_shell_deselect): export this function, so gtkmenu.c can
do the right thing for deselection as well.
Sat Mar 15 20:10:33 1999 Tim Janik <timj@gtk.org>
* gtk/gtkwidget.[hc]:
(gtk_widget_accelerators_locked): return whether a widget's accelerators
are locked.
* gtk/gtkmenu.c (gtk_menu_key_press): don't remove or install new or
existing accelerators if the widget's accelerators are locked.
Sat Mar 14 19:44:05 1999 Tim Janik <timj@gtk.org>
* gtk/gtkitemfactory.[hc]: allow managing of foreign menu items.
* gtk/gtkmenu.c: truely forward key press and key release events to
the menu widget from the toplevel or tearoff window. we can't simply
connect to that, we need to stop further processing of the events as
well.
Sat Mar 13 13:14:17 1999 Tim Janik <timj@gtk.org>
* gtk/gtkmenu.c:
(gtk_menu_key_press): pass event->keyval, event->state to
gtk_accelerator_valid, instead of event->keyval twice.
refuse to install single letter accelerators for menus that use
single letter shortcuts.
* gtk/gtkitemfactory.c (gtk_item_factory_create_item): use
gtk_menu_ensure_uline_accel_group().
* gtk/gtkmenu.[hc]: added gtk_menu_ensure_uline_accel_group()
which will always return an uline accel group, made
gtk_menu_get_uline_accel_group() return NULL if the group isn't
yet created.
Mon Mar 15 01:03:27 1999 Lars Hamann <lars@gtk.org>
* gtk/gtkclist.h (struct _GtkCListColumn): added button_passive flag.
* gtk/gtkclist.c (gtk_clist_column_title_passive):
Leave button sensitive, trap button_press, button_release,
motion_notify, enter_notify and leave_notify events instead.
(gtk_clist_column_title_active): disconnect event handler.
(gtk_clist_drag_data_get): fixed memory leak. Reported by
Guillaume Laurent <glaurent@worldnet.fr>
Wed Mar 10 23:49:55 1999 Lars Hamann <lars@gtk.org>
* gtk/gtklayout.c (gtk_layout_adjustment_changed): fixed a few
width/height mixups.
* gtk/gtkctree.c (tree_delete): emit an tree_unselect_row signal
if needed.
Wed Mar 10 00:11:32 1999 Tim Janik <timj@gtk.org>
* gtk/testgtk.c (create_item_factory): unref the item factory after
window's destruction.
* gtk/gtkmenushell.c (gtk_menu_shell_activate_item): keep a reference
count on the menu shell around the menu item's activation, since the
signal emission may cause menu shell destruction.
* gtk/gtkitemfactory.c:
the previous code leaked one accel group per menu. we use
gtk_menu_get_uline_accel_group() now to fix that, and with that
also create the underline accelerator group of the menus only if
required (i.e. an underline accelerator has been specified).
(gtk_item_factory_construct):
(gtk_item_factory_create_item): removed code that would create an
extra accel group for the menu (and leak references).
(gtk_item_factory_create_item): adapted the underline accelerator
installation code to properly feature gtk_menu_get_uline_accel_group().
* gtk/gtkmenu.[hc]: added gtk_menu_get_accel_group() to retrive
menu->accel_group, this may return NULL if the accelerator group
hasn't been set yet.
added gtk_menu_get_uline_accel_group() to retrive the underline
accelerator group of the menu, this will be created on demand
and proper care is taken about its reference count.
* gtk/gtkitemfactory.h:
* gtk/gtkitemfactory.c:
dumped the approach of keeping a widgets by action list on the
factory since the factory<->widget destroy negotiation didn't work
and would be hard to get going at all. instead we keep a list of
GtkItemFactoryItem items on the factory (GtkItemFactoryItems are
persistant throughout a program's life time).
also, i removed the static const gchar *key_* variables, and made
them inline strings (they weren't actually used anyways).
(gtk_item_factory_add_item): update ifactory->items.
(gtk_item_factory_destroy): destroy ifactory->items (and remove
the item factory pointer from the remaining ifactory widgets).
(gtk_item_factory_get_widget_by_action): walk the GtkItemFactoryItem
list to find the widget.
(gtk_item_factory_get_item): new function that works around
gtk_item_factory_get_widget() limitations, this function will only
return menu items, even for <Branch> entries.
Tue Mar 9 01:01:28 1999 Tim Janik <timj@gtk.org>
* gdk/gdkfont.c (gdk_font_load): first lookup the xfont ID in our
font hash table, if we have a GdkFontPrivate entry for this font
already, simply increment its reference count, provided by Olaf Dietsche
<olaf.dietsche+list.gtk@netcologne.de>.
* gtk/gtkstyle.c (gtk_style_copy): plug a GdkFont reference leak, fix
provided by Olaf Dietsche <olaf.dietsche+list.gtk@netcologne.de>.
Sun Mar 7 06:13:29 1999 Tim Janik <timj@gtk.org>
* gtk/gtkcontainer.c:
(gtk_container_add_with_args):
(gtk_container_addv):
(gtk_container_add): before adding a child to a conatiner, make sure
it is (default) constructed, this is neccessary because under certain
circumstances the child will get relized and mapped immediatedly, in
which case it has to be constructed already.
Mon Mar 1 17:58:21 1999 Tim Janik <timj@gtk.org>
* gtk/gtksignal.c (gtk_signal_connect_by_type): count object_signal
values > 1 as TRUE also.
1999-03-17 01:39:42 +00:00
|
|
|
|
GtkAccelGroup*
|
|
|
|
|
gtk_menu_get_accel_group (GtkMenu *menu)
|
|
|
|
|
{
|
|
|
|
|
g_return_val_if_fail (GTK_IS_MENU (menu), NULL);
|
|
|
|
|
|
2010-12-23 20:50:18 +00:00
|
|
|
|
return menu->priv->accel_group;
|
Tue Mar 16 17:43:33 1999 Tim Janik <timj@gtk.org>
Wed Mar 17 01:46:28 1999 Tim Janik <timj@gtk.org>
* merges from gtk-1-2:
Tue Mar 16 17:43:33 1999 Tim Janik <timj@gtk.org>
* gtk/gtkitemfactory.c (gtk_item_factory_parse_rc_string): ensure the
item factory class has been created.
(gtk_item_factory_parse_rc): likewise.
* gtk/gtkmenu.c:
keep proper references for old_active_menu_item.
(gtk_menu_reparent): unset the usize of the new parent,
so the menu can sanely be size requested and we don't get nasty screen
artefacts upon next reparentation.
(gtk_menu_motion_notify): set send_event to TRUE if we synthesize an
enter notify. only synthesize enter notifies if the pointer really is
inside the event window.
(gtk_menu_popdown): use gtk_menu_shell_deselect().
(gtk_menu_popup): move the background setting stuff into
gtk_menu_tearoff_bg_copy() so it can be called from other places as well.
* gtk/gtkmenushell.c (gtk_menu_shell_button_press): use
gtk_menu_shell_select_item() to select the new item.
(gtk_menu_shell_deselect): export this function, so gtkmenu.c can
do the right thing for deselection as well.
Sat Mar 15 20:10:33 1999 Tim Janik <timj@gtk.org>
* gtk/gtkwidget.[hc]:
(gtk_widget_accelerators_locked): return whether a widget's accelerators
are locked.
* gtk/gtkmenu.c (gtk_menu_key_press): don't remove or install new or
existing accelerators if the widget's accelerators are locked.
Sat Mar 14 19:44:05 1999 Tim Janik <timj@gtk.org>
* gtk/gtkitemfactory.[hc]: allow managing of foreign menu items.
* gtk/gtkmenu.c: truely forward key press and key release events to
the menu widget from the toplevel or tearoff window. we can't simply
connect to that, we need to stop further processing of the events as
well.
Sat Mar 13 13:14:17 1999 Tim Janik <timj@gtk.org>
* gtk/gtkmenu.c:
(gtk_menu_key_press): pass event->keyval, event->state to
gtk_accelerator_valid, instead of event->keyval twice.
refuse to install single letter accelerators for menus that use
single letter shortcuts.
* gtk/gtkitemfactory.c (gtk_item_factory_create_item): use
gtk_menu_ensure_uline_accel_group().
* gtk/gtkmenu.[hc]: added gtk_menu_ensure_uline_accel_group()
which will always return an uline accel group, made
gtk_menu_get_uline_accel_group() return NULL if the group isn't
yet created.
Mon Mar 15 01:03:27 1999 Lars Hamann <lars@gtk.org>
* gtk/gtkclist.h (struct _GtkCListColumn): added button_passive flag.
* gtk/gtkclist.c (gtk_clist_column_title_passive):
Leave button sensitive, trap button_press, button_release,
motion_notify, enter_notify and leave_notify events instead.
(gtk_clist_column_title_active): disconnect event handler.
(gtk_clist_drag_data_get): fixed memory leak. Reported by
Guillaume Laurent <glaurent@worldnet.fr>
Wed Mar 10 23:49:55 1999 Lars Hamann <lars@gtk.org>
* gtk/gtklayout.c (gtk_layout_adjustment_changed): fixed a few
width/height mixups.
* gtk/gtkctree.c (tree_delete): emit an tree_unselect_row signal
if needed.
Wed Mar 10 00:11:32 1999 Tim Janik <timj@gtk.org>
* gtk/testgtk.c (create_item_factory): unref the item factory after
window's destruction.
* gtk/gtkmenushell.c (gtk_menu_shell_activate_item): keep a reference
count on the menu shell around the menu item's activation, since the
signal emission may cause menu shell destruction.
* gtk/gtkitemfactory.c:
the previous code leaked one accel group per menu. we use
gtk_menu_get_uline_accel_group() now to fix that, and with that
also create the underline accelerator group of the menus only if
required (i.e. an underline accelerator has been specified).
(gtk_item_factory_construct):
(gtk_item_factory_create_item): removed code that would create an
extra accel group for the menu (and leak references).
(gtk_item_factory_create_item): adapted the underline accelerator
installation code to properly feature gtk_menu_get_uline_accel_group().
* gtk/gtkmenu.[hc]: added gtk_menu_get_accel_group() to retrive
menu->accel_group, this may return NULL if the accelerator group
hasn't been set yet.
added gtk_menu_get_uline_accel_group() to retrive the underline
accelerator group of the menu, this will be created on demand
and proper care is taken about its reference count.
* gtk/gtkitemfactory.h:
* gtk/gtkitemfactory.c:
dumped the approach of keeping a widgets by action list on the
factory since the factory<->widget destroy negotiation didn't work
and would be hard to get going at all. instead we keep a list of
GtkItemFactoryItem items on the factory (GtkItemFactoryItems are
persistant throughout a program's life time).
also, i removed the static const gchar *key_* variables, and made
them inline strings (they weren't actually used anyways).
(gtk_item_factory_add_item): update ifactory->items.
(gtk_item_factory_destroy): destroy ifactory->items (and remove
the item factory pointer from the remaining ifactory widgets).
(gtk_item_factory_get_widget_by_action): walk the GtkItemFactoryItem
list to find the widget.
(gtk_item_factory_get_item): new function that works around
gtk_item_factory_get_widget() limitations, this function will only
return menu items, even for <Branch> entries.
Tue Mar 9 01:01:28 1999 Tim Janik <timj@gtk.org>
* gdk/gdkfont.c (gdk_font_load): first lookup the xfont ID in our
font hash table, if we have a GdkFontPrivate entry for this font
already, simply increment its reference count, provided by Olaf Dietsche
<olaf.dietsche+list.gtk@netcologne.de>.
* gtk/gtkstyle.c (gtk_style_copy): plug a GdkFont reference leak, fix
provided by Olaf Dietsche <olaf.dietsche+list.gtk@netcologne.de>.
Sun Mar 7 06:13:29 1999 Tim Janik <timj@gtk.org>
* gtk/gtkcontainer.c:
(gtk_container_add_with_args):
(gtk_container_addv):
(gtk_container_add): before adding a child to a conatiner, make sure
it is (default) constructed, this is neccessary because under certain
circumstances the child will get relized and mapped immediatedly, in
which case it has to be constructed already.
Mon Mar 1 17:58:21 1999 Tim Janik <timj@gtk.org>
* gtk/gtksignal.c (gtk_signal_connect_by_type): count object_signal
values > 1 as TRUE also.
1999-03-17 01:39:42 +00:00
|
|
|
|
}
|
|
|
|
|
|
2003-11-27 15:51:32 +00:00
|
|
|
|
static gboolean
|
|
|
|
|
gtk_menu_real_can_activate_accel (GtkWidget *widget,
|
|
|
|
|
guint signal_id)
|
|
|
|
|
{
|
2003-12-08 22:55:03 +00:00
|
|
|
|
/* Menu items chain here to figure whether they can activate their
|
|
|
|
|
* accelerators. Unlike ordinary widgets, menus allow accel
|
|
|
|
|
* activation even if invisible since that's the usual case for
|
|
|
|
|
* submenus/popup-menus. however, the state of the attach widget
|
|
|
|
|
* affects the "activeness" of the menu.
|
2003-11-27 15:51:32 +00:00
|
|
|
|
*/
|
|
|
|
|
GtkWidget *awidget = gtk_menu_get_attach_widget (GTK_MENU (widget));
|
2003-12-08 22:55:03 +00:00
|
|
|
|
|
|
|
|
|
if (awidget)
|
|
|
|
|
return gtk_widget_can_activate_accel (awidget, signal_id);
|
|
|
|
|
else
|
2010-02-27 04:24:24 +00:00
|
|
|
|
return gtk_widget_is_sensitive (widget);
|
2003-11-27 15:51:32 +00:00
|
|
|
|
}
|
|
|
|
|
|
added gtkaccelmap.sgml. other updates.
Mon Nov 12 23:06:38 2001 Tim Janik <timj@gtk.org>
* added gtkaccelmap.sgml. other updates.
Mon Nov 12 23:08:37 2001 Tim Janik <timj@gtk.org>
* gtk/maketypes.awk: fix type utils generation on unix.
* gtk/gtkaccelmap.[hc]: new files, implementing a global accelerator
registry.
* gtk/gtkaccelgroup.[hc]: major API/implementation revamp:
removed GTK_ACCEL_SIGNAL_VISIBLE, gtk_accel_group_get_default,
gtk_accel_group_get_entry, gtk_accel_group_(un)lock_entry,
gtk_accel_group_add/remove, gtk_accel_group_handle_add/remove,
gtk_accel_group_create_add/remove, gtk_accel_group_entries_from_object.
introduced ::accel_changed signal for change notification, and
gtk_accel_group_connect/disconnect to connect closures to accel groups.
made gtk_accel_group_attach/detach and gtk_accel_group_activate private
functions.
deprecated gtk_accel_group_ref/unref.
* gtk/gtkaccellabel.[hc]: changes to make accellabels pay attention
to accel group changed notification and basically operate on closures.
removed gtk_accel_label_get_accel_object and
gtk_accel_label_set_accel_object.
introduced gtk_accel_label_set_accel_closure, and for convenience,
gtk_accel_label_set_accel_widget.
* gtk/gtkitemfactory.[hc]: removed accelerator propagation code
which mostly moved into gtkaccelmap.[hc].
removed gtk_item_factory_parse_rc*, gtk_item_factory_dump_*
and gtk_item_factory_print_func.
* gtk/gtkmain.c: call _gtk_accel_map_init().
* gtk/gtkmenuitem.[hc]: introduced gtk_menu_item_set_accel_path(),
that associates an accelerator path with menu items, through which
persistent accelerator settings on menu items are enabled.
* gtk/gtkmenu.[hc]: added gtk_menu_set_accel_path() so accelerator
paths of menu item can be default constructed to allow installation
of accelerators on menu items that don't come with an accelerator
binding by default.
* gtk/gtksettings.c: fix STRING type rc settings by special casing
them appropriately in the parser.
* gtk/gtksignal.[hc]: allow a class function offset of 0 for
gtk_signal_newv().
* gtk/gtkwidget.[hc]: accelerator API revamp.
removed ::accelerator_add/remove signals, gtk_widget_accelerator_signal,
gtk_widget_accelerators_locked, gtk_widget_remove_accelerators and
gtk_widget_(un)lock_accelerators.
accelerators maintained through gtk_widget_add/remove_accelerator()
are not runtime changable now, the correct sequence to setup a
widget for runtime changable accelerators is now:
gtk_accel_map_add_entry(accel_path, key, mods);
_gtk_widget_set_accel_path(widget, accel_path, accel_group);
* gtk/gtkwindow.[hc]: accelerator changes, proxy and coalesce accel
group changes (as well as mnemonic changes) through the new signal
::accels_changed.
Sat Nov 10 12:08:56 2001 Tim Janik <timj@gtk.org>
* gtk/gtksettings.c (_gtk_settings_parse_convert): properly handle
GString->string conversions.
2001-11-13 00:53:47 +00:00
|
|
|
|
/**
|
2012-04-13 00:07:28 +00:00
|
|
|
|
* gtk_menu_set_accel_path:
|
added gtkaccelmap.sgml. other updates.
Mon Nov 12 23:06:38 2001 Tim Janik <timj@gtk.org>
* added gtkaccelmap.sgml. other updates.
Mon Nov 12 23:08:37 2001 Tim Janik <timj@gtk.org>
* gtk/maketypes.awk: fix type utils generation on unix.
* gtk/gtkaccelmap.[hc]: new files, implementing a global accelerator
registry.
* gtk/gtkaccelgroup.[hc]: major API/implementation revamp:
removed GTK_ACCEL_SIGNAL_VISIBLE, gtk_accel_group_get_default,
gtk_accel_group_get_entry, gtk_accel_group_(un)lock_entry,
gtk_accel_group_add/remove, gtk_accel_group_handle_add/remove,
gtk_accel_group_create_add/remove, gtk_accel_group_entries_from_object.
introduced ::accel_changed signal for change notification, and
gtk_accel_group_connect/disconnect to connect closures to accel groups.
made gtk_accel_group_attach/detach and gtk_accel_group_activate private
functions.
deprecated gtk_accel_group_ref/unref.
* gtk/gtkaccellabel.[hc]: changes to make accellabels pay attention
to accel group changed notification and basically operate on closures.
removed gtk_accel_label_get_accel_object and
gtk_accel_label_set_accel_object.
introduced gtk_accel_label_set_accel_closure, and for convenience,
gtk_accel_label_set_accel_widget.
* gtk/gtkitemfactory.[hc]: removed accelerator propagation code
which mostly moved into gtkaccelmap.[hc].
removed gtk_item_factory_parse_rc*, gtk_item_factory_dump_*
and gtk_item_factory_print_func.
* gtk/gtkmain.c: call _gtk_accel_map_init().
* gtk/gtkmenuitem.[hc]: introduced gtk_menu_item_set_accel_path(),
that associates an accelerator path with menu items, through which
persistent accelerator settings on menu items are enabled.
* gtk/gtkmenu.[hc]: added gtk_menu_set_accel_path() so accelerator
paths of menu item can be default constructed to allow installation
of accelerators on menu items that don't come with an accelerator
binding by default.
* gtk/gtksettings.c: fix STRING type rc settings by special casing
them appropriately in the parser.
* gtk/gtksignal.[hc]: allow a class function offset of 0 for
gtk_signal_newv().
* gtk/gtkwidget.[hc]: accelerator API revamp.
removed ::accelerator_add/remove signals, gtk_widget_accelerator_signal,
gtk_widget_accelerators_locked, gtk_widget_remove_accelerators and
gtk_widget_(un)lock_accelerators.
accelerators maintained through gtk_widget_add/remove_accelerator()
are not runtime changable now, the correct sequence to setup a
widget for runtime changable accelerators is now:
gtk_accel_map_add_entry(accel_path, key, mods);
_gtk_widget_set_accel_path(widget, accel_path, accel_group);
* gtk/gtkwindow.[hc]: accelerator changes, proxy and coalesce accel
group changes (as well as mnemonic changes) through the new signal
::accels_changed.
Sat Nov 10 12:08:56 2001 Tim Janik <timj@gtk.org>
* gtk/gtksettings.c (_gtk_settings_parse_convert): properly handle
GString->string conversions.
2001-11-13 00:53:47 +00:00
|
|
|
|
* @menu: a valid #GtkMenu
|
2018-04-17 18:53:33 +00:00
|
|
|
|
* @accel_path: (nullable): a valid accelerator path, or %NULL to unset the path
|
added gtkaccelmap.sgml. other updates.
Mon Nov 12 23:06:38 2001 Tim Janik <timj@gtk.org>
* added gtkaccelmap.sgml. other updates.
Mon Nov 12 23:08:37 2001 Tim Janik <timj@gtk.org>
* gtk/maketypes.awk: fix type utils generation on unix.
* gtk/gtkaccelmap.[hc]: new files, implementing a global accelerator
registry.
* gtk/gtkaccelgroup.[hc]: major API/implementation revamp:
removed GTK_ACCEL_SIGNAL_VISIBLE, gtk_accel_group_get_default,
gtk_accel_group_get_entry, gtk_accel_group_(un)lock_entry,
gtk_accel_group_add/remove, gtk_accel_group_handle_add/remove,
gtk_accel_group_create_add/remove, gtk_accel_group_entries_from_object.
introduced ::accel_changed signal for change notification, and
gtk_accel_group_connect/disconnect to connect closures to accel groups.
made gtk_accel_group_attach/detach and gtk_accel_group_activate private
functions.
deprecated gtk_accel_group_ref/unref.
* gtk/gtkaccellabel.[hc]: changes to make accellabels pay attention
to accel group changed notification and basically operate on closures.
removed gtk_accel_label_get_accel_object and
gtk_accel_label_set_accel_object.
introduced gtk_accel_label_set_accel_closure, and for convenience,
gtk_accel_label_set_accel_widget.
* gtk/gtkitemfactory.[hc]: removed accelerator propagation code
which mostly moved into gtkaccelmap.[hc].
removed gtk_item_factory_parse_rc*, gtk_item_factory_dump_*
and gtk_item_factory_print_func.
* gtk/gtkmain.c: call _gtk_accel_map_init().
* gtk/gtkmenuitem.[hc]: introduced gtk_menu_item_set_accel_path(),
that associates an accelerator path with menu items, through which
persistent accelerator settings on menu items are enabled.
* gtk/gtkmenu.[hc]: added gtk_menu_set_accel_path() so accelerator
paths of menu item can be default constructed to allow installation
of accelerators on menu items that don't come with an accelerator
binding by default.
* gtk/gtksettings.c: fix STRING type rc settings by special casing
them appropriately in the parser.
* gtk/gtksignal.[hc]: allow a class function offset of 0 for
gtk_signal_newv().
* gtk/gtkwidget.[hc]: accelerator API revamp.
removed ::accelerator_add/remove signals, gtk_widget_accelerator_signal,
gtk_widget_accelerators_locked, gtk_widget_remove_accelerators and
gtk_widget_(un)lock_accelerators.
accelerators maintained through gtk_widget_add/remove_accelerator()
are not runtime changable now, the correct sequence to setup a
widget for runtime changable accelerators is now:
gtk_accel_map_add_entry(accel_path, key, mods);
_gtk_widget_set_accel_path(widget, accel_path, accel_group);
* gtk/gtkwindow.[hc]: accelerator changes, proxy and coalesce accel
group changes (as well as mnemonic changes) through the new signal
::accels_changed.
Sat Nov 10 12:08:56 2001 Tim Janik <timj@gtk.org>
* gtk/gtksettings.c (_gtk_settings_parse_convert): properly handle
GString->string conversions.
2001-11-13 00:53:47 +00:00
|
|
|
|
*
|
|
|
|
|
* Sets an accelerator path for this menu from which accelerator paths
|
|
|
|
|
* for its immediate children, its menu items, can be constructed.
|
|
|
|
|
* The main purpose of this function is to spare the programmer the
|
|
|
|
|
* inconvenience of having to call gtk_menu_item_set_accel_path() on
|
|
|
|
|
* each menu item that should support runtime user changable accelerators.
|
|
|
|
|
* Instead, by just calling gtk_menu_set_accel_path() on their parent,
|
2010-12-23 20:50:18 +00:00
|
|
|
|
* each menu item of this menu, that contains a label describing its
|
|
|
|
|
* purpose, automatically gets an accel path assigned.
|
|
|
|
|
*
|
2014-02-05 18:07:34 +00:00
|
|
|
|
* For example, a menu containing menu items “New” and “Exit”, will, after
|
2014-02-09 22:24:06 +00:00
|
|
|
|
* `gtk_menu_set_accel_path (menu, "<Gnumeric-Sheet>/File");` has been
|
|
|
|
|
* called, assign its items the accel paths: `"<Gnumeric-Sheet>/File/New"`
|
|
|
|
|
* and `"<Gnumeric-Sheet>/File/Exit"`.
|
2010-12-23 20:50:18 +00:00
|
|
|
|
*
|
added gtkaccelmap.sgml. other updates.
Mon Nov 12 23:06:38 2001 Tim Janik <timj@gtk.org>
* added gtkaccelmap.sgml. other updates.
Mon Nov 12 23:08:37 2001 Tim Janik <timj@gtk.org>
* gtk/maketypes.awk: fix type utils generation on unix.
* gtk/gtkaccelmap.[hc]: new files, implementing a global accelerator
registry.
* gtk/gtkaccelgroup.[hc]: major API/implementation revamp:
removed GTK_ACCEL_SIGNAL_VISIBLE, gtk_accel_group_get_default,
gtk_accel_group_get_entry, gtk_accel_group_(un)lock_entry,
gtk_accel_group_add/remove, gtk_accel_group_handle_add/remove,
gtk_accel_group_create_add/remove, gtk_accel_group_entries_from_object.
introduced ::accel_changed signal for change notification, and
gtk_accel_group_connect/disconnect to connect closures to accel groups.
made gtk_accel_group_attach/detach and gtk_accel_group_activate private
functions.
deprecated gtk_accel_group_ref/unref.
* gtk/gtkaccellabel.[hc]: changes to make accellabels pay attention
to accel group changed notification and basically operate on closures.
removed gtk_accel_label_get_accel_object and
gtk_accel_label_set_accel_object.
introduced gtk_accel_label_set_accel_closure, and for convenience,
gtk_accel_label_set_accel_widget.
* gtk/gtkitemfactory.[hc]: removed accelerator propagation code
which mostly moved into gtkaccelmap.[hc].
removed gtk_item_factory_parse_rc*, gtk_item_factory_dump_*
and gtk_item_factory_print_func.
* gtk/gtkmain.c: call _gtk_accel_map_init().
* gtk/gtkmenuitem.[hc]: introduced gtk_menu_item_set_accel_path(),
that associates an accelerator path with menu items, through which
persistent accelerator settings on menu items are enabled.
* gtk/gtkmenu.[hc]: added gtk_menu_set_accel_path() so accelerator
paths of menu item can be default constructed to allow installation
of accelerators on menu items that don't come with an accelerator
binding by default.
* gtk/gtksettings.c: fix STRING type rc settings by special casing
them appropriately in the parser.
* gtk/gtksignal.[hc]: allow a class function offset of 0 for
gtk_signal_newv().
* gtk/gtkwidget.[hc]: accelerator API revamp.
removed ::accelerator_add/remove signals, gtk_widget_accelerator_signal,
gtk_widget_accelerators_locked, gtk_widget_remove_accelerators and
gtk_widget_(un)lock_accelerators.
accelerators maintained through gtk_widget_add/remove_accelerator()
are not runtime changable now, the correct sequence to setup a
widget for runtime changable accelerators is now:
gtk_accel_map_add_entry(accel_path, key, mods);
_gtk_widget_set_accel_path(widget, accel_path, accel_group);
* gtk/gtkwindow.[hc]: accelerator changes, proxy and coalesce accel
group changes (as well as mnemonic changes) through the new signal
::accels_changed.
Sat Nov 10 12:08:56 2001 Tim Janik <timj@gtk.org>
* gtk/gtksettings.c (_gtk_settings_parse_convert): properly handle
GString->string conversions.
2001-11-13 00:53:47 +00:00
|
|
|
|
* Assigning accel paths to menu items then enables the user to change
|
|
|
|
|
* their accelerators at runtime. More details about accelerator paths
|
|
|
|
|
* and their default setups can be found at gtk_accel_map_add_entry().
|
2010-12-23 20:50:18 +00:00
|
|
|
|
*
|
|
|
|
|
* Note that @accel_path string will be stored in a #GQuark. Therefore,
|
|
|
|
|
* if you pass a static string, you can save some memory by interning
|
|
|
|
|
* it first with g_intern_static_string().
|
added gtkaccelmap.sgml. other updates.
Mon Nov 12 23:06:38 2001 Tim Janik <timj@gtk.org>
* added gtkaccelmap.sgml. other updates.
Mon Nov 12 23:08:37 2001 Tim Janik <timj@gtk.org>
* gtk/maketypes.awk: fix type utils generation on unix.
* gtk/gtkaccelmap.[hc]: new files, implementing a global accelerator
registry.
* gtk/gtkaccelgroup.[hc]: major API/implementation revamp:
removed GTK_ACCEL_SIGNAL_VISIBLE, gtk_accel_group_get_default,
gtk_accel_group_get_entry, gtk_accel_group_(un)lock_entry,
gtk_accel_group_add/remove, gtk_accel_group_handle_add/remove,
gtk_accel_group_create_add/remove, gtk_accel_group_entries_from_object.
introduced ::accel_changed signal for change notification, and
gtk_accel_group_connect/disconnect to connect closures to accel groups.
made gtk_accel_group_attach/detach and gtk_accel_group_activate private
functions.
deprecated gtk_accel_group_ref/unref.
* gtk/gtkaccellabel.[hc]: changes to make accellabels pay attention
to accel group changed notification and basically operate on closures.
removed gtk_accel_label_get_accel_object and
gtk_accel_label_set_accel_object.
introduced gtk_accel_label_set_accel_closure, and for convenience,
gtk_accel_label_set_accel_widget.
* gtk/gtkitemfactory.[hc]: removed accelerator propagation code
which mostly moved into gtkaccelmap.[hc].
removed gtk_item_factory_parse_rc*, gtk_item_factory_dump_*
and gtk_item_factory_print_func.
* gtk/gtkmain.c: call _gtk_accel_map_init().
* gtk/gtkmenuitem.[hc]: introduced gtk_menu_item_set_accel_path(),
that associates an accelerator path with menu items, through which
persistent accelerator settings on menu items are enabled.
* gtk/gtkmenu.[hc]: added gtk_menu_set_accel_path() so accelerator
paths of menu item can be default constructed to allow installation
of accelerators on menu items that don't come with an accelerator
binding by default.
* gtk/gtksettings.c: fix STRING type rc settings by special casing
them appropriately in the parser.
* gtk/gtksignal.[hc]: allow a class function offset of 0 for
gtk_signal_newv().
* gtk/gtkwidget.[hc]: accelerator API revamp.
removed ::accelerator_add/remove signals, gtk_widget_accelerator_signal,
gtk_widget_accelerators_locked, gtk_widget_remove_accelerators and
gtk_widget_(un)lock_accelerators.
accelerators maintained through gtk_widget_add/remove_accelerator()
are not runtime changable now, the correct sequence to setup a
widget for runtime changable accelerators is now:
gtk_accel_map_add_entry(accel_path, key, mods);
_gtk_widget_set_accel_path(widget, accel_path, accel_group);
* gtk/gtkwindow.[hc]: accelerator changes, proxy and coalesce accel
group changes (as well as mnemonic changes) through the new signal
::accels_changed.
Sat Nov 10 12:08:56 2001 Tim Janik <timj@gtk.org>
* gtk/gtksettings.c (_gtk_settings_parse_convert): properly handle
GString->string conversions.
2001-11-13 00:53:47 +00:00
|
|
|
|
*/
|
|
|
|
|
void
|
|
|
|
|
gtk_menu_set_accel_path (GtkMenu *menu,
|
2010-12-23 20:50:18 +00:00
|
|
|
|
const gchar *accel_path)
|
added gtkaccelmap.sgml. other updates.
Mon Nov 12 23:06:38 2001 Tim Janik <timj@gtk.org>
* added gtkaccelmap.sgml. other updates.
Mon Nov 12 23:08:37 2001 Tim Janik <timj@gtk.org>
* gtk/maketypes.awk: fix type utils generation on unix.
* gtk/gtkaccelmap.[hc]: new files, implementing a global accelerator
registry.
* gtk/gtkaccelgroup.[hc]: major API/implementation revamp:
removed GTK_ACCEL_SIGNAL_VISIBLE, gtk_accel_group_get_default,
gtk_accel_group_get_entry, gtk_accel_group_(un)lock_entry,
gtk_accel_group_add/remove, gtk_accel_group_handle_add/remove,
gtk_accel_group_create_add/remove, gtk_accel_group_entries_from_object.
introduced ::accel_changed signal for change notification, and
gtk_accel_group_connect/disconnect to connect closures to accel groups.
made gtk_accel_group_attach/detach and gtk_accel_group_activate private
functions.
deprecated gtk_accel_group_ref/unref.
* gtk/gtkaccellabel.[hc]: changes to make accellabels pay attention
to accel group changed notification and basically operate on closures.
removed gtk_accel_label_get_accel_object and
gtk_accel_label_set_accel_object.
introduced gtk_accel_label_set_accel_closure, and for convenience,
gtk_accel_label_set_accel_widget.
* gtk/gtkitemfactory.[hc]: removed accelerator propagation code
which mostly moved into gtkaccelmap.[hc].
removed gtk_item_factory_parse_rc*, gtk_item_factory_dump_*
and gtk_item_factory_print_func.
* gtk/gtkmain.c: call _gtk_accel_map_init().
* gtk/gtkmenuitem.[hc]: introduced gtk_menu_item_set_accel_path(),
that associates an accelerator path with menu items, through which
persistent accelerator settings on menu items are enabled.
* gtk/gtkmenu.[hc]: added gtk_menu_set_accel_path() so accelerator
paths of menu item can be default constructed to allow installation
of accelerators on menu items that don't come with an accelerator
binding by default.
* gtk/gtksettings.c: fix STRING type rc settings by special casing
them appropriately in the parser.
* gtk/gtksignal.[hc]: allow a class function offset of 0 for
gtk_signal_newv().
* gtk/gtkwidget.[hc]: accelerator API revamp.
removed ::accelerator_add/remove signals, gtk_widget_accelerator_signal,
gtk_widget_accelerators_locked, gtk_widget_remove_accelerators and
gtk_widget_(un)lock_accelerators.
accelerators maintained through gtk_widget_add/remove_accelerator()
are not runtime changable now, the correct sequence to setup a
widget for runtime changable accelerators is now:
gtk_accel_map_add_entry(accel_path, key, mods);
_gtk_widget_set_accel_path(widget, accel_path, accel_group);
* gtk/gtkwindow.[hc]: accelerator changes, proxy and coalesce accel
group changes (as well as mnemonic changes) through the new signal
::accels_changed.
Sat Nov 10 12:08:56 2001 Tim Janik <timj@gtk.org>
* gtk/gtksettings.c (_gtk_settings_parse_convert): properly handle
GString->string conversions.
2001-11-13 00:53:47 +00:00
|
|
|
|
{
|
2018-04-17 18:51:53 +00:00
|
|
|
|
GtkMenuPrivate *priv;
|
|
|
|
|
|
added gtkaccelmap.sgml. other updates.
Mon Nov 12 23:06:38 2001 Tim Janik <timj@gtk.org>
* added gtkaccelmap.sgml. other updates.
Mon Nov 12 23:08:37 2001 Tim Janik <timj@gtk.org>
* gtk/maketypes.awk: fix type utils generation on unix.
* gtk/gtkaccelmap.[hc]: new files, implementing a global accelerator
registry.
* gtk/gtkaccelgroup.[hc]: major API/implementation revamp:
removed GTK_ACCEL_SIGNAL_VISIBLE, gtk_accel_group_get_default,
gtk_accel_group_get_entry, gtk_accel_group_(un)lock_entry,
gtk_accel_group_add/remove, gtk_accel_group_handle_add/remove,
gtk_accel_group_create_add/remove, gtk_accel_group_entries_from_object.
introduced ::accel_changed signal for change notification, and
gtk_accel_group_connect/disconnect to connect closures to accel groups.
made gtk_accel_group_attach/detach and gtk_accel_group_activate private
functions.
deprecated gtk_accel_group_ref/unref.
* gtk/gtkaccellabel.[hc]: changes to make accellabels pay attention
to accel group changed notification and basically operate on closures.
removed gtk_accel_label_get_accel_object and
gtk_accel_label_set_accel_object.
introduced gtk_accel_label_set_accel_closure, and for convenience,
gtk_accel_label_set_accel_widget.
* gtk/gtkitemfactory.[hc]: removed accelerator propagation code
which mostly moved into gtkaccelmap.[hc].
removed gtk_item_factory_parse_rc*, gtk_item_factory_dump_*
and gtk_item_factory_print_func.
* gtk/gtkmain.c: call _gtk_accel_map_init().
* gtk/gtkmenuitem.[hc]: introduced gtk_menu_item_set_accel_path(),
that associates an accelerator path with menu items, through which
persistent accelerator settings on menu items are enabled.
* gtk/gtkmenu.[hc]: added gtk_menu_set_accel_path() so accelerator
paths of menu item can be default constructed to allow installation
of accelerators on menu items that don't come with an accelerator
binding by default.
* gtk/gtksettings.c: fix STRING type rc settings by special casing
them appropriately in the parser.
* gtk/gtksignal.[hc]: allow a class function offset of 0 for
gtk_signal_newv().
* gtk/gtkwidget.[hc]: accelerator API revamp.
removed ::accelerator_add/remove signals, gtk_widget_accelerator_signal,
gtk_widget_accelerators_locked, gtk_widget_remove_accelerators and
gtk_widget_(un)lock_accelerators.
accelerators maintained through gtk_widget_add/remove_accelerator()
are not runtime changable now, the correct sequence to setup a
widget for runtime changable accelerators is now:
gtk_accel_map_add_entry(accel_path, key, mods);
_gtk_widget_set_accel_path(widget, accel_path, accel_group);
* gtk/gtkwindow.[hc]: accelerator changes, proxy and coalesce accel
group changes (as well as mnemonic changes) through the new signal
::accels_changed.
Sat Nov 10 12:08:56 2001 Tim Janik <timj@gtk.org>
* gtk/gtksettings.c (_gtk_settings_parse_convert): properly handle
GString->string conversions.
2001-11-13 00:53:47 +00:00
|
|
|
|
g_return_if_fail (GTK_IS_MENU (menu));
|
2010-12-23 20:50:18 +00:00
|
|
|
|
|
2018-04-17 18:51:53 +00:00
|
|
|
|
priv = menu->priv;
|
|
|
|
|
|
added gtkaccelmap.sgml. other updates.
Mon Nov 12 23:06:38 2001 Tim Janik <timj@gtk.org>
* added gtkaccelmap.sgml. other updates.
Mon Nov 12 23:08:37 2001 Tim Janik <timj@gtk.org>
* gtk/maketypes.awk: fix type utils generation on unix.
* gtk/gtkaccelmap.[hc]: new files, implementing a global accelerator
registry.
* gtk/gtkaccelgroup.[hc]: major API/implementation revamp:
removed GTK_ACCEL_SIGNAL_VISIBLE, gtk_accel_group_get_default,
gtk_accel_group_get_entry, gtk_accel_group_(un)lock_entry,
gtk_accel_group_add/remove, gtk_accel_group_handle_add/remove,
gtk_accel_group_create_add/remove, gtk_accel_group_entries_from_object.
introduced ::accel_changed signal for change notification, and
gtk_accel_group_connect/disconnect to connect closures to accel groups.
made gtk_accel_group_attach/detach and gtk_accel_group_activate private
functions.
deprecated gtk_accel_group_ref/unref.
* gtk/gtkaccellabel.[hc]: changes to make accellabels pay attention
to accel group changed notification and basically operate on closures.
removed gtk_accel_label_get_accel_object and
gtk_accel_label_set_accel_object.
introduced gtk_accel_label_set_accel_closure, and for convenience,
gtk_accel_label_set_accel_widget.
* gtk/gtkitemfactory.[hc]: removed accelerator propagation code
which mostly moved into gtkaccelmap.[hc].
removed gtk_item_factory_parse_rc*, gtk_item_factory_dump_*
and gtk_item_factory_print_func.
* gtk/gtkmain.c: call _gtk_accel_map_init().
* gtk/gtkmenuitem.[hc]: introduced gtk_menu_item_set_accel_path(),
that associates an accelerator path with menu items, through which
persistent accelerator settings on menu items are enabled.
* gtk/gtkmenu.[hc]: added gtk_menu_set_accel_path() so accelerator
paths of menu item can be default constructed to allow installation
of accelerators on menu items that don't come with an accelerator
binding by default.
* gtk/gtksettings.c: fix STRING type rc settings by special casing
them appropriately in the parser.
* gtk/gtksignal.[hc]: allow a class function offset of 0 for
gtk_signal_newv().
* gtk/gtkwidget.[hc]: accelerator API revamp.
removed ::accelerator_add/remove signals, gtk_widget_accelerator_signal,
gtk_widget_accelerators_locked, gtk_widget_remove_accelerators and
gtk_widget_(un)lock_accelerators.
accelerators maintained through gtk_widget_add/remove_accelerator()
are not runtime changable now, the correct sequence to setup a
widget for runtime changable accelerators is now:
gtk_accel_map_add_entry(accel_path, key, mods);
_gtk_widget_set_accel_path(widget, accel_path, accel_group);
* gtk/gtkwindow.[hc]: accelerator changes, proxy and coalesce accel
group changes (as well as mnemonic changes) through the new signal
::accels_changed.
Sat Nov 10 12:08:56 2001 Tim Janik <timj@gtk.org>
* gtk/gtksettings.c (_gtk_settings_parse_convert): properly handle
GString->string conversions.
2001-11-13 00:53:47 +00:00
|
|
|
|
if (accel_path)
|
|
|
|
|
g_return_if_fail (accel_path[0] == '<' && strchr (accel_path, '/')); /* simplistic check */
|
|
|
|
|
|
2018-04-17 19:03:07 +00:00
|
|
|
|
priv->accel_path = g_intern_string (accel_path);
|
2010-12-23 20:50:18 +00:00
|
|
|
|
if (priv->accel_path)
|
added gtkaccelmap.sgml. other updates.
Mon Nov 12 23:06:38 2001 Tim Janik <timj@gtk.org>
* added gtkaccelmap.sgml. other updates.
Mon Nov 12 23:08:37 2001 Tim Janik <timj@gtk.org>
* gtk/maketypes.awk: fix type utils generation on unix.
* gtk/gtkaccelmap.[hc]: new files, implementing a global accelerator
registry.
* gtk/gtkaccelgroup.[hc]: major API/implementation revamp:
removed GTK_ACCEL_SIGNAL_VISIBLE, gtk_accel_group_get_default,
gtk_accel_group_get_entry, gtk_accel_group_(un)lock_entry,
gtk_accel_group_add/remove, gtk_accel_group_handle_add/remove,
gtk_accel_group_create_add/remove, gtk_accel_group_entries_from_object.
introduced ::accel_changed signal for change notification, and
gtk_accel_group_connect/disconnect to connect closures to accel groups.
made gtk_accel_group_attach/detach and gtk_accel_group_activate private
functions.
deprecated gtk_accel_group_ref/unref.
* gtk/gtkaccellabel.[hc]: changes to make accellabels pay attention
to accel group changed notification and basically operate on closures.
removed gtk_accel_label_get_accel_object and
gtk_accel_label_set_accel_object.
introduced gtk_accel_label_set_accel_closure, and for convenience,
gtk_accel_label_set_accel_widget.
* gtk/gtkitemfactory.[hc]: removed accelerator propagation code
which mostly moved into gtkaccelmap.[hc].
removed gtk_item_factory_parse_rc*, gtk_item_factory_dump_*
and gtk_item_factory_print_func.
* gtk/gtkmain.c: call _gtk_accel_map_init().
* gtk/gtkmenuitem.[hc]: introduced gtk_menu_item_set_accel_path(),
that associates an accelerator path with menu items, through which
persistent accelerator settings on menu items are enabled.
* gtk/gtkmenu.[hc]: added gtk_menu_set_accel_path() so accelerator
paths of menu item can be default constructed to allow installation
of accelerators on menu items that don't come with an accelerator
binding by default.
* gtk/gtksettings.c: fix STRING type rc settings by special casing
them appropriately in the parser.
* gtk/gtksignal.[hc]: allow a class function offset of 0 for
gtk_signal_newv().
* gtk/gtkwidget.[hc]: accelerator API revamp.
removed ::accelerator_add/remove signals, gtk_widget_accelerator_signal,
gtk_widget_accelerators_locked, gtk_widget_remove_accelerators and
gtk_widget_(un)lock_accelerators.
accelerators maintained through gtk_widget_add/remove_accelerator()
are not runtime changable now, the correct sequence to setup a
widget for runtime changable accelerators is now:
gtk_accel_map_add_entry(accel_path, key, mods);
_gtk_widget_set_accel_path(widget, accel_path, accel_group);
* gtk/gtkwindow.[hc]: accelerator changes, proxy and coalesce accel
group changes (as well as mnemonic changes) through the new signal
::accels_changed.
Sat Nov 10 12:08:56 2001 Tim Janik <timj@gtk.org>
* gtk/gtksettings.c (_gtk_settings_parse_convert): properly handle
GString->string conversions.
2001-11-13 00:53:47 +00:00
|
|
|
|
_gtk_menu_refresh_accel_paths (menu, FALSE);
|
|
|
|
|
}
|
|
|
|
|
|
2008-06-20 11:06:52 +00:00
|
|
|
|
/**
|
2012-04-13 00:07:28 +00:00
|
|
|
|
* gtk_menu_get_accel_path:
|
2008-06-20 13:54:31 +00:00
|
|
|
|
* @menu: a valid #GtkMenu
|
2008-06-20 11:06:52 +00:00
|
|
|
|
*
|
|
|
|
|
* Retrieves the accelerator path set on the menu.
|
|
|
|
|
*
|
2008-07-21 23:23:41 +00:00
|
|
|
|
* Returns: the accelerator path set on the menu.
|
|
|
|
|
*
|
2008-06-20 13:54:31 +00:00
|
|
|
|
* Since: 2.14
|
2008-06-20 11:06:52 +00:00
|
|
|
|
*/
|
|
|
|
|
const gchar*
|
2008-09-03 13:18:34 +00:00
|
|
|
|
gtk_menu_get_accel_path (GtkMenu *menu)
|
2008-06-20 11:06:52 +00:00
|
|
|
|
{
|
2008-06-21 09:49:00 +00:00
|
|
|
|
g_return_val_if_fail (GTK_IS_MENU (menu), NULL);
|
2008-06-20 11:06:52 +00:00
|
|
|
|
|
2010-12-23 20:50:18 +00:00
|
|
|
|
return menu->priv->accel_path;
|
2008-06-20 11:06:52 +00:00
|
|
|
|
}
|
|
|
|
|
|
added gtkaccelmap.sgml. other updates.
Mon Nov 12 23:06:38 2001 Tim Janik <timj@gtk.org>
* added gtkaccelmap.sgml. other updates.
Mon Nov 12 23:08:37 2001 Tim Janik <timj@gtk.org>
* gtk/maketypes.awk: fix type utils generation on unix.
* gtk/gtkaccelmap.[hc]: new files, implementing a global accelerator
registry.
* gtk/gtkaccelgroup.[hc]: major API/implementation revamp:
removed GTK_ACCEL_SIGNAL_VISIBLE, gtk_accel_group_get_default,
gtk_accel_group_get_entry, gtk_accel_group_(un)lock_entry,
gtk_accel_group_add/remove, gtk_accel_group_handle_add/remove,
gtk_accel_group_create_add/remove, gtk_accel_group_entries_from_object.
introduced ::accel_changed signal for change notification, and
gtk_accel_group_connect/disconnect to connect closures to accel groups.
made gtk_accel_group_attach/detach and gtk_accel_group_activate private
functions.
deprecated gtk_accel_group_ref/unref.
* gtk/gtkaccellabel.[hc]: changes to make accellabels pay attention
to accel group changed notification and basically operate on closures.
removed gtk_accel_label_get_accel_object and
gtk_accel_label_set_accel_object.
introduced gtk_accel_label_set_accel_closure, and for convenience,
gtk_accel_label_set_accel_widget.
* gtk/gtkitemfactory.[hc]: removed accelerator propagation code
which mostly moved into gtkaccelmap.[hc].
removed gtk_item_factory_parse_rc*, gtk_item_factory_dump_*
and gtk_item_factory_print_func.
* gtk/gtkmain.c: call _gtk_accel_map_init().
* gtk/gtkmenuitem.[hc]: introduced gtk_menu_item_set_accel_path(),
that associates an accelerator path with menu items, through which
persistent accelerator settings on menu items are enabled.
* gtk/gtkmenu.[hc]: added gtk_menu_set_accel_path() so accelerator
paths of menu item can be default constructed to allow installation
of accelerators on menu items that don't come with an accelerator
binding by default.
* gtk/gtksettings.c: fix STRING type rc settings by special casing
them appropriately in the parser.
* gtk/gtksignal.[hc]: allow a class function offset of 0 for
gtk_signal_newv().
* gtk/gtkwidget.[hc]: accelerator API revamp.
removed ::accelerator_add/remove signals, gtk_widget_accelerator_signal,
gtk_widget_accelerators_locked, gtk_widget_remove_accelerators and
gtk_widget_(un)lock_accelerators.
accelerators maintained through gtk_widget_add/remove_accelerator()
are not runtime changable now, the correct sequence to setup a
widget for runtime changable accelerators is now:
gtk_accel_map_add_entry(accel_path, key, mods);
_gtk_widget_set_accel_path(widget, accel_path, accel_group);
* gtk/gtkwindow.[hc]: accelerator changes, proxy and coalesce accel
group changes (as well as mnemonic changes) through the new signal
::accels_changed.
Sat Nov 10 12:08:56 2001 Tim Janik <timj@gtk.org>
* gtk/gtksettings.c (_gtk_settings_parse_convert): properly handle
GString->string conversions.
2001-11-13 00:53:47 +00:00
|
|
|
|
typedef struct {
|
|
|
|
|
GtkMenu *menu;
|
|
|
|
|
gboolean group_changed;
|
|
|
|
|
} AccelPropagation;
|
|
|
|
|
|
|
|
|
|
static void
|
2001-11-20 23:43:03 +00:00
|
|
|
|
refresh_accel_paths_foreach (GtkWidget *widget,
|
2010-12-23 20:50:18 +00:00
|
|
|
|
gpointer data)
|
added gtkaccelmap.sgml. other updates.
Mon Nov 12 23:06:38 2001 Tim Janik <timj@gtk.org>
* added gtkaccelmap.sgml. other updates.
Mon Nov 12 23:08:37 2001 Tim Janik <timj@gtk.org>
* gtk/maketypes.awk: fix type utils generation on unix.
* gtk/gtkaccelmap.[hc]: new files, implementing a global accelerator
registry.
* gtk/gtkaccelgroup.[hc]: major API/implementation revamp:
removed GTK_ACCEL_SIGNAL_VISIBLE, gtk_accel_group_get_default,
gtk_accel_group_get_entry, gtk_accel_group_(un)lock_entry,
gtk_accel_group_add/remove, gtk_accel_group_handle_add/remove,
gtk_accel_group_create_add/remove, gtk_accel_group_entries_from_object.
introduced ::accel_changed signal for change notification, and
gtk_accel_group_connect/disconnect to connect closures to accel groups.
made gtk_accel_group_attach/detach and gtk_accel_group_activate private
functions.
deprecated gtk_accel_group_ref/unref.
* gtk/gtkaccellabel.[hc]: changes to make accellabels pay attention
to accel group changed notification and basically operate on closures.
removed gtk_accel_label_get_accel_object and
gtk_accel_label_set_accel_object.
introduced gtk_accel_label_set_accel_closure, and for convenience,
gtk_accel_label_set_accel_widget.
* gtk/gtkitemfactory.[hc]: removed accelerator propagation code
which mostly moved into gtkaccelmap.[hc].
removed gtk_item_factory_parse_rc*, gtk_item_factory_dump_*
and gtk_item_factory_print_func.
* gtk/gtkmain.c: call _gtk_accel_map_init().
* gtk/gtkmenuitem.[hc]: introduced gtk_menu_item_set_accel_path(),
that associates an accelerator path with menu items, through which
persistent accelerator settings on menu items are enabled.
* gtk/gtkmenu.[hc]: added gtk_menu_set_accel_path() so accelerator
paths of menu item can be default constructed to allow installation
of accelerators on menu items that don't come with an accelerator
binding by default.
* gtk/gtksettings.c: fix STRING type rc settings by special casing
them appropriately in the parser.
* gtk/gtksignal.[hc]: allow a class function offset of 0 for
gtk_signal_newv().
* gtk/gtkwidget.[hc]: accelerator API revamp.
removed ::accelerator_add/remove signals, gtk_widget_accelerator_signal,
gtk_widget_accelerators_locked, gtk_widget_remove_accelerators and
gtk_widget_(un)lock_accelerators.
accelerators maintained through gtk_widget_add/remove_accelerator()
are not runtime changable now, the correct sequence to setup a
widget for runtime changable accelerators is now:
gtk_accel_map_add_entry(accel_path, key, mods);
_gtk_widget_set_accel_path(widget, accel_path, accel_group);
* gtk/gtkwindow.[hc]: accelerator changes, proxy and coalesce accel
group changes (as well as mnemonic changes) through the new signal
::accels_changed.
Sat Nov 10 12:08:56 2001 Tim Janik <timj@gtk.org>
* gtk/gtksettings.c (_gtk_settings_parse_convert): properly handle
GString->string conversions.
2001-11-13 00:53:47 +00:00
|
|
|
|
{
|
2010-12-23 20:50:18 +00:00
|
|
|
|
GtkMenuPrivate *priv;
|
added gtkaccelmap.sgml. other updates.
Mon Nov 12 23:06:38 2001 Tim Janik <timj@gtk.org>
* added gtkaccelmap.sgml. other updates.
Mon Nov 12 23:08:37 2001 Tim Janik <timj@gtk.org>
* gtk/maketypes.awk: fix type utils generation on unix.
* gtk/gtkaccelmap.[hc]: new files, implementing a global accelerator
registry.
* gtk/gtkaccelgroup.[hc]: major API/implementation revamp:
removed GTK_ACCEL_SIGNAL_VISIBLE, gtk_accel_group_get_default,
gtk_accel_group_get_entry, gtk_accel_group_(un)lock_entry,
gtk_accel_group_add/remove, gtk_accel_group_handle_add/remove,
gtk_accel_group_create_add/remove, gtk_accel_group_entries_from_object.
introduced ::accel_changed signal for change notification, and
gtk_accel_group_connect/disconnect to connect closures to accel groups.
made gtk_accel_group_attach/detach and gtk_accel_group_activate private
functions.
deprecated gtk_accel_group_ref/unref.
* gtk/gtkaccellabel.[hc]: changes to make accellabels pay attention
to accel group changed notification and basically operate on closures.
removed gtk_accel_label_get_accel_object and
gtk_accel_label_set_accel_object.
introduced gtk_accel_label_set_accel_closure, and for convenience,
gtk_accel_label_set_accel_widget.
* gtk/gtkitemfactory.[hc]: removed accelerator propagation code
which mostly moved into gtkaccelmap.[hc].
removed gtk_item_factory_parse_rc*, gtk_item_factory_dump_*
and gtk_item_factory_print_func.
* gtk/gtkmain.c: call _gtk_accel_map_init().
* gtk/gtkmenuitem.[hc]: introduced gtk_menu_item_set_accel_path(),
that associates an accelerator path with menu items, through which
persistent accelerator settings on menu items are enabled.
* gtk/gtkmenu.[hc]: added gtk_menu_set_accel_path() so accelerator
paths of menu item can be default constructed to allow installation
of accelerators on menu items that don't come with an accelerator
binding by default.
* gtk/gtksettings.c: fix STRING type rc settings by special casing
them appropriately in the parser.
* gtk/gtksignal.[hc]: allow a class function offset of 0 for
gtk_signal_newv().
* gtk/gtkwidget.[hc]: accelerator API revamp.
removed ::accelerator_add/remove signals, gtk_widget_accelerator_signal,
gtk_widget_accelerators_locked, gtk_widget_remove_accelerators and
gtk_widget_(un)lock_accelerators.
accelerators maintained through gtk_widget_add/remove_accelerator()
are not runtime changable now, the correct sequence to setup a
widget for runtime changable accelerators is now:
gtk_accel_map_add_entry(accel_path, key, mods);
_gtk_widget_set_accel_path(widget, accel_path, accel_group);
* gtk/gtkwindow.[hc]: accelerator changes, proxy and coalesce accel
group changes (as well as mnemonic changes) through the new signal
::accels_changed.
Sat Nov 10 12:08:56 2001 Tim Janik <timj@gtk.org>
* gtk/gtksettings.c (_gtk_settings_parse_convert): properly handle
GString->string conversions.
2001-11-13 00:53:47 +00:00
|
|
|
|
AccelPropagation *prop = data;
|
|
|
|
|
|
2010-12-23 20:50:18 +00:00
|
|
|
|
if (GTK_IS_MENU_ITEM (widget)) /* should always be true */
|
|
|
|
|
{
|
|
|
|
|
priv = prop->menu->priv;
|
|
|
|
|
_gtk_menu_item_refresh_accel_path (GTK_MENU_ITEM (widget),
|
|
|
|
|
priv->accel_path,
|
|
|
|
|
priv->accel_group,
|
|
|
|
|
prop->group_changed);
|
|
|
|
|
}
|
added gtkaccelmap.sgml. other updates.
Mon Nov 12 23:06:38 2001 Tim Janik <timj@gtk.org>
* added gtkaccelmap.sgml. other updates.
Mon Nov 12 23:08:37 2001 Tim Janik <timj@gtk.org>
* gtk/maketypes.awk: fix type utils generation on unix.
* gtk/gtkaccelmap.[hc]: new files, implementing a global accelerator
registry.
* gtk/gtkaccelgroup.[hc]: major API/implementation revamp:
removed GTK_ACCEL_SIGNAL_VISIBLE, gtk_accel_group_get_default,
gtk_accel_group_get_entry, gtk_accel_group_(un)lock_entry,
gtk_accel_group_add/remove, gtk_accel_group_handle_add/remove,
gtk_accel_group_create_add/remove, gtk_accel_group_entries_from_object.
introduced ::accel_changed signal for change notification, and
gtk_accel_group_connect/disconnect to connect closures to accel groups.
made gtk_accel_group_attach/detach and gtk_accel_group_activate private
functions.
deprecated gtk_accel_group_ref/unref.
* gtk/gtkaccellabel.[hc]: changes to make accellabels pay attention
to accel group changed notification and basically operate on closures.
removed gtk_accel_label_get_accel_object and
gtk_accel_label_set_accel_object.
introduced gtk_accel_label_set_accel_closure, and for convenience,
gtk_accel_label_set_accel_widget.
* gtk/gtkitemfactory.[hc]: removed accelerator propagation code
which mostly moved into gtkaccelmap.[hc].
removed gtk_item_factory_parse_rc*, gtk_item_factory_dump_*
and gtk_item_factory_print_func.
* gtk/gtkmain.c: call _gtk_accel_map_init().
* gtk/gtkmenuitem.[hc]: introduced gtk_menu_item_set_accel_path(),
that associates an accelerator path with menu items, through which
persistent accelerator settings on menu items are enabled.
* gtk/gtkmenu.[hc]: added gtk_menu_set_accel_path() so accelerator
paths of menu item can be default constructed to allow installation
of accelerators on menu items that don't come with an accelerator
binding by default.
* gtk/gtksettings.c: fix STRING type rc settings by special casing
them appropriately in the parser.
* gtk/gtksignal.[hc]: allow a class function offset of 0 for
gtk_signal_newv().
* gtk/gtkwidget.[hc]: accelerator API revamp.
removed ::accelerator_add/remove signals, gtk_widget_accelerator_signal,
gtk_widget_accelerators_locked, gtk_widget_remove_accelerators and
gtk_widget_(un)lock_accelerators.
accelerators maintained through gtk_widget_add/remove_accelerator()
are not runtime changable now, the correct sequence to setup a
widget for runtime changable accelerators is now:
gtk_accel_map_add_entry(accel_path, key, mods);
_gtk_widget_set_accel_path(widget, accel_path, accel_group);
* gtk/gtkwindow.[hc]: accelerator changes, proxy and coalesce accel
group changes (as well as mnemonic changes) through the new signal
::accels_changed.
Sat Nov 10 12:08:56 2001 Tim Janik <timj@gtk.org>
* gtk/gtksettings.c (_gtk_settings_parse_convert): properly handle
GString->string conversions.
2001-11-13 00:53:47 +00:00
|
|
|
|
}
|
|
|
|
|
|
2001-11-20 23:43:03 +00:00
|
|
|
|
static void
|
2008-09-03 13:18:34 +00:00
|
|
|
|
_gtk_menu_refresh_accel_paths (GtkMenu *menu,
|
2010-12-23 20:50:18 +00:00
|
|
|
|
gboolean group_changed)
|
added gtkaccelmap.sgml. other updates.
Mon Nov 12 23:06:38 2001 Tim Janik <timj@gtk.org>
* added gtkaccelmap.sgml. other updates.
Mon Nov 12 23:08:37 2001 Tim Janik <timj@gtk.org>
* gtk/maketypes.awk: fix type utils generation on unix.
* gtk/gtkaccelmap.[hc]: new files, implementing a global accelerator
registry.
* gtk/gtkaccelgroup.[hc]: major API/implementation revamp:
removed GTK_ACCEL_SIGNAL_VISIBLE, gtk_accel_group_get_default,
gtk_accel_group_get_entry, gtk_accel_group_(un)lock_entry,
gtk_accel_group_add/remove, gtk_accel_group_handle_add/remove,
gtk_accel_group_create_add/remove, gtk_accel_group_entries_from_object.
introduced ::accel_changed signal for change notification, and
gtk_accel_group_connect/disconnect to connect closures to accel groups.
made gtk_accel_group_attach/detach and gtk_accel_group_activate private
functions.
deprecated gtk_accel_group_ref/unref.
* gtk/gtkaccellabel.[hc]: changes to make accellabels pay attention
to accel group changed notification and basically operate on closures.
removed gtk_accel_label_get_accel_object and
gtk_accel_label_set_accel_object.
introduced gtk_accel_label_set_accel_closure, and for convenience,
gtk_accel_label_set_accel_widget.
* gtk/gtkitemfactory.[hc]: removed accelerator propagation code
which mostly moved into gtkaccelmap.[hc].
removed gtk_item_factory_parse_rc*, gtk_item_factory_dump_*
and gtk_item_factory_print_func.
* gtk/gtkmain.c: call _gtk_accel_map_init().
* gtk/gtkmenuitem.[hc]: introduced gtk_menu_item_set_accel_path(),
that associates an accelerator path with menu items, through which
persistent accelerator settings on menu items are enabled.
* gtk/gtkmenu.[hc]: added gtk_menu_set_accel_path() so accelerator
paths of menu item can be default constructed to allow installation
of accelerators on menu items that don't come with an accelerator
binding by default.
* gtk/gtksettings.c: fix STRING type rc settings by special casing
them appropriately in the parser.
* gtk/gtksignal.[hc]: allow a class function offset of 0 for
gtk_signal_newv().
* gtk/gtkwidget.[hc]: accelerator API revamp.
removed ::accelerator_add/remove signals, gtk_widget_accelerator_signal,
gtk_widget_accelerators_locked, gtk_widget_remove_accelerators and
gtk_widget_(un)lock_accelerators.
accelerators maintained through gtk_widget_add/remove_accelerator()
are not runtime changable now, the correct sequence to setup a
widget for runtime changable accelerators is now:
gtk_accel_map_add_entry(accel_path, key, mods);
_gtk_widget_set_accel_path(widget, accel_path, accel_group);
* gtk/gtkwindow.[hc]: accelerator changes, proxy and coalesce accel
group changes (as well as mnemonic changes) through the new signal
::accels_changed.
Sat Nov 10 12:08:56 2001 Tim Janik <timj@gtk.org>
* gtk/gtksettings.c (_gtk_settings_parse_convert): properly handle
GString->string conversions.
2001-11-13 00:53:47 +00:00
|
|
|
|
{
|
2010-12-23 20:50:18 +00:00
|
|
|
|
GtkMenuPrivate *priv = menu->priv;
|
2008-09-03 13:18:34 +00:00
|
|
|
|
|
2019-02-09 16:16:01 +00:00
|
|
|
|
if (priv->accel_path)
|
added gtkaccelmap.sgml. other updates.
Mon Nov 12 23:06:38 2001 Tim Janik <timj@gtk.org>
* added gtkaccelmap.sgml. other updates.
Mon Nov 12 23:08:37 2001 Tim Janik <timj@gtk.org>
* gtk/maketypes.awk: fix type utils generation on unix.
* gtk/gtkaccelmap.[hc]: new files, implementing a global accelerator
registry.
* gtk/gtkaccelgroup.[hc]: major API/implementation revamp:
removed GTK_ACCEL_SIGNAL_VISIBLE, gtk_accel_group_get_default,
gtk_accel_group_get_entry, gtk_accel_group_(un)lock_entry,
gtk_accel_group_add/remove, gtk_accel_group_handle_add/remove,
gtk_accel_group_create_add/remove, gtk_accel_group_entries_from_object.
introduced ::accel_changed signal for change notification, and
gtk_accel_group_connect/disconnect to connect closures to accel groups.
made gtk_accel_group_attach/detach and gtk_accel_group_activate private
functions.
deprecated gtk_accel_group_ref/unref.
* gtk/gtkaccellabel.[hc]: changes to make accellabels pay attention
to accel group changed notification and basically operate on closures.
removed gtk_accel_label_get_accel_object and
gtk_accel_label_set_accel_object.
introduced gtk_accel_label_set_accel_closure, and for convenience,
gtk_accel_label_set_accel_widget.
* gtk/gtkitemfactory.[hc]: removed accelerator propagation code
which mostly moved into gtkaccelmap.[hc].
removed gtk_item_factory_parse_rc*, gtk_item_factory_dump_*
and gtk_item_factory_print_func.
* gtk/gtkmain.c: call _gtk_accel_map_init().
* gtk/gtkmenuitem.[hc]: introduced gtk_menu_item_set_accel_path(),
that associates an accelerator path with menu items, through which
persistent accelerator settings on menu items are enabled.
* gtk/gtkmenu.[hc]: added gtk_menu_set_accel_path() so accelerator
paths of menu item can be default constructed to allow installation
of accelerators on menu items that don't come with an accelerator
binding by default.
* gtk/gtksettings.c: fix STRING type rc settings by special casing
them appropriately in the parser.
* gtk/gtksignal.[hc]: allow a class function offset of 0 for
gtk_signal_newv().
* gtk/gtkwidget.[hc]: accelerator API revamp.
removed ::accelerator_add/remove signals, gtk_widget_accelerator_signal,
gtk_widget_accelerators_locked, gtk_widget_remove_accelerators and
gtk_widget_(un)lock_accelerators.
accelerators maintained through gtk_widget_add/remove_accelerator()
are not runtime changable now, the correct sequence to setup a
widget for runtime changable accelerators is now:
gtk_accel_map_add_entry(accel_path, key, mods);
_gtk_widget_set_accel_path(widget, accel_path, accel_group);
* gtk/gtkwindow.[hc]: accelerator changes, proxy and coalesce accel
group changes (as well as mnemonic changes) through the new signal
::accels_changed.
Sat Nov 10 12:08:56 2001 Tim Janik <timj@gtk.org>
* gtk/gtksettings.c (_gtk_settings_parse_convert): properly handle
GString->string conversions.
2001-11-13 00:53:47 +00:00
|
|
|
|
{
|
|
|
|
|
AccelPropagation prop;
|
|
|
|
|
|
|
|
|
|
prop.menu = menu;
|
|
|
|
|
prop.group_changed = group_changed;
|
|
|
|
|
gtk_container_foreach (GTK_CONTAINER (menu),
|
2010-12-23 20:50:18 +00:00
|
|
|
|
refresh_accel_paths_foreach,
|
|
|
|
|
&prop);
|
added gtkaccelmap.sgml. other updates.
Mon Nov 12 23:06:38 2001 Tim Janik <timj@gtk.org>
* added gtkaccelmap.sgml. other updates.
Mon Nov 12 23:08:37 2001 Tim Janik <timj@gtk.org>
* gtk/maketypes.awk: fix type utils generation on unix.
* gtk/gtkaccelmap.[hc]: new files, implementing a global accelerator
registry.
* gtk/gtkaccelgroup.[hc]: major API/implementation revamp:
removed GTK_ACCEL_SIGNAL_VISIBLE, gtk_accel_group_get_default,
gtk_accel_group_get_entry, gtk_accel_group_(un)lock_entry,
gtk_accel_group_add/remove, gtk_accel_group_handle_add/remove,
gtk_accel_group_create_add/remove, gtk_accel_group_entries_from_object.
introduced ::accel_changed signal for change notification, and
gtk_accel_group_connect/disconnect to connect closures to accel groups.
made gtk_accel_group_attach/detach and gtk_accel_group_activate private
functions.
deprecated gtk_accel_group_ref/unref.
* gtk/gtkaccellabel.[hc]: changes to make accellabels pay attention
to accel group changed notification and basically operate on closures.
removed gtk_accel_label_get_accel_object and
gtk_accel_label_set_accel_object.
introduced gtk_accel_label_set_accel_closure, and for convenience,
gtk_accel_label_set_accel_widget.
* gtk/gtkitemfactory.[hc]: removed accelerator propagation code
which mostly moved into gtkaccelmap.[hc].
removed gtk_item_factory_parse_rc*, gtk_item_factory_dump_*
and gtk_item_factory_print_func.
* gtk/gtkmain.c: call _gtk_accel_map_init().
* gtk/gtkmenuitem.[hc]: introduced gtk_menu_item_set_accel_path(),
that associates an accelerator path with menu items, through which
persistent accelerator settings on menu items are enabled.
* gtk/gtkmenu.[hc]: added gtk_menu_set_accel_path() so accelerator
paths of menu item can be default constructed to allow installation
of accelerators on menu items that don't come with an accelerator
binding by default.
* gtk/gtksettings.c: fix STRING type rc settings by special casing
them appropriately in the parser.
* gtk/gtksignal.[hc]: allow a class function offset of 0 for
gtk_signal_newv().
* gtk/gtkwidget.[hc]: accelerator API revamp.
removed ::accelerator_add/remove signals, gtk_widget_accelerator_signal,
gtk_widget_accelerators_locked, gtk_widget_remove_accelerators and
gtk_widget_(un)lock_accelerators.
accelerators maintained through gtk_widget_add/remove_accelerator()
are not runtime changable now, the correct sequence to setup a
widget for runtime changable accelerators is now:
gtk_accel_map_add_entry(accel_path, key, mods);
_gtk_widget_set_accel_path(widget, accel_path, accel_group);
* gtk/gtkwindow.[hc]: accelerator changes, proxy and coalesce accel
group changes (as well as mnemonic changes) through the new signal
::accels_changed.
Sat Nov 10 12:08:56 2001 Tim Janik <timj@gtk.org>
* gtk/gtksettings.c (_gtk_settings_parse_convert): properly handle
GString->string conversions.
2001-11-13 00:53:47 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2011-01-15 13:51:11 +00:00
|
|
|
|
/**
|
|
|
|
|
* gtk_menu_reposition:
|
|
|
|
|
* @menu: a #GtkMenu
|
|
|
|
|
*
|
|
|
|
|
* Repositions the menu according to its position function.
|
|
|
|
|
*/
|
fixed an assertment.
Sat Jun 6 06:01:24 1998 Tim Janik <timj@gtk.org>
* gtk/gtksignal.c (gtk_signal_emitv): fixed an assertment.
* gtk/makeenums.awk: a script to generate the GtkEnumValue arrays from,
this should eventually be done by gentypeinfo.el somewhen.
* gtk/gtkenumvalues.c: new generated file to hold GtkEnumValue arrays.
* gtk/gtktypeutils.h: new function gtk_enum_values() to retrive all the
enum values of an enum type.
* gtk/gtk.defs:
* gtk/gtkcurve.h:
* gtk/gtkobject.h:
* gtk/gtkprivate.h:
* gtk/gtkwidget.h:
* gtk/gtkenums.h:
brought enum/flags definitions in sync, added a few more enum
definitions for bindings and pattern matching.
* some more macro and GtkType fixups in various places.
* gdk/gdktypes.h (enum): added a new value GDK_AFTER_MASK, which is used
as a key-release modifier for the binding system.
Fri Jun 5 06:06:06 1998 Tim Janik <timj@gtk.org>
* gtk/gtkmenu.h (struct _GtkMenu): removed GList*children, since it
was a stale list pointer that is already present in GtkMenuShell.
* gtk/gtkmenushell.h (struct _GtkMenuShellClass): added a signal
GtkMenuShell::selection_done which is emitted after the menu shell
poped down again and all possible menu items have been activated.
Thu Jun 4 02:20:42 1998 Tim Janik <timj@gtk.org>
* gtk/gtkmenushell.c (gtk_menu_shell_button_release): flush the x-queue
before activation of the menuitem, so the menu is actually taken off the
screen prior to any menu item activation.
* gtk/gtkctree.c (gtk_ctree_get_row_data): allow function invokation
for NULL nodes.
* gtk/gtkwidget.h:
* gtk/gtkwidget.c: new function gtk_widget_stop_accelerator to stop
the emission of the "add-accelerator" signal on a widget. this is
usefull to prevent accelerator installation on certain widgets.
* gtk/gtknotebook.c (gtk_notebook_menu_item_create): keep the menu
labels left justified, by setting their alignment. stop accelerator
installation for the menu items, since we use dynamic menus.
Wed Jun 3 06:41:22 1998 Tim Janik <timj@gtk.org>
* gtk/gtkmenufactory.c: adaptions to use the new accel groups. people
should *really* use GtkItemFactory. this is only for preserving source
compatibility where possible, use of GtkMenuFactory is deprecated as of
now.
* gtk/gtkobject.h (gtk_object_class_add_user_signal): new function
to create user signals of type GTK_RUN_NO_RECURSE. don't know why i
missed this possibility when i added gtk_object_class_add_user_signal
in late january.
* gtk/gtkmain.c (gtk_init): ignore subsequent function calls.
Sun May 31 07:31:09 1998 Tim Janik <timj@gtk.org>
* gtk/gtkaccelgroup.h:
* gtk/gtkaccelgroup.c: new implementation of the accelerator concept.
* gtk/gtkaccellabel.h:
* gtk/gtkaccellabel.c: new widget derived from GtkLabel whitch features
display of the accelerators associated with a certain widget.
* gtk/gtkitemfactory.h:
* gtk/gtkitemfactory.c: new widget, item factory with automatic rc
parsing and accelerator handling.
* gtk/gtkmenu.c (gtk_menu_reposition): new function to care for
positioning a menu.
(gtk_menu_map): removed the allocation code.
(gtk_menu_size_allocate): care for redrawing of children and resize
our widget->window correctly.
(gtk_menu_key_press): feature the new accelerator groups.
* gtk/gtkmenuitem.c (gtk_menu_item_size_allocate): reposition the
submenu if neccessary.
* gtk/gtkmenuitem.c:
* gtk/gtkcheckmenuitem.c:
* gtk/gtkradiomenuitem.c: use GtkAccelLabel in the *_new_with_label()
function variants.
* gdk/gdk.c:
(gdk_keyval_from_name):
(gdk_keyval_name): new functions for keyval<->key-name associations.
(gdk_keyval_to_upper):
(gdk_keyval_to_lower):
(gdk_keyval_is_upper):
(gdk_keyval_is_lower): new functions to check/translate keyvalues with
regards to their cases.
Wed May 27 00:48:10 1998 Tim Janik <timj@gtk.org>
* gtk/gtkwidget.c (gtk_widget_class_path): new function to calculate a
widget's class path.
(gtk_widget_path): new function to calculate a widget's name path.
* gtk/gtkrc.c: newly introduced GtkPatternSpec structures to speed up
pattern matching, features reversed pattern matches.
1998-06-07 06:48:56 +00:00
|
|
|
|
void
|
|
|
|
|
gtk_menu_reposition (GtkMenu *menu)
|
|
|
|
|
{
|
|
|
|
|
g_return_if_fail (GTK_IS_MENU (menu));
|
|
|
|
|
|
2010-12-23 20:50:18 +00:00
|
|
|
|
if (!menu->priv->torn_off && gtk_widget_is_drawable (GTK_WIDGET (menu)))
|
2010-10-31 19:52:32 +00:00
|
|
|
|
gtk_menu_position (menu, FALSE);
|
fixed an assertment.
Sat Jun 6 06:01:24 1998 Tim Janik <timj@gtk.org>
* gtk/gtksignal.c (gtk_signal_emitv): fixed an assertment.
* gtk/makeenums.awk: a script to generate the GtkEnumValue arrays from,
this should eventually be done by gentypeinfo.el somewhen.
* gtk/gtkenumvalues.c: new generated file to hold GtkEnumValue arrays.
* gtk/gtktypeutils.h: new function gtk_enum_values() to retrive all the
enum values of an enum type.
* gtk/gtk.defs:
* gtk/gtkcurve.h:
* gtk/gtkobject.h:
* gtk/gtkprivate.h:
* gtk/gtkwidget.h:
* gtk/gtkenums.h:
brought enum/flags definitions in sync, added a few more enum
definitions for bindings and pattern matching.
* some more macro and GtkType fixups in various places.
* gdk/gdktypes.h (enum): added a new value GDK_AFTER_MASK, which is used
as a key-release modifier for the binding system.
Fri Jun 5 06:06:06 1998 Tim Janik <timj@gtk.org>
* gtk/gtkmenu.h (struct _GtkMenu): removed GList*children, since it
was a stale list pointer that is already present in GtkMenuShell.
* gtk/gtkmenushell.h (struct _GtkMenuShellClass): added a signal
GtkMenuShell::selection_done which is emitted after the menu shell
poped down again and all possible menu items have been activated.
Thu Jun 4 02:20:42 1998 Tim Janik <timj@gtk.org>
* gtk/gtkmenushell.c (gtk_menu_shell_button_release): flush the x-queue
before activation of the menuitem, so the menu is actually taken off the
screen prior to any menu item activation.
* gtk/gtkctree.c (gtk_ctree_get_row_data): allow function invokation
for NULL nodes.
* gtk/gtkwidget.h:
* gtk/gtkwidget.c: new function gtk_widget_stop_accelerator to stop
the emission of the "add-accelerator" signal on a widget. this is
usefull to prevent accelerator installation on certain widgets.
* gtk/gtknotebook.c (gtk_notebook_menu_item_create): keep the menu
labels left justified, by setting their alignment. stop accelerator
installation for the menu items, since we use dynamic menus.
Wed Jun 3 06:41:22 1998 Tim Janik <timj@gtk.org>
* gtk/gtkmenufactory.c: adaptions to use the new accel groups. people
should *really* use GtkItemFactory. this is only for preserving source
compatibility where possible, use of GtkMenuFactory is deprecated as of
now.
* gtk/gtkobject.h (gtk_object_class_add_user_signal): new function
to create user signals of type GTK_RUN_NO_RECURSE. don't know why i
missed this possibility when i added gtk_object_class_add_user_signal
in late january.
* gtk/gtkmain.c (gtk_init): ignore subsequent function calls.
Sun May 31 07:31:09 1998 Tim Janik <timj@gtk.org>
* gtk/gtkaccelgroup.h:
* gtk/gtkaccelgroup.c: new implementation of the accelerator concept.
* gtk/gtkaccellabel.h:
* gtk/gtkaccellabel.c: new widget derived from GtkLabel whitch features
display of the accelerators associated with a certain widget.
* gtk/gtkitemfactory.h:
* gtk/gtkitemfactory.c: new widget, item factory with automatic rc
parsing and accelerator handling.
* gtk/gtkmenu.c (gtk_menu_reposition): new function to care for
positioning a menu.
(gtk_menu_map): removed the allocation code.
(gtk_menu_size_allocate): care for redrawing of children and resize
our widget->window correctly.
(gtk_menu_key_press): feature the new accelerator groups.
* gtk/gtkmenuitem.c (gtk_menu_item_size_allocate): reposition the
submenu if neccessary.
* gtk/gtkmenuitem.c:
* gtk/gtkcheckmenuitem.c:
* gtk/gtkradiomenuitem.c: use GtkAccelLabel in the *_new_with_label()
function variants.
* gdk/gdk.c:
(gdk_keyval_from_name):
(gdk_keyval_name): new functions for keyval<->key-name associations.
(gdk_keyval_to_upper):
(gdk_keyval_to_lower):
(gdk_keyval_is_upper):
(gdk_keyval_is_lower): new functions to check/translate keyvalues with
regards to their cases.
Wed May 27 00:48:10 1998 Tim Janik <timj@gtk.org>
* gtk/gtkwidget.c (gtk_widget_class_path): new function to calculate a
widget's class path.
(gtk_widget_path): new function to calculate a widget's name path.
* gtk/gtkrc.c: newly introduced GtkPatternSpec structures to speed up
pattern matching, features reversed pattern matches.
1998-06-07 06:48:56 +00:00
|
|
|
|
}
|
|
|
|
|
|
Add note about GtkMenuPositionFunc API changes.
2000-11-08 Alexander Larsson <alexl@redhat.com>
* docs/Changes-2.0.txt: Add note about GtkMenuPositionFunc
API changes.
* gtk/gtkmenu.c: Add support for scrolling menus.
Remove gtk_menu_append/prepend/insert, these have been moved to
gtkcompat.h as #defines.
* gtk/gtkcompat.h.in:
Add compatibility #defines for gtk_menu_append/prepend/insert
* gtk/gtkmenu.h: Add data needed for scrolling menus.
GtkMenuPositionFunc gets an extra argument push_in.
gtk_menu_append/prepend/insert removed.
* gtk/gtkmenuitem.c (gtk_menu_item_position_menu): Change menu
positioning behaviour to fit to scrolling menus.
* gtk/gtkmenuitem.c (gtk_menu_item_forall): Don't recurse
into menuitem->submeny. That is wrong, and broke torn
off submenus of torn off menus, since they were unrealized
when the first menu was unrealized.
* gtk/gtkmenushell.[ch]: Virtualize gtk_menu_shell_insert() and
gtk_menu_shell_select_item() since these need to be overridden in
GtkMenu.
* gtk/gtkoptionmenu.c (gtk_opttion_menu_position): Change menu
positioning behaviour to fit to scrolling menus.
(gtk_option_menu_key_press, gtk_option_menu_button_press): Select
the current item so that it is prelighted when the menu pops up.
This is a workaround to the fact that the menu doesn't get the
initial enter event (due to grabs).
* gtk/gtkfilesel.c, gtk/gtkinputdialog.c, gtk/testgtk.c:
s/gtk_menu_append/gtk_menu_shell_append/
* gtk/gtknotebook.c:
s/gtk_menu_insert/gtk_menu_shell_insert/
* gtk/testgtk.c (create_menu, create_menus):
Create the first menu with 50 items so that menu scrolling
can be tested.
Patch from Jonathan Blandford <jrb@redhat.com>
* gtk/gtkmenuitem.[ch] (gtk_menu_item_toggle_size_request): new
system to handle size requests. First, we ask what the size of
the toggle is. Then, when allocating the size, we allocate the
toggle_size first. This way we can have multiple menu-item
classes w/o needing a seperate class for each.
* gtk/gtkmenu.c (gtk_menu_size_request): Actually use the new system.
* gtk/gtkmenu.c (gtk_menu_size_allocate): Use the new system.
* gtk/gtkcheckmenuitem.c
(gtk_check_menu_item_toggle_size_request): New function to handle
the toggle size-request.
2000-11-08 17:34:52 +00:00
|
|
|
|
static void
|
|
|
|
|
gtk_menu_scrollbar_changed (GtkAdjustment *adjustment,
|
2010-12-23 20:50:18 +00:00
|
|
|
|
GtkMenu *menu)
|
Add note about GtkMenuPositionFunc API changes.
2000-11-08 Alexander Larsson <alexl@redhat.com>
* docs/Changes-2.0.txt: Add note about GtkMenuPositionFunc
API changes.
* gtk/gtkmenu.c: Add support for scrolling menus.
Remove gtk_menu_append/prepend/insert, these have been moved to
gtkcompat.h as #defines.
* gtk/gtkcompat.h.in:
Add compatibility #defines for gtk_menu_append/prepend/insert
* gtk/gtkmenu.h: Add data needed for scrolling menus.
GtkMenuPositionFunc gets an extra argument push_in.
gtk_menu_append/prepend/insert removed.
* gtk/gtkmenuitem.c (gtk_menu_item_position_menu): Change menu
positioning behaviour to fit to scrolling menus.
* gtk/gtkmenuitem.c (gtk_menu_item_forall): Don't recurse
into menuitem->submeny. That is wrong, and broke torn
off submenus of torn off menus, since they were unrealized
when the first menu was unrealized.
* gtk/gtkmenushell.[ch]: Virtualize gtk_menu_shell_insert() and
gtk_menu_shell_select_item() since these need to be overridden in
GtkMenu.
* gtk/gtkoptionmenu.c (gtk_opttion_menu_position): Change menu
positioning behaviour to fit to scrolling menus.
(gtk_option_menu_key_press, gtk_option_menu_button_press): Select
the current item so that it is prelighted when the menu pops up.
This is a workaround to the fact that the menu doesn't get the
initial enter event (due to grabs).
* gtk/gtkfilesel.c, gtk/gtkinputdialog.c, gtk/testgtk.c:
s/gtk_menu_append/gtk_menu_shell_append/
* gtk/gtknotebook.c:
s/gtk_menu_insert/gtk_menu_shell_insert/
* gtk/testgtk.c (create_menu, create_menus):
Create the first menu with 50 items so that menu scrolling
can be tested.
Patch from Jonathan Blandford <jrb@redhat.com>
* gtk/gtkmenuitem.[ch] (gtk_menu_item_toggle_size_request): new
system to handle size requests. First, we ask what the size of
the toggle is. Then, when allocating the size, we allocate the
toggle_size first. This way we can have multiple menu-item
classes w/o needing a seperate class for each.
* gtk/gtkmenu.c (gtk_menu_size_request): Actually use the new system.
* gtk/gtkmenu.c (gtk_menu_size_allocate): Use the new system.
* gtk/gtkcheckmenuitem.c
(gtk_check_menu_item_toggle_size_request): New function to handle
the toggle size-request.
2000-11-08 17:34:52 +00:00
|
|
|
|
{
|
2011-01-05 18:26:14 +00:00
|
|
|
|
double value;
|
Add note about GtkMenuPositionFunc API changes.
2000-11-08 Alexander Larsson <alexl@redhat.com>
* docs/Changes-2.0.txt: Add note about GtkMenuPositionFunc
API changes.
* gtk/gtkmenu.c: Add support for scrolling menus.
Remove gtk_menu_append/prepend/insert, these have been moved to
gtkcompat.h as #defines.
* gtk/gtkcompat.h.in:
Add compatibility #defines for gtk_menu_append/prepend/insert
* gtk/gtkmenu.h: Add data needed for scrolling menus.
GtkMenuPositionFunc gets an extra argument push_in.
gtk_menu_append/prepend/insert removed.
* gtk/gtkmenuitem.c (gtk_menu_item_position_menu): Change menu
positioning behaviour to fit to scrolling menus.
* gtk/gtkmenuitem.c (gtk_menu_item_forall): Don't recurse
into menuitem->submeny. That is wrong, and broke torn
off submenus of torn off menus, since they were unrealized
when the first menu was unrealized.
* gtk/gtkmenushell.[ch]: Virtualize gtk_menu_shell_insert() and
gtk_menu_shell_select_item() since these need to be overridden in
GtkMenu.
* gtk/gtkoptionmenu.c (gtk_opttion_menu_position): Change menu
positioning behaviour to fit to scrolling menus.
(gtk_option_menu_key_press, gtk_option_menu_button_press): Select
the current item so that it is prelighted when the menu pops up.
This is a workaround to the fact that the menu doesn't get the
initial enter event (due to grabs).
* gtk/gtkfilesel.c, gtk/gtkinputdialog.c, gtk/testgtk.c:
s/gtk_menu_append/gtk_menu_shell_append/
* gtk/gtknotebook.c:
s/gtk_menu_insert/gtk_menu_shell_insert/
* gtk/testgtk.c (create_menu, create_menus):
Create the first menu with 50 items so that menu scrolling
can be tested.
Patch from Jonathan Blandford <jrb@redhat.com>
* gtk/gtkmenuitem.[ch] (gtk_menu_item_toggle_size_request): new
system to handle size requests. First, we ask what the size of
the toggle is. Then, when allocating the size, we allocate the
toggle_size first. This way we can have multiple menu-item
classes w/o needing a seperate class for each.
* gtk/gtkmenu.c (gtk_menu_size_request): Actually use the new system.
* gtk/gtkmenu.c (gtk_menu_size_allocate): Use the new system.
* gtk/gtkcheckmenuitem.c
(gtk_check_menu_item_toggle_size_request): New function to handle
the toggle size-request.
2000-11-08 17:34:52 +00:00
|
|
|
|
|
2011-01-05 18:26:14 +00:00
|
|
|
|
value = gtk_adjustment_get_value (adjustment);
|
|
|
|
|
if (menu->priv->scroll_offset != value)
|
2019-01-17 18:27:51 +00:00
|
|
|
|
gtk_menu_scroll_to (menu, value, GTK_MENU_SCROLL_FLAG_NONE);
|
Add note about GtkMenuPositionFunc API changes.
2000-11-08 Alexander Larsson <alexl@redhat.com>
* docs/Changes-2.0.txt: Add note about GtkMenuPositionFunc
API changes.
* gtk/gtkmenu.c: Add support for scrolling menus.
Remove gtk_menu_append/prepend/insert, these have been moved to
gtkcompat.h as #defines.
* gtk/gtkcompat.h.in:
Add compatibility #defines for gtk_menu_append/prepend/insert
* gtk/gtkmenu.h: Add data needed for scrolling menus.
GtkMenuPositionFunc gets an extra argument push_in.
gtk_menu_append/prepend/insert removed.
* gtk/gtkmenuitem.c (gtk_menu_item_position_menu): Change menu
positioning behaviour to fit to scrolling menus.
* gtk/gtkmenuitem.c (gtk_menu_item_forall): Don't recurse
into menuitem->submeny. That is wrong, and broke torn
off submenus of torn off menus, since they were unrealized
when the first menu was unrealized.
* gtk/gtkmenushell.[ch]: Virtualize gtk_menu_shell_insert() and
gtk_menu_shell_select_item() since these need to be overridden in
GtkMenu.
* gtk/gtkoptionmenu.c (gtk_opttion_menu_position): Change menu
positioning behaviour to fit to scrolling menus.
(gtk_option_menu_key_press, gtk_option_menu_button_press): Select
the current item so that it is prelighted when the menu pops up.
This is a workaround to the fact that the menu doesn't get the
initial enter event (due to grabs).
* gtk/gtkfilesel.c, gtk/gtkinputdialog.c, gtk/testgtk.c:
s/gtk_menu_append/gtk_menu_shell_append/
* gtk/gtknotebook.c:
s/gtk_menu_insert/gtk_menu_shell_insert/
* gtk/testgtk.c (create_menu, create_menus):
Create the first menu with 50 items so that menu scrolling
can be tested.
Patch from Jonathan Blandford <jrb@redhat.com>
* gtk/gtkmenuitem.[ch] (gtk_menu_item_toggle_size_request): new
system to handle size requests. First, we ask what the size of
the toggle is. Then, when allocating the size, we allocate the
toggle_size first. This way we can have multiple menu-item
classes w/o needing a seperate class for each.
* gtk/gtkmenu.c (gtk_menu_size_request): Actually use the new system.
* gtk/gtkmenu.c (gtk_menu_size_allocate): Use the new system.
* gtk/gtkcheckmenuitem.c
(gtk_check_menu_item_toggle_size_request): New function to handle
the toggle size-request.
2000-11-08 17:34:52 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
2001-07-12 17:50:14 +00:00
|
|
|
|
gtk_menu_set_tearoff_hints (GtkMenu *menu,
|
2010-12-23 20:50:18 +00:00
|
|
|
|
gint width)
|
Add note about GtkMenuPositionFunc API changes.
2000-11-08 Alexander Larsson <alexl@redhat.com>
* docs/Changes-2.0.txt: Add note about GtkMenuPositionFunc
API changes.
* gtk/gtkmenu.c: Add support for scrolling menus.
Remove gtk_menu_append/prepend/insert, these have been moved to
gtkcompat.h as #defines.
* gtk/gtkcompat.h.in:
Add compatibility #defines for gtk_menu_append/prepend/insert
* gtk/gtkmenu.h: Add data needed for scrolling menus.
GtkMenuPositionFunc gets an extra argument push_in.
gtk_menu_append/prepend/insert removed.
* gtk/gtkmenuitem.c (gtk_menu_item_position_menu): Change menu
positioning behaviour to fit to scrolling menus.
* gtk/gtkmenuitem.c (gtk_menu_item_forall): Don't recurse
into menuitem->submeny. That is wrong, and broke torn
off submenus of torn off menus, since they were unrealized
when the first menu was unrealized.
* gtk/gtkmenushell.[ch]: Virtualize gtk_menu_shell_insert() and
gtk_menu_shell_select_item() since these need to be overridden in
GtkMenu.
* gtk/gtkoptionmenu.c (gtk_opttion_menu_position): Change menu
positioning behaviour to fit to scrolling menus.
(gtk_option_menu_key_press, gtk_option_menu_button_press): Select
the current item so that it is prelighted when the menu pops up.
This is a workaround to the fact that the menu doesn't get the
initial enter event (due to grabs).
* gtk/gtkfilesel.c, gtk/gtkinputdialog.c, gtk/testgtk.c:
s/gtk_menu_append/gtk_menu_shell_append/
* gtk/gtknotebook.c:
s/gtk_menu_insert/gtk_menu_shell_insert/
* gtk/testgtk.c (create_menu, create_menus):
Create the first menu with 50 items so that menu scrolling
can be tested.
Patch from Jonathan Blandford <jrb@redhat.com>
* gtk/gtkmenuitem.[ch] (gtk_menu_item_toggle_size_request): new
system to handle size requests. First, we ask what the size of
the toggle is. Then, when allocating the size, we allocate the
toggle_size first. This way we can have multiple menu-item
classes w/o needing a seperate class for each.
* gtk/gtkmenu.c (gtk_menu_size_request): Actually use the new system.
* gtk/gtkmenu.c (gtk_menu_size_allocate): Use the new system.
* gtk/gtkcheckmenuitem.c
(gtk_check_menu_item_toggle_size_request): New function to handle
the toggle size-request.
2000-11-08 17:34:52 +00:00
|
|
|
|
{
|
2010-12-23 20:50:18 +00:00
|
|
|
|
GtkMenuPrivate *priv = menu->priv;
|
Add note about GtkMenuPositionFunc API changes.
2000-11-08 Alexander Larsson <alexl@redhat.com>
* docs/Changes-2.0.txt: Add note about GtkMenuPositionFunc
API changes.
* gtk/gtkmenu.c: Add support for scrolling menus.
Remove gtk_menu_append/prepend/insert, these have been moved to
gtkcompat.h as #defines.
* gtk/gtkcompat.h.in:
Add compatibility #defines for gtk_menu_append/prepend/insert
* gtk/gtkmenu.h: Add data needed for scrolling menus.
GtkMenuPositionFunc gets an extra argument push_in.
gtk_menu_append/prepend/insert removed.
* gtk/gtkmenuitem.c (gtk_menu_item_position_menu): Change menu
positioning behaviour to fit to scrolling menus.
* gtk/gtkmenuitem.c (gtk_menu_item_forall): Don't recurse
into menuitem->submeny. That is wrong, and broke torn
off submenus of torn off menus, since they were unrealized
when the first menu was unrealized.
* gtk/gtkmenushell.[ch]: Virtualize gtk_menu_shell_insert() and
gtk_menu_shell_select_item() since these need to be overridden in
GtkMenu.
* gtk/gtkoptionmenu.c (gtk_opttion_menu_position): Change menu
positioning behaviour to fit to scrolling menus.
(gtk_option_menu_key_press, gtk_option_menu_button_press): Select
the current item so that it is prelighted when the menu pops up.
This is a workaround to the fact that the menu doesn't get the
initial enter event (due to grabs).
* gtk/gtkfilesel.c, gtk/gtkinputdialog.c, gtk/testgtk.c:
s/gtk_menu_append/gtk_menu_shell_append/
* gtk/gtknotebook.c:
s/gtk_menu_insert/gtk_menu_shell_insert/
* gtk/testgtk.c (create_menu, create_menus):
Create the first menu with 50 items so that menu scrolling
can be tested.
Patch from Jonathan Blandford <jrb@redhat.com>
* gtk/gtkmenuitem.[ch] (gtk_menu_item_toggle_size_request): new
system to handle size requests. First, we ask what the size of
the toggle is. Then, when allocating the size, we allocate the
toggle_size first. This way we can have multiple menu-item
classes w/o needing a seperate class for each.
* gtk/gtkmenu.c (gtk_menu_size_request): Actually use the new system.
* gtk/gtkmenu.c (gtk_menu_size_allocate): Use the new system.
* gtk/gtkcheckmenuitem.c
(gtk_check_menu_item_toggle_size_request): New function to handle
the toggle size-request.
2000-11-08 17:34:52 +00:00
|
|
|
|
GdkGeometry geometry_hints;
|
2010-08-18 23:42:02 +00:00
|
|
|
|
|
2010-12-23 20:50:18 +00:00
|
|
|
|
if (!priv->tearoff_window)
|
Add note about GtkMenuPositionFunc API changes.
2000-11-08 Alexander Larsson <alexl@redhat.com>
* docs/Changes-2.0.txt: Add note about GtkMenuPositionFunc
API changes.
* gtk/gtkmenu.c: Add support for scrolling menus.
Remove gtk_menu_append/prepend/insert, these have been moved to
gtkcompat.h as #defines.
* gtk/gtkcompat.h.in:
Add compatibility #defines for gtk_menu_append/prepend/insert
* gtk/gtkmenu.h: Add data needed for scrolling menus.
GtkMenuPositionFunc gets an extra argument push_in.
gtk_menu_append/prepend/insert removed.
* gtk/gtkmenuitem.c (gtk_menu_item_position_menu): Change menu
positioning behaviour to fit to scrolling menus.
* gtk/gtkmenuitem.c (gtk_menu_item_forall): Don't recurse
into menuitem->submeny. That is wrong, and broke torn
off submenus of torn off menus, since they were unrealized
when the first menu was unrealized.
* gtk/gtkmenushell.[ch]: Virtualize gtk_menu_shell_insert() and
gtk_menu_shell_select_item() since these need to be overridden in
GtkMenu.
* gtk/gtkoptionmenu.c (gtk_opttion_menu_position): Change menu
positioning behaviour to fit to scrolling menus.
(gtk_option_menu_key_press, gtk_option_menu_button_press): Select
the current item so that it is prelighted when the menu pops up.
This is a workaround to the fact that the menu doesn't get the
initial enter event (due to grabs).
* gtk/gtkfilesel.c, gtk/gtkinputdialog.c, gtk/testgtk.c:
s/gtk_menu_append/gtk_menu_shell_append/
* gtk/gtknotebook.c:
s/gtk_menu_insert/gtk_menu_shell_insert/
* gtk/testgtk.c (create_menu, create_menus):
Create the first menu with 50 items so that menu scrolling
can be tested.
Patch from Jonathan Blandford <jrb@redhat.com>
* gtk/gtkmenuitem.[ch] (gtk_menu_item_toggle_size_request): new
system to handle size requests. First, we ask what the size of
the toggle is. Then, when allocating the size, we allocate the
toggle_size first. This way we can have multiple menu-item
classes w/o needing a seperate class for each.
* gtk/gtkmenu.c (gtk_menu_size_request): Actually use the new system.
* gtk/gtkmenu.c (gtk_menu_size_allocate): Use the new system.
* gtk/gtkcheckmenuitem.c
(gtk_check_menu_item_toggle_size_request): New function to handle
the toggle size-request.
2000-11-08 17:34:52 +00:00
|
|
|
|
return;
|
|
|
|
|
|
2010-12-23 20:50:18 +00:00
|
|
|
|
if (gtk_widget_get_visible (priv->tearoff_scrollbar))
|
2001-11-28 23:26:17 +00:00
|
|
|
|
{
|
2010-09-07 22:25:47 +00:00
|
|
|
|
GtkRequisition requisition;
|
2010-09-14 01:33:06 +00:00
|
|
|
|
|
2010-12-23 20:50:18 +00:00
|
|
|
|
gtk_widget_get_preferred_size (priv->tearoff_scrollbar,
|
2010-09-21 14:35:17 +00:00
|
|
|
|
&requisition, NULL);
|
2010-09-07 22:25:47 +00:00
|
|
|
|
width += requisition.width;
|
2001-11-28 23:26:17 +00:00
|
|
|
|
}
|
|
|
|
|
|
Add note about GtkMenuPositionFunc API changes.
2000-11-08 Alexander Larsson <alexl@redhat.com>
* docs/Changes-2.0.txt: Add note about GtkMenuPositionFunc
API changes.
* gtk/gtkmenu.c: Add support for scrolling menus.
Remove gtk_menu_append/prepend/insert, these have been moved to
gtkcompat.h as #defines.
* gtk/gtkcompat.h.in:
Add compatibility #defines for gtk_menu_append/prepend/insert
* gtk/gtkmenu.h: Add data needed for scrolling menus.
GtkMenuPositionFunc gets an extra argument push_in.
gtk_menu_append/prepend/insert removed.
* gtk/gtkmenuitem.c (gtk_menu_item_position_menu): Change menu
positioning behaviour to fit to scrolling menus.
* gtk/gtkmenuitem.c (gtk_menu_item_forall): Don't recurse
into menuitem->submeny. That is wrong, and broke torn
off submenus of torn off menus, since they were unrealized
when the first menu was unrealized.
* gtk/gtkmenushell.[ch]: Virtualize gtk_menu_shell_insert() and
gtk_menu_shell_select_item() since these need to be overridden in
GtkMenu.
* gtk/gtkoptionmenu.c (gtk_opttion_menu_position): Change menu
positioning behaviour to fit to scrolling menus.
(gtk_option_menu_key_press, gtk_option_menu_button_press): Select
the current item so that it is prelighted when the menu pops up.
This is a workaround to the fact that the menu doesn't get the
initial enter event (due to grabs).
* gtk/gtkfilesel.c, gtk/gtkinputdialog.c, gtk/testgtk.c:
s/gtk_menu_append/gtk_menu_shell_append/
* gtk/gtknotebook.c:
s/gtk_menu_insert/gtk_menu_shell_insert/
* gtk/testgtk.c (create_menu, create_menus):
Create the first menu with 50 items so that menu scrolling
can be tested.
Patch from Jonathan Blandford <jrb@redhat.com>
* gtk/gtkmenuitem.[ch] (gtk_menu_item_toggle_size_request): new
system to handle size requests. First, we ask what the size of
the toggle is. Then, when allocating the size, we allocate the
toggle_size first. This way we can have multiple menu-item
classes w/o needing a seperate class for each.
* gtk/gtkmenu.c (gtk_menu_size_request): Actually use the new system.
* gtk/gtkmenu.c (gtk_menu_size_allocate): Use the new system.
* gtk/gtkcheckmenuitem.c
(gtk_check_menu_item_toggle_size_request): New function to handle
the toggle size-request.
2000-11-08 17:34:52 +00:00
|
|
|
|
geometry_hints.min_width = width;
|
|
|
|
|
geometry_hints.max_width = width;
|
2010-12-23 20:50:18 +00:00
|
|
|
|
|
Add note about GtkMenuPositionFunc API changes.
2000-11-08 Alexander Larsson <alexl@redhat.com>
* docs/Changes-2.0.txt: Add note about GtkMenuPositionFunc
API changes.
* gtk/gtkmenu.c: Add support for scrolling menus.
Remove gtk_menu_append/prepend/insert, these have been moved to
gtkcompat.h as #defines.
* gtk/gtkcompat.h.in:
Add compatibility #defines for gtk_menu_append/prepend/insert
* gtk/gtkmenu.h: Add data needed for scrolling menus.
GtkMenuPositionFunc gets an extra argument push_in.
gtk_menu_append/prepend/insert removed.
* gtk/gtkmenuitem.c (gtk_menu_item_position_menu): Change menu
positioning behaviour to fit to scrolling menus.
* gtk/gtkmenuitem.c (gtk_menu_item_forall): Don't recurse
into menuitem->submeny. That is wrong, and broke torn
off submenus of torn off menus, since they were unrealized
when the first menu was unrealized.
* gtk/gtkmenushell.[ch]: Virtualize gtk_menu_shell_insert() and
gtk_menu_shell_select_item() since these need to be overridden in
GtkMenu.
* gtk/gtkoptionmenu.c (gtk_opttion_menu_position): Change menu
positioning behaviour to fit to scrolling menus.
(gtk_option_menu_key_press, gtk_option_menu_button_press): Select
the current item so that it is prelighted when the menu pops up.
This is a workaround to the fact that the menu doesn't get the
initial enter event (due to grabs).
* gtk/gtkfilesel.c, gtk/gtkinputdialog.c, gtk/testgtk.c:
s/gtk_menu_append/gtk_menu_shell_append/
* gtk/gtknotebook.c:
s/gtk_menu_insert/gtk_menu_shell_insert/
* gtk/testgtk.c (create_menu, create_menus):
Create the first menu with 50 items so that menu scrolling
can be tested.
Patch from Jonathan Blandford <jrb@redhat.com>
* gtk/gtkmenuitem.[ch] (gtk_menu_item_toggle_size_request): new
system to handle size requests. First, we ask what the size of
the toggle is. Then, when allocating the size, we allocate the
toggle_size first. This way we can have multiple menu-item
classes w/o needing a seperate class for each.
* gtk/gtkmenu.c (gtk_menu_size_request): Actually use the new system.
* gtk/gtkmenu.c (gtk_menu_size_allocate): Use the new system.
* gtk/gtkcheckmenuitem.c
(gtk_check_menu_item_toggle_size_request): New function to handle
the toggle size-request.
2000-11-08 17:34:52 +00:00
|
|
|
|
geometry_hints.min_height = 0;
|
2010-08-18 23:42:02 +00:00
|
|
|
|
geometry_hints.max_height = priv->requested_height;
|
2002-08-02 22:03:23 +00:00
|
|
|
|
|
2010-12-23 20:50:18 +00:00
|
|
|
|
gtk_window_set_geometry_hints (GTK_WINDOW (priv->tearoff_window),
|
|
|
|
|
NULL,
|
|
|
|
|
&geometry_hints,
|
|
|
|
|
GDK_HINT_MAX_SIZE|GDK_HINT_MIN_SIZE);
|
Add note about GtkMenuPositionFunc API changes.
2000-11-08 Alexander Larsson <alexl@redhat.com>
* docs/Changes-2.0.txt: Add note about GtkMenuPositionFunc
API changes.
* gtk/gtkmenu.c: Add support for scrolling menus.
Remove gtk_menu_append/prepend/insert, these have been moved to
gtkcompat.h as #defines.
* gtk/gtkcompat.h.in:
Add compatibility #defines for gtk_menu_append/prepend/insert
* gtk/gtkmenu.h: Add data needed for scrolling menus.
GtkMenuPositionFunc gets an extra argument push_in.
gtk_menu_append/prepend/insert removed.
* gtk/gtkmenuitem.c (gtk_menu_item_position_menu): Change menu
positioning behaviour to fit to scrolling menus.
* gtk/gtkmenuitem.c (gtk_menu_item_forall): Don't recurse
into menuitem->submeny. That is wrong, and broke torn
off submenus of torn off menus, since they were unrealized
when the first menu was unrealized.
* gtk/gtkmenushell.[ch]: Virtualize gtk_menu_shell_insert() and
gtk_menu_shell_select_item() since these need to be overridden in
GtkMenu.
* gtk/gtkoptionmenu.c (gtk_opttion_menu_position): Change menu
positioning behaviour to fit to scrolling menus.
(gtk_option_menu_key_press, gtk_option_menu_button_press): Select
the current item so that it is prelighted when the menu pops up.
This is a workaround to the fact that the menu doesn't get the
initial enter event (due to grabs).
* gtk/gtkfilesel.c, gtk/gtkinputdialog.c, gtk/testgtk.c:
s/gtk_menu_append/gtk_menu_shell_append/
* gtk/gtknotebook.c:
s/gtk_menu_insert/gtk_menu_shell_insert/
* gtk/testgtk.c (create_menu, create_menus):
Create the first menu with 50 items so that menu scrolling
can be tested.
Patch from Jonathan Blandford <jrb@redhat.com>
* gtk/gtkmenuitem.[ch] (gtk_menu_item_toggle_size_request): new
system to handle size requests. First, we ask what the size of
the toggle is. Then, when allocating the size, we allocate the
toggle_size first. This way we can have multiple menu-item
classes w/o needing a seperate class for each.
* gtk/gtkmenu.c (gtk_menu_size_request): Actually use the new system.
* gtk/gtkmenu.c (gtk_menu_size_allocate): Use the new system.
* gtk/gtkcheckmenuitem.c
(gtk_check_menu_item_toggle_size_request): New function to handle
the toggle size-request.
2000-11-08 17:34:52 +00:00
|
|
|
|
}
|
|
|
|
|
|
2001-12-27 20:22:16 +00:00
|
|
|
|
static void
|
|
|
|
|
gtk_menu_update_title (GtkMenu *menu)
|
|
|
|
|
{
|
2010-12-23 20:50:18 +00:00
|
|
|
|
GtkMenuPrivate *priv = menu->priv;
|
|
|
|
|
|
|
|
|
|
if (priv->tearoff_window)
|
2001-12-27 20:22:16 +00:00
|
|
|
|
{
|
|
|
|
|
const gchar *title;
|
|
|
|
|
GtkWidget *attach_widget;
|
|
|
|
|
|
2013-08-20 04:14:00 +00:00
|
|
|
|
G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
|
2001-12-27 20:22:16 +00:00
|
|
|
|
title = gtk_menu_get_title (menu);
|
2013-08-20 04:14:00 +00:00
|
|
|
|
G_GNUC_END_IGNORE_DEPRECATIONS;
|
2001-12-27 20:22:16 +00:00
|
|
|
|
if (!title)
|
2010-12-23 20:50:18 +00:00
|
|
|
|
{
|
|
|
|
|
attach_widget = gtk_menu_get_attach_widget (menu);
|
|
|
|
|
if (GTK_IS_MENU_ITEM (attach_widget))
|
|
|
|
|
{
|
|
|
|
|
GtkWidget *child = gtk_bin_get_child (GTK_BIN (attach_widget));
|
|
|
|
|
if (GTK_IS_LABEL (child))
|
|
|
|
|
title = gtk_label_get_text (GTK_LABEL (child));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2001-12-27 20:22:16 +00:00
|
|
|
|
if (title)
|
2010-12-23 20:50:18 +00:00
|
|
|
|
gtk_window_set_title (GTK_WINDOW (priv->tearoff_window), title);
|
2001-12-27 20:22:16 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
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
|
|
|
|
|
2003-11-05 21:50:51 +00:00
|
|
|
|
static GtkWidget*
|
|
|
|
|
gtk_menu_get_toplevel (GtkWidget *menu)
|
|
|
|
|
{
|
|
|
|
|
GtkWidget *attach, *toplevel;
|
|
|
|
|
|
|
|
|
|
attach = gtk_menu_get_attach_widget (GTK_MENU (menu));
|
|
|
|
|
|
|
|
|
|
if (GTK_IS_MENU_ITEM (attach))
|
2010-08-11 21:08:37 +00:00
|
|
|
|
attach = gtk_widget_get_parent (attach);
|
2003-11-05 21:50:51 +00:00
|
|
|
|
|
|
|
|
|
if (GTK_IS_MENU (attach))
|
2004-03-11 21:38:21 +00:00
|
|
|
|
return gtk_menu_get_toplevel (attach);
|
2003-11-05 21:50:51 +00:00
|
|
|
|
else if (GTK_IS_WIDGET (attach))
|
|
|
|
|
{
|
2004-03-11 21:38:21 +00:00
|
|
|
|
toplevel = gtk_widget_get_toplevel (attach);
|
2010-12-23 20:50:18 +00:00
|
|
|
|
if (gtk_widget_is_toplevel (toplevel))
|
|
|
|
|
return toplevel;
|
2003-11-05 21:50:51 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
|
2004-05-10 04:49:11 +00:00
|
|
|
|
static void
|
2004-05-10 04:51:13 +00:00
|
|
|
|
tearoff_window_destroyed (GtkWidget *widget,
|
2010-12-23 20:50:18 +00:00
|
|
|
|
GtkMenu *menu)
|
2004-05-10 04:49:11 +00:00
|
|
|
|
{
|
2013-08-20 04:14:00 +00:00
|
|
|
|
G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
|
2004-05-10 04:49:11 +00:00
|
|
|
|
gtk_menu_set_tearoff_state (menu, FALSE);
|
2013-08-20 04:14:00 +00:00
|
|
|
|
G_GNUC_END_IGNORE_DEPRECATIONS;
|
2004-05-10 04:49:11 +00:00
|
|
|
|
}
|
|
|
|
|
|
2011-01-15 13:51:11 +00:00
|
|
|
|
/**
|
|
|
|
|
* gtk_menu_set_tearoff_state:
|
|
|
|
|
* @menu: a #GtkMenu
|
|
|
|
|
* @torn_off: If %TRUE, menu is displayed as a tearoff menu.
|
|
|
|
|
*
|
|
|
|
|
* Changes the tearoff state of the menu. A menu is normally
|
|
|
|
|
* displayed as drop down menu which persists as long as the menu is
|
|
|
|
|
* active. It can also be displayed as a tearoff menu which persists
|
|
|
|
|
* until it is closed or reattached.
|
2013-07-18 02:52:53 +00:00
|
|
|
|
*
|
|
|
|
|
* Deprecated: 3.10
|
2011-01-15 13:51:11 +00:00
|
|
|
|
*/
|
2010-12-23 20:50:18 +00:00
|
|
|
|
void
|
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_menu_set_tearoff_state (GtkMenu *menu,
|
2010-12-23 20:50:18 +00:00
|
|
|
|
gboolean torn_off)
|
1997-11-24 22:37:52 +00:00
|
|
|
|
{
|
2018-04-17 18:51:53 +00:00
|
|
|
|
GtkMenuPrivate *priv;
|
2010-09-20 14:39:25 +00:00
|
|
|
|
gint height;
|
1997-11-24 22:37:52 +00:00
|
|
|
|
|
2010-12-23 20:50:18 +00:00
|
|
|
|
g_return_if_fail (GTK_IS_MENU (menu));
|
2010-08-18 23:42:02 +00:00
|
|
|
|
|
2018-04-17 18:51:53 +00:00
|
|
|
|
priv = menu->priv;
|
|
|
|
|
|
2018-04-17 18:56:54 +00:00
|
|
|
|
torn_off = !!torn_off;
|
2010-12-23 20:50:18 +00:00
|
|
|
|
if (priv->torn_off != torn_off)
|
1997-11-24 22:37:52 +00:00
|
|
|
|
{
|
2010-12-23 20:50:18 +00:00
|
|
|
|
priv->torn_off = torn_off;
|
|
|
|
|
priv->tearoff_active = torn_off;
|
|
|
|
|
|
|
|
|
|
if (priv->torn_off)
|
|
|
|
|
{
|
|
|
|
|
if (gtk_widget_get_visible (GTK_WIDGET (menu)))
|
|
|
|
|
gtk_menu_popdown (menu);
|
1997-11-24 22:37:52 +00:00
|
|
|
|
|
2010-12-23 20:50:18 +00:00
|
|
|
|
if (!priv->tearoff_window)
|
|
|
|
|
{
|
|
|
|
|
GtkWidget *toplevel;
|
2003-11-05 21:50:51 +00:00
|
|
|
|
|
2010-12-23 20:50:18 +00:00
|
|
|
|
priv->tearoff_window = g_object_new (GTK_TYPE_WINDOW,
|
|
|
|
|
"type", GTK_WINDOW_TOPLEVEL,
|
|
|
|
|
"screen", gtk_widget_get_screen (priv->toplevel),
|
|
|
|
|
"app-paintable", TRUE,
|
|
|
|
|
NULL);
|
Integrate Erwann Chenede's multihead changes for the gtk/ directory.
Mon Apr 29 18:28:00 2002 Owen Taylor <otaylor@redhat.com>
Integrate Erwann Chenede's multihead changes for the gtk/ directory.
* gtk/gtkclipboard.[ch]: Add gtk_clipboard_get_for_display(),
make internals multihead aware.
* gtk/gtkcolorsel.[ch]: Add
gtk_color_selection_set_change_palette_with_screen_hook () [ugh!]
make up for non-multihead safety of
gtk_color_selection_set_change_palette_hook()
* gtk/gtkinvisible.[ch] gtk/gtkmenu.[ch] gtkwindow.[ch]: Add
gtk_{invisible,menu,window}_set_screen(); add "screen" properties
for GtkWindow and GtkMenu.
* gtk/gtkplug.[ch]: Add gtk_plug_construct_for_display(),
gtk_plug_new_for_display(). Multihead fixes.
* gtk/gtkselection.[ch]: Add gtk_selection_owner_set_for_display(),
make internals multihead aware.
* gtk/gtksettings.[ch]: Add gtk_settings_get_for_screen(), get
rid of now-useless gtk_settings_constructor().
* gtk/gtkstyle.[ch]: Add gtk_style_get_font_for_display(), fix
check/radio button indicators bitmap handling to be multihead
safe.
* gtk/gtkwidget.[ch]: Add gtk_widget_get_screen(), gtk_widget_has_screen(),
gtk_widget_get_display(), gtk_widget_get_clipboard(),
gtk_widget_get_root_window().
* gtk/gtkbindings.c gtk/gtkbutton.c gtk/gtkclist.c gtk/gtkcombo.c
gtk/gtkctree.c gtk/gtkdnd.c gtk/gtkfilesel.c gtk/gtkgamma.c
gtk/gtkhandlebox.c gtk/gtkhsv.c gtk/gtkimcontext.c gtk/gtklabel.c
gtk/gtklist.c gtk/gtkmain.c gtk/gtkmenuitem.c gtk/gtkmenushell.c
gtk/gtknotebook.c gtk/gtkoldeditable.c gtk/gtkoptionmenu.c
gtk/gtkpaned.c gtk/gtkpreview.c gtk/gtksocket.c gtk/gtktext.c
gtk/gtktextbuffer.c gtk/gtktextview.c gtk/gtktipsquery.c
gtk/gtktooltips.c gtk/gtktreeview.c gtk/gtktreeviewcolumn.c:
misc mechanical multihead-safety fixes.
* gtk/gtkclipboard.c: Use a GtkImage rather than a pixmap for
the dropper, look up the color palette only at realization time,
other multihead fixes.
* gtk/gtkcombo.c (gtk_combo_unrealize): Popdown the list when
unrealizing.
* gtk/gtkentry.c: Only claim ownership of the primary selection
when realized, misc multihead fixes.
* gtk/gtkfontsel.c: Only fill in fonts when attached to a screen,
fix gtk_font_selection_get_font() for multihead.
* gtk/gtkgc.c: make the depth => drawable hash per-screen.
* gtk/gtkinvisible.c: Add a constructor that realizes the
widget, so we get a realized widget with g_object_new() as
well gtk_invisible_new() as before.
* gtk/gtkmain.c: Get rid of unused gtk_visual/gtk_colormap
variables.
* gtk/gtktextdisplay.c: Add warnings if stipple bitmaps
are used on the wrong screen.
* gtk/gtktoolbar.c: Make handling of GtkSettings-based layout
read properties and connect to settings when the screen is changed,
rather than on init/finalize.
* gtk/gtkwindow.c: Fix icon handing to be multihead safe ...
default icon pixmaps/mask are only shared between windows on the
same screen. Misc multihead fixes.
Sat Apr 27 13:49:53 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtkclipboard.c (gtk_clipboard_get_for_display):
Update docs to reference GDK_SELECTION_CLIPBOARD rather GDK_NONE.
2002-04-29 Alex Larsson <alexl@redhat.com>
* gdk/linux-fb/gdkproperty-fb.c (gdk_property_get):
Fix silly bug, noticed by Sven Neumann.
Sun Apr 28 22:43:55 2002 Jonathan Blandford <jrb@gnome.org>
* gtk/gtktreemodelsort.c (gtk_tree_model_sort_set_sort_func): Fix
so that you can set a new sort func.
2002-04-29 22:53:45 +00:00
|
|
|
|
|
2010-12-23 20:50:18 +00:00
|
|
|
|
gtk_window_set_type_hint (GTK_WINDOW (priv->tearoff_window),
|
|
|
|
|
GDK_WINDOW_TYPE_HINT_MENU);
|
|
|
|
|
gtk_window_set_mnemonic_modifier (GTK_WINDOW (priv->tearoff_window), 0);
|
|
|
|
|
g_signal_connect (priv->tearoff_window, "destroy",
|
|
|
|
|
G_CALLBACK (tearoff_window_destroyed), menu);
|
|
|
|
|
g_signal_connect (priv->tearoff_window, "event",
|
|
|
|
|
G_CALLBACK (gtk_menu_window_event), menu);
|
2001-12-27 20:22:16 +00:00
|
|
|
|
|
2010-12-23 20:50:18 +00:00
|
|
|
|
gtk_menu_update_title (menu);
|
2001-12-27 20:22:16 +00:00
|
|
|
|
|
2010-12-23 20:50:18 +00:00
|
|
|
|
gtk_widget_realize (priv->tearoff_window);
|
2003-11-05 21:50:51 +00:00
|
|
|
|
|
2010-12-23 20:50:18 +00:00
|
|
|
|
toplevel = gtk_menu_get_toplevel (GTK_WIDGET (menu));
|
|
|
|
|
if (toplevel != NULL)
|
|
|
|
|
gtk_window_set_transient_for (GTK_WINDOW (priv->tearoff_window),
|
|
|
|
|
GTK_WINDOW (toplevel));
|
2010-10-30 03:00:32 +00:00
|
|
|
|
|
2010-12-23 20:50:18 +00:00
|
|
|
|
priv->tearoff_hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
|
|
|
|
|
gtk_container_add (GTK_CONTAINER (priv->tearoff_window),
|
|
|
|
|
priv->tearoff_hbox);
|
Add note about GtkMenuPositionFunc API changes.
2000-11-08 Alexander Larsson <alexl@redhat.com>
* docs/Changes-2.0.txt: Add note about GtkMenuPositionFunc
API changes.
* gtk/gtkmenu.c: Add support for scrolling menus.
Remove gtk_menu_append/prepend/insert, these have been moved to
gtkcompat.h as #defines.
* gtk/gtkcompat.h.in:
Add compatibility #defines for gtk_menu_append/prepend/insert
* gtk/gtkmenu.h: Add data needed for scrolling menus.
GtkMenuPositionFunc gets an extra argument push_in.
gtk_menu_append/prepend/insert removed.
* gtk/gtkmenuitem.c (gtk_menu_item_position_menu): Change menu
positioning behaviour to fit to scrolling menus.
* gtk/gtkmenuitem.c (gtk_menu_item_forall): Don't recurse
into menuitem->submeny. That is wrong, and broke torn
off submenus of torn off menus, since they were unrealized
when the first menu was unrealized.
* gtk/gtkmenushell.[ch]: Virtualize gtk_menu_shell_insert() and
gtk_menu_shell_select_item() since these need to be overridden in
GtkMenu.
* gtk/gtkoptionmenu.c (gtk_opttion_menu_position): Change menu
positioning behaviour to fit to scrolling menus.
(gtk_option_menu_key_press, gtk_option_menu_button_press): Select
the current item so that it is prelighted when the menu pops up.
This is a workaround to the fact that the menu doesn't get the
initial enter event (due to grabs).
* gtk/gtkfilesel.c, gtk/gtkinputdialog.c, gtk/testgtk.c:
s/gtk_menu_append/gtk_menu_shell_append/
* gtk/gtknotebook.c:
s/gtk_menu_insert/gtk_menu_shell_insert/
* gtk/testgtk.c (create_menu, create_menus):
Create the first menu with 50 items so that menu scrolling
can be tested.
Patch from Jonathan Blandford <jrb@redhat.com>
* gtk/gtkmenuitem.[ch] (gtk_menu_item_toggle_size_request): new
system to handle size requests. First, we ask what the size of
the toggle is. Then, when allocating the size, we allocate the
toggle_size first. This way we can have multiple menu-item
classes w/o needing a seperate class for each.
* gtk/gtkmenu.c (gtk_menu_size_request): Actually use the new system.
* gtk/gtkmenu.c (gtk_menu_size_allocate): Use the new system.
* gtk/gtkcheckmenuitem.c
(gtk_check_menu_item_toggle_size_request): New function to handle
the toggle size-request.
2000-11-08 17:34:52 +00:00
|
|
|
|
|
2010-09-20 14:39:25 +00:00
|
|
|
|
height = gdk_window_get_height (gtk_widget_get_window (GTK_WIDGET (menu)));
|
2010-12-23 20:50:18 +00:00
|
|
|
|
priv->tearoff_adjustment = gtk_adjustment_new (0,
|
2010-09-27 13:10:12 +00:00
|
|
|
|
0, priv->requested_height,
|
|
|
|
|
MENU_SCROLL_STEP2,
|
|
|
|
|
height/2,
|
|
|
|
|
height);
|
2010-12-23 20:50:18 +00:00
|
|
|
|
g_object_connect (priv->tearoff_adjustment,
|
|
|
|
|
"signal::value-changed", gtk_menu_scrollbar_changed, menu,
|
|
|
|
|
NULL);
|
|
|
|
|
priv->tearoff_scrollbar = gtk_scrollbar_new (GTK_ORIENTATION_VERTICAL, priv->tearoff_adjustment);
|
|
|
|
|
|
|
|
|
|
gtk_box_pack_end (GTK_BOX (priv->tearoff_hbox),
|
|
|
|
|
priv->tearoff_scrollbar,
|
|
|
|
|
FALSE, FALSE, 0);
|
|
|
|
|
|
2011-01-05 18:26:14 +00:00
|
|
|
|
if (gtk_adjustment_get_upper (priv->tearoff_adjustment) > height)
|
2010-12-23 20:50:18 +00:00
|
|
|
|
gtk_widget_show (priv->tearoff_scrollbar);
|
|
|
|
|
|
|
|
|
|
gtk_widget_show (priv->tearoff_hbox);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
gtk_menu_reparent (menu, priv->tearoff_hbox, FALSE);
|
|
|
|
|
|
|
|
|
|
/* Update menu->requisition */
|
|
|
|
|
gtk_widget_get_preferred_size (GTK_WIDGET (menu), NULL, NULL);
|
|
|
|
|
|
|
|
|
|
gtk_menu_set_tearoff_hints (menu, gdk_window_get_width (gtk_widget_get_window (GTK_WIDGET (menu))));
|
|
|
|
|
|
|
|
|
|
gtk_widget_realize (priv->tearoff_window);
|
|
|
|
|
gtk_menu_position (menu, TRUE);
|
|
|
|
|
|
|
|
|
|
gtk_widget_show (GTK_WIDGET (menu));
|
|
|
|
|
gtk_widget_show (priv->tearoff_window);
|
|
|
|
|
|
2019-01-17 18:27:51 +00:00
|
|
|
|
gtk_menu_scroll_to (menu, 0, GTK_MENU_SCROLL_FLAG_NONE);
|
2010-12-23 20:50:18 +00:00
|
|
|
|
|
|
|
|
|
}
|
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
|
|
|
|
else
|
2010-12-23 20:50:18 +00:00
|
|
|
|
{
|
|
|
|
|
gtk_widget_hide (GTK_WIDGET (menu));
|
|
|
|
|
gtk_widget_hide (priv->tearoff_window);
|
|
|
|
|
if (GTK_IS_CONTAINER (priv->toplevel))
|
|
|
|
|
gtk_menu_reparent (menu, priv->toplevel, FALSE);
|
|
|
|
|
gtk_widget_destroy (priv->tearoff_window);
|
|
|
|
|
|
|
|
|
|
priv->tearoff_window = NULL;
|
|
|
|
|
priv->tearoff_hbox = NULL;
|
|
|
|
|
priv->tearoff_scrollbar = NULL;
|
|
|
|
|
priv->tearoff_adjustment = NULL;
|
|
|
|
|
}
|
2004-05-07 04:43:56 +00:00
|
|
|
|
|
2005-03-26 05:49:15 +00:00
|
|
|
|
g_object_notify (G_OBJECT (menu), "tearoff-state");
|
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
|
|
|
|
}
|
1997-11-24 22:37:52 +00:00
|
|
|
|
}
|
|
|
|
|
|
2001-06-24 15:34:48 +00:00
|
|
|
|
/**
|
|
|
|
|
* gtk_menu_get_tearoff_state:
|
|
|
|
|
* @menu: a #GtkMenu
|
|
|
|
|
*
|
2010-12-23 20:50:18 +00:00
|
|
|
|
* Returns whether the menu is torn off.
|
|
|
|
|
* See gtk_menu_set_tearoff_state().
|
2001-06-24 15:34:48 +00:00
|
|
|
|
*
|
2014-02-19 23:49:43 +00:00
|
|
|
|
* Returns: %TRUE if the menu is currently torn off.
|
2013-07-18 02:52:53 +00:00
|
|
|
|
*
|
|
|
|
|
* Deprecated: 3.10
|
2010-12-23 20:50:18 +00:00
|
|
|
|
*/
|
2001-06-24 15:34:48 +00:00
|
|
|
|
gboolean
|
|
|
|
|
gtk_menu_get_tearoff_state (GtkMenu *menu)
|
|
|
|
|
{
|
|
|
|
|
g_return_val_if_fail (GTK_IS_MENU (menu), FALSE);
|
|
|
|
|
|
2010-12-23 20:50:18 +00:00
|
|
|
|
return menu->priv->torn_off;
|
2001-06-24 15:34:48 +00:00
|
|
|
|
}
|
|
|
|
|
|
2001-12-27 20:22:16 +00:00
|
|
|
|
/**
|
|
|
|
|
* gtk_menu_set_title:
|
|
|
|
|
* @menu: a #GtkMenu
|
2018-04-17 18:53:33 +00:00
|
|
|
|
* @title: (nullable): a string containing the title for the menu, or %NULL to
|
|
|
|
|
* inherit the title of the parent menu item, if any
|
2010-12-23 20:50:18 +00:00
|
|
|
|
*
|
|
|
|
|
* Sets the title string for the menu.
|
|
|
|
|
*
|
|
|
|
|
* The title is displayed when the menu is shown as a tearoff
|
|
|
|
|
* menu. If @title is %NULL, the menu will see if it is attached
|
|
|
|
|
* to a parent menu item, and if so it will try to use the same
|
2014-02-07 18:01:26 +00:00
|
|
|
|
* text as that menu item’s label.
|
2013-07-18 02:52:53 +00:00
|
|
|
|
*
|
|
|
|
|
* Deprecated: 3.10
|
2010-12-23 20:50:18 +00:00
|
|
|
|
*/
|
2006-12-15 20:13:01 +00:00
|
|
|
|
void
|
1999-01-18 18:48:09 +00:00
|
|
|
|
gtk_menu_set_title (GtkMenu *menu,
|
2010-12-23 20:50:18 +00:00
|
|
|
|
const gchar *title)
|
1999-01-18 18:48:09 +00:00
|
|
|
|
{
|
2018-04-17 18:51:53 +00:00
|
|
|
|
GtkMenuPrivate *priv;
|
2006-12-15 20:13:01 +00:00
|
|
|
|
char *old_title;
|
2005-11-21 16:15:11 +00:00
|
|
|
|
|
1999-01-18 18:48:09 +00:00
|
|
|
|
g_return_if_fail (GTK_IS_MENU (menu));
|
|
|
|
|
|
2018-04-17 18:51:53 +00:00
|
|
|
|
priv = menu->priv;
|
|
|
|
|
|
2006-12-15 20:13:01 +00:00
|
|
|
|
old_title = priv->title;
|
|
|
|
|
priv->title = g_strdup (title);
|
|
|
|
|
g_free (old_title);
|
2010-12-23 20:50:18 +00:00
|
|
|
|
|
2006-12-15 20:13:01 +00:00
|
|
|
|
gtk_menu_update_title (menu);
|
|
|
|
|
g_object_notify (G_OBJECT (menu), "tearoff-title");
|
1999-01-18 18:48:09 +00:00
|
|
|
|
}
|
|
|
|
|
|
2001-06-24 15:34:48 +00:00
|
|
|
|
/**
|
|
|
|
|
* gtk_menu_get_title:
|
|
|
|
|
* @menu: a #GtkMenu
|
|
|
|
|
*
|
|
|
|
|
* Returns the title of the menu. See gtk_menu_set_title().
|
|
|
|
|
*
|
2014-02-19 23:49:43 +00:00
|
|
|
|
* Returns: the title of the menu, or %NULL if the menu
|
2010-12-23 20:50:18 +00:00
|
|
|
|
* has no title set on it. This string is owned by GTK+
|
|
|
|
|
* and should not be modified or freed.
|
2013-07-18 02:52:53 +00:00
|
|
|
|
*
|
|
|
|
|
* Deprecated: 3.10
|
2001-06-24 15:34:48 +00:00
|
|
|
|
**/
|
2011-06-06 18:13:44 +00:00
|
|
|
|
const gchar *
|
2001-06-24 15:34:48 +00:00
|
|
|
|
gtk_menu_get_title (GtkMenu *menu)
|
|
|
|
|
{
|
|
|
|
|
g_return_val_if_fail (GTK_IS_MENU (menu), NULL);
|
|
|
|
|
|
2010-12-23 20:50:18 +00:00
|
|
|
|
return menu->priv->title;
|
2001-06-24 15:34:48 +00:00
|
|
|
|
}
|
|
|
|
|
|
2011-01-15 13:51:11 +00:00
|
|
|
|
/**
|
|
|
|
|
* gtk_menu_reorder_child:
|
|
|
|
|
* @menu: a #GtkMenu
|
|
|
|
|
* @child: the #GtkMenuItem to move
|
2011-02-09 04:14:46 +00:00
|
|
|
|
* @position: the new position to place @child.
|
|
|
|
|
* Positions are numbered from 0 to n - 1
|
|
|
|
|
*
|
|
|
|
|
* Moves @child to a new @position in the list of @menu
|
|
|
|
|
* children.
|
2011-01-15 13:51:11 +00:00
|
|
|
|
*/
|
1999-02-25 08:17:13 +00:00
|
|
|
|
void
|
|
|
|
|
gtk_menu_reorder_child (GtkMenu *menu,
|
|
|
|
|
GtkWidget *child,
|
|
|
|
|
gint position)
|
|
|
|
|
{
|
|
|
|
|
GtkMenuShell *menu_shell;
|
2003-12-19 20:56:19 +00:00
|
|
|
|
|
1999-02-25 08:17:13 +00:00
|
|
|
|
g_return_if_fail (GTK_IS_MENU (menu));
|
|
|
|
|
g_return_if_fail (GTK_IS_MENU_ITEM (child));
|
2003-12-19 20:56:19 +00:00
|
|
|
|
|
1999-02-25 08:17:13 +00:00
|
|
|
|
menu_shell = GTK_MENU_SHELL (menu);
|
2003-12-19 20:56:19 +00:00
|
|
|
|
|
2010-12-23 23:21:53 +00:00
|
|
|
|
if (g_list_find (menu_shell->priv->children, child))
|
2010-12-23 20:50:18 +00:00
|
|
|
|
{
|
2010-12-23 23:21:53 +00:00
|
|
|
|
menu_shell->priv->children = g_list_remove (menu_shell->priv->children, child);
|
|
|
|
|
menu_shell->priv->children = g_list_insert (menu_shell->priv->children, child, position);
|
2003-12-19 20:56:19 +00:00
|
|
|
|
|
2004-03-15 02:03:59 +00:00
|
|
|
|
menu_queue_resize (menu);
|
2010-12-23 20:50:18 +00:00
|
|
|
|
}
|
1999-02-25 08:17:13 +00:00
|
|
|
|
}
|
|
|
|
|
|
2010-11-30 23:55:14 +00:00
|
|
|
|
static void
|
2011-05-17 18:10:19 +00:00
|
|
|
|
get_menu_padding (GtkWidget *widget,
|
|
|
|
|
GtkBorder *padding)
|
2010-11-21 18:40:28 +00:00
|
|
|
|
{
|
|
|
|
|
GtkStyleContext *context;
|
|
|
|
|
|
|
|
|
|
context = gtk_widget_get_style_context (widget);
|
|
|
|
|
|
2015-11-22 10:43:39 +00:00
|
|
|
|
gtk_style_context_get_padding (context,
|
|
|
|
|
gtk_style_context_get_state (context),
|
|
|
|
|
padding);
|
2010-11-21 18:40:28 +00:00
|
|
|
|
}
|
|
|
|
|
|
2014-03-05 11:59:24 +00:00
|
|
|
|
static void
|
|
|
|
|
get_menu_margin (GtkWidget *widget,
|
|
|
|
|
GtkBorder *margin)
|
|
|
|
|
{
|
|
|
|
|
GtkStyleContext *context;
|
|
|
|
|
|
|
|
|
|
context = gtk_widget_get_style_context (widget);
|
|
|
|
|
|
2015-11-22 10:43:39 +00:00
|
|
|
|
gtk_style_context_get_margin (context,
|
|
|
|
|
gtk_style_context_get_state (context),
|
|
|
|
|
margin);
|
2014-03-05 11:59:24 +00:00
|
|
|
|
}
|
|
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
|
static void
|
|
|
|
|
gtk_menu_realize (GtkWidget *widget)
|
|
|
|
|
{
|
2010-12-23 20:50:18 +00:00
|
|
|
|
GtkMenu *menu = GTK_MENU (widget);
|
|
|
|
|
GtkMenuPrivate *priv = menu->priv;
|
2010-08-11 21:08:37 +00:00
|
|
|
|
GtkAllocation allocation;
|
|
|
|
|
GdkWindow *window;
|
1997-11-24 22:37:52 +00:00
|
|
|
|
GdkWindowAttr attributes;
|
|
|
|
|
gint attributes_mask;
|
2010-11-30 23:55:14 +00:00
|
|
|
|
gint border_width;
|
Add note about GtkMenuPositionFunc API changes.
2000-11-08 Alexander Larsson <alexl@redhat.com>
* docs/Changes-2.0.txt: Add note about GtkMenuPositionFunc
API changes.
* gtk/gtkmenu.c: Add support for scrolling menus.
Remove gtk_menu_append/prepend/insert, these have been moved to
gtkcompat.h as #defines.
* gtk/gtkcompat.h.in:
Add compatibility #defines for gtk_menu_append/prepend/insert
* gtk/gtkmenu.h: Add data needed for scrolling menus.
GtkMenuPositionFunc gets an extra argument push_in.
gtk_menu_append/prepend/insert removed.
* gtk/gtkmenuitem.c (gtk_menu_item_position_menu): Change menu
positioning behaviour to fit to scrolling menus.
* gtk/gtkmenuitem.c (gtk_menu_item_forall): Don't recurse
into menuitem->submeny. That is wrong, and broke torn
off submenus of torn off menus, since they were unrealized
when the first menu was unrealized.
* gtk/gtkmenushell.[ch]: Virtualize gtk_menu_shell_insert() and
gtk_menu_shell_select_item() since these need to be overridden in
GtkMenu.
* gtk/gtkoptionmenu.c (gtk_opttion_menu_position): Change menu
positioning behaviour to fit to scrolling menus.
(gtk_option_menu_key_press, gtk_option_menu_button_press): Select
the current item so that it is prelighted when the menu pops up.
This is a workaround to the fact that the menu doesn't get the
initial enter event (due to grabs).
* gtk/gtkfilesel.c, gtk/gtkinputdialog.c, gtk/testgtk.c:
s/gtk_menu_append/gtk_menu_shell_append/
* gtk/gtknotebook.c:
s/gtk_menu_insert/gtk_menu_shell_insert/
* gtk/testgtk.c (create_menu, create_menus):
Create the first menu with 50 items so that menu scrolling
can be tested.
Patch from Jonathan Blandford <jrb@redhat.com>
* gtk/gtkmenuitem.[ch] (gtk_menu_item_toggle_size_request): new
system to handle size requests. First, we ask what the size of
the toggle is. Then, when allocating the size, we allocate the
toggle_size first. This way we can have multiple menu-item
classes w/o needing a seperate class for each.
* gtk/gtkmenu.c (gtk_menu_size_request): Actually use the new system.
* gtk/gtkmenu.c (gtk_menu_size_allocate): Use the new system.
* gtk/gtkcheckmenuitem.c
(gtk_check_menu_item_toggle_size_request): New function to handle
the toggle size-request.
2000-11-08 17:34:52 +00:00
|
|
|
|
GtkWidget *child;
|
|
|
|
|
GList *children;
|
2011-05-17 18:10:19 +00:00
|
|
|
|
GtkBorder arrow_border, padding;
|
2005-12-02 19:49:10 +00:00
|
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
|
g_return_if_fail (GTK_IS_MENU (widget));
|
Add note about GtkMenuPositionFunc API changes.
2000-11-08 Alexander Larsson <alexl@redhat.com>
* docs/Changes-2.0.txt: Add note about GtkMenuPositionFunc
API changes.
* gtk/gtkmenu.c: Add support for scrolling menus.
Remove gtk_menu_append/prepend/insert, these have been moved to
gtkcompat.h as #defines.
* gtk/gtkcompat.h.in:
Add compatibility #defines for gtk_menu_append/prepend/insert
* gtk/gtkmenu.h: Add data needed for scrolling menus.
GtkMenuPositionFunc gets an extra argument push_in.
gtk_menu_append/prepend/insert removed.
* gtk/gtkmenuitem.c (gtk_menu_item_position_menu): Change menu
positioning behaviour to fit to scrolling menus.
* gtk/gtkmenuitem.c (gtk_menu_item_forall): Don't recurse
into menuitem->submeny. That is wrong, and broke torn
off submenus of torn off menus, since they were unrealized
when the first menu was unrealized.
* gtk/gtkmenushell.[ch]: Virtualize gtk_menu_shell_insert() and
gtk_menu_shell_select_item() since these need to be overridden in
GtkMenu.
* gtk/gtkoptionmenu.c (gtk_opttion_menu_position): Change menu
positioning behaviour to fit to scrolling menus.
(gtk_option_menu_key_press, gtk_option_menu_button_press): Select
the current item so that it is prelighted when the menu pops up.
This is a workaround to the fact that the menu doesn't get the
initial enter event (due to grabs).
* gtk/gtkfilesel.c, gtk/gtkinputdialog.c, gtk/testgtk.c:
s/gtk_menu_append/gtk_menu_shell_append/
* gtk/gtknotebook.c:
s/gtk_menu_insert/gtk_menu_shell_insert/
* gtk/testgtk.c (create_menu, create_menus):
Create the first menu with 50 items so that menu scrolling
can be tested.
Patch from Jonathan Blandford <jrb@redhat.com>
* gtk/gtkmenuitem.[ch] (gtk_menu_item_toggle_size_request): new
system to handle size requests. First, we ask what the size of
the toggle is. Then, when allocating the size, we allocate the
toggle_size first. This way we can have multiple menu-item
classes w/o needing a seperate class for each.
* gtk/gtkmenu.c (gtk_menu_size_request): Actually use the new system.
* gtk/gtkmenu.c (gtk_menu_size_allocate): Use the new system.
* gtk/gtkcheckmenuitem.c
(gtk_check_menu_item_toggle_size_request): New function to handle
the toggle size-request.
2000-11-08 17:34:52 +00:00
|
|
|
|
|
2010-03-06 10:51:33 +00:00
|
|
|
|
gtk_widget_set_realized (widget, TRUE);
|
2010-08-11 21:08:37 +00:00
|
|
|
|
|
|
|
|
|
gtk_widget_get_allocation (widget, &allocation);
|
|
|
|
|
|
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
|
|
|
|
attributes.window_type = GDK_WINDOW_CHILD;
|
2010-08-11 21:08:37 +00:00
|
|
|
|
attributes.x = allocation.x;
|
|
|
|
|
attributes.y = allocation.y;
|
|
|
|
|
attributes.width = allocation.width;
|
|
|
|
|
attributes.height = allocation.height;
|
1997-11-24 22:37:52 +00:00
|
|
|
|
attributes.wclass = GDK_INPUT_OUTPUT;
|
|
|
|
|
attributes.visual = gtk_widget_get_visual (widget);
|
|
|
|
|
attributes.event_mask = gtk_widget_get_events (widget);
|
2015-09-14 08:56:13 +00:00
|
|
|
|
attributes.event_mask |= (GDK_KEY_PRESS_MASK |
|
2010-12-23 20:50:18 +00:00
|
|
|
|
GDK_ENTER_NOTIFY_MASK | GDK_LEAVE_NOTIFY_MASK );
|
2010-08-11 21:08:37 +00:00
|
|
|
|
|
2010-08-28 16:04:08 +00:00
|
|
|
|
attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL;
|
2010-08-11 21:08:37 +00:00
|
|
|
|
|
|
|
|
|
window = gdk_window_new (gtk_widget_get_parent_window (widget),
|
|
|
|
|
&attributes, attributes_mask);
|
|
|
|
|
gtk_widget_set_window (widget, window);
|
2013-02-05 08:36:49 +00:00
|
|
|
|
gtk_widget_register_window (widget, window);
|
2010-08-11 21:08:37 +00:00
|
|
|
|
|
2011-05-17 18:10:19 +00:00
|
|
|
|
get_menu_padding (widget, &padding);
|
2010-06-02 04:28:22 +00:00
|
|
|
|
border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));
|
2003-07-06 13:14:28 +00:00
|
|
|
|
|
2010-08-11 21:08:37 +00:00
|
|
|
|
gtk_widget_get_allocation (widget, &allocation);
|
|
|
|
|
|
2012-11-27 14:04:12 +00:00
|
|
|
|
attributes.x = border_width + padding.left;
|
|
|
|
|
attributes.y = border_width + padding.top;
|
2010-11-30 23:55:14 +00:00
|
|
|
|
attributes.width = allocation.width -
|
2012-11-27 14:04:12 +00:00
|
|
|
|
(2 * border_width) - padding.left - padding.right;
|
2010-11-30 23:55:14 +00:00
|
|
|
|
attributes.height = allocation.height -
|
2012-11-27 14:04:12 +00:00
|
|
|
|
(2 * border_width) - padding.top - padding.bottom;
|
Add note about GtkMenuPositionFunc API changes.
2000-11-08 Alexander Larsson <alexl@redhat.com>
* docs/Changes-2.0.txt: Add note about GtkMenuPositionFunc
API changes.
* gtk/gtkmenu.c: Add support for scrolling menus.
Remove gtk_menu_append/prepend/insert, these have been moved to
gtkcompat.h as #defines.
* gtk/gtkcompat.h.in:
Add compatibility #defines for gtk_menu_append/prepend/insert
* gtk/gtkmenu.h: Add data needed for scrolling menus.
GtkMenuPositionFunc gets an extra argument push_in.
gtk_menu_append/prepend/insert removed.
* gtk/gtkmenuitem.c (gtk_menu_item_position_menu): Change menu
positioning behaviour to fit to scrolling menus.
* gtk/gtkmenuitem.c (gtk_menu_item_forall): Don't recurse
into menuitem->submeny. That is wrong, and broke torn
off submenus of torn off menus, since they were unrealized
when the first menu was unrealized.
* gtk/gtkmenushell.[ch]: Virtualize gtk_menu_shell_insert() and
gtk_menu_shell_select_item() since these need to be overridden in
GtkMenu.
* gtk/gtkoptionmenu.c (gtk_opttion_menu_position): Change menu
positioning behaviour to fit to scrolling menus.
(gtk_option_menu_key_press, gtk_option_menu_button_press): Select
the current item so that it is prelighted when the menu pops up.
This is a workaround to the fact that the menu doesn't get the
initial enter event (due to grabs).
* gtk/gtkfilesel.c, gtk/gtkinputdialog.c, gtk/testgtk.c:
s/gtk_menu_append/gtk_menu_shell_append/
* gtk/gtknotebook.c:
s/gtk_menu_insert/gtk_menu_shell_insert/
* gtk/testgtk.c (create_menu, create_menus):
Create the first menu with 50 items so that menu scrolling
can be tested.
Patch from Jonathan Blandford <jrb@redhat.com>
* gtk/gtkmenuitem.[ch] (gtk_menu_item_toggle_size_request): new
system to handle size requests. First, we ask what the size of
the toggle is. Then, when allocating the size, we allocate the
toggle_size first. This way we can have multiple menu-item
classes w/o needing a seperate class for each.
* gtk/gtkmenu.c (gtk_menu_size_request): Actually use the new system.
* gtk/gtkmenu.c (gtk_menu_size_allocate): Use the new system.
* gtk/gtkcheckmenuitem.c
(gtk_check_menu_item_toggle_size_request): New function to handle
the toggle size-request.
2000-11-08 17:34:52 +00:00
|
|
|
|
|
2007-05-09 15:46:41 +00:00
|
|
|
|
get_arrows_border (menu, &arrow_border);
|
|
|
|
|
attributes.y += arrow_border.top;
|
|
|
|
|
attributes.height -= arrow_border.top;
|
|
|
|
|
attributes.height -= arrow_border.bottom;
|
Add note about GtkMenuPositionFunc API changes.
2000-11-08 Alexander Larsson <alexl@redhat.com>
* docs/Changes-2.0.txt: Add note about GtkMenuPositionFunc
API changes.
* gtk/gtkmenu.c: Add support for scrolling menus.
Remove gtk_menu_append/prepend/insert, these have been moved to
gtkcompat.h as #defines.
* gtk/gtkcompat.h.in:
Add compatibility #defines for gtk_menu_append/prepend/insert
* gtk/gtkmenu.h: Add data needed for scrolling menus.
GtkMenuPositionFunc gets an extra argument push_in.
gtk_menu_append/prepend/insert removed.
* gtk/gtkmenuitem.c (gtk_menu_item_position_menu): Change menu
positioning behaviour to fit to scrolling menus.
* gtk/gtkmenuitem.c (gtk_menu_item_forall): Don't recurse
into menuitem->submeny. That is wrong, and broke torn
off submenus of torn off menus, since they were unrealized
when the first menu was unrealized.
* gtk/gtkmenushell.[ch]: Virtualize gtk_menu_shell_insert() and
gtk_menu_shell_select_item() since these need to be overridden in
GtkMenu.
* gtk/gtkoptionmenu.c (gtk_opttion_menu_position): Change menu
positioning behaviour to fit to scrolling menus.
(gtk_option_menu_key_press, gtk_option_menu_button_press): Select
the current item so that it is prelighted when the menu pops up.
This is a workaround to the fact that the menu doesn't get the
initial enter event (due to grabs).
* gtk/gtkfilesel.c, gtk/gtkinputdialog.c, gtk/testgtk.c:
s/gtk_menu_append/gtk_menu_shell_append/
* gtk/gtknotebook.c:
s/gtk_menu_insert/gtk_menu_shell_insert/
* gtk/testgtk.c (create_menu, create_menus):
Create the first menu with 50 items so that menu scrolling
can be tested.
Patch from Jonathan Blandford <jrb@redhat.com>
* gtk/gtkmenuitem.[ch] (gtk_menu_item_toggle_size_request): new
system to handle size requests. First, we ask what the size of
the toggle is. Then, when allocating the size, we allocate the
toggle_size first. This way we can have multiple menu-item
classes w/o needing a seperate class for each.
* gtk/gtkmenu.c (gtk_menu_size_request): Actually use the new system.
* gtk/gtkmenu.c (gtk_menu_size_allocate): Use the new system.
* gtk/gtkcheckmenuitem.c
(gtk_check_menu_item_toggle_size_request): New function to handle
the toggle size-request.
2000-11-08 17:34:52 +00:00
|
|
|
|
|
2010-11-30 23:55:14 +00:00
|
|
|
|
attributes.width = MAX (1, attributes.width);
|
|
|
|
|
attributes.height = MAX (1, attributes.height);
|
|
|
|
|
|
2010-12-23 20:50:18 +00:00
|
|
|
|
priv->view_window = gdk_window_new (window,
|
2010-08-11 21:08:37 +00:00
|
|
|
|
&attributes, attributes_mask);
|
2013-02-05 08:36:49 +00:00
|
|
|
|
gtk_widget_register_window (widget, priv->view_window);
|
Add note about GtkMenuPositionFunc API changes.
2000-11-08 Alexander Larsson <alexl@redhat.com>
* docs/Changes-2.0.txt: Add note about GtkMenuPositionFunc
API changes.
* gtk/gtkmenu.c: Add support for scrolling menus.
Remove gtk_menu_append/prepend/insert, these have been moved to
gtkcompat.h as #defines.
* gtk/gtkcompat.h.in:
Add compatibility #defines for gtk_menu_append/prepend/insert
* gtk/gtkmenu.h: Add data needed for scrolling menus.
GtkMenuPositionFunc gets an extra argument push_in.
gtk_menu_append/prepend/insert removed.
* gtk/gtkmenuitem.c (gtk_menu_item_position_menu): Change menu
positioning behaviour to fit to scrolling menus.
* gtk/gtkmenuitem.c (gtk_menu_item_forall): Don't recurse
into menuitem->submeny. That is wrong, and broke torn
off submenus of torn off menus, since they were unrealized
when the first menu was unrealized.
* gtk/gtkmenushell.[ch]: Virtualize gtk_menu_shell_insert() and
gtk_menu_shell_select_item() since these need to be overridden in
GtkMenu.
* gtk/gtkoptionmenu.c (gtk_opttion_menu_position): Change menu
positioning behaviour to fit to scrolling menus.
(gtk_option_menu_key_press, gtk_option_menu_button_press): Select
the current item so that it is prelighted when the menu pops up.
This is a workaround to the fact that the menu doesn't get the
initial enter event (due to grabs).
* gtk/gtkfilesel.c, gtk/gtkinputdialog.c, gtk/testgtk.c:
s/gtk_menu_append/gtk_menu_shell_append/
* gtk/gtknotebook.c:
s/gtk_menu_insert/gtk_menu_shell_insert/
* gtk/testgtk.c (create_menu, create_menus):
Create the first menu with 50 items so that menu scrolling
can be tested.
Patch from Jonathan Blandford <jrb@redhat.com>
* gtk/gtkmenuitem.[ch] (gtk_menu_item_toggle_size_request): new
system to handle size requests. First, we ask what the size of
the toggle is. Then, when allocating the size, we allocate the
toggle_size first. This way we can have multiple menu-item
classes w/o needing a seperate class for each.
* gtk/gtkmenu.c (gtk_menu_size_request): Actually use the new system.
* gtk/gtkmenu.c (gtk_menu_size_allocate): Use the new system.
* gtk/gtkcheckmenuitem.c
(gtk_check_menu_item_toggle_size_request): New function to handle
the toggle size-request.
2000-11-08 17:34:52 +00:00
|
|
|
|
|
2010-08-11 21:08:37 +00:00
|
|
|
|
gtk_widget_get_allocation (widget, &allocation);
|
|
|
|
|
|
Add note about GtkMenuPositionFunc API changes.
2000-11-08 Alexander Larsson <alexl@redhat.com>
* docs/Changes-2.0.txt: Add note about GtkMenuPositionFunc
API changes.
* gtk/gtkmenu.c: Add support for scrolling menus.
Remove gtk_menu_append/prepend/insert, these have been moved to
gtkcompat.h as #defines.
* gtk/gtkcompat.h.in:
Add compatibility #defines for gtk_menu_append/prepend/insert
* gtk/gtkmenu.h: Add data needed for scrolling menus.
GtkMenuPositionFunc gets an extra argument push_in.
gtk_menu_append/prepend/insert removed.
* gtk/gtkmenuitem.c (gtk_menu_item_position_menu): Change menu
positioning behaviour to fit to scrolling menus.
* gtk/gtkmenuitem.c (gtk_menu_item_forall): Don't recurse
into menuitem->submeny. That is wrong, and broke torn
off submenus of torn off menus, since they were unrealized
when the first menu was unrealized.
* gtk/gtkmenushell.[ch]: Virtualize gtk_menu_shell_insert() and
gtk_menu_shell_select_item() since these need to be overridden in
GtkMenu.
* gtk/gtkoptionmenu.c (gtk_opttion_menu_position): Change menu
positioning behaviour to fit to scrolling menus.
(gtk_option_menu_key_press, gtk_option_menu_button_press): Select
the current item so that it is prelighted when the menu pops up.
This is a workaround to the fact that the menu doesn't get the
initial enter event (due to grabs).
* gtk/gtkfilesel.c, gtk/gtkinputdialog.c, gtk/testgtk.c:
s/gtk_menu_append/gtk_menu_shell_append/
* gtk/gtknotebook.c:
s/gtk_menu_insert/gtk_menu_shell_insert/
* gtk/testgtk.c (create_menu, create_menus):
Create the first menu with 50 items so that menu scrolling
can be tested.
Patch from Jonathan Blandford <jrb@redhat.com>
* gtk/gtkmenuitem.[ch] (gtk_menu_item_toggle_size_request): new
system to handle size requests. First, we ask what the size of
the toggle is. Then, when allocating the size, we allocate the
toggle_size first. This way we can have multiple menu-item
classes w/o needing a seperate class for each.
* gtk/gtkmenu.c (gtk_menu_size_request): Actually use the new system.
* gtk/gtkmenu.c (gtk_menu_size_allocate): Use the new system.
* gtk/gtkcheckmenuitem.c
(gtk_check_menu_item_toggle_size_request): New function to handle
the toggle size-request.
2000-11-08 17:34:52 +00:00
|
|
|
|
attributes.x = 0;
|
2013-05-09 16:06:05 +00:00
|
|
|
|
attributes.y = - priv->scroll_offset;
|
2012-11-27 14:04:12 +00:00
|
|
|
|
attributes.width = allocation.width + (2 * border_width) +
|
2011-05-17 18:10:19 +00:00
|
|
|
|
padding.left + padding.right;
|
2012-11-27 14:04:12 +00:00
|
|
|
|
attributes.height = priv->requested_height - (2 * border_width) +
|
2011-05-17 18:10:19 +00:00
|
|
|
|
padding.top + padding.bottom;
|
2010-11-30 23:55:14 +00:00
|
|
|
|
|
|
|
|
|
attributes.width = MAX (1, attributes.width);
|
|
|
|
|
attributes.height = MAX (1, attributes.height);
|
2010-08-11 21:08:37 +00:00
|
|
|
|
|
2010-12-23 20:50:18 +00:00
|
|
|
|
priv->bin_window = gdk_window_new (priv->view_window,
|
2010-08-11 21:08:37 +00:00
|
|
|
|
&attributes, attributes_mask);
|
2013-02-05 08:36:49 +00:00
|
|
|
|
gtk_widget_register_window (widget, priv->bin_window);
|
Add note about GtkMenuPositionFunc API changes.
2000-11-08 Alexander Larsson <alexl@redhat.com>
* docs/Changes-2.0.txt: Add note about GtkMenuPositionFunc
API changes.
* gtk/gtkmenu.c: Add support for scrolling menus.
Remove gtk_menu_append/prepend/insert, these have been moved to
gtkcompat.h as #defines.
* gtk/gtkcompat.h.in:
Add compatibility #defines for gtk_menu_append/prepend/insert
* gtk/gtkmenu.h: Add data needed for scrolling menus.
GtkMenuPositionFunc gets an extra argument push_in.
gtk_menu_append/prepend/insert removed.
* gtk/gtkmenuitem.c (gtk_menu_item_position_menu): Change menu
positioning behaviour to fit to scrolling menus.
* gtk/gtkmenuitem.c (gtk_menu_item_forall): Don't recurse
into menuitem->submeny. That is wrong, and broke torn
off submenus of torn off menus, since they were unrealized
when the first menu was unrealized.
* gtk/gtkmenushell.[ch]: Virtualize gtk_menu_shell_insert() and
gtk_menu_shell_select_item() since these need to be overridden in
GtkMenu.
* gtk/gtkoptionmenu.c (gtk_opttion_menu_position): Change menu
positioning behaviour to fit to scrolling menus.
(gtk_option_menu_key_press, gtk_option_menu_button_press): Select
the current item so that it is prelighted when the menu pops up.
This is a workaround to the fact that the menu doesn't get the
initial enter event (due to grabs).
* gtk/gtkfilesel.c, gtk/gtkinputdialog.c, gtk/testgtk.c:
s/gtk_menu_append/gtk_menu_shell_append/
* gtk/gtknotebook.c:
s/gtk_menu_insert/gtk_menu_shell_insert/
* gtk/testgtk.c (create_menu, create_menus):
Create the first menu with 50 items so that menu scrolling
can be tested.
Patch from Jonathan Blandford <jrb@redhat.com>
* gtk/gtkmenuitem.[ch] (gtk_menu_item_toggle_size_request): new
system to handle size requests. First, we ask what the size of
the toggle is. Then, when allocating the size, we allocate the
toggle_size first. This way we can have multiple menu-item
classes w/o needing a seperate class for each.
* gtk/gtkmenu.c (gtk_menu_size_request): Actually use the new system.
* gtk/gtkmenu.c (gtk_menu_size_allocate): Use the new system.
* gtk/gtkcheckmenuitem.c
(gtk_check_menu_item_toggle_size_request): New function to handle
the toggle size-request.
2000-11-08 17:34:52 +00:00
|
|
|
|
|
2010-12-23 23:21:53 +00:00
|
|
|
|
children = GTK_MENU_SHELL (menu)->priv->children;
|
Add note about GtkMenuPositionFunc API changes.
2000-11-08 Alexander Larsson <alexl@redhat.com>
* docs/Changes-2.0.txt: Add note about GtkMenuPositionFunc
API changes.
* gtk/gtkmenu.c: Add support for scrolling menus.
Remove gtk_menu_append/prepend/insert, these have been moved to
gtkcompat.h as #defines.
* gtk/gtkcompat.h.in:
Add compatibility #defines for gtk_menu_append/prepend/insert
* gtk/gtkmenu.h: Add data needed for scrolling menus.
GtkMenuPositionFunc gets an extra argument push_in.
gtk_menu_append/prepend/insert removed.
* gtk/gtkmenuitem.c (gtk_menu_item_position_menu): Change menu
positioning behaviour to fit to scrolling menus.
* gtk/gtkmenuitem.c (gtk_menu_item_forall): Don't recurse
into menuitem->submeny. That is wrong, and broke torn
off submenus of torn off menus, since they were unrealized
when the first menu was unrealized.
* gtk/gtkmenushell.[ch]: Virtualize gtk_menu_shell_insert() and
gtk_menu_shell_select_item() since these need to be overridden in
GtkMenu.
* gtk/gtkoptionmenu.c (gtk_opttion_menu_position): Change menu
positioning behaviour to fit to scrolling menus.
(gtk_option_menu_key_press, gtk_option_menu_button_press): Select
the current item so that it is prelighted when the menu pops up.
This is a workaround to the fact that the menu doesn't get the
initial enter event (due to grabs).
* gtk/gtkfilesel.c, gtk/gtkinputdialog.c, gtk/testgtk.c:
s/gtk_menu_append/gtk_menu_shell_append/
* gtk/gtknotebook.c:
s/gtk_menu_insert/gtk_menu_shell_insert/
* gtk/testgtk.c (create_menu, create_menus):
Create the first menu with 50 items so that menu scrolling
can be tested.
Patch from Jonathan Blandford <jrb@redhat.com>
* gtk/gtkmenuitem.[ch] (gtk_menu_item_toggle_size_request): new
system to handle size requests. First, we ask what the size of
the toggle is. Then, when allocating the size, we allocate the
toggle_size first. This way we can have multiple menu-item
classes w/o needing a seperate class for each.
* gtk/gtkmenu.c (gtk_menu_size_request): Actually use the new system.
* gtk/gtkmenu.c (gtk_menu_size_allocate): Use the new system.
* gtk/gtkcheckmenuitem.c
(gtk_check_menu_item_toggle_size_request): New function to handle
the toggle size-request.
2000-11-08 17:34:52 +00:00
|
|
|
|
while (children)
|
|
|
|
|
{
|
|
|
|
|
child = children->data;
|
|
|
|
|
children = children->next;
|
2010-12-23 20:50:18 +00:00
|
|
|
|
|
|
|
|
|
gtk_widget_set_parent_window (child, priv->bin_window);
|
Add note about GtkMenuPositionFunc API changes.
2000-11-08 Alexander Larsson <alexl@redhat.com>
* docs/Changes-2.0.txt: Add note about GtkMenuPositionFunc
API changes.
* gtk/gtkmenu.c: Add support for scrolling menus.
Remove gtk_menu_append/prepend/insert, these have been moved to
gtkcompat.h as #defines.
* gtk/gtkcompat.h.in:
Add compatibility #defines for gtk_menu_append/prepend/insert
* gtk/gtkmenu.h: Add data needed for scrolling menus.
GtkMenuPositionFunc gets an extra argument push_in.
gtk_menu_append/prepend/insert removed.
* gtk/gtkmenuitem.c (gtk_menu_item_position_menu): Change menu
positioning behaviour to fit to scrolling menus.
* gtk/gtkmenuitem.c (gtk_menu_item_forall): Don't recurse
into menuitem->submeny. That is wrong, and broke torn
off submenus of torn off menus, since they were unrealized
when the first menu was unrealized.
* gtk/gtkmenushell.[ch]: Virtualize gtk_menu_shell_insert() and
gtk_menu_shell_select_item() since these need to be overridden in
GtkMenu.
* gtk/gtkoptionmenu.c (gtk_opttion_menu_position): Change menu
positioning behaviour to fit to scrolling menus.
(gtk_option_menu_key_press, gtk_option_menu_button_press): Select
the current item so that it is prelighted when the menu pops up.
This is a workaround to the fact that the menu doesn't get the
initial enter event (due to grabs).
* gtk/gtkfilesel.c, gtk/gtkinputdialog.c, gtk/testgtk.c:
s/gtk_menu_append/gtk_menu_shell_append/
* gtk/gtknotebook.c:
s/gtk_menu_insert/gtk_menu_shell_insert/
* gtk/testgtk.c (create_menu, create_menus):
Create the first menu with 50 items so that menu scrolling
can be tested.
Patch from Jonathan Blandford <jrb@redhat.com>
* gtk/gtkmenuitem.[ch] (gtk_menu_item_toggle_size_request): new
system to handle size requests. First, we ask what the size of
the toggle is. Then, when allocating the size, we allocate the
toggle_size first. This way we can have multiple menu-item
classes w/o needing a seperate class for each.
* gtk/gtkmenu.c (gtk_menu_size_request): Actually use the new system.
* gtk/gtkmenu.c (gtk_menu_size_allocate): Use the new system.
* gtk/gtkcheckmenuitem.c
(gtk_check_menu_item_toggle_size_request): New function to handle
the toggle size-request.
2000-11-08 17:34:52 +00:00
|
|
|
|
}
|
2010-08-11 21:08:37 +00:00
|
|
|
|
|
2010-12-23 23:21:53 +00:00
|
|
|
|
if (GTK_MENU_SHELL (widget)->priv->active_menu_item)
|
2002-02-18 22:08:41 +00:00
|
|
|
|
gtk_menu_scroll_item_visible (GTK_MENU_SHELL (widget),
|
2010-12-23 23:21:53 +00:00
|
|
|
|
GTK_MENU_SHELL (widget)->priv->active_menu_item);
|
2001-09-22 14:55:02 +00:00
|
|
|
|
|
2010-12-23 20:50:18 +00:00
|
|
|
|
gdk_window_show (priv->bin_window);
|
|
|
|
|
gdk_window_show (priv->view_window);
|
Add note about GtkMenuPositionFunc API changes.
2000-11-08 Alexander Larsson <alexl@redhat.com>
* docs/Changes-2.0.txt: Add note about GtkMenuPositionFunc
API changes.
* gtk/gtkmenu.c: Add support for scrolling menus.
Remove gtk_menu_append/prepend/insert, these have been moved to
gtkcompat.h as #defines.
* gtk/gtkcompat.h.in:
Add compatibility #defines for gtk_menu_append/prepend/insert
* gtk/gtkmenu.h: Add data needed for scrolling menus.
GtkMenuPositionFunc gets an extra argument push_in.
gtk_menu_append/prepend/insert removed.
* gtk/gtkmenuitem.c (gtk_menu_item_position_menu): Change menu
positioning behaviour to fit to scrolling menus.
* gtk/gtkmenuitem.c (gtk_menu_item_forall): Don't recurse
into menuitem->submeny. That is wrong, and broke torn
off submenus of torn off menus, since they were unrealized
when the first menu was unrealized.
* gtk/gtkmenushell.[ch]: Virtualize gtk_menu_shell_insert() and
gtk_menu_shell_select_item() since these need to be overridden in
GtkMenu.
* gtk/gtkoptionmenu.c (gtk_opttion_menu_position): Change menu
positioning behaviour to fit to scrolling menus.
(gtk_option_menu_key_press, gtk_option_menu_button_press): Select
the current item so that it is prelighted when the menu pops up.
This is a workaround to the fact that the menu doesn't get the
initial enter event (due to grabs).
* gtk/gtkfilesel.c, gtk/gtkinputdialog.c, gtk/testgtk.c:
s/gtk_menu_append/gtk_menu_shell_append/
* gtk/gtknotebook.c:
s/gtk_menu_insert/gtk_menu_shell_insert/
* gtk/testgtk.c (create_menu, create_menus):
Create the first menu with 50 items so that menu scrolling
can be tested.
Patch from Jonathan Blandford <jrb@redhat.com>
* gtk/gtkmenuitem.[ch] (gtk_menu_item_toggle_size_request): new
system to handle size requests. First, we ask what the size of
the toggle is. Then, when allocating the size, we allocate the
toggle_size first. This way we can have multiple menu-item
classes w/o needing a seperate class for each.
* gtk/gtkmenu.c (gtk_menu_size_request): Actually use the new system.
* gtk/gtkmenu.c (gtk_menu_size_allocate): Use the new system.
* gtk/gtkcheckmenuitem.c
(gtk_check_menu_item_toggle_size_request): New function to handle
the toggle size-request.
2000-11-08 17:34:52 +00:00
|
|
|
|
}
|
|
|
|
|
|
2010-12-23 20:50:18 +00:00
|
|
|
|
static gboolean
|
2002-10-01 09:57:55 +00:00
|
|
|
|
gtk_menu_focus (GtkWidget *widget,
|
|
|
|
|
GtkDirectionType direction)
|
|
|
|
|
{
|
2010-12-23 20:50:18 +00:00
|
|
|
|
/* A menu or its menu items cannot have focus */
|
2002-10-01 09:57:55 +00:00
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
|
|
|
|
|
2010-12-23 20:50:18 +00:00
|
|
|
|
/* See notes in gtk_menu_popup() for information
|
2014-02-05 18:07:34 +00:00
|
|
|
|
* about the “grab transfer window”
|
2002-02-02 21:50:46 +00:00
|
|
|
|
*/
|
|
|
|
|
static GdkWindow *
|
|
|
|
|
menu_grab_transfer_window_get (GtkMenu *menu)
|
|
|
|
|
{
|
|
|
|
|
GdkWindow *window = g_object_get_data (G_OBJECT (menu), "gtk-menu-transfer-window");
|
|
|
|
|
if (!window)
|
|
|
|
|
{
|
|
|
|
|
GdkWindowAttr attributes;
|
|
|
|
|
gint attributes_mask;
|
2014-01-25 01:13:01 +00:00
|
|
|
|
GdkWindow *parent;
|
2010-12-23 20:50:18 +00:00
|
|
|
|
|
2002-02-02 21:50:46 +00:00
|
|
|
|
attributes.x = -100;
|
|
|
|
|
attributes.y = -100;
|
|
|
|
|
attributes.width = 10;
|
|
|
|
|
attributes.height = 10;
|
|
|
|
|
attributes.window_type = GDK_WINDOW_TEMP;
|
|
|
|
|
attributes.wclass = GDK_INPUT_ONLY;
|
|
|
|
|
attributes.override_redirect = TRUE;
|
|
|
|
|
attributes.event_mask = 0;
|
|
|
|
|
|
|
|
|
|
attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_NOREDIR;
|
2010-12-23 20:50:18 +00:00
|
|
|
|
|
2014-01-25 01:13:01 +00:00
|
|
|
|
parent = gdk_screen_get_root_window (gtk_widget_get_screen (GTK_WIDGET (menu)));
|
|
|
|
|
window = gdk_window_new (parent,
|
2010-12-23 20:50:18 +00:00
|
|
|
|
&attributes, attributes_mask);
|
2013-02-05 08:36:49 +00:00
|
|
|
|
gtk_widget_register_window (GTK_WIDGET (menu), window);
|
2002-02-02 21:50:46 +00:00
|
|
|
|
|
|
|
|
|
gdk_window_show (window);
|
|
|
|
|
|
2005-09-01 05:11:46 +00:00
|
|
|
|
g_object_set_data (G_OBJECT (menu), I_("gtk-menu-transfer-window"), window);
|
2002-02-02 21:50:46 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return window;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
menu_grab_transfer_window_destroy (GtkMenu *menu)
|
|
|
|
|
{
|
|
|
|
|
GdkWindow *window = g_object_get_data (G_OBJECT (menu), "gtk-menu-transfer-window");
|
|
|
|
|
if (window)
|
|
|
|
|
{
|
wayland: Fix GtkMenuButton popups in a terrible, hacky way
Since you can't take grabs on unmapped windows, GtkMenu takes a grab on
the menu in a convoluted way: it first grabs another window, shows the
menu window, and then transfers the grab over to the GtkMenu widget.
For normal menubars, this is perfectly fine, as the first window it grabs
is our toplevel, and that gets picked up in our transient path. For
GtkMenuButton or other spurious uses of gtk_menu_popup, it creates a new
temporary input-only window which it takes the grab on, known as the "grab
transfer window". Since this window isn't a transient-for of our new menu
widget window, the grab isn't noticed when we go to show it, and thus the
menu ends up as a new toplevel.
Add a special hack to GtkMenu and the Wayland backend which lets us notice
this "grab transfer window", and include it in our grab finding path.
It's sort of terrible to have to hack up the widgets instead of just the
backend, but the alternative would be an entirely new window type which is
managed correctly by GDK. I don't want to write that.
2014-05-15 21:20:00 +00:00
|
|
|
|
GdkWindow *widget_window;
|
|
|
|
|
|
2013-02-05 08:36:49 +00:00
|
|
|
|
gtk_widget_unregister_window (GTK_WIDGET (menu), window);
|
2002-02-02 21:50:46 +00:00
|
|
|
|
gdk_window_destroy (window);
|
2005-09-01 05:11:46 +00:00
|
|
|
|
g_object_set_data (G_OBJECT (menu), I_("gtk-menu-transfer-window"), NULL);
|
wayland: Fix GtkMenuButton popups in a terrible, hacky way
Since you can't take grabs on unmapped windows, GtkMenu takes a grab on
the menu in a convoluted way: it first grabs another window, shows the
menu window, and then transfers the grab over to the GtkMenu widget.
For normal menubars, this is perfectly fine, as the first window it grabs
is our toplevel, and that gets picked up in our transient path. For
GtkMenuButton or other spurious uses of gtk_menu_popup, it creates a new
temporary input-only window which it takes the grab on, known as the "grab
transfer window". Since this window isn't a transient-for of our new menu
widget window, the grab isn't noticed when we go to show it, and thus the
menu ends up as a new toplevel.
Add a special hack to GtkMenu and the Wayland backend which lets us notice
this "grab transfer window", and include it in our grab finding path.
It's sort of terrible to have to hack up the widgets instead of just the
backend, but the alternative would be an entirely new window type which is
managed correctly by GDK. I don't want to write that.
2014-05-15 21:20:00 +00:00
|
|
|
|
|
|
|
|
|
widget_window = gtk_widget_get_window (GTK_WIDGET (menu));
|
|
|
|
|
g_object_set_data (G_OBJECT (widget_window), I_("gdk-attached-grab-window"), window);
|
2002-02-02 21:50:46 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
Add note about GtkMenuPositionFunc API changes.
2000-11-08 Alexander Larsson <alexl@redhat.com>
* docs/Changes-2.0.txt: Add note about GtkMenuPositionFunc
API changes.
* gtk/gtkmenu.c: Add support for scrolling menus.
Remove gtk_menu_append/prepend/insert, these have been moved to
gtkcompat.h as #defines.
* gtk/gtkcompat.h.in:
Add compatibility #defines for gtk_menu_append/prepend/insert
* gtk/gtkmenu.h: Add data needed for scrolling menus.
GtkMenuPositionFunc gets an extra argument push_in.
gtk_menu_append/prepend/insert removed.
* gtk/gtkmenuitem.c (gtk_menu_item_position_menu): Change menu
positioning behaviour to fit to scrolling menus.
* gtk/gtkmenuitem.c (gtk_menu_item_forall): Don't recurse
into menuitem->submeny. That is wrong, and broke torn
off submenus of torn off menus, since they were unrealized
when the first menu was unrealized.
* gtk/gtkmenushell.[ch]: Virtualize gtk_menu_shell_insert() and
gtk_menu_shell_select_item() since these need to be overridden in
GtkMenu.
* gtk/gtkoptionmenu.c (gtk_opttion_menu_position): Change menu
positioning behaviour to fit to scrolling menus.
(gtk_option_menu_key_press, gtk_option_menu_button_press): Select
the current item so that it is prelighted when the menu pops up.
This is a workaround to the fact that the menu doesn't get the
initial enter event (due to grabs).
* gtk/gtkfilesel.c, gtk/gtkinputdialog.c, gtk/testgtk.c:
s/gtk_menu_append/gtk_menu_shell_append/
* gtk/gtknotebook.c:
s/gtk_menu_insert/gtk_menu_shell_insert/
* gtk/testgtk.c (create_menu, create_menus):
Create the first menu with 50 items so that menu scrolling
can be tested.
Patch from Jonathan Blandford <jrb@redhat.com>
* gtk/gtkmenuitem.[ch] (gtk_menu_item_toggle_size_request): new
system to handle size requests. First, we ask what the size of
the toggle is. Then, when allocating the size, we allocate the
toggle_size first. This way we can have multiple menu-item
classes w/o needing a seperate class for each.
* gtk/gtkmenu.c (gtk_menu_size_request): Actually use the new system.
* gtk/gtkmenu.c (gtk_menu_size_allocate): Use the new system.
* gtk/gtkcheckmenuitem.c
(gtk_check_menu_item_toggle_size_request): New function to handle
the toggle size-request.
2000-11-08 17:34:52 +00:00
|
|
|
|
static void
|
|
|
|
|
gtk_menu_unrealize (GtkWidget *widget)
|
|
|
|
|
{
|
2008-02-07 16:59:42 +00:00
|
|
|
|
GtkMenu *menu = GTK_MENU (widget);
|
2010-12-23 20:50:18 +00:00
|
|
|
|
GtkMenuPrivate *priv = menu->priv;
|
Add note about GtkMenuPositionFunc API changes.
2000-11-08 Alexander Larsson <alexl@redhat.com>
* docs/Changes-2.0.txt: Add note about GtkMenuPositionFunc
API changes.
* gtk/gtkmenu.c: Add support for scrolling menus.
Remove gtk_menu_append/prepend/insert, these have been moved to
gtkcompat.h as #defines.
* gtk/gtkcompat.h.in:
Add compatibility #defines for gtk_menu_append/prepend/insert
* gtk/gtkmenu.h: Add data needed for scrolling menus.
GtkMenuPositionFunc gets an extra argument push_in.
gtk_menu_append/prepend/insert removed.
* gtk/gtkmenuitem.c (gtk_menu_item_position_menu): Change menu
positioning behaviour to fit to scrolling menus.
* gtk/gtkmenuitem.c (gtk_menu_item_forall): Don't recurse
into menuitem->submeny. That is wrong, and broke torn
off submenus of torn off menus, since they were unrealized
when the first menu was unrealized.
* gtk/gtkmenushell.[ch]: Virtualize gtk_menu_shell_insert() and
gtk_menu_shell_select_item() since these need to be overridden in
GtkMenu.
* gtk/gtkoptionmenu.c (gtk_opttion_menu_position): Change menu
positioning behaviour to fit to scrolling menus.
(gtk_option_menu_key_press, gtk_option_menu_button_press): Select
the current item so that it is prelighted when the menu pops up.
This is a workaround to the fact that the menu doesn't get the
initial enter event (due to grabs).
* gtk/gtkfilesel.c, gtk/gtkinputdialog.c, gtk/testgtk.c:
s/gtk_menu_append/gtk_menu_shell_append/
* gtk/gtknotebook.c:
s/gtk_menu_insert/gtk_menu_shell_insert/
* gtk/testgtk.c (create_menu, create_menus):
Create the first menu with 50 items so that menu scrolling
can be tested.
Patch from Jonathan Blandford <jrb@redhat.com>
* gtk/gtkmenuitem.[ch] (gtk_menu_item_toggle_size_request): new
system to handle size requests. First, we ask what the size of
the toggle is. Then, when allocating the size, we allocate the
toggle_size first. This way we can have multiple menu-item
classes w/o needing a seperate class for each.
* gtk/gtkmenu.c (gtk_menu_size_request): Actually use the new system.
* gtk/gtkmenu.c (gtk_menu_size_allocate): Use the new system.
* gtk/gtkcheckmenuitem.c
(gtk_check_menu_item_toggle_size_request): New function to handle
the toggle size-request.
2000-11-08 17:34:52 +00:00
|
|
|
|
|
2002-02-02 21:50:46 +00:00
|
|
|
|
menu_grab_transfer_window_destroy (menu);
|
|
|
|
|
|
2013-02-05 08:36:49 +00:00
|
|
|
|
gtk_widget_unregister_window (widget, priv->view_window);
|
2010-12-23 20:50:18 +00:00
|
|
|
|
gdk_window_destroy (priv->view_window);
|
|
|
|
|
priv->view_window = NULL;
|
Add note about GtkMenuPositionFunc API changes.
2000-11-08 Alexander Larsson <alexl@redhat.com>
* docs/Changes-2.0.txt: Add note about GtkMenuPositionFunc
API changes.
* gtk/gtkmenu.c: Add support for scrolling menus.
Remove gtk_menu_append/prepend/insert, these have been moved to
gtkcompat.h as #defines.
* gtk/gtkcompat.h.in:
Add compatibility #defines for gtk_menu_append/prepend/insert
* gtk/gtkmenu.h: Add data needed for scrolling menus.
GtkMenuPositionFunc gets an extra argument push_in.
gtk_menu_append/prepend/insert removed.
* gtk/gtkmenuitem.c (gtk_menu_item_position_menu): Change menu
positioning behaviour to fit to scrolling menus.
* gtk/gtkmenuitem.c (gtk_menu_item_forall): Don't recurse
into menuitem->submeny. That is wrong, and broke torn
off submenus of torn off menus, since they were unrealized
when the first menu was unrealized.
* gtk/gtkmenushell.[ch]: Virtualize gtk_menu_shell_insert() and
gtk_menu_shell_select_item() since these need to be overridden in
GtkMenu.
* gtk/gtkoptionmenu.c (gtk_opttion_menu_position): Change menu
positioning behaviour to fit to scrolling menus.
(gtk_option_menu_key_press, gtk_option_menu_button_press): Select
the current item so that it is prelighted when the menu pops up.
This is a workaround to the fact that the menu doesn't get the
initial enter event (due to grabs).
* gtk/gtkfilesel.c, gtk/gtkinputdialog.c, gtk/testgtk.c:
s/gtk_menu_append/gtk_menu_shell_append/
* gtk/gtknotebook.c:
s/gtk_menu_insert/gtk_menu_shell_insert/
* gtk/testgtk.c (create_menu, create_menus):
Create the first menu with 50 items so that menu scrolling
can be tested.
Patch from Jonathan Blandford <jrb@redhat.com>
* gtk/gtkmenuitem.[ch] (gtk_menu_item_toggle_size_request): new
system to handle size requests. First, we ask what the size of
the toggle is. Then, when allocating the size, we allocate the
toggle_size first. This way we can have multiple menu-item
classes w/o needing a seperate class for each.
* gtk/gtkmenu.c (gtk_menu_size_request): Actually use the new system.
* gtk/gtkmenu.c (gtk_menu_size_allocate): Use the new system.
* gtk/gtkcheckmenuitem.c
(gtk_check_menu_item_toggle_size_request): New function to handle
the toggle size-request.
2000-11-08 17:34:52 +00:00
|
|
|
|
|
2013-02-05 08:36:49 +00:00
|
|
|
|
gtk_widget_unregister_window (widget, priv->bin_window);
|
2010-12-23 20:50:18 +00:00
|
|
|
|
gdk_window_destroy (priv->bin_window);
|
|
|
|
|
priv->bin_window = NULL;
|
Add note about GtkMenuPositionFunc API changes.
2000-11-08 Alexander Larsson <alexl@redhat.com>
* docs/Changes-2.0.txt: Add note about GtkMenuPositionFunc
API changes.
* gtk/gtkmenu.c: Add support for scrolling menus.
Remove gtk_menu_append/prepend/insert, these have been moved to
gtkcompat.h as #defines.
* gtk/gtkcompat.h.in:
Add compatibility #defines for gtk_menu_append/prepend/insert
* gtk/gtkmenu.h: Add data needed for scrolling menus.
GtkMenuPositionFunc gets an extra argument push_in.
gtk_menu_append/prepend/insert removed.
* gtk/gtkmenuitem.c (gtk_menu_item_position_menu): Change menu
positioning behaviour to fit to scrolling menus.
* gtk/gtkmenuitem.c (gtk_menu_item_forall): Don't recurse
into menuitem->submeny. That is wrong, and broke torn
off submenus of torn off menus, since they were unrealized
when the first menu was unrealized.
* gtk/gtkmenushell.[ch]: Virtualize gtk_menu_shell_insert() and
gtk_menu_shell_select_item() since these need to be overridden in
GtkMenu.
* gtk/gtkoptionmenu.c (gtk_opttion_menu_position): Change menu
positioning behaviour to fit to scrolling menus.
(gtk_option_menu_key_press, gtk_option_menu_button_press): Select
the current item so that it is prelighted when the menu pops up.
This is a workaround to the fact that the menu doesn't get the
initial enter event (due to grabs).
* gtk/gtkfilesel.c, gtk/gtkinputdialog.c, gtk/testgtk.c:
s/gtk_menu_append/gtk_menu_shell_append/
* gtk/gtknotebook.c:
s/gtk_menu_insert/gtk_menu_shell_insert/
* gtk/testgtk.c (create_menu, create_menus):
Create the first menu with 50 items so that menu scrolling
can be tested.
Patch from Jonathan Blandford <jrb@redhat.com>
* gtk/gtkmenuitem.[ch] (gtk_menu_item_toggle_size_request): new
system to handle size requests. First, we ask what the size of
the toggle is. Then, when allocating the size, we allocate the
toggle_size first. This way we can have multiple menu-item
classes w/o needing a seperate class for each.
* gtk/gtkmenu.c (gtk_menu_size_request): Actually use the new system.
* gtk/gtkmenu.c (gtk_menu_size_allocate): Use the new system.
* gtk/gtkcheckmenuitem.c
(gtk_check_menu_item_toggle_size_request): New function to handle
the toggle size-request.
2000-11-08 17:34:52 +00:00
|
|
|
|
|
2008-08-12 09:06:34 +00:00
|
|
|
|
GTK_WIDGET_CLASS (gtk_menu_parent_class)->unrealize (widget);
|
1997-11-24 22:37:52 +00:00
|
|
|
|
}
|
|
|
|
|
|
2010-08-18 23:42:02 +00:00
|
|
|
|
static gint
|
|
|
|
|
calculate_line_heights (GtkMenu *menu,
|
2010-12-23 20:50:18 +00:00
|
|
|
|
gint for_width,
|
|
|
|
|
guint **ret_min_heights,
|
|
|
|
|
guint **ret_nat_heights)
|
1997-11-24 22:37:52 +00:00
|
|
|
|
{
|
2011-01-12 19:35:04 +00:00
|
|
|
|
GtkBorder padding;
|
The table menu patch! Turns GtkMenu into a table, so you can attach menu
Wed Sep 10 22:25:04 2003 Kristian Rietveld <kris@gtk.org>
The table menu patch! Turns GtkMenu into a table, so you can attach
menu items in numerous new ways! Be creative!
Contains some bug fixes and RTL adaptions from Matthias Clasen.
* gtk/gtkmenu.c [toplevel]: introduce ATTACH_INFO_KEY, extend
GtkMenuPrivate, introduce AttachInfo, add child properties enum,
(gtk_menu_free_private), (gtk_menu_get_private): we have to free
the heights array in the private struct,
(gtk_menu_class_init): reorder code a bit, install child properties,
(get_attach_info), (get_child_attach): new utility functions,
(gtk_menu_set_child_property), (gtk_menu_get_child_property): introduce
child properties, for the attach info,
(gtk_menu_remove): remove AttachInfo from menu item,
(gtk_menu_real_insert): implemented algorithm to automagically place
inserted menu items at the correct place in the table,
(gtk_menu_size_request), (gtk_menu_size_allocate),
(compute_child_offset): reworked/rewritten to support table menus,
(gtk_menu_attach): new function,
(find_child_containing), (gtk_menu_move_current): new functions to
get table menu keynav right.
* gtk/gtkmenu.h: add gtk_menu_attach() prototype.
2003-09-10 20:32:33 +00:00
|
|
|
|
GtkMenuPrivate *priv;
|
2010-12-23 20:50:18 +00:00
|
|
|
|
GtkMenuShell *menu_shell;
|
2010-08-18 23:42:02 +00:00
|
|
|
|
GtkWidget *child, *widget;
|
|
|
|
|
GList *children;
|
|
|
|
|
guint border_width;
|
|
|
|
|
guint n_columns;
|
|
|
|
|
gint n_heights;
|
|
|
|
|
guint *min_heights;
|
|
|
|
|
guint *nat_heights;
|
|
|
|
|
gint avail_width;
|
2010-12-23 20:50:18 +00:00
|
|
|
|
|
|
|
|
|
priv = menu->priv;
|
2010-08-18 23:42:02 +00:00
|
|
|
|
widget = GTK_WIDGET (menu);
|
|
|
|
|
menu_shell = GTK_MENU_SHELL (widget);
|
2010-12-23 20:50:18 +00:00
|
|
|
|
|
2010-08-18 23:42:02 +00:00
|
|
|
|
min_heights = g_new0 (guint, gtk_menu_get_n_rows (menu));
|
|
|
|
|
nat_heights = g_new0 (guint, gtk_menu_get_n_rows (menu));
|
|
|
|
|
n_heights = gtk_menu_get_n_rows (menu);
|
|
|
|
|
n_columns = gtk_menu_get_n_columns (menu);
|
2010-12-23 20:50:18 +00:00
|
|
|
|
avail_width = for_width - (2 * priv->toggle_size + priv->accel_size) * n_columns;
|
The table menu patch! Turns GtkMenu into a table, so you can attach menu
Wed Sep 10 22:25:04 2003 Kristian Rietveld <kris@gtk.org>
The table menu patch! Turns GtkMenu into a table, so you can attach
menu items in numerous new ways! Be creative!
Contains some bug fixes and RTL adaptions from Matthias Clasen.
* gtk/gtkmenu.c [toplevel]: introduce ATTACH_INFO_KEY, extend
GtkMenuPrivate, introduce AttachInfo, add child properties enum,
(gtk_menu_free_private), (gtk_menu_get_private): we have to free
the heights array in the private struct,
(gtk_menu_class_init): reorder code a bit, install child properties,
(get_attach_info), (get_child_attach): new utility functions,
(gtk_menu_set_child_property), (gtk_menu_get_child_property): introduce
child properties, for the attach info,
(gtk_menu_remove): remove AttachInfo from menu item,
(gtk_menu_real_insert): implemented algorithm to automagically place
inserted menu items at the correct place in the table,
(gtk_menu_size_request), (gtk_menu_size_allocate),
(compute_child_offset): reworked/rewritten to support table menus,
(gtk_menu_attach): new function,
(find_child_containing), (gtk_menu_move_current): new functions to
get table menu keynav right.
* gtk/gtkmenu.h: add gtk_menu_attach() prototype.
2003-09-10 20:32:33 +00:00
|
|
|
|
|
2011-05-17 18:10:19 +00:00
|
|
|
|
get_menu_padding (widget, &padding);
|
2011-01-12 19:35:04 +00:00
|
|
|
|
|
2010-08-18 23:42:02 +00:00
|
|
|
|
border_width = gtk_container_get_border_width (GTK_CONTAINER (menu));
|
2012-11-27 14:04:12 +00:00
|
|
|
|
avail_width -= (border_width) * 2 + padding.left + padding.right;
|
2010-08-18 23:42:02 +00:00
|
|
|
|
|
2010-12-23 23:21:53 +00:00
|
|
|
|
for (children = menu_shell->priv->children; children; children = children->next)
|
1997-11-24 22:37:52 +00:00
|
|
|
|
{
|
The table menu patch! Turns GtkMenu into a table, so you can attach menu
Wed Sep 10 22:25:04 2003 Kristian Rietveld <kris@gtk.org>
The table menu patch! Turns GtkMenu into a table, so you can attach
menu items in numerous new ways! Be creative!
Contains some bug fixes and RTL adaptions from Matthias Clasen.
* gtk/gtkmenu.c [toplevel]: introduce ATTACH_INFO_KEY, extend
GtkMenuPrivate, introduce AttachInfo, add child properties enum,
(gtk_menu_free_private), (gtk_menu_get_private): we have to free
the heights array in the private struct,
(gtk_menu_class_init): reorder code a bit, install child properties,
(get_attach_info), (get_child_attach): new utility functions,
(gtk_menu_set_child_property), (gtk_menu_get_child_property): introduce
child properties, for the attach info,
(gtk_menu_remove): remove AttachInfo from menu item,
(gtk_menu_real_insert): implemented algorithm to automagically place
inserted menu items at the correct place in the table,
(gtk_menu_size_request), (gtk_menu_size_allocate),
(compute_child_offset): reworked/rewritten to support table menus,
(gtk_menu_attach): new function,
(find_child_containing), (gtk_menu_move_current): new functions to
get table menu keynav right.
* gtk/gtkmenu.h: add gtk_menu_attach() prototype.
2003-09-10 20:32:33 +00:00
|
|
|
|
gint part;
|
|
|
|
|
gint toggle_size;
|
2005-11-10 14:33:51 +00:00
|
|
|
|
gint l, r, t, b;
|
2010-08-18 23:42:02 +00:00
|
|
|
|
gint child_min, child_nat;
|
The table menu patch! Turns GtkMenu into a table, so you can attach menu
Wed Sep 10 22:25:04 2003 Kristian Rietveld <kris@gtk.org>
The table menu patch! Turns GtkMenu into a table, so you can attach
menu items in numerous new ways! Be creative!
Contains some bug fixes and RTL adaptions from Matthias Clasen.
* gtk/gtkmenu.c [toplevel]: introduce ATTACH_INFO_KEY, extend
GtkMenuPrivate, introduce AttachInfo, add child properties enum,
(gtk_menu_free_private), (gtk_menu_get_private): we have to free
the heights array in the private struct,
(gtk_menu_class_init): reorder code a bit, install child properties,
(get_attach_info), (get_child_attach): new utility functions,
(gtk_menu_set_child_property), (gtk_menu_get_child_property): introduce
child properties, for the attach info,
(gtk_menu_remove): remove AttachInfo from menu item,
(gtk_menu_real_insert): implemented algorithm to automagically place
inserted menu items at the correct place in the table,
(gtk_menu_size_request), (gtk_menu_size_allocate),
(compute_child_offset): reworked/rewritten to support table menus,
(gtk_menu_attach): new function,
(find_child_containing), (gtk_menu_move_current): new functions to
get table menu keynav right.
* gtk/gtkmenu.h: add gtk_menu_attach() prototype.
2003-09-10 20:32:33 +00:00
|
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
|
child = children->data;
|
2010-12-23 20:50:18 +00:00
|
|
|
|
|
|
|
|
|
if (!gtk_widget_get_visible (child))
|
The table menu patch! Turns GtkMenu into a table, so you can attach menu
Wed Sep 10 22:25:04 2003 Kristian Rietveld <kris@gtk.org>
The table menu patch! Turns GtkMenu into a table, so you can attach
menu items in numerous new ways! Be creative!
Contains some bug fixes and RTL adaptions from Matthias Clasen.
* gtk/gtkmenu.c [toplevel]: introduce ATTACH_INFO_KEY, extend
GtkMenuPrivate, introduce AttachInfo, add child properties enum,
(gtk_menu_free_private), (gtk_menu_get_private): we have to free
the heights array in the private struct,
(gtk_menu_class_init): reorder code a bit, install child properties,
(get_attach_info), (get_child_attach): new utility functions,
(gtk_menu_set_child_property), (gtk_menu_get_child_property): introduce
child properties, for the attach info,
(gtk_menu_remove): remove AttachInfo from menu item,
(gtk_menu_real_insert): implemented algorithm to automagically place
inserted menu items at the correct place in the table,
(gtk_menu_size_request), (gtk_menu_size_allocate),
(compute_child_offset): reworked/rewritten to support table menus,
(gtk_menu_attach): new function,
(find_child_containing), (gtk_menu_move_current): new functions to
get table menu keynav right.
* gtk/gtkmenu.h: add gtk_menu_attach() prototype.
2003-09-10 20:32:33 +00:00
|
|
|
|
continue;
|
Add note about GtkMenuPositionFunc API changes.
2000-11-08 Alexander Larsson <alexl@redhat.com>
* docs/Changes-2.0.txt: Add note about GtkMenuPositionFunc
API changes.
* gtk/gtkmenu.c: Add support for scrolling menus.
Remove gtk_menu_append/prepend/insert, these have been moved to
gtkcompat.h as #defines.
* gtk/gtkcompat.h.in:
Add compatibility #defines for gtk_menu_append/prepend/insert
* gtk/gtkmenu.h: Add data needed for scrolling menus.
GtkMenuPositionFunc gets an extra argument push_in.
gtk_menu_append/prepend/insert removed.
* gtk/gtkmenuitem.c (gtk_menu_item_position_menu): Change menu
positioning behaviour to fit to scrolling menus.
* gtk/gtkmenuitem.c (gtk_menu_item_forall): Don't recurse
into menuitem->submeny. That is wrong, and broke torn
off submenus of torn off menus, since they were unrealized
when the first menu was unrealized.
* gtk/gtkmenushell.[ch]: Virtualize gtk_menu_shell_insert() and
gtk_menu_shell_select_item() since these need to be overridden in
GtkMenu.
* gtk/gtkoptionmenu.c (gtk_opttion_menu_position): Change menu
positioning behaviour to fit to scrolling menus.
(gtk_option_menu_key_press, gtk_option_menu_button_press): Select
the current item so that it is prelighted when the menu pops up.
This is a workaround to the fact that the menu doesn't get the
initial enter event (due to grabs).
* gtk/gtkfilesel.c, gtk/gtkinputdialog.c, gtk/testgtk.c:
s/gtk_menu_append/gtk_menu_shell_append/
* gtk/gtknotebook.c:
s/gtk_menu_insert/gtk_menu_shell_insert/
* gtk/testgtk.c (create_menu, create_menus):
Create the first menu with 50 items so that menu scrolling
can be tested.
Patch from Jonathan Blandford <jrb@redhat.com>
* gtk/gtkmenuitem.[ch] (gtk_menu_item_toggle_size_request): new
system to handle size requests. First, we ask what the size of
the toggle is. Then, when allocating the size, we allocate the
toggle_size first. This way we can have multiple menu-item
classes w/o needing a seperate class for each.
* gtk/gtkmenu.c (gtk_menu_size_request): Actually use the new system.
* gtk/gtkmenu.c (gtk_menu_size_allocate): Use the new system.
* gtk/gtkcheckmenuitem.c
(gtk_check_menu_item_toggle_size_request): New function to handle
the toggle size-request.
2000-11-08 17:34:52 +00:00
|
|
|
|
|
2004-03-15 02:03:59 +00:00
|
|
|
|
get_effective_child_attach (child, &l, &r, &t, &b);
|
The table menu patch! Turns GtkMenu into a table, so you can attach menu
Wed Sep 10 22:25:04 2003 Kristian Rietveld <kris@gtk.org>
The table menu patch! Turns GtkMenu into a table, so you can attach
menu items in numerous new ways! Be creative!
Contains some bug fixes and RTL adaptions from Matthias Clasen.
* gtk/gtkmenu.c [toplevel]: introduce ATTACH_INFO_KEY, extend
GtkMenuPrivate, introduce AttachInfo, add child properties enum,
(gtk_menu_free_private), (gtk_menu_get_private): we have to free
the heights array in the private struct,
(gtk_menu_class_init): reorder code a bit, install child properties,
(get_attach_info), (get_child_attach): new utility functions,
(gtk_menu_set_child_property), (gtk_menu_get_child_property): introduce
child properties, for the attach info,
(gtk_menu_remove): remove AttachInfo from menu item,
(gtk_menu_real_insert): implemented algorithm to automagically place
inserted menu items at the correct place in the table,
(gtk_menu_size_request), (gtk_menu_size_allocate),
(compute_child_offset): reworked/rewritten to support table menus,
(gtk_menu_attach): new function,
(find_child_containing), (gtk_menu_move_current): new functions to
get table menu keynav right.
* gtk/gtkmenu.h: add gtk_menu_attach() prototype.
2003-09-10 20:32:33 +00:00
|
|
|
|
|
2010-08-18 23:42:02 +00:00
|
|
|
|
part = avail_width / (r - l);
|
The table menu patch! Turns GtkMenu into a table, so you can attach menu
Wed Sep 10 22:25:04 2003 Kristian Rietveld <kris@gtk.org>
The table menu patch! Turns GtkMenu into a table, so you can attach
menu items in numerous new ways! Be creative!
Contains some bug fixes and RTL adaptions from Matthias Clasen.
* gtk/gtkmenu.c [toplevel]: introduce ATTACH_INFO_KEY, extend
GtkMenuPrivate, introduce AttachInfo, add child properties enum,
(gtk_menu_free_private), (gtk_menu_get_private): we have to free
the heights array in the private struct,
(gtk_menu_class_init): reorder code a bit, install child properties,
(get_attach_info), (get_child_attach): new utility functions,
(gtk_menu_set_child_property), (gtk_menu_get_child_property): introduce
child properties, for the attach info,
(gtk_menu_remove): remove AttachInfo from menu item,
(gtk_menu_real_insert): implemented algorithm to automagically place
inserted menu items at the correct place in the table,
(gtk_menu_size_request), (gtk_menu_size_allocate),
(compute_child_offset): reworked/rewritten to support table menus,
(gtk_menu_attach): new function,
(find_child_containing), (gtk_menu_move_current): new functions to
get table menu keynav right.
* gtk/gtkmenu.h: add gtk_menu_attach() prototype.
2003-09-10 20:32:33 +00:00
|
|
|
|
|
2010-09-21 14:35:17 +00:00
|
|
|
|
gtk_widget_get_preferred_height_for_width (child, part,
|
|
|
|
|
&child_min, &child_nat);
|
The table menu patch! Turns GtkMenu into a table, so you can attach menu
Wed Sep 10 22:25:04 2003 Kristian Rietveld <kris@gtk.org>
The table menu patch! Turns GtkMenu into a table, so you can attach
menu items in numerous new ways! Be creative!
Contains some bug fixes and RTL adaptions from Matthias Clasen.
* gtk/gtkmenu.c [toplevel]: introduce ATTACH_INFO_KEY, extend
GtkMenuPrivate, introduce AttachInfo, add child properties enum,
(gtk_menu_free_private), (gtk_menu_get_private): we have to free
the heights array in the private struct,
(gtk_menu_class_init): reorder code a bit, install child properties,
(get_attach_info), (get_child_attach): new utility functions,
(gtk_menu_set_child_property), (gtk_menu_get_child_property): introduce
child properties, for the attach info,
(gtk_menu_remove): remove AttachInfo from menu item,
(gtk_menu_real_insert): implemented algorithm to automagically place
inserted menu items at the correct place in the table,
(gtk_menu_size_request), (gtk_menu_size_allocate),
(compute_child_offset): reworked/rewritten to support table menus,
(gtk_menu_attach): new function,
(find_child_containing), (gtk_menu_move_current): new functions to
get table menu keynav right.
* gtk/gtkmenu.h: add gtk_menu_attach() prototype.
2003-09-10 20:32:33 +00:00
|
|
|
|
|
2010-08-18 23:42:02 +00:00
|
|
|
|
gtk_menu_item_toggle_size_request (GTK_MENU_ITEM (child), &toggle_size);
|
2010-12-23 20:50:18 +00:00
|
|
|
|
|
2010-08-18 23:42:02 +00:00
|
|
|
|
part = MAX (child_min, toggle_size) / (b - t);
|
|
|
|
|
min_heights[t] = MAX (min_heights[t], part);
|
2008-11-01 04:32:40 +00:00
|
|
|
|
|
2010-08-18 23:42:02 +00:00
|
|
|
|
part = MAX (child_nat, toggle_size) / (b - t);
|
|
|
|
|
nat_heights[t] = MAX (nat_heights[t], part);
|
2008-11-01 04:32:40 +00:00
|
|
|
|
}
|
|
|
|
|
|
2010-08-18 23:42:02 +00:00
|
|
|
|
if (ret_min_heights)
|
|
|
|
|
*ret_min_heights = min_heights;
|
|
|
|
|
else
|
|
|
|
|
g_free (min_heights);
|
2005-12-02 19:49:10 +00:00
|
|
|
|
|
2010-08-18 23:42:02 +00:00
|
|
|
|
if (ret_nat_heights)
|
|
|
|
|
*ret_nat_heights = nat_heights;
|
|
|
|
|
else
|
|
|
|
|
g_free (nat_heights);
|
2010-12-23 20:50:18 +00:00
|
|
|
|
|
2010-08-18 23:42:02 +00:00
|
|
|
|
return n_heights;
|
1997-11-24 22:37:52 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
gtk_menu_size_allocate (GtkWidget *widget,
|
2010-12-23 20:50:18 +00:00
|
|
|
|
GtkAllocation *allocation)
|
1997-11-24 22:37:52 +00:00
|
|
|
|
{
|
|
|
|
|
GtkMenu *menu;
|
2010-12-23 20:50:18 +00:00
|
|
|
|
GtkMenuPrivate *priv;
|
1997-11-24 22:37:52 +00:00
|
|
|
|
GtkMenuShell *menu_shell;
|
|
|
|
|
GtkWidget *child;
|
2015-12-21 01:30:52 +00:00
|
|
|
|
GtkAllocation arrow_allocation, child_allocation;
|
|
|
|
|
GtkAllocation clip;
|
1997-11-24 22:37:52 +00:00
|
|
|
|
GList *children;
|
2010-11-30 23:55:14 +00:00
|
|
|
|
gint x, y, i;
|
Add note about GtkMenuPositionFunc API changes.
2000-11-08 Alexander Larsson <alexl@redhat.com>
* docs/Changes-2.0.txt: Add note about GtkMenuPositionFunc
API changes.
* gtk/gtkmenu.c: Add support for scrolling menus.
Remove gtk_menu_append/prepend/insert, these have been moved to
gtkcompat.h as #defines.
* gtk/gtkcompat.h.in:
Add compatibility #defines for gtk_menu_append/prepend/insert
* gtk/gtkmenu.h: Add data needed for scrolling menus.
GtkMenuPositionFunc gets an extra argument push_in.
gtk_menu_append/prepend/insert removed.
* gtk/gtkmenuitem.c (gtk_menu_item_position_menu): Change menu
positioning behaviour to fit to scrolling menus.
* gtk/gtkmenuitem.c (gtk_menu_item_forall): Don't recurse
into menuitem->submeny. That is wrong, and broke torn
off submenus of torn off menus, since they were unrealized
when the first menu was unrealized.
* gtk/gtkmenushell.[ch]: Virtualize gtk_menu_shell_insert() and
gtk_menu_shell_select_item() since these need to be overridden in
GtkMenu.
* gtk/gtkoptionmenu.c (gtk_opttion_menu_position): Change menu
positioning behaviour to fit to scrolling menus.
(gtk_option_menu_key_press, gtk_option_menu_button_press): Select
the current item so that it is prelighted when the menu pops up.
This is a workaround to the fact that the menu doesn't get the
initial enter event (due to grabs).
* gtk/gtkfilesel.c, gtk/gtkinputdialog.c, gtk/testgtk.c:
s/gtk_menu_append/gtk_menu_shell_append/
* gtk/gtknotebook.c:
s/gtk_menu_insert/gtk_menu_shell_insert/
* gtk/testgtk.c (create_menu, create_menus):
Create the first menu with 50 items so that menu scrolling
can be tested.
Patch from Jonathan Blandford <jrb@redhat.com>
* gtk/gtkmenuitem.[ch] (gtk_menu_item_toggle_size_request): new
system to handle size requests. First, we ask what the size of
the toggle is. Then, when allocating the size, we allocate the
toggle_size first. This way we can have multiple menu-item
classes w/o needing a seperate class for each.
* gtk/gtkmenu.c (gtk_menu_size_request): Actually use the new system.
* gtk/gtkmenu.c (gtk_menu_size_allocate): Use the new system.
* gtk/gtkcheckmenuitem.c
(gtk_check_menu_item_toggle_size_request): New function to handle
the toggle size-request.
2000-11-08 17:34:52 +00:00
|
|
|
|
gint width, height;
|
2010-06-02 04:28:22 +00:00
|
|
|
|
guint border_width;
|
2015-12-21 01:30:52 +00:00
|
|
|
|
GtkBorder arrow_border, padding;
|
2010-11-21 18:40:28 +00:00
|
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
|
g_return_if_fail (GTK_IS_MENU (widget));
|
|
|
|
|
g_return_if_fail (allocation != NULL);
|
2010-12-23 20:50:18 +00:00
|
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
|
menu = GTK_MENU (widget);
|
|
|
|
|
menu_shell = GTK_MENU_SHELL (widget);
|
2010-12-23 20:50:18 +00:00
|
|
|
|
priv = menu->priv;
|
Add note about GtkMenuPositionFunc API changes.
2000-11-08 Alexander Larsson <alexl@redhat.com>
* docs/Changes-2.0.txt: Add note about GtkMenuPositionFunc
API changes.
* gtk/gtkmenu.c: Add support for scrolling menus.
Remove gtk_menu_append/prepend/insert, these have been moved to
gtkcompat.h as #defines.
* gtk/gtkcompat.h.in:
Add compatibility #defines for gtk_menu_append/prepend/insert
* gtk/gtkmenu.h: Add data needed for scrolling menus.
GtkMenuPositionFunc gets an extra argument push_in.
gtk_menu_append/prepend/insert removed.
* gtk/gtkmenuitem.c (gtk_menu_item_position_menu): Change menu
positioning behaviour to fit to scrolling menus.
* gtk/gtkmenuitem.c (gtk_menu_item_forall): Don't recurse
into menuitem->submeny. That is wrong, and broke torn
off submenus of torn off menus, since they were unrealized
when the first menu was unrealized.
* gtk/gtkmenushell.[ch]: Virtualize gtk_menu_shell_insert() and
gtk_menu_shell_select_item() since these need to be overridden in
GtkMenu.
* gtk/gtkoptionmenu.c (gtk_opttion_menu_position): Change menu
positioning behaviour to fit to scrolling menus.
(gtk_option_menu_key_press, gtk_option_menu_button_press): Select
the current item so that it is prelighted when the menu pops up.
This is a workaround to the fact that the menu doesn't get the
initial enter event (due to grabs).
* gtk/gtkfilesel.c, gtk/gtkinputdialog.c, gtk/testgtk.c:
s/gtk_menu_append/gtk_menu_shell_append/
* gtk/gtknotebook.c:
s/gtk_menu_insert/gtk_menu_shell_insert/
* gtk/testgtk.c (create_menu, create_menus):
Create the first menu with 50 items so that menu scrolling
can be tested.
Patch from Jonathan Blandford <jrb@redhat.com>
* gtk/gtkmenuitem.[ch] (gtk_menu_item_toggle_size_request): new
system to handle size requests. First, we ask what the size of
the toggle is. Then, when allocating the size, we allocate the
toggle_size first. This way we can have multiple menu-item
classes w/o needing a seperate class for each.
* gtk/gtkmenu.c (gtk_menu_size_request): Actually use the new system.
* gtk/gtkmenu.c (gtk_menu_size_allocate): Use the new system.
* gtk/gtkcheckmenuitem.c
(gtk_check_menu_item_toggle_size_request): New function to handle
the toggle size-request.
2000-11-08 17:34:52 +00:00
|
|
|
|
|
2010-08-11 21:08:37 +00:00
|
|
|
|
gtk_widget_set_allocation (widget, allocation);
|
|
|
|
|
|
2011-05-17 18:10:19 +00:00
|
|
|
|
get_menu_padding (widget, &padding);
|
2010-06-02 04:28:22 +00:00
|
|
|
|
border_width = gtk_container_get_border_width (GTK_CONTAINER (menu));
|
2010-08-18 23:42:02 +00:00
|
|
|
|
|
|
|
|
|
g_free (priv->heights);
|
2010-12-23 20:50:18 +00:00
|
|
|
|
priv->heights_length = calculate_line_heights (menu,
|
|
|
|
|
allocation->width,
|
|
|
|
|
&priv->heights,
|
|
|
|
|
NULL);
|
2010-08-18 23:42:02 +00:00
|
|
|
|
|
|
|
|
|
/* refresh our cached height request */
|
2012-11-27 14:04:12 +00:00
|
|
|
|
priv->requested_height = (2 * border_width) + padding.top + padding.bottom;
|
2010-08-18 23:42:02 +00:00
|
|
|
|
for (i = 0; i < priv->heights_length; i++)
|
|
|
|
|
priv->requested_height += priv->heights[i];
|
|
|
|
|
|
2012-11-27 14:04:12 +00:00
|
|
|
|
x = border_width + padding.left;
|
|
|
|
|
y = border_width + padding.top;
|
2015-05-31 01:27:45 +00:00
|
|
|
|
width = allocation->width - (2 * border_width) - padding.left - padding.right;
|
|
|
|
|
height = allocation->height - (2 * border_width) - padding.top - padding.bottom;
|
2002-08-02 22:03:23 +00:00
|
|
|
|
|
2010-12-23 23:21:53 +00:00
|
|
|
|
if (menu_shell->priv->active)
|
2019-01-17 18:27:51 +00:00
|
|
|
|
gtk_menu_scroll_to (menu, priv->scroll_offset, GTK_MENU_SCROLL_FLAG_NONE);
|
2006-02-22 10:10:23 +00:00
|
|
|
|
|
2015-12-21 01:30:52 +00:00
|
|
|
|
get_arrows_border (menu, &arrow_border);
|
|
|
|
|
|
|
|
|
|
arrow_allocation.x = x;
|
|
|
|
|
arrow_allocation.y = y;
|
|
|
|
|
arrow_allocation.width = width;
|
|
|
|
|
arrow_allocation.height = arrow_border.top;
|
|
|
|
|
|
|
|
|
|
if (priv->upper_arrow_visible)
|
|
|
|
|
gtk_css_gadget_allocate (priv->top_arrow_gadget,
|
|
|
|
|
&arrow_allocation, -1,
|
|
|
|
|
&clip);
|
|
|
|
|
|
|
|
|
|
arrow_allocation.y = height - y - arrow_border.bottom;
|
|
|
|
|
arrow_allocation.height = arrow_border.bottom;
|
|
|
|
|
|
|
|
|
|
if (priv->lower_arrow_visible)
|
|
|
|
|
gtk_css_gadget_allocate (priv->bottom_arrow_gadget,
|
|
|
|
|
&arrow_allocation, -1,
|
|
|
|
|
&clip);
|
|
|
|
|
|
2010-12-23 20:50:18 +00:00
|
|
|
|
if (!priv->tearoff_active)
|
Add note about GtkMenuPositionFunc API changes.
2000-11-08 Alexander Larsson <alexl@redhat.com>
* docs/Changes-2.0.txt: Add note about GtkMenuPositionFunc
API changes.
* gtk/gtkmenu.c: Add support for scrolling menus.
Remove gtk_menu_append/prepend/insert, these have been moved to
gtkcompat.h as #defines.
* gtk/gtkcompat.h.in:
Add compatibility #defines for gtk_menu_append/prepend/insert
* gtk/gtkmenu.h: Add data needed for scrolling menus.
GtkMenuPositionFunc gets an extra argument push_in.
gtk_menu_append/prepend/insert removed.
* gtk/gtkmenuitem.c (gtk_menu_item_position_menu): Change menu
positioning behaviour to fit to scrolling menus.
* gtk/gtkmenuitem.c (gtk_menu_item_forall): Don't recurse
into menuitem->submeny. That is wrong, and broke torn
off submenus of torn off menus, since they were unrealized
when the first menu was unrealized.
* gtk/gtkmenushell.[ch]: Virtualize gtk_menu_shell_insert() and
gtk_menu_shell_select_item() since these need to be overridden in
GtkMenu.
* gtk/gtkoptionmenu.c (gtk_opttion_menu_position): Change menu
positioning behaviour to fit to scrolling menus.
(gtk_option_menu_key_press, gtk_option_menu_button_press): Select
the current item so that it is prelighted when the menu pops up.
This is a workaround to the fact that the menu doesn't get the
initial enter event (due to grabs).
* gtk/gtkfilesel.c, gtk/gtkinputdialog.c, gtk/testgtk.c:
s/gtk_menu_append/gtk_menu_shell_append/
* gtk/gtknotebook.c:
s/gtk_menu_insert/gtk_menu_shell_insert/
* gtk/testgtk.c (create_menu, create_menus):
Create the first menu with 50 items so that menu scrolling
can be tested.
Patch from Jonathan Blandford <jrb@redhat.com>
* gtk/gtkmenuitem.[ch] (gtk_menu_item_toggle_size_request): new
system to handle size requests. First, we ask what the size of
the toggle is. Then, when allocating the size, we allocate the
toggle_size first. This way we can have multiple menu-item
classes w/o needing a seperate class for each.
* gtk/gtkmenu.c (gtk_menu_size_request): Actually use the new system.
* gtk/gtkmenu.c (gtk_menu_size_allocate): Use the new system.
* gtk/gtkcheckmenuitem.c
(gtk_check_menu_item_toggle_size_request): New function to handle
the toggle size-request.
2000-11-08 17:34:52 +00:00
|
|
|
|
{
|
2007-05-09 15:46:41 +00:00
|
|
|
|
y += arrow_border.top;
|
|
|
|
|
height -= arrow_border.top;
|
|
|
|
|
height -= arrow_border.bottom;
|
|
|
|
|
}
|
2006-02-22 10:10:23 +00:00
|
|
|
|
|
2010-11-30 23:55:14 +00:00
|
|
|
|
width = MAX (1, width);
|
|
|
|
|
height = MAX (1, height);
|
|
|
|
|
|
2010-03-02 06:16:02 +00:00
|
|
|
|
if (gtk_widget_get_realized (widget))
|
Add note about GtkMenuPositionFunc API changes.
2000-11-08 Alexander Larsson <alexl@redhat.com>
* docs/Changes-2.0.txt: Add note about GtkMenuPositionFunc
API changes.
* gtk/gtkmenu.c: Add support for scrolling menus.
Remove gtk_menu_append/prepend/insert, these have been moved to
gtkcompat.h as #defines.
* gtk/gtkcompat.h.in:
Add compatibility #defines for gtk_menu_append/prepend/insert
* gtk/gtkmenu.h: Add data needed for scrolling menus.
GtkMenuPositionFunc gets an extra argument push_in.
gtk_menu_append/prepend/insert removed.
* gtk/gtkmenuitem.c (gtk_menu_item_position_menu): Change menu
positioning behaviour to fit to scrolling menus.
* gtk/gtkmenuitem.c (gtk_menu_item_forall): Don't recurse
into menuitem->submeny. That is wrong, and broke torn
off submenus of torn off menus, since they were unrealized
when the first menu was unrealized.
* gtk/gtkmenushell.[ch]: Virtualize gtk_menu_shell_insert() and
gtk_menu_shell_select_item() since these need to be overridden in
GtkMenu.
* gtk/gtkoptionmenu.c (gtk_opttion_menu_position): Change menu
positioning behaviour to fit to scrolling menus.
(gtk_option_menu_key_press, gtk_option_menu_button_press): Select
the current item so that it is prelighted when the menu pops up.
This is a workaround to the fact that the menu doesn't get the
initial enter event (due to grabs).
* gtk/gtkfilesel.c, gtk/gtkinputdialog.c, gtk/testgtk.c:
s/gtk_menu_append/gtk_menu_shell_append/
* gtk/gtknotebook.c:
s/gtk_menu_insert/gtk_menu_shell_insert/
* gtk/testgtk.c (create_menu, create_menus):
Create the first menu with 50 items so that menu scrolling
can be tested.
Patch from Jonathan Blandford <jrb@redhat.com>
* gtk/gtkmenuitem.[ch] (gtk_menu_item_toggle_size_request): new
system to handle size requests. First, we ask what the size of
the toggle is. Then, when allocating the size, we allocate the
toggle_size first. This way we can have multiple menu-item
classes w/o needing a seperate class for each.
* gtk/gtkmenu.c (gtk_menu_size_request): Actually use the new system.
* gtk/gtkmenu.c (gtk_menu_size_allocate): Use the new system.
* gtk/gtkcheckmenuitem.c
(gtk_check_menu_item_toggle_size_request): New function to handle
the toggle size-request.
2000-11-08 17:34:52 +00:00
|
|
|
|
{
|
2010-08-11 21:08:37 +00:00
|
|
|
|
gdk_window_move_resize (gtk_widget_get_window (widget),
|
2010-12-23 20:50:18 +00:00
|
|
|
|
allocation->x, allocation->y,
|
|
|
|
|
allocation->width, allocation->height);
|
|
|
|
|
|
|
|
|
|
gdk_window_move_resize (priv->view_window, x, y, width, height);
|
Add note about GtkMenuPositionFunc API changes.
2000-11-08 Alexander Larsson <alexl@redhat.com>
* docs/Changes-2.0.txt: Add note about GtkMenuPositionFunc
API changes.
* gtk/gtkmenu.c: Add support for scrolling menus.
Remove gtk_menu_append/prepend/insert, these have been moved to
gtkcompat.h as #defines.
* gtk/gtkcompat.h.in:
Add compatibility #defines for gtk_menu_append/prepend/insert
* gtk/gtkmenu.h: Add data needed for scrolling menus.
GtkMenuPositionFunc gets an extra argument push_in.
gtk_menu_append/prepend/insert removed.
* gtk/gtkmenuitem.c (gtk_menu_item_position_menu): Change menu
positioning behaviour to fit to scrolling menus.
* gtk/gtkmenuitem.c (gtk_menu_item_forall): Don't recurse
into menuitem->submeny. That is wrong, and broke torn
off submenus of torn off menus, since they were unrealized
when the first menu was unrealized.
* gtk/gtkmenushell.[ch]: Virtualize gtk_menu_shell_insert() and
gtk_menu_shell_select_item() since these need to be overridden in
GtkMenu.
* gtk/gtkoptionmenu.c (gtk_opttion_menu_position): Change menu
positioning behaviour to fit to scrolling menus.
(gtk_option_menu_key_press, gtk_option_menu_button_press): Select
the current item so that it is prelighted when the menu pops up.
This is a workaround to the fact that the menu doesn't get the
initial enter event (due to grabs).
* gtk/gtkfilesel.c, gtk/gtkinputdialog.c, gtk/testgtk.c:
s/gtk_menu_append/gtk_menu_shell_append/
* gtk/gtknotebook.c:
s/gtk_menu_insert/gtk_menu_shell_insert/
* gtk/testgtk.c (create_menu, create_menus):
Create the first menu with 50 items so that menu scrolling
can be tested.
Patch from Jonathan Blandford <jrb@redhat.com>
* gtk/gtkmenuitem.[ch] (gtk_menu_item_toggle_size_request): new
system to handle size requests. First, we ask what the size of
the toggle is. Then, when allocating the size, we allocate the
toggle_size first. This way we can have multiple menu-item
classes w/o needing a seperate class for each.
* gtk/gtkmenu.c (gtk_menu_size_request): Actually use the new system.
* gtk/gtkmenu.c (gtk_menu_size_allocate): Use the new system.
* gtk/gtkcheckmenuitem.c
(gtk_check_menu_item_toggle_size_request): New function to handle
the toggle size-request.
2000-11-08 17:34:52 +00:00
|
|
|
|
}
|
1997-11-24 22:37:52 +00:00
|
|
|
|
|
2010-12-23 23:21:53 +00:00
|
|
|
|
if (menu_shell->priv->children)
|
1997-11-24 22:37:52 +00:00
|
|
|
|
{
|
2004-03-15 02:03:59 +00:00
|
|
|
|
gint base_width = width / gtk_menu_get_n_columns (menu);
|
The table menu patch! Turns GtkMenu into a table, so you can attach menu
Wed Sep 10 22:25:04 2003 Kristian Rietveld <kris@gtk.org>
The table menu patch! Turns GtkMenu into a table, so you can attach
menu items in numerous new ways! Be creative!
Contains some bug fixes and RTL adaptions from Matthias Clasen.
* gtk/gtkmenu.c [toplevel]: introduce ATTACH_INFO_KEY, extend
GtkMenuPrivate, introduce AttachInfo, add child properties enum,
(gtk_menu_free_private), (gtk_menu_get_private): we have to free
the heights array in the private struct,
(gtk_menu_class_init): reorder code a bit, install child properties,
(get_attach_info), (get_child_attach): new utility functions,
(gtk_menu_set_child_property), (gtk_menu_get_child_property): introduce
child properties, for the attach info,
(gtk_menu_remove): remove AttachInfo from menu item,
(gtk_menu_real_insert): implemented algorithm to automagically place
inserted menu items at the correct place in the table,
(gtk_menu_size_request), (gtk_menu_size_allocate),
(compute_child_offset): reworked/rewritten to support table menus,
(gtk_menu_attach): new function,
(find_child_containing), (gtk_menu_move_current): new functions to
get table menu keynav right.
* gtk/gtkmenu.h: add gtk_menu_attach() prototype.
2003-09-10 20:32:33 +00:00
|
|
|
|
|
2010-12-23 23:21:53 +00:00
|
|
|
|
children = menu_shell->priv->children;
|
1997-11-24 22:37:52 +00:00
|
|
|
|
while (children)
|
2010-12-23 20:50:18 +00:00
|
|
|
|
{
|
|
|
|
|
child = children->data;
|
|
|
|
|
children = children->next;
|
The table menu patch! Turns GtkMenu into a table, so you can attach menu
Wed Sep 10 22:25:04 2003 Kristian Rietveld <kris@gtk.org>
The table menu patch! Turns GtkMenu into a table, so you can attach
menu items in numerous new ways! Be creative!
Contains some bug fixes and RTL adaptions from Matthias Clasen.
* gtk/gtkmenu.c [toplevel]: introduce ATTACH_INFO_KEY, extend
GtkMenuPrivate, introduce AttachInfo, add child properties enum,
(gtk_menu_free_private), (gtk_menu_get_private): we have to free
the heights array in the private struct,
(gtk_menu_class_init): reorder code a bit, install child properties,
(get_attach_info), (get_child_attach): new utility functions,
(gtk_menu_set_child_property), (gtk_menu_get_child_property): introduce
child properties, for the attach info,
(gtk_menu_remove): remove AttachInfo from menu item,
(gtk_menu_real_insert): implemented algorithm to automagically place
inserted menu items at the correct place in the table,
(gtk_menu_size_request), (gtk_menu_size_allocate),
(compute_child_offset): reworked/rewritten to support table menus,
(gtk_menu_attach): new function,
(find_child_containing), (gtk_menu_move_current): new functions to
get table menu keynav right.
* gtk/gtkmenu.h: add gtk_menu_attach() prototype.
2003-09-10 20:32:33 +00:00
|
|
|
|
|
2010-12-23 20:50:18 +00:00
|
|
|
|
if (gtk_widget_get_visible (child))
|
|
|
|
|
{
|
|
|
|
|
gint l, r, t, b;
|
The table menu patch! Turns GtkMenu into a table, so you can attach menu
Wed Sep 10 22:25:04 2003 Kristian Rietveld <kris@gtk.org>
The table menu patch! Turns GtkMenu into a table, so you can attach
menu items in numerous new ways! Be creative!
Contains some bug fixes and RTL adaptions from Matthias Clasen.
* gtk/gtkmenu.c [toplevel]: introduce ATTACH_INFO_KEY, extend
GtkMenuPrivate, introduce AttachInfo, add child properties enum,
(gtk_menu_free_private), (gtk_menu_get_private): we have to free
the heights array in the private struct,
(gtk_menu_class_init): reorder code a bit, install child properties,
(get_attach_info), (get_child_attach): new utility functions,
(gtk_menu_set_child_property), (gtk_menu_get_child_property): introduce
child properties, for the attach info,
(gtk_menu_remove): remove AttachInfo from menu item,
(gtk_menu_real_insert): implemented algorithm to automagically place
inserted menu items at the correct place in the table,
(gtk_menu_size_request), (gtk_menu_size_allocate),
(compute_child_offset): reworked/rewritten to support table menus,
(gtk_menu_attach): new function,
(find_child_containing), (gtk_menu_move_current): new functions to
get table menu keynav right.
* gtk/gtkmenu.h: add gtk_menu_attach() prototype.
2003-09-10 20:32:33 +00:00
|
|
|
|
|
2010-12-23 20:50:18 +00:00
|
|
|
|
get_effective_child_attach (child, &l, &r, &t, &b);
|
The table menu patch! Turns GtkMenu into a table, so you can attach menu
Wed Sep 10 22:25:04 2003 Kristian Rietveld <kris@gtk.org>
The table menu patch! Turns GtkMenu into a table, so you can attach
menu items in numerous new ways! Be creative!
Contains some bug fixes and RTL adaptions from Matthias Clasen.
* gtk/gtkmenu.c [toplevel]: introduce ATTACH_INFO_KEY, extend
GtkMenuPrivate, introduce AttachInfo, add child properties enum,
(gtk_menu_free_private), (gtk_menu_get_private): we have to free
the heights array in the private struct,
(gtk_menu_class_init): reorder code a bit, install child properties,
(get_attach_info), (get_child_attach): new utility functions,
(gtk_menu_set_child_property), (gtk_menu_get_child_property): introduce
child properties, for the attach info,
(gtk_menu_remove): remove AttachInfo from menu item,
(gtk_menu_real_insert): implemented algorithm to automagically place
inserted menu items at the correct place in the table,
(gtk_menu_size_request), (gtk_menu_size_allocate),
(compute_child_offset): reworked/rewritten to support table menus,
(gtk_menu_attach): new function,
(find_child_containing), (gtk_menu_move_current): new functions to
get table menu keynav right.
* gtk/gtkmenu.h: add gtk_menu_attach() prototype.
2003-09-10 20:32:33 +00:00
|
|
|
|
|
|
|
|
|
if (gtk_widget_get_direction (GTK_WIDGET (menu)) == GTK_TEXT_DIR_RTL)
|
|
|
|
|
{
|
|
|
|
|
guint tmp;
|
2010-12-23 20:50:18 +00:00
|
|
|
|
tmp = gtk_menu_get_n_columns (menu) - l;
|
|
|
|
|
l = gtk_menu_get_n_columns (menu) - r;
|
The table menu patch! Turns GtkMenu into a table, so you can attach menu
Wed Sep 10 22:25:04 2003 Kristian Rietveld <kris@gtk.org>
The table menu patch! Turns GtkMenu into a table, so you can attach
menu items in numerous new ways! Be creative!
Contains some bug fixes and RTL adaptions from Matthias Clasen.
* gtk/gtkmenu.c [toplevel]: introduce ATTACH_INFO_KEY, extend
GtkMenuPrivate, introduce AttachInfo, add child properties enum,
(gtk_menu_free_private), (gtk_menu_get_private): we have to free
the heights array in the private struct,
(gtk_menu_class_init): reorder code a bit, install child properties,
(get_attach_info), (get_child_attach): new utility functions,
(gtk_menu_set_child_property), (gtk_menu_get_child_property): introduce
child properties, for the attach info,
(gtk_menu_remove): remove AttachInfo from menu item,
(gtk_menu_real_insert): implemented algorithm to automagically place
inserted menu items at the correct place in the table,
(gtk_menu_size_request), (gtk_menu_size_allocate),
(compute_child_offset): reworked/rewritten to support table menus,
(gtk_menu_attach): new function,
(find_child_containing), (gtk_menu_move_current): new functions to
get table menu keynav right.
* gtk/gtkmenu.h: add gtk_menu_attach() prototype.
2003-09-10 20:32:33 +00:00
|
|
|
|
r = tmp;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
child_allocation.width = (r - l) * base_width;
|
|
|
|
|
child_allocation.height = 0;
|
|
|
|
|
child_allocation.x = l * base_width;
|
|
|
|
|
child_allocation.y = 0;
|
|
|
|
|
|
|
|
|
|
for (i = 0; i < b; i++)
|
|
|
|
|
{
|
|
|
|
|
if (i < t)
|
|
|
|
|
child_allocation.y += priv->heights[i];
|
|
|
|
|
else
|
|
|
|
|
child_allocation.height += priv->heights[i];
|
|
|
|
|
}
|
Add note about GtkMenuPositionFunc API changes.
2000-11-08 Alexander Larsson <alexl@redhat.com>
* docs/Changes-2.0.txt: Add note about GtkMenuPositionFunc
API changes.
* gtk/gtkmenu.c: Add support for scrolling menus.
Remove gtk_menu_append/prepend/insert, these have been moved to
gtkcompat.h as #defines.
* gtk/gtkcompat.h.in:
Add compatibility #defines for gtk_menu_append/prepend/insert
* gtk/gtkmenu.h: Add data needed for scrolling menus.
GtkMenuPositionFunc gets an extra argument push_in.
gtk_menu_append/prepend/insert removed.
* gtk/gtkmenuitem.c (gtk_menu_item_position_menu): Change menu
positioning behaviour to fit to scrolling menus.
* gtk/gtkmenuitem.c (gtk_menu_item_forall): Don't recurse
into menuitem->submeny. That is wrong, and broke torn
off submenus of torn off menus, since they were unrealized
when the first menu was unrealized.
* gtk/gtkmenushell.[ch]: Virtualize gtk_menu_shell_insert() and
gtk_menu_shell_select_item() since these need to be overridden in
GtkMenu.
* gtk/gtkoptionmenu.c (gtk_opttion_menu_position): Change menu
positioning behaviour to fit to scrolling menus.
(gtk_option_menu_key_press, gtk_option_menu_button_press): Select
the current item so that it is prelighted when the menu pops up.
This is a workaround to the fact that the menu doesn't get the
initial enter event (due to grabs).
* gtk/gtkfilesel.c, gtk/gtkinputdialog.c, gtk/testgtk.c:
s/gtk_menu_append/gtk_menu_shell_append/
* gtk/gtknotebook.c:
s/gtk_menu_insert/gtk_menu_shell_insert/
* gtk/testgtk.c (create_menu, create_menus):
Create the first menu with 50 items so that menu scrolling
can be tested.
Patch from Jonathan Blandford <jrb@redhat.com>
* gtk/gtkmenuitem.[ch] (gtk_menu_item_toggle_size_request): new
system to handle size requests. First, we ask what the size of
the toggle is. Then, when allocating the size, we allocate the
toggle_size first. This way we can have multiple menu-item
classes w/o needing a seperate class for each.
* gtk/gtkmenu.c (gtk_menu_size_request): Actually use the new system.
* gtk/gtkmenu.c (gtk_menu_size_allocate): Use the new system.
* gtk/gtkcheckmenuitem.c
(gtk_check_menu_item_toggle_size_request): New function to handle
the toggle size-request.
2000-11-08 17:34:52 +00:00
|
|
|
|
|
2010-12-23 20:50:18 +00:00
|
|
|
|
gtk_menu_item_toggle_size_allocate (GTK_MENU_ITEM (child),
|
|
|
|
|
priv->toggle_size);
|
|
|
|
|
|
|
|
|
|
gtk_widget_size_allocate (child, &child_allocation);
|
|
|
|
|
gtk_widget_queue_draw (child);
|
|
|
|
|
}
|
|
|
|
|
}
|
2003-07-06 13:14:28 +00:00
|
|
|
|
|
Add note about GtkMenuPositionFunc API changes.
2000-11-08 Alexander Larsson <alexl@redhat.com>
* docs/Changes-2.0.txt: Add note about GtkMenuPositionFunc
API changes.
* gtk/gtkmenu.c: Add support for scrolling menus.
Remove gtk_menu_append/prepend/insert, these have been moved to
gtkcompat.h as #defines.
* gtk/gtkcompat.h.in:
Add compatibility #defines for gtk_menu_append/prepend/insert
* gtk/gtkmenu.h: Add data needed for scrolling menus.
GtkMenuPositionFunc gets an extra argument push_in.
gtk_menu_append/prepend/insert removed.
* gtk/gtkmenuitem.c (gtk_menu_item_position_menu): Change menu
positioning behaviour to fit to scrolling menus.
* gtk/gtkmenuitem.c (gtk_menu_item_forall): Don't recurse
into menuitem->submeny. That is wrong, and broke torn
off submenus of torn off menus, since they were unrealized
when the first menu was unrealized.
* gtk/gtkmenushell.[ch]: Virtualize gtk_menu_shell_insert() and
gtk_menu_shell_select_item() since these need to be overridden in
GtkMenu.
* gtk/gtkoptionmenu.c (gtk_opttion_menu_position): Change menu
positioning behaviour to fit to scrolling menus.
(gtk_option_menu_key_press, gtk_option_menu_button_press): Select
the current item so that it is prelighted when the menu pops up.
This is a workaround to the fact that the menu doesn't get the
initial enter event (due to grabs).
* gtk/gtkfilesel.c, gtk/gtkinputdialog.c, gtk/testgtk.c:
s/gtk_menu_append/gtk_menu_shell_append/
* gtk/gtknotebook.c:
s/gtk_menu_insert/gtk_menu_shell_insert/
* gtk/testgtk.c (create_menu, create_menus):
Create the first menu with 50 items so that menu scrolling
can be tested.
Patch from Jonathan Blandford <jrb@redhat.com>
* gtk/gtkmenuitem.[ch] (gtk_menu_item_toggle_size_request): new
system to handle size requests. First, we ask what the size of
the toggle is. Then, when allocating the size, we allocate the
toggle_size first. This way we can have multiple menu-item
classes w/o needing a seperate class for each.
* gtk/gtkmenu.c (gtk_menu_size_request): Actually use the new system.
* gtk/gtkmenu.c (gtk_menu_size_allocate): Use the new system.
* gtk/gtkcheckmenuitem.c
(gtk_check_menu_item_toggle_size_request): New function to handle
the toggle size-request.
2000-11-08 17:34:52 +00:00
|
|
|
|
/* Resize the item window */
|
2010-03-02 06:16:02 +00:00
|
|
|
|
if (gtk_widget_get_realized (widget))
|
2010-12-23 20:50:18 +00:00
|
|
|
|
{
|
2015-05-31 01:27:45 +00:00
|
|
|
|
gint w, h;
|
Add note about GtkMenuPositionFunc API changes.
2000-11-08 Alexander Larsson <alexl@redhat.com>
* docs/Changes-2.0.txt: Add note about GtkMenuPositionFunc
API changes.
* gtk/gtkmenu.c: Add support for scrolling menus.
Remove gtk_menu_append/prepend/insert, these have been moved to
gtkcompat.h as #defines.
* gtk/gtkcompat.h.in:
Add compatibility #defines for gtk_menu_append/prepend/insert
* gtk/gtkmenu.h: Add data needed for scrolling menus.
GtkMenuPositionFunc gets an extra argument push_in.
gtk_menu_append/prepend/insert removed.
* gtk/gtkmenuitem.c (gtk_menu_item_position_menu): Change menu
positioning behaviour to fit to scrolling menus.
* gtk/gtkmenuitem.c (gtk_menu_item_forall): Don't recurse
into menuitem->submeny. That is wrong, and broke torn
off submenus of torn off menus, since they were unrealized
when the first menu was unrealized.
* gtk/gtkmenushell.[ch]: Virtualize gtk_menu_shell_insert() and
gtk_menu_shell_select_item() since these need to be overridden in
GtkMenu.
* gtk/gtkoptionmenu.c (gtk_opttion_menu_position): Change menu
positioning behaviour to fit to scrolling menus.
(gtk_option_menu_key_press, gtk_option_menu_button_press): Select
the current item so that it is prelighted when the menu pops up.
This is a workaround to the fact that the menu doesn't get the
initial enter event (due to grabs).
* gtk/gtkfilesel.c, gtk/gtkinputdialog.c, gtk/testgtk.c:
s/gtk_menu_append/gtk_menu_shell_append/
* gtk/gtknotebook.c:
s/gtk_menu_insert/gtk_menu_shell_insert/
* gtk/testgtk.c (create_menu, create_menus):
Create the first menu with 50 items so that menu scrolling
can be tested.
Patch from Jonathan Blandford <jrb@redhat.com>
* gtk/gtkmenuitem.[ch] (gtk_menu_item_toggle_size_request): new
system to handle size requests. First, we ask what the size of
the toggle is. Then, when allocating the size, we allocate the
toggle_size first. This way we can have multiple menu-item
classes w/o needing a seperate class for each.
* gtk/gtkmenu.c (gtk_menu_size_request): Actually use the new system.
* gtk/gtkmenu.c (gtk_menu_size_allocate): Use the new system.
* gtk/gtkcheckmenuitem.c
(gtk_check_menu_item_toggle_size_request): New function to handle
the toggle size-request.
2000-11-08 17:34:52 +00:00
|
|
|
|
|
2015-05-31 01:27:45 +00:00
|
|
|
|
h = 0;
|
2010-12-23 20:50:18 +00:00
|
|
|
|
for (i = 0; i < gtk_menu_get_n_rows (menu); i++)
|
2015-05-31 01:27:45 +00:00
|
|
|
|
h += priv->heights[i];
|
The table menu patch! Turns GtkMenu into a table, so you can attach menu
Wed Sep 10 22:25:04 2003 Kristian Rietveld <kris@gtk.org>
The table menu patch! Turns GtkMenu into a table, so you can attach
menu items in numerous new ways! Be creative!
Contains some bug fixes and RTL adaptions from Matthias Clasen.
* gtk/gtkmenu.c [toplevel]: introduce ATTACH_INFO_KEY, extend
GtkMenuPrivate, introduce AttachInfo, add child properties enum,
(gtk_menu_free_private), (gtk_menu_get_private): we have to free
the heights array in the private struct,
(gtk_menu_class_init): reorder code a bit, install child properties,
(get_attach_info), (get_child_attach): new utility functions,
(gtk_menu_set_child_property), (gtk_menu_get_child_property): introduce
child properties, for the attach info,
(gtk_menu_remove): remove AttachInfo from menu item,
(gtk_menu_real_insert): implemented algorithm to automagically place
inserted menu items at the correct place in the table,
(gtk_menu_size_request), (gtk_menu_size_allocate),
(compute_child_offset): reworked/rewritten to support table menus,
(gtk_menu_attach): new function,
(find_child_containing), (gtk_menu_move_current): new functions to
get table menu keynav right.
* gtk/gtkmenu.h: add gtk_menu_attach() prototype.
2003-09-10 20:32:33 +00:00
|
|
|
|
|
2015-05-31 01:27:45 +00:00
|
|
|
|
w = gtk_menu_get_n_columns (menu) * base_width;
|
|
|
|
|
gdk_window_resize (priv->bin_window, w, h);
|
2010-12-23 20:50:18 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (priv->tearoff_active)
|
|
|
|
|
{
|
|
|
|
|
if (height >= priv->requested_height)
|
|
|
|
|
{
|
|
|
|
|
if (gtk_widget_get_visible (priv->tearoff_scrollbar))
|
|
|
|
|
{
|
|
|
|
|
gtk_widget_hide (priv->tearoff_scrollbar);
|
|
|
|
|
gtk_menu_set_tearoff_hints (menu, allocation->width);
|
|
|
|
|
|
2019-01-17 18:27:51 +00:00
|
|
|
|
gtk_menu_scroll_to (menu, 0, GTK_MENU_SCROLL_FLAG_NONE);
|
2010-12-23 20:50:18 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2011-01-05 18:26:14 +00:00
|
|
|
|
gtk_adjustment_configure (priv->tearoff_adjustment,
|
|
|
|
|
gtk_adjustment_get_value (priv->tearoff_adjustment),
|
|
|
|
|
0,
|
|
|
|
|
priv->requested_height,
|
|
|
|
|
gtk_adjustment_get_step_increment (priv->tearoff_adjustment),
|
|
|
|
|
gtk_adjustment_get_page_increment (priv->tearoff_adjustment),
|
|
|
|
|
allocation->height);
|
2010-12-23 20:50:18 +00:00
|
|
|
|
|
|
|
|
|
if (!gtk_widget_get_visible (priv->tearoff_scrollbar))
|
|
|
|
|
{
|
|
|
|
|
gtk_widget_show (priv->tearoff_scrollbar);
|
|
|
|
|
gtk_menu_set_tearoff_hints (menu, allocation->width);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
1997-11-24 22:37:52 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2010-09-06 15:32:30 +00:00
|
|
|
|
static gboolean
|
|
|
|
|
gtk_menu_draw (GtkWidget *widget,
|
2010-12-23 20:50:18 +00:00
|
|
|
|
cairo_t *cr)
|
1997-11-24 22:37:52 +00:00
|
|
|
|
{
|
Add note about GtkMenuPositionFunc API changes.
2000-11-08 Alexander Larsson <alexl@redhat.com>
* docs/Changes-2.0.txt: Add note about GtkMenuPositionFunc
API changes.
* gtk/gtkmenu.c: Add support for scrolling menus.
Remove gtk_menu_append/prepend/insert, these have been moved to
gtkcompat.h as #defines.
* gtk/gtkcompat.h.in:
Add compatibility #defines for gtk_menu_append/prepend/insert
* gtk/gtkmenu.h: Add data needed for scrolling menus.
GtkMenuPositionFunc gets an extra argument push_in.
gtk_menu_append/prepend/insert removed.
* gtk/gtkmenuitem.c (gtk_menu_item_position_menu): Change menu
positioning behaviour to fit to scrolling menus.
* gtk/gtkmenuitem.c (gtk_menu_item_forall): Don't recurse
into menuitem->submeny. That is wrong, and broke torn
off submenus of torn off menus, since they were unrealized
when the first menu was unrealized.
* gtk/gtkmenushell.[ch]: Virtualize gtk_menu_shell_insert() and
gtk_menu_shell_select_item() since these need to be overridden in
GtkMenu.
* gtk/gtkoptionmenu.c (gtk_opttion_menu_position): Change menu
positioning behaviour to fit to scrolling menus.
(gtk_option_menu_key_press, gtk_option_menu_button_press): Select
the current item so that it is prelighted when the menu pops up.
This is a workaround to the fact that the menu doesn't get the
initial enter event (due to grabs).
* gtk/gtkfilesel.c, gtk/gtkinputdialog.c, gtk/testgtk.c:
s/gtk_menu_append/gtk_menu_shell_append/
* gtk/gtknotebook.c:
s/gtk_menu_insert/gtk_menu_shell_insert/
* gtk/testgtk.c (create_menu, create_menus):
Create the first menu with 50 items so that menu scrolling
can be tested.
Patch from Jonathan Blandford <jrb@redhat.com>
* gtk/gtkmenuitem.[ch] (gtk_menu_item_toggle_size_request): new
system to handle size requests. First, we ask what the size of
the toggle is. Then, when allocating the size, we allocate the
toggle_size first. This way we can have multiple menu-item
classes w/o needing a seperate class for each.
* gtk/gtkmenu.c (gtk_menu_size_request): Actually use the new system.
* gtk/gtkmenu.c (gtk_menu_size_allocate): Use the new system.
* gtk/gtkcheckmenuitem.c
(gtk_check_menu_item_toggle_size_request): New function to handle
the toggle size-request.
2000-11-08 17:34:52 +00:00
|
|
|
|
GtkMenu *menu;
|
2006-02-22 10:10:23 +00:00
|
|
|
|
GtkMenuPrivate *priv;
|
2010-11-21 18:40:28 +00:00
|
|
|
|
GtkStyleContext *context;
|
2015-12-21 01:30:52 +00:00
|
|
|
|
gint width, height;
|
2010-11-21 18:40:28 +00:00
|
|
|
|
|
Add note about GtkMenuPositionFunc API changes.
2000-11-08 Alexander Larsson <alexl@redhat.com>
* docs/Changes-2.0.txt: Add note about GtkMenuPositionFunc
API changes.
* gtk/gtkmenu.c: Add support for scrolling menus.
Remove gtk_menu_append/prepend/insert, these have been moved to
gtkcompat.h as #defines.
* gtk/gtkcompat.h.in:
Add compatibility #defines for gtk_menu_append/prepend/insert
* gtk/gtkmenu.h: Add data needed for scrolling menus.
GtkMenuPositionFunc gets an extra argument push_in.
gtk_menu_append/prepend/insert removed.
* gtk/gtkmenuitem.c (gtk_menu_item_position_menu): Change menu
positioning behaviour to fit to scrolling menus.
* gtk/gtkmenuitem.c (gtk_menu_item_forall): Don't recurse
into menuitem->submeny. That is wrong, and broke torn
off submenus of torn off menus, since they were unrealized
when the first menu was unrealized.
* gtk/gtkmenushell.[ch]: Virtualize gtk_menu_shell_insert() and
gtk_menu_shell_select_item() since these need to be overridden in
GtkMenu.
* gtk/gtkoptionmenu.c (gtk_opttion_menu_position): Change menu
positioning behaviour to fit to scrolling menus.
(gtk_option_menu_key_press, gtk_option_menu_button_press): Select
the current item so that it is prelighted when the menu pops up.
This is a workaround to the fact that the menu doesn't get the
initial enter event (due to grabs).
* gtk/gtkfilesel.c, gtk/gtkinputdialog.c, gtk/testgtk.c:
s/gtk_menu_append/gtk_menu_shell_append/
* gtk/gtknotebook.c:
s/gtk_menu_insert/gtk_menu_shell_insert/
* gtk/testgtk.c (create_menu, create_menus):
Create the first menu with 50 items so that menu scrolling
can be tested.
Patch from Jonathan Blandford <jrb@redhat.com>
* gtk/gtkmenuitem.[ch] (gtk_menu_item_toggle_size_request): new
system to handle size requests. First, we ask what the size of
the toggle is. Then, when allocating the size, we allocate the
toggle_size first. This way we can have multiple menu-item
classes w/o needing a seperate class for each.
* gtk/gtkmenu.c (gtk_menu_size_request): Actually use the new system.
* gtk/gtkmenu.c (gtk_menu_size_allocate): Use the new system.
* gtk/gtkcheckmenuitem.c
(gtk_check_menu_item_toggle_size_request): New function to handle
the toggle size-request.
2000-11-08 17:34:52 +00:00
|
|
|
|
menu = GTK_MENU (widget);
|
2011-01-04 17:32:22 +00:00
|
|
|
|
priv = menu->priv;
|
2010-11-21 18:40:28 +00:00
|
|
|
|
context = gtk_widget_get_style_context (widget);
|
2010-08-11 21:08:37 +00:00
|
|
|
|
|
2015-12-21 01:30:52 +00:00
|
|
|
|
width = gtk_widget_get_allocated_width (widget);
|
|
|
|
|
height = gtk_widget_get_allocated_height (widget);
|
2001-12-12 21:30:08 +00:00
|
|
|
|
|
2010-09-06 15:32:30 +00:00
|
|
|
|
if (gtk_cairo_should_draw_window (cr, gtk_widget_get_window (widget)))
|
1997-11-24 22:37:52 +00:00
|
|
|
|
{
|
2010-11-21 18:40:28 +00:00
|
|
|
|
gtk_render_background (context, cr, 0, 0,
|
2015-12-21 01:30:52 +00:00
|
|
|
|
width, height);
|
2010-11-21 18:40:28 +00:00
|
|
|
|
gtk_render_frame (context, cr, 0, 0,
|
2015-12-21 01:30:52 +00:00
|
|
|
|
width, height);
|
2010-11-21 18:40:28 +00:00
|
|
|
|
|
2010-12-23 20:50:18 +00:00
|
|
|
|
if (priv->upper_arrow_visible && !priv->tearoff_active)
|
2015-12-21 01:30:52 +00:00
|
|
|
|
gtk_css_gadget_draw (priv->top_arrow_gadget, cr);
|
2006-02-22 10:10:23 +00:00
|
|
|
|
|
2010-12-23 20:50:18 +00:00
|
|
|
|
if (priv->lower_arrow_visible && !priv->tearoff_active)
|
2015-12-21 01:30:52 +00:00
|
|
|
|
gtk_css_gadget_draw (priv->bottom_arrow_gadget, cr);
|
2010-09-06 15:32:30 +00:00
|
|
|
|
}
|
Tue Mar 16 17:43:33 1999 Tim Janik <timj@gtk.org>
Wed Mar 17 01:46:28 1999 Tim Janik <timj@gtk.org>
* merges from gtk-1-2:
Tue Mar 16 17:43:33 1999 Tim Janik <timj@gtk.org>
* gtk/gtkitemfactory.c (gtk_item_factory_parse_rc_string): ensure the
item factory class has been created.
(gtk_item_factory_parse_rc): likewise.
* gtk/gtkmenu.c:
keep proper references for old_active_menu_item.
(gtk_menu_reparent): unset the usize of the new parent,
so the menu can sanely be size requested and we don't get nasty screen
artefacts upon next reparentation.
(gtk_menu_motion_notify): set send_event to TRUE if we synthesize an
enter notify. only synthesize enter notifies if the pointer really is
inside the event window.
(gtk_menu_popdown): use gtk_menu_shell_deselect().
(gtk_menu_popup): move the background setting stuff into
gtk_menu_tearoff_bg_copy() so it can be called from other places as well.
* gtk/gtkmenushell.c (gtk_menu_shell_button_press): use
gtk_menu_shell_select_item() to select the new item.
(gtk_menu_shell_deselect): export this function, so gtkmenu.c can
do the right thing for deselection as well.
Sat Mar 15 20:10:33 1999 Tim Janik <timj@gtk.org>
* gtk/gtkwidget.[hc]:
(gtk_widget_accelerators_locked): return whether a widget's accelerators
are locked.
* gtk/gtkmenu.c (gtk_menu_key_press): don't remove or install new or
existing accelerators if the widget's accelerators are locked.
Sat Mar 14 19:44:05 1999 Tim Janik <timj@gtk.org>
* gtk/gtkitemfactory.[hc]: allow managing of foreign menu items.
* gtk/gtkmenu.c: truely forward key press and key release events to
the menu widget from the toplevel or tearoff window. we can't simply
connect to that, we need to stop further processing of the events as
well.
Sat Mar 13 13:14:17 1999 Tim Janik <timj@gtk.org>
* gtk/gtkmenu.c:
(gtk_menu_key_press): pass event->keyval, event->state to
gtk_accelerator_valid, instead of event->keyval twice.
refuse to install single letter accelerators for menus that use
single letter shortcuts.
* gtk/gtkitemfactory.c (gtk_item_factory_create_item): use
gtk_menu_ensure_uline_accel_group().
* gtk/gtkmenu.[hc]: added gtk_menu_ensure_uline_accel_group()
which will always return an uline accel group, made
gtk_menu_get_uline_accel_group() return NULL if the group isn't
yet created.
Mon Mar 15 01:03:27 1999 Lars Hamann <lars@gtk.org>
* gtk/gtkclist.h (struct _GtkCListColumn): added button_passive flag.
* gtk/gtkclist.c (gtk_clist_column_title_passive):
Leave button sensitive, trap button_press, button_release,
motion_notify, enter_notify and leave_notify events instead.
(gtk_clist_column_title_active): disconnect event handler.
(gtk_clist_drag_data_get): fixed memory leak. Reported by
Guillaume Laurent <glaurent@worldnet.fr>
Wed Mar 10 23:49:55 1999 Lars Hamann <lars@gtk.org>
* gtk/gtklayout.c (gtk_layout_adjustment_changed): fixed a few
width/height mixups.
* gtk/gtkctree.c (tree_delete): emit an tree_unselect_row signal
if needed.
Wed Mar 10 00:11:32 1999 Tim Janik <timj@gtk.org>
* gtk/testgtk.c (create_item_factory): unref the item factory after
window's destruction.
* gtk/gtkmenushell.c (gtk_menu_shell_activate_item): keep a reference
count on the menu shell around the menu item's activation, since the
signal emission may cause menu shell destruction.
* gtk/gtkitemfactory.c:
the previous code leaked one accel group per menu. we use
gtk_menu_get_uline_accel_group() now to fix that, and with that
also create the underline accelerator group of the menus only if
required (i.e. an underline accelerator has been specified).
(gtk_item_factory_construct):
(gtk_item_factory_create_item): removed code that would create an
extra accel group for the menu (and leak references).
(gtk_item_factory_create_item): adapted the underline accelerator
installation code to properly feature gtk_menu_get_uline_accel_group().
* gtk/gtkmenu.[hc]: added gtk_menu_get_accel_group() to retrive
menu->accel_group, this may return NULL if the accelerator group
hasn't been set yet.
added gtk_menu_get_uline_accel_group() to retrive the underline
accelerator group of the menu, this will be created on demand
and proper care is taken about its reference count.
* gtk/gtkitemfactory.h:
* gtk/gtkitemfactory.c:
dumped the approach of keeping a widgets by action list on the
factory since the factory<->widget destroy negotiation didn't work
and would be hard to get going at all. instead we keep a list of
GtkItemFactoryItem items on the factory (GtkItemFactoryItems are
persistant throughout a program's life time).
also, i removed the static const gchar *key_* variables, and made
them inline strings (they weren't actually used anyways).
(gtk_item_factory_add_item): update ifactory->items.
(gtk_item_factory_destroy): destroy ifactory->items (and remove
the item factory pointer from the remaining ifactory widgets).
(gtk_item_factory_get_widget_by_action): walk the GtkItemFactoryItem
list to find the widget.
(gtk_item_factory_get_item): new function that works around
gtk_item_factory_get_widget() limitations, this function will only
return menu items, even for <Branch> entries.
Tue Mar 9 01:01:28 1999 Tim Janik <timj@gtk.org>
* gdk/gdkfont.c (gdk_font_load): first lookup the xfont ID in our
font hash table, if we have a GdkFontPrivate entry for this font
already, simply increment its reference count, provided by Olaf Dietsche
<olaf.dietsche+list.gtk@netcologne.de>.
* gtk/gtkstyle.c (gtk_style_copy): plug a GdkFont reference leak, fix
provided by Olaf Dietsche <olaf.dietsche+list.gtk@netcologne.de>.
Sun Mar 7 06:13:29 1999 Tim Janik <timj@gtk.org>
* gtk/gtkcontainer.c:
(gtk_container_add_with_args):
(gtk_container_addv):
(gtk_container_add): before adding a child to a conatiner, make sure
it is (default) constructed, this is neccessary because under certain
circumstances the child will get relized and mapped immediatedly, in
which case it has to be constructed already.
Mon Mar 1 17:58:21 1999 Tim Janik <timj@gtk.org>
* gtk/gtksignal.c (gtk_signal_connect_by_type): count object_signal
values > 1 as TRUE also.
1999-03-17 01:39:42 +00:00
|
|
|
|
|
2016-03-24 18:50:45 +00:00
|
|
|
|
if (gtk_cairo_should_draw_window (cr, priv->bin_window))
|
|
|
|
|
{
|
|
|
|
|
int x, y;
|
|
|
|
|
|
|
|
|
|
gdk_window_get_position (priv->view_window, &x, &y);
|
|
|
|
|
cairo_rectangle (cr,
|
|
|
|
|
x, y,
|
|
|
|
|
gdk_window_get_width (priv->view_window),
|
|
|
|
|
gdk_window_get_height (priv->view_window));
|
|
|
|
|
cairo_clip (cr);
|
|
|
|
|
|
|
|
|
|
GTK_WIDGET_CLASS (gtk_menu_parent_class)->draw (widget, cr);
|
|
|
|
|
}
|
2008-08-12 09:06:34 +00:00
|
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
|
|
|
|
|
added gtkaccelmap.sgml. other updates.
Mon Nov 12 23:06:38 2001 Tim Janik <timj@gtk.org>
* added gtkaccelmap.sgml. other updates.
Mon Nov 12 23:08:37 2001 Tim Janik <timj@gtk.org>
* gtk/maketypes.awk: fix type utils generation on unix.
* gtk/gtkaccelmap.[hc]: new files, implementing a global accelerator
registry.
* gtk/gtkaccelgroup.[hc]: major API/implementation revamp:
removed GTK_ACCEL_SIGNAL_VISIBLE, gtk_accel_group_get_default,
gtk_accel_group_get_entry, gtk_accel_group_(un)lock_entry,
gtk_accel_group_add/remove, gtk_accel_group_handle_add/remove,
gtk_accel_group_create_add/remove, gtk_accel_group_entries_from_object.
introduced ::accel_changed signal for change notification, and
gtk_accel_group_connect/disconnect to connect closures to accel groups.
made gtk_accel_group_attach/detach and gtk_accel_group_activate private
functions.
deprecated gtk_accel_group_ref/unref.
* gtk/gtkaccellabel.[hc]: changes to make accellabels pay attention
to accel group changed notification and basically operate on closures.
removed gtk_accel_label_get_accel_object and
gtk_accel_label_set_accel_object.
introduced gtk_accel_label_set_accel_closure, and for convenience,
gtk_accel_label_set_accel_widget.
* gtk/gtkitemfactory.[hc]: removed accelerator propagation code
which mostly moved into gtkaccelmap.[hc].
removed gtk_item_factory_parse_rc*, gtk_item_factory_dump_*
and gtk_item_factory_print_func.
* gtk/gtkmain.c: call _gtk_accel_map_init().
* gtk/gtkmenuitem.[hc]: introduced gtk_menu_item_set_accel_path(),
that associates an accelerator path with menu items, through which
persistent accelerator settings on menu items are enabled.
* gtk/gtkmenu.[hc]: added gtk_menu_set_accel_path() so accelerator
paths of menu item can be default constructed to allow installation
of accelerators on menu items that don't come with an accelerator
binding by default.
* gtk/gtksettings.c: fix STRING type rc settings by special casing
them appropriately in the parser.
* gtk/gtksignal.[hc]: allow a class function offset of 0 for
gtk_signal_newv().
* gtk/gtkwidget.[hc]: accelerator API revamp.
removed ::accelerator_add/remove signals, gtk_widget_accelerator_signal,
gtk_widget_accelerators_locked, gtk_widget_remove_accelerators and
gtk_widget_(un)lock_accelerators.
accelerators maintained through gtk_widget_add/remove_accelerator()
are not runtime changable now, the correct sequence to setup a
widget for runtime changable accelerators is now:
gtk_accel_map_add_entry(accel_path, key, mods);
_gtk_widget_set_accel_path(widget, accel_path, accel_group);
* gtk/gtkwindow.[hc]: accelerator changes, proxy and coalesce accel
group changes (as well as mnemonic changes) through the new signal
::accels_changed.
Sat Nov 10 12:08:56 2001 Tim Janik <timj@gtk.org>
* gtk/gtksettings.c (_gtk_settings_parse_convert): properly handle
GString->string conversions.
2001-11-13 00:53:47 +00:00
|
|
|
|
static void
|
|
|
|
|
gtk_menu_show (GtkWidget *widget)
|
|
|
|
|
{
|
|
|
|
|
GtkMenu *menu = GTK_MENU (widget);
|
|
|
|
|
|
|
|
|
|
_gtk_menu_refresh_accel_paths (menu, FALSE);
|
|
|
|
|
|
2006-05-02 23:56:43 +00:00
|
|
|
|
GTK_WIDGET_CLASS (gtk_menu_parent_class)->show (widget);
|
added gtkaccelmap.sgml. other updates.
Mon Nov 12 23:06:38 2001 Tim Janik <timj@gtk.org>
* added gtkaccelmap.sgml. other updates.
Mon Nov 12 23:08:37 2001 Tim Janik <timj@gtk.org>
* gtk/maketypes.awk: fix type utils generation on unix.
* gtk/gtkaccelmap.[hc]: new files, implementing a global accelerator
registry.
* gtk/gtkaccelgroup.[hc]: major API/implementation revamp:
removed GTK_ACCEL_SIGNAL_VISIBLE, gtk_accel_group_get_default,
gtk_accel_group_get_entry, gtk_accel_group_(un)lock_entry,
gtk_accel_group_add/remove, gtk_accel_group_handle_add/remove,
gtk_accel_group_create_add/remove, gtk_accel_group_entries_from_object.
introduced ::accel_changed signal for change notification, and
gtk_accel_group_connect/disconnect to connect closures to accel groups.
made gtk_accel_group_attach/detach and gtk_accel_group_activate private
functions.
deprecated gtk_accel_group_ref/unref.
* gtk/gtkaccellabel.[hc]: changes to make accellabels pay attention
to accel group changed notification and basically operate on closures.
removed gtk_accel_label_get_accel_object and
gtk_accel_label_set_accel_object.
introduced gtk_accel_label_set_accel_closure, and for convenience,
gtk_accel_label_set_accel_widget.
* gtk/gtkitemfactory.[hc]: removed accelerator propagation code
which mostly moved into gtkaccelmap.[hc].
removed gtk_item_factory_parse_rc*, gtk_item_factory_dump_*
and gtk_item_factory_print_func.
* gtk/gtkmain.c: call _gtk_accel_map_init().
* gtk/gtkmenuitem.[hc]: introduced gtk_menu_item_set_accel_path(),
that associates an accelerator path with menu items, through which
persistent accelerator settings on menu items are enabled.
* gtk/gtkmenu.[hc]: added gtk_menu_set_accel_path() so accelerator
paths of menu item can be default constructed to allow installation
of accelerators on menu items that don't come with an accelerator
binding by default.
* gtk/gtksettings.c: fix STRING type rc settings by special casing
them appropriately in the parser.
* gtk/gtksignal.[hc]: allow a class function offset of 0 for
gtk_signal_newv().
* gtk/gtkwidget.[hc]: accelerator API revamp.
removed ::accelerator_add/remove signals, gtk_widget_accelerator_signal,
gtk_widget_accelerators_locked, gtk_widget_remove_accelerators and
gtk_widget_(un)lock_accelerators.
accelerators maintained through gtk_widget_add/remove_accelerator()
are not runtime changable now, the correct sequence to setup a
widget for runtime changable accelerators is now:
gtk_accel_map_add_entry(accel_path, key, mods);
_gtk_widget_set_accel_path(widget, accel_path, accel_group);
* gtk/gtkwindow.[hc]: accelerator changes, proxy and coalesce accel
group changes (as well as mnemonic changes) through the new signal
::accels_changed.
Sat Nov 10 12:08:56 2001 Tim Janik <timj@gtk.org>
* gtk/gtksettings.c (_gtk_settings_parse_convert): properly handle
GString->string conversions.
2001-11-13 00:53:47 +00:00
|
|
|
|
}
|
|
|
|
|
|
2010-08-18 23:42:02 +00:00
|
|
|
|
|
|
|
|
|
static void
|
2010-09-21 14:35:17 +00:00
|
|
|
|
gtk_menu_get_preferred_width (GtkWidget *widget,
|
|
|
|
|
gint *minimum_size,
|
|
|
|
|
gint *natural_size)
|
2010-08-18 23:42:02 +00:00
|
|
|
|
{
|
|
|
|
|
GtkMenu *menu;
|
|
|
|
|
GtkMenuShell *menu_shell;
|
|
|
|
|
GtkMenuPrivate *priv;
|
|
|
|
|
GtkWidget *child;
|
|
|
|
|
GList *children;
|
|
|
|
|
guint max_toggle_size;
|
|
|
|
|
guint max_accel_width;
|
2010-11-30 23:55:14 +00:00
|
|
|
|
guint border_width;
|
2010-08-18 23:42:02 +00:00
|
|
|
|
gint child_min, child_nat;
|
|
|
|
|
gint min_width, nat_width;
|
2011-05-17 18:10:19 +00:00
|
|
|
|
GtkBorder padding;
|
2010-08-18 23:42:02 +00:00
|
|
|
|
|
|
|
|
|
menu = GTK_MENU (widget);
|
|
|
|
|
menu_shell = GTK_MENU_SHELL (widget);
|
2010-12-23 20:50:18 +00:00
|
|
|
|
priv = menu->priv;
|
2010-08-11 21:08:37 +00:00
|
|
|
|
|
2010-08-18 23:42:02 +00:00
|
|
|
|
min_width = nat_width = 0;
|
2010-12-23 20:50:18 +00:00
|
|
|
|
|
2010-08-18 23:42:02 +00:00
|
|
|
|
max_toggle_size = 0;
|
|
|
|
|
max_accel_width = 0;
|
2010-12-23 20:50:18 +00:00
|
|
|
|
|
2010-12-23 23:21:53 +00:00
|
|
|
|
children = menu_shell->priv->children;
|
2010-08-18 23:42:02 +00:00
|
|
|
|
while (children)
|
|
|
|
|
{
|
|
|
|
|
gint part;
|
|
|
|
|
gint toggle_size;
|
|
|
|
|
gint l, r, t, b;
|
|
|
|
|
|
|
|
|
|
child = children->data;
|
|
|
|
|
children = children->next;
|
2010-12-23 20:50:18 +00:00
|
|
|
|
|
2010-08-18 23:42:02 +00:00
|
|
|
|
if (! gtk_widget_get_visible (child))
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
get_effective_child_attach (child, &l, &r, &t, &b);
|
|
|
|
|
|
|
|
|
|
/* It's important to size_request the child
|
|
|
|
|
* before doing the toggle size request, in
|
|
|
|
|
* case the toggle size request depends on the size
|
|
|
|
|
* request of a child of the child (e.g. for ImageMenuItem)
|
|
|
|
|
*/
|
2010-09-21 14:35:17 +00:00
|
|
|
|
gtk_widget_get_preferred_width (child, &child_min, &child_nat);
|
2010-08-18 23:42:02 +00:00
|
|
|
|
|
|
|
|
|
gtk_menu_item_toggle_size_request (GTK_MENU_ITEM (child), &toggle_size);
|
|
|
|
|
max_toggle_size = MAX (max_toggle_size, toggle_size);
|
|
|
|
|
max_accel_width = MAX (max_accel_width,
|
2010-12-27 01:36:51 +00:00
|
|
|
|
GTK_MENU_ITEM (child)->priv->accelerator_width);
|
2010-08-18 23:42:02 +00:00
|
|
|
|
|
|
|
|
|
part = child_min / (r - l);
|
|
|
|
|
min_width = MAX (min_width, part);
|
|
|
|
|
|
|
|
|
|
part = child_nat / (r - l);
|
|
|
|
|
nat_width = MAX (nat_width, part);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* If the menu doesn't include any images or check items
|
|
|
|
|
* reserve the space so that all menus are consistent.
|
|
|
|
|
* We only do this for 'ordinary' menus, not for combobox
|
|
|
|
|
* menus or multi-column menus
|
|
|
|
|
*/
|
2010-12-23 20:50:18 +00:00
|
|
|
|
if (max_toggle_size == 0 &&
|
2010-08-18 23:42:02 +00:00
|
|
|
|
gtk_menu_get_n_columns (menu) == 1 &&
|
|
|
|
|
!priv->no_toggle_size)
|
|
|
|
|
{
|
2015-12-19 01:52:16 +00:00
|
|
|
|
GtkWidget *menu_item;
|
|
|
|
|
GtkCssGadget *indicator_gadget;
|
|
|
|
|
gint indicator_width;
|
|
|
|
|
|
|
|
|
|
/* Create a GtkCheckMenuItem, to query indicator size */
|
|
|
|
|
menu_item = gtk_check_menu_item_new ();
|
|
|
|
|
indicator_gadget = _gtk_check_menu_item_get_indicator_gadget
|
|
|
|
|
(GTK_CHECK_MENU_ITEM (menu_item));
|
|
|
|
|
|
|
|
|
|
gtk_css_gadget_get_preferred_size (indicator_gadget,
|
|
|
|
|
GTK_ORIENTATION_HORIZONTAL,
|
|
|
|
|
-1,
|
|
|
|
|
&indicator_width, NULL,
|
|
|
|
|
NULL, NULL);
|
|
|
|
|
max_toggle_size = indicator_width;
|
|
|
|
|
|
|
|
|
|
gtk_widget_destroy (menu_item);
|
2016-11-23 19:50:16 +00:00
|
|
|
|
g_object_ref_sink (menu_item);
|
|
|
|
|
g_object_unref (menu_item);
|
2010-08-18 23:42:02 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
min_width += 2 * max_toggle_size + max_accel_width;
|
|
|
|
|
min_width *= gtk_menu_get_n_columns (menu);
|
|
|
|
|
|
|
|
|
|
nat_width += 2 * max_toggle_size + max_accel_width;
|
|
|
|
|
nat_width *= gtk_menu_get_n_columns (menu);
|
|
|
|
|
|
2011-05-17 18:10:19 +00:00
|
|
|
|
get_menu_padding (widget, &padding);
|
2010-08-18 23:42:02 +00:00
|
|
|
|
border_width = gtk_container_get_border_width (GTK_CONTAINER (menu));
|
2012-11-27 14:04:12 +00:00
|
|
|
|
min_width += (2 * border_width) + padding.left + padding.right;
|
|
|
|
|
nat_width += (2 * border_width) + padding.left + padding.right;
|
2010-11-30 23:55:14 +00:00
|
|
|
|
|
2010-12-23 20:50:18 +00:00
|
|
|
|
priv->toggle_size = max_toggle_size;
|
2010-08-18 23:42:02 +00:00
|
|
|
|
priv->accel_size = max_accel_width;
|
|
|
|
|
|
2014-04-30 07:23:04 +00:00
|
|
|
|
*minimum_size = min_width;
|
|
|
|
|
*natural_size = nat_width;
|
2010-08-18 23:42:02 +00:00
|
|
|
|
|
2010-12-23 20:50:18 +00:00
|
|
|
|
/* Don't resize the tearoff if it is not active,
|
|
|
|
|
* because it won't redraw (it is only a background pixmap).
|
2010-08-18 23:42:02 +00:00
|
|
|
|
*/
|
2010-12-23 20:50:18 +00:00
|
|
|
|
if (priv->tearoff_active)
|
2010-08-18 23:42:02 +00:00
|
|
|
|
gtk_menu_set_tearoff_hints (menu, min_width);
|
|
|
|
|
}
|
|
|
|
|
|
2010-12-23 20:50:18 +00:00
|
|
|
|
static void
|
2010-09-21 14:35:17 +00:00
|
|
|
|
gtk_menu_get_preferred_height (GtkWidget *widget,
|
|
|
|
|
gint *minimum_size,
|
|
|
|
|
gint *natural_size)
|
2010-08-18 23:42:02 +00:00
|
|
|
|
{
|
2014-05-01 23:31:31 +00:00
|
|
|
|
gint min_width, nat_width;
|
2010-08-18 23:42:02 +00:00
|
|
|
|
|
2010-12-23 20:50:18 +00:00
|
|
|
|
/* Menus are height-for-width only, just return the height
|
|
|
|
|
* for the minimum width
|
|
|
|
|
*/
|
2014-05-01 23:31:31 +00:00
|
|
|
|
GTK_WIDGET_GET_CLASS (widget)->get_preferred_width (widget, &min_width, &nat_width);
|
2010-09-21 14:35:17 +00:00
|
|
|
|
GTK_WIDGET_GET_CLASS (widget)->get_preferred_height_for_width (widget, min_width, minimum_size, natural_size);
|
2010-08-18 23:42:02 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
2010-09-21 14:35:17 +00:00
|
|
|
|
gtk_menu_get_preferred_height_for_width (GtkWidget *widget,
|
|
|
|
|
gint for_size,
|
|
|
|
|
gint *minimum_size,
|
|
|
|
|
gint *natural_size)
|
2010-08-18 23:42:02 +00:00
|
|
|
|
{
|
2013-11-25 02:46:25 +00:00
|
|
|
|
GtkBorder padding, arrow_border;
|
2010-08-21 01:15:35 +00:00
|
|
|
|
GtkMenu *menu = GTK_MENU (widget);
|
2010-12-23 20:50:18 +00:00
|
|
|
|
GtkMenuPrivate *priv = menu->priv;
|
2010-08-21 01:15:35 +00:00
|
|
|
|
guint *min_heights, *nat_heights;
|
2012-11-27 14:04:12 +00:00
|
|
|
|
guint border_width;
|
2010-08-21 01:15:35 +00:00
|
|
|
|
gint n_heights, i;
|
2013-11-25 02:46:25 +00:00
|
|
|
|
gint min_height, single_height, nat_height;
|
2010-08-18 23:42:02 +00:00
|
|
|
|
|
|
|
|
|
border_width = gtk_container_get_border_width (GTK_CONTAINER (menu));
|
2011-05-17 18:10:19 +00:00
|
|
|
|
get_menu_padding (widget, &padding);
|
2011-01-12 19:35:04 +00:00
|
|
|
|
|
2012-11-27 14:04:12 +00:00
|
|
|
|
min_height = nat_height = (2 * border_width) + padding.top + padding.bottom;
|
2013-11-25 02:46:25 +00:00
|
|
|
|
single_height = 0;
|
2010-08-18 23:42:02 +00:00
|
|
|
|
|
2010-12-23 20:50:18 +00:00
|
|
|
|
n_heights =
|
2010-08-18 23:42:02 +00:00
|
|
|
|
calculate_line_heights (menu, for_size, &min_heights, &nat_heights);
|
|
|
|
|
|
|
|
|
|
for (i = 0; i < n_heights; i++)
|
|
|
|
|
{
|
|
|
|
|
min_height += min_heights[i];
|
2013-11-25 02:46:25 +00:00
|
|
|
|
single_height = MAX (single_height, min_heights[i]);
|
2010-08-18 23:42:02 +00:00
|
|
|
|
nat_height += nat_heights[i];
|
|
|
|
|
}
|
|
|
|
|
|
2013-11-25 02:46:25 +00:00
|
|
|
|
get_arrows_border (menu, &arrow_border);
|
|
|
|
|
single_height += (2 * border_width)
|
|
|
|
|
+ padding.top + padding.bottom
|
|
|
|
|
+ arrow_border.top + arrow_border.bottom;
|
|
|
|
|
min_height = MIN (min_height, single_height);
|
|
|
|
|
|
2010-12-23 20:50:18 +00:00
|
|
|
|
if (priv->have_position)
|
2010-08-21 01:15:35 +00:00
|
|
|
|
{
|
2016-04-11 02:59:53 +00:00
|
|
|
|
GdkDisplay *display;
|
|
|
|
|
GdkMonitor *monitor;
|
|
|
|
|
GdkRectangle workarea;
|
2014-10-31 01:10:13 +00:00
|
|
|
|
GtkBorder border;
|
2010-08-21 01:15:35 +00:00
|
|
|
|
|
2016-04-11 02:59:53 +00:00
|
|
|
|
display = gtk_widget_get_display (priv->toplevel);
|
|
|
|
|
monitor = gdk_display_get_monitor (display, priv->monitor_num);
|
|
|
|
|
gdk_monitor_get_workarea (monitor, &workarea);
|
2010-12-23 20:50:18 +00:00
|
|
|
|
|
2016-04-11 02:59:53 +00:00
|
|
|
|
if (priv->position_y + min_height > workarea.y + workarea.height)
|
|
|
|
|
min_height = workarea.y + workarea.height - priv->position_y;
|
2010-08-21 01:15:35 +00:00
|
|
|
|
|
2016-04-11 02:59:53 +00:00
|
|
|
|
if (priv->position_y + nat_height > workarea.y + workarea.height)
|
|
|
|
|
nat_height = workarea.y + workarea.height - priv->position_y;
|
2010-08-21 01:15:35 +00:00
|
|
|
|
|
2014-10-31 01:10:13 +00:00
|
|
|
|
_gtk_window_get_shadow_width (GTK_WINDOW (priv->toplevel), &border);
|
|
|
|
|
|
2016-04-11 02:59:53 +00:00
|
|
|
|
if (priv->position_y + border.top < workarea.y)
|
2010-12-23 20:50:18 +00:00
|
|
|
|
{
|
2016-04-11 02:59:53 +00:00
|
|
|
|
min_height -= workarea.y - (priv->position_y + border.top);
|
|
|
|
|
nat_height -= workarea.y - (priv->position_y + border.top);
|
2010-12-23 20:50:18 +00:00
|
|
|
|
}
|
2010-08-21 01:15:35 +00:00
|
|
|
|
}
|
|
|
|
|
|
2014-04-30 07:23:04 +00:00
|
|
|
|
*minimum_size = min_height;
|
|
|
|
|
*natural_size = nat_height;
|
2010-08-18 23:42:02 +00:00
|
|
|
|
|
|
|
|
|
g_free (min_heights);
|
|
|
|
|
g_free (nat_heights);
|
|
|
|
|
}
|
|
|
|
|
|
2007-03-29 15:47:49 +00:00
|
|
|
|
static gboolean
|
|
|
|
|
pointer_in_menu_window (GtkWidget *widget,
|
|
|
|
|
gdouble x_root,
|
|
|
|
|
gdouble y_root)
|
|
|
|
|
{
|
|
|
|
|
GtkMenu *menu = GTK_MENU (widget);
|
2010-12-23 20:50:18 +00:00
|
|
|
|
GtkMenuPrivate *priv = menu->priv;
|
|
|
|
|
GtkAllocation allocation;
|
2007-03-29 15:47:49 +00:00
|
|
|
|
|
2010-12-23 20:50:18 +00:00
|
|
|
|
if (gtk_widget_get_mapped (priv->toplevel))
|
2007-03-29 15:47:49 +00:00
|
|
|
|
{
|
|
|
|
|
GtkMenuShell *menu_shell;
|
|
|
|
|
gint window_x, window_y;
|
|
|
|
|
|
2010-12-23 20:50:18 +00:00
|
|
|
|
gdk_window_get_position (gtk_widget_get_window (priv->toplevel),
|
2010-08-11 21:08:37 +00:00
|
|
|
|
&window_x, &window_y);
|
2007-03-29 15:47:49 +00:00
|
|
|
|
|
2010-08-11 21:08:37 +00:00
|
|
|
|
gtk_widget_get_allocation (widget, &allocation);
|
|
|
|
|
if (x_root >= window_x && x_root < window_x + allocation.width &&
|
|
|
|
|
y_root >= window_y && y_root < window_y + allocation.height)
|
2007-03-29 15:47:49 +00:00
|
|
|
|
return TRUE;
|
|
|
|
|
|
|
|
|
|
menu_shell = GTK_MENU_SHELL (widget);
|
|
|
|
|
|
2010-12-23 23:21:53 +00:00
|
|
|
|
if (GTK_IS_MENU (menu_shell->priv->parent_menu_shell))
|
|
|
|
|
return pointer_in_menu_window (menu_shell->priv->parent_menu_shell,
|
2007-03-29 15:47:49 +00:00
|
|
|
|
x_root, y_root);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
|
|
|
|
|
2006-02-22 10:10:23 +00:00
|
|
|
|
static gboolean
|
|
|
|
|
gtk_menu_button_press (GtkWidget *widget,
|
|
|
|
|
GdkEventButton *event)
|
|
|
|
|
{
|
2011-12-12 19:07:57 +00:00
|
|
|
|
GdkDevice *source_device;
|
|
|
|
|
GtkWidget *event_widget;
|
|
|
|
|
GtkMenu *menu;
|
|
|
|
|
|
2006-02-22 10:10:23 +00:00
|
|
|
|
if (event->type != GDK_BUTTON_PRESS)
|
|
|
|
|
return FALSE;
|
|
|
|
|
|
2011-12-12 19:07:57 +00:00
|
|
|
|
source_device = gdk_event_get_source_device ((GdkEvent *) event);
|
|
|
|
|
event_widget = gtk_get_event_widget ((GdkEvent *) event);
|
|
|
|
|
menu = GTK_MENU (widget);
|
|
|
|
|
|
2007-03-29 15:47:49 +00:00
|
|
|
|
/* Don't pass down to menu shell if a non-menuitem part of the menu
|
|
|
|
|
* was clicked. The check for the event_widget being a GtkMenuShell
|
|
|
|
|
* works because we have the pointer grabbed on menu_shell->window
|
|
|
|
|
* with owner_events=TRUE, so all events that are either outside
|
|
|
|
|
* the menu or on its border are delivered relative to
|
|
|
|
|
* menu_shell->window.
|
|
|
|
|
*/
|
2011-12-12 19:07:57 +00:00
|
|
|
|
if (GTK_IS_MENU_SHELL (event_widget) &&
|
2007-03-29 15:47:49 +00:00
|
|
|
|
pointer_in_menu_window (widget, event->x_root, event->y_root))
|
|
|
|
|
return TRUE;
|
|
|
|
|
|
2011-12-12 19:07:57 +00:00
|
|
|
|
if (GTK_IS_MENU_ITEM (event_widget) &&
|
|
|
|
|
gdk_device_get_source (source_device) == GDK_SOURCE_TOUCHSCREEN &&
|
|
|
|
|
GTK_MENU_ITEM (event_widget)->priv->submenu != NULL &&
|
|
|
|
|
!gtk_widget_is_drawable (GTK_MENU_ITEM (event_widget)->priv->submenu))
|
|
|
|
|
menu->priv->ignore_button_release = TRUE;
|
|
|
|
|
|
2006-05-02 23:56:43 +00:00
|
|
|
|
return GTK_WIDGET_CLASS (gtk_menu_parent_class)->button_press_event (widget, event);
|
2002-11-09 20:52:31 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
|
gtk_menu_button_release (GtkWidget *widget,
|
2010-12-23 20:50:18 +00:00
|
|
|
|
GdkEventButton *event)
|
2002-11-09 20:52:31 +00:00
|
|
|
|
{
|
2010-12-23 20:50:18 +00:00
|
|
|
|
GtkMenuPrivate *priv = GTK_MENU (widget)->priv;
|
2002-11-09 20:52:31 +00:00
|
|
|
|
|
2007-02-01 13:57:36 +00:00
|
|
|
|
if (priv->ignore_button_release)
|
|
|
|
|
{
|
|
|
|
|
priv->ignore_button_release = FALSE;
|
|
|
|
|
return FALSE;
|
2002-11-09 20:52:31 +00:00
|
|
|
|
}
|
|
|
|
|
|
2006-02-22 10:10:23 +00:00
|
|
|
|
if (event->type != GDK_BUTTON_RELEASE)
|
|
|
|
|
return FALSE;
|
|
|
|
|
|
2007-03-29 15:47:49 +00:00
|
|
|
|
/* Don't pass down to menu shell if a non-menuitem part of the menu
|
|
|
|
|
* was clicked (see comment in button_press()).
|
|
|
|
|
*/
|
|
|
|
|
if (GTK_IS_MENU_SHELL (gtk_get_event_widget ((GdkEvent *) event)) &&
|
|
|
|
|
pointer_in_menu_window (widget, event->x_root, event->y_root))
|
2007-09-11 17:38:12 +00:00
|
|
|
|
{
|
|
|
|
|
/* Ugly: make sure menu_shell->button gets reset to 0 when we
|
|
|
|
|
* bail out early here so it is in a consistent state for the
|
|
|
|
|
* next button_press/button_release in GtkMenuShell.
|
|
|
|
|
* See bug #449371.
|
|
|
|
|
*/
|
2010-12-23 23:21:53 +00:00
|
|
|
|
if (GTK_MENU_SHELL (widget)->priv->active)
|
|
|
|
|
GTK_MENU_SHELL (widget)->priv->button = 0;
|
2007-09-11 17:38:12 +00:00
|
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
|
}
|
2007-03-29 15:47:49 +00:00
|
|
|
|
|
2006-05-02 23:56:43 +00:00
|
|
|
|
return GTK_WIDGET_CLASS (gtk_menu_parent_class)->button_release_event (widget, event);
|
2002-11-09 20:52:31 +00:00
|
|
|
|
}
|
|
|
|
|
|
2000-09-02 02:43:50 +00:00
|
|
|
|
static gboolean
|
2010-12-23 20:50:18 +00:00
|
|
|
|
gtk_menu_key_press (GtkWidget *widget,
|
|
|
|
|
GdkEventKey *event)
|
1997-11-24 22:37:52 +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
|
|
|
|
GtkMenu *menu;
|
2010-12-23 20:50:18 +00:00
|
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
|
g_return_val_if_fail (GTK_IS_MENU (widget), FALSE);
|
|
|
|
|
g_return_val_if_fail (event != NULL, FALSE);
|
2010-12-23 20:50:18 +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
|
|
|
|
menu = GTK_MENU (widget);
|
2010-12-23 20:50:18 +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_menu_stop_navigating_submenu (menu);
|
2000-09-02 02:43:50 +00:00
|
|
|
|
|
2013-06-26 16:00:42 +00:00
|
|
|
|
return GTK_WIDGET_CLASS (gtk_menu_parent_class)->key_press_event (widget, event);
|
1997-11-24 22:37:52 +00:00
|
|
|
|
}
|
|
|
|
|
|
2004-12-22 16:52:23 +00:00
|
|
|
|
static gboolean
|
|
|
|
|
check_threshold (GtkWidget *widget,
|
2008-09-03 13:18:34 +00:00
|
|
|
|
gint start_x,
|
|
|
|
|
gint start_y,
|
|
|
|
|
gint x,
|
|
|
|
|
gint y)
|
2004-12-22 16:52:23 +00:00
|
|
|
|
{
|
|
|
|
|
#define THRESHOLD 8
|
2010-12-23 20:50:18 +00:00
|
|
|
|
|
2004-12-22 16:52:23 +00:00
|
|
|
|
return
|
2010-12-23 20:50:18 +00:00
|
|
|
|
ABS (start_x - x) > THRESHOLD ||
|
2004-12-22 16:52:23 +00:00
|
|
|
|
ABS (start_y - y) > THRESHOLD;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static gboolean
|
2008-09-03 13:18:34 +00:00
|
|
|
|
definitely_within_item (GtkWidget *widget,
|
|
|
|
|
gint x,
|
|
|
|
|
gint y)
|
2004-12-22 16:52:23 +00:00
|
|
|
|
{
|
2010-12-27 01:36:51 +00:00
|
|
|
|
GdkWindow *window = GTK_MENU_ITEM (widget)->priv->event_window;
|
2004-12-22 16:52:23 +00:00
|
|
|
|
int w, h;
|
|
|
|
|
|
2010-09-20 14:39:25 +00:00
|
|
|
|
w = gdk_window_get_width (window);
|
|
|
|
|
h = gdk_window_get_height (window);
|
2010-12-23 20:50:18 +00:00
|
|
|
|
|
2004-12-22 16:52:23 +00:00
|
|
|
|
return
|
|
|
|
|
check_threshold (widget, 0, 0, x, y) &&
|
|
|
|
|
check_threshold (widget, w - 1, 0, x, y) &&
|
|
|
|
|
check_threshold (widget, w - 1, h - 1, x, y) &&
|
|
|
|
|
check_threshold (widget, 0, h - 1, x, y);
|
|
|
|
|
}
|
|
|
|
|
|
2010-06-16 11:14:01 +00:00
|
|
|
|
static gboolean
|
|
|
|
|
gtk_menu_has_navigation_triangle (GtkMenu *menu)
|
|
|
|
|
{
|
2010-12-23 20:50:18 +00:00
|
|
|
|
GtkMenuPrivate *priv = menu->priv;
|
2010-06-16 11:14:01 +00:00
|
|
|
|
|
|
|
|
|
return priv->navigation_height && priv->navigation_width;
|
|
|
|
|
}
|
|
|
|
|
|
2000-09-02 02:43:50 +00:00
|
|
|
|
static gboolean
|
2008-09-03 13:18:34 +00:00
|
|
|
|
gtk_menu_motion_notify (GtkWidget *widget,
|
|
|
|
|
GdkEventMotion *event)
|
1997-11-24 22:37:52 +00:00
|
|
|
|
{
|
2000-09-02 02:43:50 +00:00
|
|
|
|
GtkWidget *menu_item;
|
|
|
|
|
GtkMenu *menu;
|
|
|
|
|
GtkMenuShell *menu_shell;
|
2010-08-11 21:08:37 +00:00
|
|
|
|
GtkWidget *parent;
|
2011-12-12 17:11:57 +00:00
|
|
|
|
GdkDevice *source_device;
|
2000-09-02 02:43:50 +00:00
|
|
|
|
|
|
|
|
|
gboolean need_enter;
|
|
|
|
|
|
2011-12-12 17:11:57 +00:00
|
|
|
|
source_device = gdk_event_get_source_device ((GdkEvent *) event);
|
|
|
|
|
|
|
|
|
|
if (GTK_IS_MENU (widget) &&
|
|
|
|
|
gdk_device_get_source (source_device) != GDK_SOURCE_TOUCHSCREEN)
|
2006-02-22 10:10:23 +00:00
|
|
|
|
{
|
2010-12-23 20:50:18 +00:00
|
|
|
|
GtkMenuPrivate *priv = GTK_MENU(widget)->priv;
|
2006-02-22 10:10:23 +00:00
|
|
|
|
|
|
|
|
|
if (priv->ignore_button_release)
|
|
|
|
|
priv->ignore_button_release = FALSE;
|
|
|
|
|
|
|
|
|
|
gtk_menu_handle_scrolling (GTK_MENU (widget), event->x_root, event->y_root,
|
|
|
|
|
TRUE, TRUE);
|
|
|
|
|
}
|
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
|
|
|
|
|
2000-09-02 02:43:50 +00:00
|
|
|
|
/* We received the event for one of two reasons:
|
|
|
|
|
*
|
|
|
|
|
* a) We are the active menu, and did gtk_grab_add()
|
|
|
|
|
* b) The widget is a child of ours, and the event was propagated
|
|
|
|
|
*
|
|
|
|
|
* Since for computation of navigation regions, we want the menu which
|
|
|
|
|
* is the parent of the menu item, for a), we need to find that menu,
|
|
|
|
|
* which may be different from 'widget'.
|
|
|
|
|
*/
|
|
|
|
|
menu_item = gtk_get_event_widget ((GdkEvent*) event);
|
2010-08-11 21:08:37 +00:00
|
|
|
|
parent = gtk_widget_get_parent (menu_item);
|
2006-02-22 10:10:23 +00:00
|
|
|
|
if (!GTK_IS_MENU_ITEM (menu_item) ||
|
2010-08-11 21:08:37 +00:00
|
|
|
|
!GTK_IS_MENU (parent))
|
2000-09-02 02:43:50 +00:00
|
|
|
|
return FALSE;
|
|
|
|
|
|
2010-08-11 21:08:37 +00:00
|
|
|
|
menu_shell = GTK_MENU_SHELL (parent);
|
2000-09-02 02:43:50 +00:00
|
|
|
|
menu = GTK_MENU (menu_shell);
|
2004-12-22 16:52:23 +00:00
|
|
|
|
|
|
|
|
|
if (definitely_within_item (menu_item, event->x, event->y))
|
2010-12-23 23:21:53 +00:00
|
|
|
|
menu_shell->priv->activate_time = 0;
|
2007-04-25 12:11:08 +00:00
|
|
|
|
|
2010-12-23 23:21:53 +00:00
|
|
|
|
need_enter = (gtk_menu_has_navigation_triangle (menu) || menu_shell->priv->ignore_enter);
|
2000-09-02 02:43:50 +00:00
|
|
|
|
|
|
|
|
|
/* Check to see if we are within an active submenu's navigation region
|
|
|
|
|
*/
|
|
|
|
|
if (gtk_menu_navigating_submenu (menu, event->x_root, event->y_root))
|
2010-12-23 20:50:18 +00:00
|
|
|
|
return TRUE;
|
2000-09-02 02:43:50 +00:00
|
|
|
|
|
2004-02-21 18:20:59 +00:00
|
|
|
|
/* Make sure we pop down if we enter a non-selectable menu item, so we
|
|
|
|
|
* don't show a submenu when the cursor is outside the stay-up triangle.
|
|
|
|
|
*/
|
|
|
|
|
if (!_gtk_menu_item_is_selectable (menu_item))
|
|
|
|
|
{
|
2010-03-14 20:11:48 +00:00
|
|
|
|
/* We really want to deselect, but this gives the menushell code
|
|
|
|
|
* a chance to do some bookkeeping about the menuitem.
|
|
|
|
|
*/
|
|
|
|
|
gtk_menu_shell_select_item (menu_shell, menu_item);
|
2004-02-21 18:20:59 +00:00
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
|
|
|
|
|
2000-09-02 02:43:50 +00:00
|
|
|
|
if (need_enter)
|
1997-11-24 22:37:52 +00:00
|
|
|
|
{
|
2000-09-02 02:43:50 +00:00
|
|
|
|
/* The menu is now sensitive to enter events on its items, but
|
|
|
|
|
* was previously sensitive. So we fake an enter event.
|
|
|
|
|
*/
|
2010-12-23 23:21:53 +00:00
|
|
|
|
menu_shell->priv->ignore_enter = FALSE;
|
2010-12-23 20:50:18 +00:00
|
|
|
|
|
2010-09-20 14:39:25 +00:00
|
|
|
|
if (event->x >= 0 && event->x < gdk_window_get_width (event->window) &&
|
2010-12-23 20:50:18 +00:00
|
|
|
|
event->y >= 0 && event->y < gdk_window_get_height (event->window))
|
|
|
|
|
{
|
|
|
|
|
GdkEvent *send_event = gdk_event_new (GDK_ENTER_NOTIFY);
|
|
|
|
|
gboolean result;
|
|
|
|
|
|
|
|
|
|
send_event->crossing.window = g_object_ref (event->window);
|
|
|
|
|
send_event->crossing.time = event->time;
|
|
|
|
|
send_event->crossing.send_event = TRUE;
|
|
|
|
|
send_event->crossing.x_root = event->x_root;
|
|
|
|
|
send_event->crossing.y_root = event->y_root;
|
|
|
|
|
send_event->crossing.x = event->x;
|
|
|
|
|
send_event->crossing.y = event->y;
|
2007-02-14 11:52:27 +00:00
|
|
|
|
send_event->crossing.state = event->state;
|
2010-05-25 22:38:44 +00:00
|
|
|
|
gdk_event_set_device (send_event, gdk_event_get_device ((GdkEvent *) event));
|
2000-09-02 02:43:50 +00:00
|
|
|
|
|
2010-12-23 20:50:18 +00:00
|
|
|
|
/* We send the event to 'widget', the currently active menu,
|
|
|
|
|
* instead of 'menu', the menu that the pointer is in. This
|
|
|
|
|
* will ensure that the event will be ignored unless the
|
|
|
|
|
* menuitem is a child of the active menu or some parent
|
|
|
|
|
* menu of the active menu.
|
|
|
|
|
*/
|
|
|
|
|
result = gtk_widget_event (widget, send_event);
|
|
|
|
|
gdk_event_free (send_event);
|
|
|
|
|
|
|
|
|
|
return result;
|
|
|
|
|
}
|
1997-11-24 22:37:52 +00:00
|
|
|
|
}
|
Tue Mar 16 17:43:33 1999 Tim Janik <timj@gtk.org>
Wed Mar 17 01:46:28 1999 Tim Janik <timj@gtk.org>
* merges from gtk-1-2:
Tue Mar 16 17:43:33 1999 Tim Janik <timj@gtk.org>
* gtk/gtkitemfactory.c (gtk_item_factory_parse_rc_string): ensure the
item factory class has been created.
(gtk_item_factory_parse_rc): likewise.
* gtk/gtkmenu.c:
keep proper references for old_active_menu_item.
(gtk_menu_reparent): unset the usize of the new parent,
so the menu can sanely be size requested and we don't get nasty screen
artefacts upon next reparentation.
(gtk_menu_motion_notify): set send_event to TRUE if we synthesize an
enter notify. only synthesize enter notifies if the pointer really is
inside the event window.
(gtk_menu_popdown): use gtk_menu_shell_deselect().
(gtk_menu_popup): move the background setting stuff into
gtk_menu_tearoff_bg_copy() so it can be called from other places as well.
* gtk/gtkmenushell.c (gtk_menu_shell_button_press): use
gtk_menu_shell_select_item() to select the new item.
(gtk_menu_shell_deselect): export this function, so gtkmenu.c can
do the right thing for deselection as well.
Sat Mar 15 20:10:33 1999 Tim Janik <timj@gtk.org>
* gtk/gtkwidget.[hc]:
(gtk_widget_accelerators_locked): return whether a widget's accelerators
are locked.
* gtk/gtkmenu.c (gtk_menu_key_press): don't remove or install new or
existing accelerators if the widget's accelerators are locked.
Sat Mar 14 19:44:05 1999 Tim Janik <timj@gtk.org>
* gtk/gtkitemfactory.[hc]: allow managing of foreign menu items.
* gtk/gtkmenu.c: truely forward key press and key release events to
the menu widget from the toplevel or tearoff window. we can't simply
connect to that, we need to stop further processing of the events as
well.
Sat Mar 13 13:14:17 1999 Tim Janik <timj@gtk.org>
* gtk/gtkmenu.c:
(gtk_menu_key_press): pass event->keyval, event->state to
gtk_accelerator_valid, instead of event->keyval twice.
refuse to install single letter accelerators for menus that use
single letter shortcuts.
* gtk/gtkitemfactory.c (gtk_item_factory_create_item): use
gtk_menu_ensure_uline_accel_group().
* gtk/gtkmenu.[hc]: added gtk_menu_ensure_uline_accel_group()
which will always return an uline accel group, made
gtk_menu_get_uline_accel_group() return NULL if the group isn't
yet created.
Mon Mar 15 01:03:27 1999 Lars Hamann <lars@gtk.org>
* gtk/gtkclist.h (struct _GtkCListColumn): added button_passive flag.
* gtk/gtkclist.c (gtk_clist_column_title_passive):
Leave button sensitive, trap button_press, button_release,
motion_notify, enter_notify and leave_notify events instead.
(gtk_clist_column_title_active): disconnect event handler.
(gtk_clist_drag_data_get): fixed memory leak. Reported by
Guillaume Laurent <glaurent@worldnet.fr>
Wed Mar 10 23:49:55 1999 Lars Hamann <lars@gtk.org>
* gtk/gtklayout.c (gtk_layout_adjustment_changed): fixed a few
width/height mixups.
* gtk/gtkctree.c (tree_delete): emit an tree_unselect_row signal
if needed.
Wed Mar 10 00:11:32 1999 Tim Janik <timj@gtk.org>
* gtk/testgtk.c (create_item_factory): unref the item factory after
window's destruction.
* gtk/gtkmenushell.c (gtk_menu_shell_activate_item): keep a reference
count on the menu shell around the menu item's activation, since the
signal emission may cause menu shell destruction.
* gtk/gtkitemfactory.c:
the previous code leaked one accel group per menu. we use
gtk_menu_get_uline_accel_group() now to fix that, and with that
also create the underline accelerator group of the menus only if
required (i.e. an underline accelerator has been specified).
(gtk_item_factory_construct):
(gtk_item_factory_create_item): removed code that would create an
extra accel group for the menu (and leak references).
(gtk_item_factory_create_item): adapted the underline accelerator
installation code to properly feature gtk_menu_get_uline_accel_group().
* gtk/gtkmenu.[hc]: added gtk_menu_get_accel_group() to retrive
menu->accel_group, this may return NULL if the accelerator group
hasn't been set yet.
added gtk_menu_get_uline_accel_group() to retrive the underline
accelerator group of the menu, this will be created on demand
and proper care is taken about its reference count.
* gtk/gtkitemfactory.h:
* gtk/gtkitemfactory.c:
dumped the approach of keeping a widgets by action list on the
factory since the factory<->widget destroy negotiation didn't work
and would be hard to get going at all. instead we keep a list of
GtkItemFactoryItem items on the factory (GtkItemFactoryItems are
persistant throughout a program's life time).
also, i removed the static const gchar *key_* variables, and made
them inline strings (they weren't actually used anyways).
(gtk_item_factory_add_item): update ifactory->items.
(gtk_item_factory_destroy): destroy ifactory->items (and remove
the item factory pointer from the remaining ifactory widgets).
(gtk_item_factory_get_widget_by_action): walk the GtkItemFactoryItem
list to find the widget.
(gtk_item_factory_get_item): new function that works around
gtk_item_factory_get_widget() limitations, this function will only
return menu items, even for <Branch> entries.
Tue Mar 9 01:01:28 1999 Tim Janik <timj@gtk.org>
* gdk/gdkfont.c (gdk_font_load): first lookup the xfont ID in our
font hash table, if we have a GdkFontPrivate entry for this font
already, simply increment its reference count, provided by Olaf Dietsche
<olaf.dietsche+list.gtk@netcologne.de>.
* gtk/gtkstyle.c (gtk_style_copy): plug a GdkFont reference leak, fix
provided by Olaf Dietsche <olaf.dietsche+list.gtk@netcologne.de>.
Sun Mar 7 06:13:29 1999 Tim Janik <timj@gtk.org>
* gtk/gtkcontainer.c:
(gtk_container_add_with_args):
(gtk_container_addv):
(gtk_container_add): before adding a child to a conatiner, make sure
it is (default) constructed, this is neccessary because under certain
circumstances the child will get relized and mapped immediatedly, in
which case it has to be constructed already.
Mon Mar 1 17:58:21 1999 Tim Janik <timj@gtk.org>
* gtk/gtksignal.c (gtk_signal_connect_by_type): count object_signal
values > 1 as TRUE also.
1999-03-17 01:39:42 +00:00
|
|
|
|
|
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
|
|
|
|
return FALSE;
|
1997-11-24 22:37:52 +00:00
|
|
|
|
}
|
|
|
|
|
|
2004-12-13 18:22:02 +00:00
|
|
|
|
static void
|
2010-12-23 20:50:18 +00:00
|
|
|
|
gtk_menu_scroll_by (GtkMenu *menu,
|
|
|
|
|
gint step)
|
Add note about GtkMenuPositionFunc API changes.
2000-11-08 Alexander Larsson <alexl@redhat.com>
* docs/Changes-2.0.txt: Add note about GtkMenuPositionFunc
API changes.
* gtk/gtkmenu.c: Add support for scrolling menus.
Remove gtk_menu_append/prepend/insert, these have been moved to
gtkcompat.h as #defines.
* gtk/gtkcompat.h.in:
Add compatibility #defines for gtk_menu_append/prepend/insert
* gtk/gtkmenu.h: Add data needed for scrolling menus.
GtkMenuPositionFunc gets an extra argument push_in.
gtk_menu_append/prepend/insert removed.
* gtk/gtkmenuitem.c (gtk_menu_item_position_menu): Change menu
positioning behaviour to fit to scrolling menus.
* gtk/gtkmenuitem.c (gtk_menu_item_forall): Don't recurse
into menuitem->submeny. That is wrong, and broke torn
off submenus of torn off menus, since they were unrealized
when the first menu was unrealized.
* gtk/gtkmenushell.[ch]: Virtualize gtk_menu_shell_insert() and
gtk_menu_shell_select_item() since these need to be overridden in
GtkMenu.
* gtk/gtkoptionmenu.c (gtk_opttion_menu_position): Change menu
positioning behaviour to fit to scrolling menus.
(gtk_option_menu_key_press, gtk_option_menu_button_press): Select
the current item so that it is prelighted when the menu pops up.
This is a workaround to the fact that the menu doesn't get the
initial enter event (due to grabs).
* gtk/gtkfilesel.c, gtk/gtkinputdialog.c, gtk/testgtk.c:
s/gtk_menu_append/gtk_menu_shell_append/
* gtk/gtknotebook.c:
s/gtk_menu_insert/gtk_menu_shell_insert/
* gtk/testgtk.c (create_menu, create_menus):
Create the first menu with 50 items so that menu scrolling
can be tested.
Patch from Jonathan Blandford <jrb@redhat.com>
* gtk/gtkmenuitem.[ch] (gtk_menu_item_toggle_size_request): new
system to handle size requests. First, we ask what the size of
the toggle is. Then, when allocating the size, we allocate the
toggle_size first. This way we can have multiple menu-item
classes w/o needing a seperate class for each.
* gtk/gtkmenu.c (gtk_menu_size_request): Actually use the new system.
* gtk/gtkmenu.c (gtk_menu_size_allocate): Use the new system.
* gtk/gtkcheckmenuitem.c
(gtk_check_menu_item_toggle_size_request): New function to handle
the toggle size-request.
2000-11-08 17:34:52 +00:00
|
|
|
|
{
|
2010-12-23 20:50:18 +00:00
|
|
|
|
GtkMenuPrivate *priv = menu->priv;
|
2010-08-11 21:08:37 +00:00
|
|
|
|
GtkBorder arrow_border;
|
Add note about GtkMenuPositionFunc API changes.
2000-11-08 Alexander Larsson <alexl@redhat.com>
* docs/Changes-2.0.txt: Add note about GtkMenuPositionFunc
API changes.
* gtk/gtkmenu.c: Add support for scrolling menus.
Remove gtk_menu_append/prepend/insert, these have been moved to
gtkcompat.h as #defines.
* gtk/gtkcompat.h.in:
Add compatibility #defines for gtk_menu_append/prepend/insert
* gtk/gtkmenu.h: Add data needed for scrolling menus.
GtkMenuPositionFunc gets an extra argument push_in.
gtk_menu_append/prepend/insert removed.
* gtk/gtkmenuitem.c (gtk_menu_item_position_menu): Change menu
positioning behaviour to fit to scrolling menus.
* gtk/gtkmenuitem.c (gtk_menu_item_forall): Don't recurse
into menuitem->submeny. That is wrong, and broke torn
off submenus of torn off menus, since they were unrealized
when the first menu was unrealized.
* gtk/gtkmenushell.[ch]: Virtualize gtk_menu_shell_insert() and
gtk_menu_shell_select_item() since these need to be overridden in
GtkMenu.
* gtk/gtkoptionmenu.c (gtk_opttion_menu_position): Change menu
positioning behaviour to fit to scrolling menus.
(gtk_option_menu_key_press, gtk_option_menu_button_press): Select
the current item so that it is prelighted when the menu pops up.
This is a workaround to the fact that the menu doesn't get the
initial enter event (due to grabs).
* gtk/gtkfilesel.c, gtk/gtkinputdialog.c, gtk/testgtk.c:
s/gtk_menu_append/gtk_menu_shell_append/
* gtk/gtknotebook.c:
s/gtk_menu_insert/gtk_menu_shell_insert/
* gtk/testgtk.c (create_menu, create_menus):
Create the first menu with 50 items so that menu scrolling
can be tested.
Patch from Jonathan Blandford <jrb@redhat.com>
* gtk/gtkmenuitem.[ch] (gtk_menu_item_toggle_size_request): new
system to handle size requests. First, we ask what the size of
the toggle is. Then, when allocating the size, we allocate the
toggle_size first. This way we can have multiple menu-item
classes w/o needing a seperate class for each.
* gtk/gtkmenu.c (gtk_menu_size_request): Actually use the new system.
* gtk/gtkmenu.c (gtk_menu_size_allocate): Use the new system.
* gtk/gtkcheckmenuitem.c
(gtk_check_menu_item_toggle_size_request): New function to handle
the toggle size-request.
2000-11-08 17:34:52 +00:00
|
|
|
|
GtkWidget *widget;
|
|
|
|
|
gint offset;
|
2010-09-20 14:39:25 +00:00
|
|
|
|
gint view_height;
|
2010-08-11 21:08:37 +00:00
|
|
|
|
|
Add note about GtkMenuPositionFunc API changes.
2000-11-08 Alexander Larsson <alexl@redhat.com>
* docs/Changes-2.0.txt: Add note about GtkMenuPositionFunc
API changes.
* gtk/gtkmenu.c: Add support for scrolling menus.
Remove gtk_menu_append/prepend/insert, these have been moved to
gtkcompat.h as #defines.
* gtk/gtkcompat.h.in:
Add compatibility #defines for gtk_menu_append/prepend/insert
* gtk/gtkmenu.h: Add data needed for scrolling menus.
GtkMenuPositionFunc gets an extra argument push_in.
gtk_menu_append/prepend/insert removed.
* gtk/gtkmenuitem.c (gtk_menu_item_position_menu): Change menu
positioning behaviour to fit to scrolling menus.
* gtk/gtkmenuitem.c (gtk_menu_item_forall): Don't recurse
into menuitem->submeny. That is wrong, and broke torn
off submenus of torn off menus, since they were unrealized
when the first menu was unrealized.
* gtk/gtkmenushell.[ch]: Virtualize gtk_menu_shell_insert() and
gtk_menu_shell_select_item() since these need to be overridden in
GtkMenu.
* gtk/gtkoptionmenu.c (gtk_opttion_menu_position): Change menu
positioning behaviour to fit to scrolling menus.
(gtk_option_menu_key_press, gtk_option_menu_button_press): Select
the current item so that it is prelighted when the menu pops up.
This is a workaround to the fact that the menu doesn't get the
initial enter event (due to grabs).
* gtk/gtkfilesel.c, gtk/gtkinputdialog.c, gtk/testgtk.c:
s/gtk_menu_append/gtk_menu_shell_append/
* gtk/gtknotebook.c:
s/gtk_menu_insert/gtk_menu_shell_insert/
* gtk/testgtk.c (create_menu, create_menus):
Create the first menu with 50 items so that menu scrolling
can be tested.
Patch from Jonathan Blandford <jrb@redhat.com>
* gtk/gtkmenuitem.[ch] (gtk_menu_item_toggle_size_request): new
system to handle size requests. First, we ask what the size of
the toggle is. Then, when allocating the size, we allocate the
toggle_size first. This way we can have multiple menu-item
classes w/o needing a seperate class for each.
* gtk/gtkmenu.c (gtk_menu_size_request): Actually use the new system.
* gtk/gtkmenu.c (gtk_menu_size_allocate): Use the new system.
* gtk/gtkcheckmenuitem.c
(gtk_check_menu_item_toggle_size_request): New function to handle
the toggle size-request.
2000-11-08 17:34:52 +00:00
|
|
|
|
widget = GTK_WIDGET (menu);
|
2010-12-23 20:50:18 +00:00
|
|
|
|
offset = priv->scroll_offset + step;
|
Add note about GtkMenuPositionFunc API changes.
2000-11-08 Alexander Larsson <alexl@redhat.com>
* docs/Changes-2.0.txt: Add note about GtkMenuPositionFunc
API changes.
* gtk/gtkmenu.c: Add support for scrolling menus.
Remove gtk_menu_append/prepend/insert, these have been moved to
gtkcompat.h as #defines.
* gtk/gtkcompat.h.in:
Add compatibility #defines for gtk_menu_append/prepend/insert
* gtk/gtkmenu.h: Add data needed for scrolling menus.
GtkMenuPositionFunc gets an extra argument push_in.
gtk_menu_append/prepend/insert removed.
* gtk/gtkmenuitem.c (gtk_menu_item_position_menu): Change menu
positioning behaviour to fit to scrolling menus.
* gtk/gtkmenuitem.c (gtk_menu_item_forall): Don't recurse
into menuitem->submeny. That is wrong, and broke torn
off submenus of torn off menus, since they were unrealized
when the first menu was unrealized.
* gtk/gtkmenushell.[ch]: Virtualize gtk_menu_shell_insert() and
gtk_menu_shell_select_item() since these need to be overridden in
GtkMenu.
* gtk/gtkoptionmenu.c (gtk_opttion_menu_position): Change menu
positioning behaviour to fit to scrolling menus.
(gtk_option_menu_key_press, gtk_option_menu_button_press): Select
the current item so that it is prelighted when the menu pops up.
This is a workaround to the fact that the menu doesn't get the
initial enter event (due to grabs).
* gtk/gtkfilesel.c, gtk/gtkinputdialog.c, gtk/testgtk.c:
s/gtk_menu_append/gtk_menu_shell_append/
* gtk/gtknotebook.c:
s/gtk_menu_insert/gtk_menu_shell_insert/
* gtk/testgtk.c (create_menu, create_menus):
Create the first menu with 50 items so that menu scrolling
can be tested.
Patch from Jonathan Blandford <jrb@redhat.com>
* gtk/gtkmenuitem.[ch] (gtk_menu_item_toggle_size_request): new
system to handle size requests. First, we ask what the size of
the toggle is. Then, when allocating the size, we allocate the
toggle_size first. This way we can have multiple menu-item
classes w/o needing a seperate class for each.
* gtk/gtkmenu.c (gtk_menu_size_request): Actually use the new system.
* gtk/gtkmenu.c (gtk_menu_size_allocate): Use the new system.
* gtk/gtkcheckmenuitem.c
(gtk_check_menu_item_toggle_size_request): New function to handle
the toggle size-request.
2000-11-08 17:34:52 +00:00
|
|
|
|
|
2007-05-09 15:46:41 +00:00
|
|
|
|
get_arrows_border (menu, &arrow_border);
|
2006-05-10 14:02:20 +00:00
|
|
|
|
|
Add note about GtkMenuPositionFunc API changes.
2000-11-08 Alexander Larsson <alexl@redhat.com>
* docs/Changes-2.0.txt: Add note about GtkMenuPositionFunc
API changes.
* gtk/gtkmenu.c: Add support for scrolling menus.
Remove gtk_menu_append/prepend/insert, these have been moved to
gtkcompat.h as #defines.
* gtk/gtkcompat.h.in:
Add compatibility #defines for gtk_menu_append/prepend/insert
* gtk/gtkmenu.h: Add data needed for scrolling menus.
GtkMenuPositionFunc gets an extra argument push_in.
gtk_menu_append/prepend/insert removed.
* gtk/gtkmenuitem.c (gtk_menu_item_position_menu): Change menu
positioning behaviour to fit to scrolling menus.
* gtk/gtkmenuitem.c (gtk_menu_item_forall): Don't recurse
into menuitem->submeny. That is wrong, and broke torn
off submenus of torn off menus, since they were unrealized
when the first menu was unrealized.
* gtk/gtkmenushell.[ch]: Virtualize gtk_menu_shell_insert() and
gtk_menu_shell_select_item() since these need to be overridden in
GtkMenu.
* gtk/gtkoptionmenu.c (gtk_opttion_menu_position): Change menu
positioning behaviour to fit to scrolling menus.
(gtk_option_menu_key_press, gtk_option_menu_button_press): Select
the current item so that it is prelighted when the menu pops up.
This is a workaround to the fact that the menu doesn't get the
initial enter event (due to grabs).
* gtk/gtkfilesel.c, gtk/gtkinputdialog.c, gtk/testgtk.c:
s/gtk_menu_append/gtk_menu_shell_append/
* gtk/gtknotebook.c:
s/gtk_menu_insert/gtk_menu_shell_insert/
* gtk/testgtk.c (create_menu, create_menus):
Create the first menu with 50 items so that menu scrolling
can be tested.
Patch from Jonathan Blandford <jrb@redhat.com>
* gtk/gtkmenuitem.[ch] (gtk_menu_item_toggle_size_request): new
system to handle size requests. First, we ask what the size of
the toggle is. Then, when allocating the size, we allocate the
toggle_size first. This way we can have multiple menu-item
classes w/o needing a seperate class for each.
* gtk/gtkmenu.c (gtk_menu_size_request): Actually use the new system.
* gtk/gtkmenu.c (gtk_menu_size_allocate): Use the new system.
* gtk/gtkcheckmenuitem.c
(gtk_check_menu_item_toggle_size_request): New function to handle
the toggle size-request.
2000-11-08 17:34:52 +00:00
|
|
|
|
/* Don't scroll over the top if we weren't before: */
|
2010-12-23 20:50:18 +00:00
|
|
|
|
if ((priv->scroll_offset >= 0) && (offset < 0))
|
Add note about GtkMenuPositionFunc API changes.
2000-11-08 Alexander Larsson <alexl@redhat.com>
* docs/Changes-2.0.txt: Add note about GtkMenuPositionFunc
API changes.
* gtk/gtkmenu.c: Add support for scrolling menus.
Remove gtk_menu_append/prepend/insert, these have been moved to
gtkcompat.h as #defines.
* gtk/gtkcompat.h.in:
Add compatibility #defines for gtk_menu_append/prepend/insert
* gtk/gtkmenu.h: Add data needed for scrolling menus.
GtkMenuPositionFunc gets an extra argument push_in.
gtk_menu_append/prepend/insert removed.
* gtk/gtkmenuitem.c (gtk_menu_item_position_menu): Change menu
positioning behaviour to fit to scrolling menus.
* gtk/gtkmenuitem.c (gtk_menu_item_forall): Don't recurse
into menuitem->submeny. That is wrong, and broke torn
off submenus of torn off menus, since they were unrealized
when the first menu was unrealized.
* gtk/gtkmenushell.[ch]: Virtualize gtk_menu_shell_insert() and
gtk_menu_shell_select_item() since these need to be overridden in
GtkMenu.
* gtk/gtkoptionmenu.c (gtk_opttion_menu_position): Change menu
positioning behaviour to fit to scrolling menus.
(gtk_option_menu_key_press, gtk_option_menu_button_press): Select
the current item so that it is prelighted when the menu pops up.
This is a workaround to the fact that the menu doesn't get the
initial enter event (due to grabs).
* gtk/gtkfilesel.c, gtk/gtkinputdialog.c, gtk/testgtk.c:
s/gtk_menu_append/gtk_menu_shell_append/
* gtk/gtknotebook.c:
s/gtk_menu_insert/gtk_menu_shell_insert/
* gtk/testgtk.c (create_menu, create_menus):
Create the first menu with 50 items so that menu scrolling
can be tested.
Patch from Jonathan Blandford <jrb@redhat.com>
* gtk/gtkmenuitem.[ch] (gtk_menu_item_toggle_size_request): new
system to handle size requests. First, we ask what the size of
the toggle is. Then, when allocating the size, we allocate the
toggle_size first. This way we can have multiple menu-item
classes w/o needing a seperate class for each.
* gtk/gtkmenu.c (gtk_menu_size_request): Actually use the new system.
* gtk/gtkmenu.c (gtk_menu_size_allocate): Use the new system.
* gtk/gtkcheckmenuitem.c
(gtk_check_menu_item_toggle_size_request): New function to handle
the toggle size-request.
2000-11-08 17:34:52 +00:00
|
|
|
|
offset = 0;
|
|
|
|
|
|
2010-09-20 14:39:25 +00:00
|
|
|
|
view_height = gdk_window_get_height (gtk_widget_get_window (widget));
|
Add note about GtkMenuPositionFunc API changes.
2000-11-08 Alexander Larsson <alexl@redhat.com>
* docs/Changes-2.0.txt: Add note about GtkMenuPositionFunc
API changes.
* gtk/gtkmenu.c: Add support for scrolling menus.
Remove gtk_menu_append/prepend/insert, these have been moved to
gtkcompat.h as #defines.
* gtk/gtkcompat.h.in:
Add compatibility #defines for gtk_menu_append/prepend/insert
* gtk/gtkmenu.h: Add data needed for scrolling menus.
GtkMenuPositionFunc gets an extra argument push_in.
gtk_menu_append/prepend/insert removed.
* gtk/gtkmenuitem.c (gtk_menu_item_position_menu): Change menu
positioning behaviour to fit to scrolling menus.
* gtk/gtkmenuitem.c (gtk_menu_item_forall): Don't recurse
into menuitem->submeny. That is wrong, and broke torn
off submenus of torn off menus, since they were unrealized
when the first menu was unrealized.
* gtk/gtkmenushell.[ch]: Virtualize gtk_menu_shell_insert() and
gtk_menu_shell_select_item() since these need to be overridden in
GtkMenu.
* gtk/gtkoptionmenu.c (gtk_opttion_menu_position): Change menu
positioning behaviour to fit to scrolling menus.
(gtk_option_menu_key_press, gtk_option_menu_button_press): Select
the current item so that it is prelighted when the menu pops up.
This is a workaround to the fact that the menu doesn't get the
initial enter event (due to grabs).
* gtk/gtkfilesel.c, gtk/gtkinputdialog.c, gtk/testgtk.c:
s/gtk_menu_append/gtk_menu_shell_append/
* gtk/gtknotebook.c:
s/gtk_menu_insert/gtk_menu_shell_insert/
* gtk/testgtk.c (create_menu, create_menus):
Create the first menu with 50 items so that menu scrolling
can be tested.
Patch from Jonathan Blandford <jrb@redhat.com>
* gtk/gtkmenuitem.[ch] (gtk_menu_item_toggle_size_request): new
system to handle size requests. First, we ask what the size of
the toggle is. Then, when allocating the size, we allocate the
toggle_size first. This way we can have multiple menu-item
classes w/o needing a seperate class for each.
* gtk/gtkmenu.c (gtk_menu_size_request): Actually use the new system.
* gtk/gtkmenu.c (gtk_menu_size_allocate): Use the new system.
* gtk/gtkcheckmenuitem.c
(gtk_check_menu_item_toggle_size_request): New function to handle
the toggle size-request.
2000-11-08 17:34:52 +00:00
|
|
|
|
|
2010-12-23 20:50:18 +00:00
|
|
|
|
if (priv->scroll_offset == 0 &&
|
2010-08-18 23:42:02 +00:00
|
|
|
|
view_height >= priv->requested_height)
|
2006-03-27 17:00:01 +00:00
|
|
|
|
return;
|
|
|
|
|
|
Add note about GtkMenuPositionFunc API changes.
2000-11-08 Alexander Larsson <alexl@redhat.com>
* docs/Changes-2.0.txt: Add note about GtkMenuPositionFunc
API changes.
* gtk/gtkmenu.c: Add support for scrolling menus.
Remove gtk_menu_append/prepend/insert, these have been moved to
gtkcompat.h as #defines.
* gtk/gtkcompat.h.in:
Add compatibility #defines for gtk_menu_append/prepend/insert
* gtk/gtkmenu.h: Add data needed for scrolling menus.
GtkMenuPositionFunc gets an extra argument push_in.
gtk_menu_append/prepend/insert removed.
* gtk/gtkmenuitem.c (gtk_menu_item_position_menu): Change menu
positioning behaviour to fit to scrolling menus.
* gtk/gtkmenuitem.c (gtk_menu_item_forall): Don't recurse
into menuitem->submeny. That is wrong, and broke torn
off submenus of torn off menus, since they were unrealized
when the first menu was unrealized.
* gtk/gtkmenushell.[ch]: Virtualize gtk_menu_shell_insert() and
gtk_menu_shell_select_item() since these need to be overridden in
GtkMenu.
* gtk/gtkoptionmenu.c (gtk_opttion_menu_position): Change menu
positioning behaviour to fit to scrolling menus.
(gtk_option_menu_key_press, gtk_option_menu_button_press): Select
the current item so that it is prelighted when the menu pops up.
This is a workaround to the fact that the menu doesn't get the
initial enter event (due to grabs).
* gtk/gtkfilesel.c, gtk/gtkinputdialog.c, gtk/testgtk.c:
s/gtk_menu_append/gtk_menu_shell_append/
* gtk/gtknotebook.c:
s/gtk_menu_insert/gtk_menu_shell_insert/
* gtk/testgtk.c (create_menu, create_menus):
Create the first menu with 50 items so that menu scrolling
can be tested.
Patch from Jonathan Blandford <jrb@redhat.com>
* gtk/gtkmenuitem.[ch] (gtk_menu_item_toggle_size_request): new
system to handle size requests. First, we ask what the size of
the toggle is. Then, when allocating the size, we allocate the
toggle_size first. This way we can have multiple menu-item
classes w/o needing a seperate class for each.
* gtk/gtkmenu.c (gtk_menu_size_request): Actually use the new system.
* gtk/gtkmenu.c (gtk_menu_size_allocate): Use the new system.
* gtk/gtkcheckmenuitem.c
(gtk_check_menu_item_toggle_size_request): New function to handle
the toggle size-request.
2000-11-08 17:34:52 +00:00
|
|
|
|
/* Don't scroll past the bottom if we weren't before: */
|
2010-12-23 20:50:18 +00:00
|
|
|
|
if (priv->scroll_offset > 0)
|
2007-05-09 15:46:41 +00:00
|
|
|
|
view_height -= arrow_border.top;
|
2006-02-22 10:10:23 +00:00
|
|
|
|
|
2015-12-21 02:44:10 +00:00
|
|
|
|
/* Since arrows are shown, reduce view height even more */
|
|
|
|
|
view_height -= arrow_border.bottom;
|
2006-02-22 10:10:23 +00:00
|
|
|
|
|
2010-12-23 20:50:18 +00:00
|
|
|
|
if ((priv->scroll_offset + view_height <= priv->requested_height) &&
|
2010-08-18 23:42:02 +00:00
|
|
|
|
(offset + view_height > priv->requested_height))
|
|
|
|
|
offset = priv->requested_height - view_height;
|
Add note about GtkMenuPositionFunc API changes.
2000-11-08 Alexander Larsson <alexl@redhat.com>
* docs/Changes-2.0.txt: Add note about GtkMenuPositionFunc
API changes.
* gtk/gtkmenu.c: Add support for scrolling menus.
Remove gtk_menu_append/prepend/insert, these have been moved to
gtkcompat.h as #defines.
* gtk/gtkcompat.h.in:
Add compatibility #defines for gtk_menu_append/prepend/insert
* gtk/gtkmenu.h: Add data needed for scrolling menus.
GtkMenuPositionFunc gets an extra argument push_in.
gtk_menu_append/prepend/insert removed.
* gtk/gtkmenuitem.c (gtk_menu_item_position_menu): Change menu
positioning behaviour to fit to scrolling menus.
* gtk/gtkmenuitem.c (gtk_menu_item_forall): Don't recurse
into menuitem->submeny. That is wrong, and broke torn
off submenus of torn off menus, since they were unrealized
when the first menu was unrealized.
* gtk/gtkmenushell.[ch]: Virtualize gtk_menu_shell_insert() and
gtk_menu_shell_select_item() since these need to be overridden in
GtkMenu.
* gtk/gtkoptionmenu.c (gtk_opttion_menu_position): Change menu
positioning behaviour to fit to scrolling menus.
(gtk_option_menu_key_press, gtk_option_menu_button_press): Select
the current item so that it is prelighted when the menu pops up.
This is a workaround to the fact that the menu doesn't get the
initial enter event (due to grabs).
* gtk/gtkfilesel.c, gtk/gtkinputdialog.c, gtk/testgtk.c:
s/gtk_menu_append/gtk_menu_shell_append/
* gtk/gtknotebook.c:
s/gtk_menu_insert/gtk_menu_shell_insert/
* gtk/testgtk.c (create_menu, create_menus):
Create the first menu with 50 items so that menu scrolling
can be tested.
Patch from Jonathan Blandford <jrb@redhat.com>
* gtk/gtkmenuitem.[ch] (gtk_menu_item_toggle_size_request): new
system to handle size requests. First, we ask what the size of
the toggle is. Then, when allocating the size, we allocate the
toggle_size first. This way we can have multiple menu-item
classes w/o needing a seperate class for each.
* gtk/gtkmenu.c (gtk_menu_size_request): Actually use the new system.
* gtk/gtkmenu.c (gtk_menu_size_allocate): Use the new system.
* gtk/gtkcheckmenuitem.c
(gtk_check_menu_item_toggle_size_request): New function to handle
the toggle size-request.
2000-11-08 17:34:52 +00:00
|
|
|
|
|
2010-12-23 20:50:18 +00:00
|
|
|
|
if (offset != priv->scroll_offset)
|
2019-01-17 18:27:51 +00:00
|
|
|
|
gtk_menu_scroll_to (menu, offset, GTK_MENU_SCROLL_FLAG_NONE);
|
2004-12-13 18:22:02 +00:00
|
|
|
|
}
|
|
|
|
|
|
2004-12-13 18:40:12 +00:00
|
|
|
|
static gboolean
|
2007-03-29 08:14:22 +00:00
|
|
|
|
gtk_menu_scroll_timeout (gpointer data)
|
2004-12-13 18:22:02 +00:00
|
|
|
|
{
|
2007-03-29 08:14:22 +00:00
|
|
|
|
GtkMenu *menu;
|
2004-12-13 18:22:02 +00:00
|
|
|
|
|
|
|
|
|
menu = GTK_MENU (data);
|
2011-12-12 17:48:30 +00:00
|
|
|
|
gtk_menu_scroll_by (menu, menu->priv->scroll_step);
|
Add note about GtkMenuPositionFunc API changes.
2000-11-08 Alexander Larsson <alexl@redhat.com>
* docs/Changes-2.0.txt: Add note about GtkMenuPositionFunc
API changes.
* gtk/gtkmenu.c: Add support for scrolling menus.
Remove gtk_menu_append/prepend/insert, these have been moved to
gtkcompat.h as #defines.
* gtk/gtkcompat.h.in:
Add compatibility #defines for gtk_menu_append/prepend/insert
* gtk/gtkmenu.h: Add data needed for scrolling menus.
GtkMenuPositionFunc gets an extra argument push_in.
gtk_menu_append/prepend/insert removed.
* gtk/gtkmenuitem.c (gtk_menu_item_position_menu): Change menu
positioning behaviour to fit to scrolling menus.
* gtk/gtkmenuitem.c (gtk_menu_item_forall): Don't recurse
into menuitem->submeny. That is wrong, and broke torn
off submenus of torn off menus, since they were unrealized
when the first menu was unrealized.
* gtk/gtkmenushell.[ch]: Virtualize gtk_menu_shell_insert() and
gtk_menu_shell_select_item() since these need to be overridden in
GtkMenu.
* gtk/gtkoptionmenu.c (gtk_opttion_menu_position): Change menu
positioning behaviour to fit to scrolling menus.
(gtk_option_menu_key_press, gtk_option_menu_button_press): Select
the current item so that it is prelighted when the menu pops up.
This is a workaround to the fact that the menu doesn't get the
initial enter event (due to grabs).
* gtk/gtkfilesel.c, gtk/gtkinputdialog.c, gtk/testgtk.c:
s/gtk_menu_append/gtk_menu_shell_append/
* gtk/gtknotebook.c:
s/gtk_menu_insert/gtk_menu_shell_insert/
* gtk/testgtk.c (create_menu, create_menus):
Create the first menu with 50 items so that menu scrolling
can be tested.
Patch from Jonathan Blandford <jrb@redhat.com>
* gtk/gtkmenuitem.[ch] (gtk_menu_item_toggle_size_request): new
system to handle size requests. First, we ask what the size of
the toggle is. Then, when allocating the size, we allocate the
toggle_size first. This way we can have multiple menu-item
classes w/o needing a seperate class for each.
* gtk/gtkmenu.c (gtk_menu_size_request): Actually use the new system.
* gtk/gtkmenu.c (gtk_menu_size_allocate): Use the new system.
* gtk/gtkcheckmenuitem.c
(gtk_check_menu_item_toggle_size_request): New function to handle
the toggle size-request.
2000-11-08 17:34:52 +00:00
|
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
|
}
|
|
|
|
|
|
2004-12-13 18:22:02 +00:00
|
|
|
|
static gboolean
|
2010-12-23 20:50:18 +00:00
|
|
|
|
gtk_menu_scroll (GtkWidget *widget,
|
|
|
|
|
GdkEventScroll *event)
|
2004-12-13 18:22:02 +00:00
|
|
|
|
{
|
|
|
|
|
GtkMenu *menu = GTK_MENU (widget);
|
|
|
|
|
|
2016-05-10 19:16:45 +00:00
|
|
|
|
if (gdk_event_get_pointer_emulated ((GdkEvent *) event))
|
2016-05-09 06:56:56 +00:00
|
|
|
|
return GDK_EVENT_PROPAGATE;
|
2016-05-03 14:44:14 +00:00
|
|
|
|
|
2004-12-13 18:22:02 +00:00
|
|
|
|
switch (event->direction)
|
|
|
|
|
{
|
|
|
|
|
case GDK_SCROLL_DOWN:
|
|
|
|
|
gtk_menu_scroll_by (menu, MENU_SCROLL_STEP2);
|
|
|
|
|
break;
|
|
|
|
|
case GDK_SCROLL_UP:
|
|
|
|
|
gtk_menu_scroll_by (menu, - MENU_SCROLL_STEP2);
|
|
|
|
|
break;
|
2012-02-23 13:14:33 +00:00
|
|
|
|
case GDK_SCROLL_SMOOTH:
|
2016-05-03 14:44:14 +00:00
|
|
|
|
gtk_menu_scroll_by (menu, event->delta_y * MENU_SCROLL_STEP2);
|
2012-02-23 13:14:33 +00:00
|
|
|
|
break;
|
2016-05-09 06:56:56 +00:00
|
|
|
|
default:
|
|
|
|
|
return GDK_EVENT_PROPAGATE;
|
|
|
|
|
break;
|
2004-12-13 18:22:02 +00:00
|
|
|
|
}
|
|
|
|
|
|
2016-05-09 06:56:56 +00:00
|
|
|
|
return GDK_EVENT_STOP;
|
2004-12-13 18:22:02 +00:00
|
|
|
|
}
|
|
|
|
|
|
2007-05-09 15:46:41 +00:00
|
|
|
|
static void
|
2008-09-03 13:18:34 +00:00
|
|
|
|
get_arrows_sensitive_area (GtkMenu *menu,
|
2007-05-09 15:46:41 +00:00
|
|
|
|
GdkRectangle *upper,
|
|
|
|
|
GdkRectangle *lower)
|
|
|
|
|
{
|
2015-12-21 01:30:52 +00:00
|
|
|
|
GtkMenuPrivate *priv = menu->priv;
|
2010-08-11 21:08:37 +00:00
|
|
|
|
GtkWidget *widget = GTK_WIDGET (menu);
|
|
|
|
|
GdkWindow *window;
|
2007-05-09 15:46:41 +00:00
|
|
|
|
gint width, height;
|
2010-06-02 04:28:22 +00:00
|
|
|
|
guint border;
|
2007-05-09 15:46:41 +00:00
|
|
|
|
gint win_x, win_y;
|
2011-01-12 19:35:04 +00:00
|
|
|
|
GtkBorder padding;
|
2015-12-21 01:30:52 +00:00
|
|
|
|
gint top_arrow_height, bottom_arrow_height;
|
|
|
|
|
|
|
|
|
|
gtk_css_gadget_get_preferred_size (priv->top_arrow_gadget,
|
|
|
|
|
GTK_ORIENTATION_VERTICAL,
|
|
|
|
|
-1,
|
|
|
|
|
&top_arrow_height, NULL,
|
|
|
|
|
NULL, NULL);
|
|
|
|
|
gtk_css_gadget_get_preferred_size (priv->bottom_arrow_gadget,
|
|
|
|
|
GTK_ORIENTATION_VERTICAL,
|
|
|
|
|
-1,
|
|
|
|
|
&bottom_arrow_height, NULL,
|
|
|
|
|
NULL, NULL);
|
2007-05-09 15:46:41 +00:00
|
|
|
|
|
2010-08-11 21:08:37 +00:00
|
|
|
|
window = gtk_widget_get_window (widget);
|
2010-09-20 14:39:25 +00:00
|
|
|
|
width = gdk_window_get_width (window);
|
|
|
|
|
height = gdk_window_get_height (window);
|
2010-08-11 21:08:37 +00:00
|
|
|
|
|
2012-11-27 14:04:12 +00:00
|
|
|
|
border = gtk_container_get_border_width (GTK_CONTAINER (menu));
|
2011-05-17 18:10:19 +00:00
|
|
|
|
get_menu_padding (widget, &padding);
|
2007-05-09 15:46:41 +00:00
|
|
|
|
|
2010-08-11 21:08:37 +00:00
|
|
|
|
gdk_window_get_position (window, &win_x, &win_y);
|
2007-05-09 15:46:41 +00:00
|
|
|
|
|
2015-12-20 19:19:23 +00:00
|
|
|
|
if (upper)
|
2007-05-09 15:46:41 +00:00
|
|
|
|
{
|
2015-12-20 19:19:23 +00:00
|
|
|
|
upper->x = win_x;
|
|
|
|
|
upper->y = win_y;
|
|
|
|
|
upper->width = width;
|
2015-12-21 01:30:52 +00:00
|
|
|
|
upper->height = top_arrow_height + border + padding.top;
|
2015-12-20 19:19:23 +00:00
|
|
|
|
}
|
2008-10-08 02:16:08 +00:00
|
|
|
|
|
2015-12-20 19:19:23 +00:00
|
|
|
|
if (lower)
|
|
|
|
|
{
|
|
|
|
|
lower->x = win_x;
|
2015-12-21 01:30:52 +00:00
|
|
|
|
lower->y = win_y + height - border - padding.bottom - bottom_arrow_height;
|
2015-12-20 19:19:23 +00:00
|
|
|
|
lower->width = width;
|
2015-12-21 01:30:52 +00:00
|
|
|
|
lower->height = bottom_arrow_height + border + padding.bottom;
|
2007-05-09 15:46:41 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
Add note about GtkMenuPositionFunc API changes.
2000-11-08 Alexander Larsson <alexl@redhat.com>
* docs/Changes-2.0.txt: Add note about GtkMenuPositionFunc
API changes.
* gtk/gtkmenu.c: Add support for scrolling menus.
Remove gtk_menu_append/prepend/insert, these have been moved to
gtkcompat.h as #defines.
* gtk/gtkcompat.h.in:
Add compatibility #defines for gtk_menu_append/prepend/insert
* gtk/gtkmenu.h: Add data needed for scrolling menus.
GtkMenuPositionFunc gets an extra argument push_in.
gtk_menu_append/prepend/insert removed.
* gtk/gtkmenuitem.c (gtk_menu_item_position_menu): Change menu
positioning behaviour to fit to scrolling menus.
* gtk/gtkmenuitem.c (gtk_menu_item_forall): Don't recurse
into menuitem->submeny. That is wrong, and broke torn
off submenus of torn off menus, since they were unrealized
when the first menu was unrealized.
* gtk/gtkmenushell.[ch]: Virtualize gtk_menu_shell_insert() and
gtk_menu_shell_select_item() since these need to be overridden in
GtkMenu.
* gtk/gtkoptionmenu.c (gtk_opttion_menu_position): Change menu
positioning behaviour to fit to scrolling menus.
(gtk_option_menu_key_press, gtk_option_menu_button_press): Select
the current item so that it is prelighted when the menu pops up.
This is a workaround to the fact that the menu doesn't get the
initial enter event (due to grabs).
* gtk/gtkfilesel.c, gtk/gtkinputdialog.c, gtk/testgtk.c:
s/gtk_menu_append/gtk_menu_shell_append/
* gtk/gtknotebook.c:
s/gtk_menu_insert/gtk_menu_shell_insert/
* gtk/testgtk.c (create_menu, create_menus):
Create the first menu with 50 items so that menu scrolling
can be tested.
Patch from Jonathan Blandford <jrb@redhat.com>
* gtk/gtkmenuitem.[ch] (gtk_menu_item_toggle_size_request): new
system to handle size requests. First, we ask what the size of
the toggle is. Then, when allocating the size, we allocate the
toggle_size first. This way we can have multiple menu-item
classes w/o needing a seperate class for each.
* gtk/gtkmenu.c (gtk_menu_size_request): Actually use the new system.
* gtk/gtkmenu.c (gtk_menu_size_allocate): Use the new system.
* gtk/gtkcheckmenuitem.c
(gtk_check_menu_item_toggle_size_request): New function to handle
the toggle size-request.
2000-11-08 17:34:52 +00:00
|
|
|
|
static void
|
2005-02-03 18:09:41 +00:00
|
|
|
|
gtk_menu_handle_scrolling (GtkMenu *menu,
|
2010-12-23 20:50:18 +00:00
|
|
|
|
gint x,
|
|
|
|
|
gint y,
|
|
|
|
|
gboolean enter,
|
2006-02-22 10:10:23 +00:00
|
|
|
|
gboolean motion)
|
Add note about GtkMenuPositionFunc API changes.
2000-11-08 Alexander Larsson <alexl@redhat.com>
* docs/Changes-2.0.txt: Add note about GtkMenuPositionFunc
API changes.
* gtk/gtkmenu.c: Add support for scrolling menus.
Remove gtk_menu_append/prepend/insert, these have been moved to
gtkcompat.h as #defines.
* gtk/gtkcompat.h.in:
Add compatibility #defines for gtk_menu_append/prepend/insert
* gtk/gtkmenu.h: Add data needed for scrolling menus.
GtkMenuPositionFunc gets an extra argument push_in.
gtk_menu_append/prepend/insert removed.
* gtk/gtkmenuitem.c (gtk_menu_item_position_menu): Change menu
positioning behaviour to fit to scrolling menus.
* gtk/gtkmenuitem.c (gtk_menu_item_forall): Don't recurse
into menuitem->submeny. That is wrong, and broke torn
off submenus of torn off menus, since they were unrealized
when the first menu was unrealized.
* gtk/gtkmenushell.[ch]: Virtualize gtk_menu_shell_insert() and
gtk_menu_shell_select_item() since these need to be overridden in
GtkMenu.
* gtk/gtkoptionmenu.c (gtk_opttion_menu_position): Change menu
positioning behaviour to fit to scrolling menus.
(gtk_option_menu_key_press, gtk_option_menu_button_press): Select
the current item so that it is prelighted when the menu pops up.
This is a workaround to the fact that the menu doesn't get the
initial enter event (due to grabs).
* gtk/gtkfilesel.c, gtk/gtkinputdialog.c, gtk/testgtk.c:
s/gtk_menu_append/gtk_menu_shell_append/
* gtk/gtknotebook.c:
s/gtk_menu_insert/gtk_menu_shell_insert/
* gtk/testgtk.c (create_menu, create_menus):
Create the first menu with 50 items so that menu scrolling
can be tested.
Patch from Jonathan Blandford <jrb@redhat.com>
* gtk/gtkmenuitem.[ch] (gtk_menu_item_toggle_size_request): new
system to handle size requests. First, we ask what the size of
the toggle is. Then, when allocating the size, we allocate the
toggle_size first. This way we can have multiple menu-item
classes w/o needing a seperate class for each.
* gtk/gtkmenu.c (gtk_menu_size_request): Actually use the new system.
* gtk/gtkmenu.c (gtk_menu_size_allocate): Use the new system.
* gtk/gtkcheckmenuitem.c
(gtk_check_menu_item_toggle_size_request): New function to handle
the toggle size-request.
2000-11-08 17:34:52 +00:00
|
|
|
|
{
|
2010-12-23 20:50:18 +00:00
|
|
|
|
GtkMenuPrivate *priv = menu->priv;
|
Add note about GtkMenuPositionFunc API changes.
2000-11-08 Alexander Larsson <alexl@redhat.com>
* docs/Changes-2.0.txt: Add note about GtkMenuPositionFunc
API changes.
* gtk/gtkmenu.c: Add support for scrolling menus.
Remove gtk_menu_append/prepend/insert, these have been moved to
gtkcompat.h as #defines.
* gtk/gtkcompat.h.in:
Add compatibility #defines for gtk_menu_append/prepend/insert
* gtk/gtkmenu.h: Add data needed for scrolling menus.
GtkMenuPositionFunc gets an extra argument push_in.
gtk_menu_append/prepend/insert removed.
* gtk/gtkmenuitem.c (gtk_menu_item_position_menu): Change menu
positioning behaviour to fit to scrolling menus.
* gtk/gtkmenuitem.c (gtk_menu_item_forall): Don't recurse
into menuitem->submeny. That is wrong, and broke torn
off submenus of torn off menus, since they were unrealized
when the first menu was unrealized.
* gtk/gtkmenushell.[ch]: Virtualize gtk_menu_shell_insert() and
gtk_menu_shell_select_item() since these need to be overridden in
GtkMenu.
* gtk/gtkoptionmenu.c (gtk_opttion_menu_position): Change menu
positioning behaviour to fit to scrolling menus.
(gtk_option_menu_key_press, gtk_option_menu_button_press): Select
the current item so that it is prelighted when the menu pops up.
This is a workaround to the fact that the menu doesn't get the
initial enter event (due to grabs).
* gtk/gtkfilesel.c, gtk/gtkinputdialog.c, gtk/testgtk.c:
s/gtk_menu_append/gtk_menu_shell_append/
* gtk/gtknotebook.c:
s/gtk_menu_insert/gtk_menu_shell_insert/
* gtk/testgtk.c (create_menu, create_menus):
Create the first menu with 50 items so that menu scrolling
can be tested.
Patch from Jonathan Blandford <jrb@redhat.com>
* gtk/gtkmenuitem.[ch] (gtk_menu_item_toggle_size_request): new
system to handle size requests. First, we ask what the size of
the toggle is. Then, when allocating the size, we allocate the
toggle_size first. This way we can have multiple menu-item
classes w/o needing a seperate class for each.
* gtk/gtkmenu.c (gtk_menu_size_request): Actually use the new system.
* gtk/gtkmenu.c (gtk_menu_size_allocate): Use the new system.
* gtk/gtkcheckmenuitem.c
(gtk_check_menu_item_toggle_size_request): New function to handle
the toggle size-request.
2000-11-08 17:34:52 +00:00
|
|
|
|
GtkMenuShell *menu_shell;
|
|
|
|
|
GdkRectangle rect;
|
|
|
|
|
gboolean in_arrow;
|
|
|
|
|
gboolean scroll_fast = FALSE;
|
2005-02-03 18:09:41 +00:00
|
|
|
|
gint top_x, top_y;
|
2007-03-29 08:14:22 +00:00
|
|
|
|
|
Add note about GtkMenuPositionFunc API changes.
2000-11-08 Alexander Larsson <alexl@redhat.com>
* docs/Changes-2.0.txt: Add note about GtkMenuPositionFunc
API changes.
* gtk/gtkmenu.c: Add support for scrolling menus.
Remove gtk_menu_append/prepend/insert, these have been moved to
gtkcompat.h as #defines.
* gtk/gtkcompat.h.in:
Add compatibility #defines for gtk_menu_append/prepend/insert
* gtk/gtkmenu.h: Add data needed for scrolling menus.
GtkMenuPositionFunc gets an extra argument push_in.
gtk_menu_append/prepend/insert removed.
* gtk/gtkmenuitem.c (gtk_menu_item_position_menu): Change menu
positioning behaviour to fit to scrolling menus.
* gtk/gtkmenuitem.c (gtk_menu_item_forall): Don't recurse
into menuitem->submeny. That is wrong, and broke torn
off submenus of torn off menus, since they were unrealized
when the first menu was unrealized.
* gtk/gtkmenushell.[ch]: Virtualize gtk_menu_shell_insert() and
gtk_menu_shell_select_item() since these need to be overridden in
GtkMenu.
* gtk/gtkoptionmenu.c (gtk_opttion_menu_position): Change menu
positioning behaviour to fit to scrolling menus.
(gtk_option_menu_key_press, gtk_option_menu_button_press): Select
the current item so that it is prelighted when the menu pops up.
This is a workaround to the fact that the menu doesn't get the
initial enter event (due to grabs).
* gtk/gtkfilesel.c, gtk/gtkinputdialog.c, gtk/testgtk.c:
s/gtk_menu_append/gtk_menu_shell_append/
* gtk/gtknotebook.c:
s/gtk_menu_insert/gtk_menu_shell_insert/
* gtk/testgtk.c (create_menu, create_menus):
Create the first menu with 50 items so that menu scrolling
can be tested.
Patch from Jonathan Blandford <jrb@redhat.com>
* gtk/gtkmenuitem.[ch] (gtk_menu_item_toggle_size_request): new
system to handle size requests. First, we ask what the size of
the toggle is. Then, when allocating the size, we allocate the
toggle_size first. This way we can have multiple menu-item
classes w/o needing a seperate class for each.
* gtk/gtkmenu.c (gtk_menu_size_request): Actually use the new system.
* gtk/gtkmenu.c (gtk_menu_size_allocate): Use the new system.
* gtk/gtkcheckmenuitem.c
(gtk_check_menu_item_toggle_size_request): New function to handle
the toggle size-request.
2000-11-08 17:34:52 +00:00
|
|
|
|
menu_shell = GTK_MENU_SHELL (menu);
|
|
|
|
|
|
2010-12-23 20:50:18 +00:00
|
|
|
|
gdk_window_get_position (gtk_widget_get_window (priv->toplevel),
|
2010-08-11 21:08:37 +00:00
|
|
|
|
&top_x, &top_y);
|
2005-04-04 16:20:28 +00:00
|
|
|
|
x -= top_x;
|
|
|
|
|
y -= top_y;
|
|
|
|
|
|
2006-02-22 10:10:23 +00:00
|
|
|
|
/* upper arrow handling */
|
|
|
|
|
|
2007-05-09 15:46:41 +00:00
|
|
|
|
get_arrows_sensitive_area (menu, &rect, NULL);
|
2006-02-22 10:10:23 +00:00
|
|
|
|
|
|
|
|
|
in_arrow = FALSE;
|
2010-12-23 20:50:18 +00:00
|
|
|
|
if (priv->upper_arrow_visible && !priv->tearoff_active &&
|
2006-02-22 10:10:23 +00:00
|
|
|
|
(x >= rect.x) && (x < rect.x + rect.width) &&
|
|
|
|
|
(y >= rect.y) && (y < rect.y + rect.height))
|
Add note about GtkMenuPositionFunc API changes.
2000-11-08 Alexander Larsson <alexl@redhat.com>
* docs/Changes-2.0.txt: Add note about GtkMenuPositionFunc
API changes.
* gtk/gtkmenu.c: Add support for scrolling menus.
Remove gtk_menu_append/prepend/insert, these have been moved to
gtkcompat.h as #defines.
* gtk/gtkcompat.h.in:
Add compatibility #defines for gtk_menu_append/prepend/insert
* gtk/gtkmenu.h: Add data needed for scrolling menus.
GtkMenuPositionFunc gets an extra argument push_in.
gtk_menu_append/prepend/insert removed.
* gtk/gtkmenuitem.c (gtk_menu_item_position_menu): Change menu
positioning behaviour to fit to scrolling menus.
* gtk/gtkmenuitem.c (gtk_menu_item_forall): Don't recurse
into menuitem->submeny. That is wrong, and broke torn
off submenus of torn off menus, since they were unrealized
when the first menu was unrealized.
* gtk/gtkmenushell.[ch]: Virtualize gtk_menu_shell_insert() and
gtk_menu_shell_select_item() since these need to be overridden in
GtkMenu.
* gtk/gtkoptionmenu.c (gtk_opttion_menu_position): Change menu
positioning behaviour to fit to scrolling menus.
(gtk_option_menu_key_press, gtk_option_menu_button_press): Select
the current item so that it is prelighted when the menu pops up.
This is a workaround to the fact that the menu doesn't get the
initial enter event (due to grabs).
* gtk/gtkfilesel.c, gtk/gtkinputdialog.c, gtk/testgtk.c:
s/gtk_menu_append/gtk_menu_shell_append/
* gtk/gtknotebook.c:
s/gtk_menu_insert/gtk_menu_shell_insert/
* gtk/testgtk.c (create_menu, create_menus):
Create the first menu with 50 items so that menu scrolling
can be tested.
Patch from Jonathan Blandford <jrb@redhat.com>
* gtk/gtkmenuitem.[ch] (gtk_menu_item_toggle_size_request): new
system to handle size requests. First, we ask what the size of
the toggle is. Then, when allocating the size, we allocate the
toggle_size first. This way we can have multiple menu-item
classes w/o needing a seperate class for each.
* gtk/gtkmenu.c (gtk_menu_size_request): Actually use the new system.
* gtk/gtkmenu.c (gtk_menu_size_allocate): Use the new system.
* gtk/gtkcheckmenuitem.c
(gtk_check_menu_item_toggle_size_request): New function to handle
the toggle size-request.
2000-11-08 17:34:52 +00:00
|
|
|
|
{
|
2006-02-22 10:10:23 +00:00
|
|
|
|
in_arrow = TRUE;
|
|
|
|
|
}
|
Add note about GtkMenuPositionFunc API changes.
2000-11-08 Alexander Larsson <alexl@redhat.com>
* docs/Changes-2.0.txt: Add note about GtkMenuPositionFunc
API changes.
* gtk/gtkmenu.c: Add support for scrolling menus.
Remove gtk_menu_append/prepend/insert, these have been moved to
gtkcompat.h as #defines.
* gtk/gtkcompat.h.in:
Add compatibility #defines for gtk_menu_append/prepend/insert
* gtk/gtkmenu.h: Add data needed for scrolling menus.
GtkMenuPositionFunc gets an extra argument push_in.
gtk_menu_append/prepend/insert removed.
* gtk/gtkmenuitem.c (gtk_menu_item_position_menu): Change menu
positioning behaviour to fit to scrolling menus.
* gtk/gtkmenuitem.c (gtk_menu_item_forall): Don't recurse
into menuitem->submeny. That is wrong, and broke torn
off submenus of torn off menus, since they were unrealized
when the first menu was unrealized.
* gtk/gtkmenushell.[ch]: Virtualize gtk_menu_shell_insert() and
gtk_menu_shell_select_item() since these need to be overridden in
GtkMenu.
* gtk/gtkoptionmenu.c (gtk_opttion_menu_position): Change menu
positioning behaviour to fit to scrolling menus.
(gtk_option_menu_key_press, gtk_option_menu_button_press): Select
the current item so that it is prelighted when the menu pops up.
This is a workaround to the fact that the menu doesn't get the
initial enter event (due to grabs).
* gtk/gtkfilesel.c, gtk/gtkinputdialog.c, gtk/testgtk.c:
s/gtk_menu_append/gtk_menu_shell_append/
* gtk/gtknotebook.c:
s/gtk_menu_insert/gtk_menu_shell_insert/
* gtk/testgtk.c (create_menu, create_menus):
Create the first menu with 50 items so that menu scrolling
can be tested.
Patch from Jonathan Blandford <jrb@redhat.com>
* gtk/gtkmenuitem.[ch] (gtk_menu_item_toggle_size_request): new
system to handle size requests. First, we ask what the size of
the toggle is. Then, when allocating the size, we allocate the
toggle_size first. This way we can have multiple menu-item
classes w/o needing a seperate class for each.
* gtk/gtkmenu.c (gtk_menu_size_request): Actually use the new system.
* gtk/gtkmenu.c (gtk_menu_size_allocate): Use the new system.
* gtk/gtkcheckmenuitem.c
(gtk_check_menu_item_toggle_size_request): New function to handle
the toggle size-request.
2000-11-08 17:34:52 +00:00
|
|
|
|
|
2010-11-21 18:40:28 +00:00
|
|
|
|
if ((priv->upper_arrow_state & GTK_STATE_FLAG_INSENSITIVE) == 0)
|
2006-02-22 10:10:23 +00:00
|
|
|
|
{
|
2007-06-27 11:43:16 +00:00
|
|
|
|
gboolean arrow_pressed = FALSE;
|
2007-04-25 12:11:08 +00:00
|
|
|
|
|
2010-12-23 20:50:18 +00:00
|
|
|
|
if (priv->upper_arrow_visible && !priv->tearoff_active)
|
2006-02-22 10:10:23 +00:00
|
|
|
|
{
|
2011-12-12 17:48:30 +00:00
|
|
|
|
scroll_fast = (y < rect.y + MENU_SCROLL_FAST_ZONE);
|
|
|
|
|
|
|
|
|
|
if (enter && in_arrow &&
|
|
|
|
|
(!priv->upper_arrow_prelight ||
|
|
|
|
|
priv->scroll_fast != scroll_fast))
|
2006-02-22 10:10:23 +00:00
|
|
|
|
{
|
2011-12-12 17:48:30 +00:00
|
|
|
|
priv->upper_arrow_prelight = TRUE;
|
|
|
|
|
priv->scroll_fast = scroll_fast;
|
|
|
|
|
|
|
|
|
|
/* Deselect the active item so that
|
|
|
|
|
* any submenus are popped down
|
|
|
|
|
*/
|
|
|
|
|
gtk_menu_shell_deselect (menu_shell);
|
|
|
|
|
|
|
|
|
|
gtk_menu_remove_scroll_timeout (menu);
|
|
|
|
|
priv->scroll_step = scroll_fast
|
|
|
|
|
? -MENU_SCROLL_STEP2
|
|
|
|
|
: -MENU_SCROLL_STEP1;
|
|
|
|
|
|
|
|
|
|
priv->scroll_timeout =
|
|
|
|
|
gdk_threads_add_timeout (scroll_fast
|
|
|
|
|
? MENU_SCROLL_TIMEOUT2
|
|
|
|
|
: MENU_SCROLL_TIMEOUT1,
|
|
|
|
|
gtk_menu_scroll_timeout, menu);
|
2013-10-22 13:43:43 +00:00
|
|
|
|
g_source_set_name_by_id (priv->scroll_timeout, "[gtk+] gtk_menu_scroll_timeout");
|
2006-02-22 10:10:23 +00:00
|
|
|
|
}
|
2011-12-12 17:48:30 +00:00
|
|
|
|
else if (!enter && !in_arrow && priv->upper_arrow_prelight)
|
2006-02-22 10:10:23 +00:00
|
|
|
|
{
|
2011-12-12 17:48:30 +00:00
|
|
|
|
gtk_menu_stop_scrolling (menu);
|
2006-02-22 10:10:23 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2011-12-12 17:48:30 +00:00
|
|
|
|
/* check if the button isn't insensitive before
|
2007-06-27 11:43:16 +00:00
|
|
|
|
* changing it to something else.
|
|
|
|
|
*/
|
2010-11-21 18:40:28 +00:00
|
|
|
|
if ((priv->upper_arrow_state & GTK_STATE_FLAG_INSENSITIVE) == 0)
|
2007-04-25 12:11:08 +00:00
|
|
|
|
{
|
2010-11-21 18:40:28 +00:00
|
|
|
|
GtkStateFlags arrow_state = 0;
|
2007-06-27 11:43:16 +00:00
|
|
|
|
|
|
|
|
|
if (arrow_pressed)
|
2010-11-21 18:40:28 +00:00
|
|
|
|
arrow_state |= GTK_STATE_FLAG_ACTIVE;
|
|
|
|
|
|
2010-12-23 20:50:18 +00:00
|
|
|
|
if (priv->upper_arrow_prelight)
|
2010-11-21 18:40:28 +00:00
|
|
|
|
arrow_state |= GTK_STATE_FLAG_PRELIGHT;
|
2007-04-25 12:11:08 +00:00
|
|
|
|
|
2007-06-27 11:43:16 +00:00
|
|
|
|
if (arrow_state != priv->upper_arrow_state)
|
|
|
|
|
{
|
|
|
|
|
priv->upper_arrow_state = arrow_state;
|
2016-01-13 05:05:16 +00:00
|
|
|
|
gtk_css_gadget_set_state (priv->top_arrow_gadget, arrow_state);
|
2007-06-27 11:43:16 +00:00
|
|
|
|
|
2010-08-11 21:08:37 +00:00
|
|
|
|
gdk_window_invalidate_rect (gtk_widget_get_window (GTK_WIDGET (menu)),
|
2007-06-27 11:43:16 +00:00
|
|
|
|
&rect, FALSE);
|
|
|
|
|
}
|
2007-04-25 12:11:08 +00:00
|
|
|
|
}
|
Add note about GtkMenuPositionFunc API changes.
2000-11-08 Alexander Larsson <alexl@redhat.com>
* docs/Changes-2.0.txt: Add note about GtkMenuPositionFunc
API changes.
* gtk/gtkmenu.c: Add support for scrolling menus.
Remove gtk_menu_append/prepend/insert, these have been moved to
gtkcompat.h as #defines.
* gtk/gtkcompat.h.in:
Add compatibility #defines for gtk_menu_append/prepend/insert
* gtk/gtkmenu.h: Add data needed for scrolling menus.
GtkMenuPositionFunc gets an extra argument push_in.
gtk_menu_append/prepend/insert removed.
* gtk/gtkmenuitem.c (gtk_menu_item_position_menu): Change menu
positioning behaviour to fit to scrolling menus.
* gtk/gtkmenuitem.c (gtk_menu_item_forall): Don't recurse
into menuitem->submeny. That is wrong, and broke torn
off submenus of torn off menus, since they were unrealized
when the first menu was unrealized.
* gtk/gtkmenushell.[ch]: Virtualize gtk_menu_shell_insert() and
gtk_menu_shell_select_item() since these need to be overridden in
GtkMenu.
* gtk/gtkoptionmenu.c (gtk_opttion_menu_position): Change menu
positioning behaviour to fit to scrolling menus.
(gtk_option_menu_key_press, gtk_option_menu_button_press): Select
the current item so that it is prelighted when the menu pops up.
This is a workaround to the fact that the menu doesn't get the
initial enter event (due to grabs).
* gtk/gtkfilesel.c, gtk/gtkinputdialog.c, gtk/testgtk.c:
s/gtk_menu_append/gtk_menu_shell_append/
* gtk/gtknotebook.c:
s/gtk_menu_insert/gtk_menu_shell_insert/
* gtk/testgtk.c (create_menu, create_menus):
Create the first menu with 50 items so that menu scrolling
can be tested.
Patch from Jonathan Blandford <jrb@redhat.com>
* gtk/gtkmenuitem.[ch] (gtk_menu_item_toggle_size_request): new
system to handle size requests. First, we ask what the size of
the toggle is. Then, when allocating the size, we allocate the
toggle_size first. This way we can have multiple menu-item
classes w/o needing a seperate class for each.
* gtk/gtkmenu.c (gtk_menu_size_request): Actually use the new system.
* gtk/gtkmenu.c (gtk_menu_size_allocate): Use the new system.
* gtk/gtkcheckmenuitem.c
(gtk_check_menu_item_toggle_size_request): New function to handle
the toggle size-request.
2000-11-08 17:34:52 +00:00
|
|
|
|
}
|
2006-02-22 10:10:23 +00:00
|
|
|
|
|
|
|
|
|
/* lower arrow handling */
|
|
|
|
|
|
2007-05-09 15:46:41 +00:00
|
|
|
|
get_arrows_sensitive_area (menu, NULL, &rect);
|
2006-02-22 10:10:23 +00:00
|
|
|
|
|
|
|
|
|
in_arrow = FALSE;
|
2010-12-23 20:50:18 +00:00
|
|
|
|
if (priv->lower_arrow_visible && !priv->tearoff_active &&
|
2006-02-22 10:10:23 +00:00
|
|
|
|
(x >= rect.x) && (x < rect.x + rect.width) &&
|
|
|
|
|
(y >= rect.y) && (y < rect.y + rect.height))
|
Add note about GtkMenuPositionFunc API changes.
2000-11-08 Alexander Larsson <alexl@redhat.com>
* docs/Changes-2.0.txt: Add note about GtkMenuPositionFunc
API changes.
* gtk/gtkmenu.c: Add support for scrolling menus.
Remove gtk_menu_append/prepend/insert, these have been moved to
gtkcompat.h as #defines.
* gtk/gtkcompat.h.in:
Add compatibility #defines for gtk_menu_append/prepend/insert
* gtk/gtkmenu.h: Add data needed for scrolling menus.
GtkMenuPositionFunc gets an extra argument push_in.
gtk_menu_append/prepend/insert removed.
* gtk/gtkmenuitem.c (gtk_menu_item_position_menu): Change menu
positioning behaviour to fit to scrolling menus.
* gtk/gtkmenuitem.c (gtk_menu_item_forall): Don't recurse
into menuitem->submeny. That is wrong, and broke torn
off submenus of torn off menus, since they were unrealized
when the first menu was unrealized.
* gtk/gtkmenushell.[ch]: Virtualize gtk_menu_shell_insert() and
gtk_menu_shell_select_item() since these need to be overridden in
GtkMenu.
* gtk/gtkoptionmenu.c (gtk_opttion_menu_position): Change menu
positioning behaviour to fit to scrolling menus.
(gtk_option_menu_key_press, gtk_option_menu_button_press): Select
the current item so that it is prelighted when the menu pops up.
This is a workaround to the fact that the menu doesn't get the
initial enter event (due to grabs).
* gtk/gtkfilesel.c, gtk/gtkinputdialog.c, gtk/testgtk.c:
s/gtk_menu_append/gtk_menu_shell_append/
* gtk/gtknotebook.c:
s/gtk_menu_insert/gtk_menu_shell_insert/
* gtk/testgtk.c (create_menu, create_menus):
Create the first menu with 50 items so that menu scrolling
can be tested.
Patch from Jonathan Blandford <jrb@redhat.com>
* gtk/gtkmenuitem.[ch] (gtk_menu_item_toggle_size_request): new
system to handle size requests. First, we ask what the size of
the toggle is. Then, when allocating the size, we allocate the
toggle_size first. This way we can have multiple menu-item
classes w/o needing a seperate class for each.
* gtk/gtkmenu.c (gtk_menu_size_request): Actually use the new system.
* gtk/gtkmenu.c (gtk_menu_size_allocate): Use the new system.
* gtk/gtkcheckmenuitem.c
(gtk_check_menu_item_toggle_size_request): New function to handle
the toggle size-request.
2000-11-08 17:34:52 +00:00
|
|
|
|
{
|
2006-02-22 10:10:23 +00:00
|
|
|
|
in_arrow = TRUE;
|
|
|
|
|
}
|
Add note about GtkMenuPositionFunc API changes.
2000-11-08 Alexander Larsson <alexl@redhat.com>
* docs/Changes-2.0.txt: Add note about GtkMenuPositionFunc
API changes.
* gtk/gtkmenu.c: Add support for scrolling menus.
Remove gtk_menu_append/prepend/insert, these have been moved to
gtkcompat.h as #defines.
* gtk/gtkcompat.h.in:
Add compatibility #defines for gtk_menu_append/prepend/insert
* gtk/gtkmenu.h: Add data needed for scrolling menus.
GtkMenuPositionFunc gets an extra argument push_in.
gtk_menu_append/prepend/insert removed.
* gtk/gtkmenuitem.c (gtk_menu_item_position_menu): Change menu
positioning behaviour to fit to scrolling menus.
* gtk/gtkmenuitem.c (gtk_menu_item_forall): Don't recurse
into menuitem->submeny. That is wrong, and broke torn
off submenus of torn off menus, since they were unrealized
when the first menu was unrealized.
* gtk/gtkmenushell.[ch]: Virtualize gtk_menu_shell_insert() and
gtk_menu_shell_select_item() since these need to be overridden in
GtkMenu.
* gtk/gtkoptionmenu.c (gtk_opttion_menu_position): Change menu
positioning behaviour to fit to scrolling menus.
(gtk_option_menu_key_press, gtk_option_menu_button_press): Select
the current item so that it is prelighted when the menu pops up.
This is a workaround to the fact that the menu doesn't get the
initial enter event (due to grabs).
* gtk/gtkfilesel.c, gtk/gtkinputdialog.c, gtk/testgtk.c:
s/gtk_menu_append/gtk_menu_shell_append/
* gtk/gtknotebook.c:
s/gtk_menu_insert/gtk_menu_shell_insert/
* gtk/testgtk.c (create_menu, create_menus):
Create the first menu with 50 items so that menu scrolling
can be tested.
Patch from Jonathan Blandford <jrb@redhat.com>
* gtk/gtkmenuitem.[ch] (gtk_menu_item_toggle_size_request): new
system to handle size requests. First, we ask what the size of
the toggle is. Then, when allocating the size, we allocate the
toggle_size first. This way we can have multiple menu-item
classes w/o needing a seperate class for each.
* gtk/gtkmenu.c (gtk_menu_size_request): Actually use the new system.
* gtk/gtkmenu.c (gtk_menu_size_allocate): Use the new system.
* gtk/gtkcheckmenuitem.c
(gtk_check_menu_item_toggle_size_request): New function to handle
the toggle size-request.
2000-11-08 17:34:52 +00:00
|
|
|
|
|
2010-11-21 18:40:28 +00:00
|
|
|
|
if ((priv->lower_arrow_state & GTK_STATE_FLAG_INSENSITIVE) == 0)
|
2006-02-22 10:10:23 +00:00
|
|
|
|
{
|
2007-06-27 11:43:16 +00:00
|
|
|
|
gboolean arrow_pressed = FALSE;
|
2007-04-25 12:11:08 +00:00
|
|
|
|
|
2010-12-23 20:50:18 +00:00
|
|
|
|
if (priv->lower_arrow_visible && !priv->tearoff_active)
|
2006-02-22 10:10:23 +00:00
|
|
|
|
{
|
2011-12-12 17:48:30 +00:00
|
|
|
|
scroll_fast = (y > rect.y + rect.height - MENU_SCROLL_FAST_ZONE);
|
|
|
|
|
|
|
|
|
|
if (enter && in_arrow &&
|
|
|
|
|
(!priv->lower_arrow_prelight ||
|
|
|
|
|
priv->scroll_fast != scroll_fast))
|
2006-02-22 10:10:23 +00:00
|
|
|
|
{
|
2011-12-12 17:48:30 +00:00
|
|
|
|
priv->lower_arrow_prelight = TRUE;
|
|
|
|
|
priv->scroll_fast = scroll_fast;
|
|
|
|
|
|
|
|
|
|
/* Deselect the active item so that
|
|
|
|
|
* any submenus are popped down
|
|
|
|
|
*/
|
|
|
|
|
gtk_menu_shell_deselect (menu_shell);
|
|
|
|
|
|
|
|
|
|
gtk_menu_remove_scroll_timeout (menu);
|
|
|
|
|
priv->scroll_step = scroll_fast
|
|
|
|
|
? MENU_SCROLL_STEP2
|
|
|
|
|
: MENU_SCROLL_STEP1;
|
|
|
|
|
|
|
|
|
|
priv->scroll_timeout =
|
|
|
|
|
gdk_threads_add_timeout (scroll_fast
|
|
|
|
|
? MENU_SCROLL_TIMEOUT2
|
|
|
|
|
: MENU_SCROLL_TIMEOUT1,
|
|
|
|
|
gtk_menu_scroll_timeout, menu);
|
2013-10-22 13:43:43 +00:00
|
|
|
|
g_source_set_name_by_id (priv->scroll_timeout, "[gtk+] gtk_menu_scroll_timeout");
|
2006-02-22 10:10:23 +00:00
|
|
|
|
}
|
2011-12-12 17:48:30 +00:00
|
|
|
|
else if (!enter && !in_arrow && priv->lower_arrow_prelight)
|
2006-02-22 10:10:23 +00:00
|
|
|
|
{
|
2011-12-12 17:48:30 +00:00
|
|
|
|
gtk_menu_stop_scrolling (menu);
|
2006-02-22 10:10:23 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2011-12-12 17:48:30 +00:00
|
|
|
|
/* check if the button isn't insensitive before
|
2007-06-27 11:43:16 +00:00
|
|
|
|
* changing it to something else.
|
|
|
|
|
*/
|
2010-11-21 18:40:28 +00:00
|
|
|
|
if ((priv->lower_arrow_state & GTK_STATE_FLAG_INSENSITIVE) == 0)
|
2007-04-25 12:11:08 +00:00
|
|
|
|
{
|
2010-11-21 18:40:28 +00:00
|
|
|
|
GtkStateFlags arrow_state = 0;
|
2007-06-27 11:43:16 +00:00
|
|
|
|
|
|
|
|
|
if (arrow_pressed)
|
2010-11-21 18:40:28 +00:00
|
|
|
|
arrow_state |= GTK_STATE_FLAG_ACTIVE;
|
|
|
|
|
|
2010-12-23 20:50:18 +00:00
|
|
|
|
if (priv->lower_arrow_prelight)
|
2010-11-21 18:40:28 +00:00
|
|
|
|
arrow_state |= GTK_STATE_FLAG_PRELIGHT;
|
2007-04-25 12:11:08 +00:00
|
|
|
|
|
2007-06-27 11:43:16 +00:00
|
|
|
|
if (arrow_state != priv->lower_arrow_state)
|
|
|
|
|
{
|
|
|
|
|
priv->lower_arrow_state = arrow_state;
|
2016-01-13 05:05:16 +00:00
|
|
|
|
gtk_css_gadget_set_state (priv->bottom_arrow_gadget, arrow_state);
|
2007-06-27 11:43:16 +00:00
|
|
|
|
|
2010-08-11 21:08:37 +00:00
|
|
|
|
gdk_window_invalidate_rect (gtk_widget_get_window (GTK_WIDGET (menu)),
|
2007-06-27 11:43:16 +00:00
|
|
|
|
&rect, FALSE);
|
|
|
|
|
}
|
2007-04-25 12:11:08 +00:00
|
|
|
|
}
|
Add note about GtkMenuPositionFunc API changes.
2000-11-08 Alexander Larsson <alexl@redhat.com>
* docs/Changes-2.0.txt: Add note about GtkMenuPositionFunc
API changes.
* gtk/gtkmenu.c: Add support for scrolling menus.
Remove gtk_menu_append/prepend/insert, these have been moved to
gtkcompat.h as #defines.
* gtk/gtkcompat.h.in:
Add compatibility #defines for gtk_menu_append/prepend/insert
* gtk/gtkmenu.h: Add data needed for scrolling menus.
GtkMenuPositionFunc gets an extra argument push_in.
gtk_menu_append/prepend/insert removed.
* gtk/gtkmenuitem.c (gtk_menu_item_position_menu): Change menu
positioning behaviour to fit to scrolling menus.
* gtk/gtkmenuitem.c (gtk_menu_item_forall): Don't recurse
into menuitem->submeny. That is wrong, and broke torn
off submenus of torn off menus, since they were unrealized
when the first menu was unrealized.
* gtk/gtkmenushell.[ch]: Virtualize gtk_menu_shell_insert() and
gtk_menu_shell_select_item() since these need to be overridden in
GtkMenu.
* gtk/gtkoptionmenu.c (gtk_opttion_menu_position): Change menu
positioning behaviour to fit to scrolling menus.
(gtk_option_menu_key_press, gtk_option_menu_button_press): Select
the current item so that it is prelighted when the menu pops up.
This is a workaround to the fact that the menu doesn't get the
initial enter event (due to grabs).
* gtk/gtkfilesel.c, gtk/gtkinputdialog.c, gtk/testgtk.c:
s/gtk_menu_append/gtk_menu_shell_append/
* gtk/gtknotebook.c:
s/gtk_menu_insert/gtk_menu_shell_insert/
* gtk/testgtk.c (create_menu, create_menus):
Create the first menu with 50 items so that menu scrolling
can be tested.
Patch from Jonathan Blandford <jrb@redhat.com>
* gtk/gtkmenuitem.[ch] (gtk_menu_item_toggle_size_request): new
system to handle size requests. First, we ask what the size of
the toggle is. Then, when allocating the size, we allocate the
toggle_size first. This way we can have multiple menu-item
classes w/o needing a seperate class for each.
* gtk/gtkmenu.c (gtk_menu_size_request): Actually use the new system.
* gtk/gtkmenu.c (gtk_menu_size_allocate): Use the new system.
* gtk/gtkcheckmenuitem.c
(gtk_check_menu_item_toggle_size_request): New function to handle
the toggle size-request.
2000-11-08 17:34:52 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2000-09-02 02:43:50 +00:00
|
|
|
|
static gboolean
|
|
|
|
|
gtk_menu_enter_notify (GtkWidget *widget,
|
2010-12-23 20:50:18 +00:00
|
|
|
|
GdkEventCrossing *event)
|
2000-09-02 02:43:50 +00:00
|
|
|
|
{
|
|
|
|
|
GtkWidget *menu_item;
|
2010-08-11 21:08:37 +00:00
|
|
|
|
GtkWidget *parent;
|
2011-12-11 17:46:50 +00:00
|
|
|
|
GdkDevice *source_device;
|
2006-02-22 10:10:23 +00:00
|
|
|
|
|
2008-08-09 04:20:14 +00:00
|
|
|
|
if (event->mode == GDK_CROSSING_GTK_GRAB ||
|
|
|
|
|
event->mode == GDK_CROSSING_GTK_UNGRAB ||
|
|
|
|
|
event->mode == GDK_CROSSING_STATE_CHANGED)
|
|
|
|
|
return TRUE;
|
|
|
|
|
|
2011-12-12 17:11:57 +00:00
|
|
|
|
source_device = gdk_event_get_source_device ((GdkEvent *) event);
|
2004-06-02 23:17:21 +00:00
|
|
|
|
menu_item = gtk_get_event_widget ((GdkEvent*) event);
|
2011-12-11 17:46:50 +00:00
|
|
|
|
|
2011-12-12 17:11:57 +00:00
|
|
|
|
if (GTK_IS_MENU (widget) &&
|
|
|
|
|
gdk_device_get_source (source_device) != GDK_SOURCE_TOUCHSCREEN)
|
2002-11-09 20:52:31 +00:00
|
|
|
|
{
|
|
|
|
|
GtkMenuShell *menu_shell = GTK_MENU_SHELL (widget);
|
|
|
|
|
|
2010-12-23 23:21:53 +00:00
|
|
|
|
if (!menu_shell->priv->ignore_enter)
|
2010-12-23 20:50:18 +00:00
|
|
|
|
gtk_menu_handle_scrolling (GTK_MENU (widget),
|
2006-02-22 10:10:23 +00:00
|
|
|
|
event->x_root, event->y_root, TRUE, TRUE);
|
2002-11-09 20:52:31 +00:00
|
|
|
|
}
|
2004-12-22 16:52:23 +00:00
|
|
|
|
|
2011-12-11 17:46:50 +00:00
|
|
|
|
if (gdk_device_get_source (source_device) != GDK_SOURCE_TOUCHSCREEN &&
|
|
|
|
|
GTK_IS_MENU_ITEM (menu_item))
|
2004-12-22 16:52:23 +00:00
|
|
|
|
{
|
2010-08-11 21:08:37 +00:00
|
|
|
|
GtkWidget *menu = gtk_widget_get_parent (menu_item);
|
2010-12-23 20:50:18 +00:00
|
|
|
|
|
2006-02-22 10:10:23 +00:00
|
|
|
|
if (GTK_IS_MENU (menu))
|
2010-12-23 20:50:18 +00:00
|
|
|
|
{
|
2011-01-04 17:32:22 +00:00
|
|
|
|
GtkMenuPrivate *priv = (GTK_MENU (menu))->priv;
|
2010-12-23 20:50:18 +00:00
|
|
|
|
GtkMenuShell *menu_shell = GTK_MENU_SHELL (menu);
|
|
|
|
|
|
|
|
|
|
if (priv->seen_item_enter)
|
|
|
|
|
{
|
|
|
|
|
/* This is the second enter we see for an item
|
|
|
|
|
* on this menu. This means a release should always
|
|
|
|
|
* mean activate.
|
|
|
|
|
*/
|
2010-12-23 23:21:53 +00:00
|
|
|
|
menu_shell->priv->activate_time = 0;
|
2010-12-23 20:50:18 +00:00
|
|
|
|
}
|
|
|
|
|
else if ((event->detail != GDK_NOTIFY_NONLINEAR &&
|
|
|
|
|
event->detail != GDK_NOTIFY_NONLINEAR_VIRTUAL))
|
|
|
|
|
{
|
|
|
|
|
if (definitely_within_item (menu_item, event->x, event->y))
|
|
|
|
|
{
|
|
|
|
|
/* This is an actual user-enter (ie. not a pop-under)
|
|
|
|
|
* In this case, the user must either have entered
|
|
|
|
|
* sufficiently far enough into the item, or he must move
|
|
|
|
|
* far enough away from the enter point. (see
|
|
|
|
|
* gtk_menu_motion_notify())
|
|
|
|
|
*/
|
2010-12-23 23:21:53 +00:00
|
|
|
|
menu_shell->priv->activate_time = 0;
|
2010-12-23 20:50:18 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
priv->seen_item_enter = TRUE;
|
|
|
|
|
}
|
2004-12-22 16:52:23 +00:00
|
|
|
|
}
|
2010-12-23 20:50:18 +00:00
|
|
|
|
|
2000-09-02 02:43:50 +00:00
|
|
|
|
/* If this is a faked enter (see gtk_menu_motion_notify), 'widget'
|
|
|
|
|
* will not correspond to the event widget's parent. Check to see
|
|
|
|
|
* if we are in the parent's navigation region.
|
|
|
|
|
*/
|
2010-08-11 21:08:37 +00:00
|
|
|
|
parent = gtk_widget_get_parent (menu_item);
|
|
|
|
|
if (GTK_IS_MENU_ITEM (menu_item) && GTK_IS_MENU (parent) &&
|
|
|
|
|
gtk_menu_navigating_submenu (GTK_MENU (parent),
|
2006-02-22 10:10:23 +00:00
|
|
|
|
event->x_root, event->y_root))
|
Add note about GtkMenuPositionFunc API changes.
2000-11-08 Alexander Larsson <alexl@redhat.com>
* docs/Changes-2.0.txt: Add note about GtkMenuPositionFunc
API changes.
* gtk/gtkmenu.c: Add support for scrolling menus.
Remove gtk_menu_append/prepend/insert, these have been moved to
gtkcompat.h as #defines.
* gtk/gtkcompat.h.in:
Add compatibility #defines for gtk_menu_append/prepend/insert
* gtk/gtkmenu.h: Add data needed for scrolling menus.
GtkMenuPositionFunc gets an extra argument push_in.
gtk_menu_append/prepend/insert removed.
* gtk/gtkmenuitem.c (gtk_menu_item_position_menu): Change menu
positioning behaviour to fit to scrolling menus.
* gtk/gtkmenuitem.c (gtk_menu_item_forall): Don't recurse
into menuitem->submeny. That is wrong, and broke torn
off submenus of torn off menus, since they were unrealized
when the first menu was unrealized.
* gtk/gtkmenushell.[ch]: Virtualize gtk_menu_shell_insert() and
gtk_menu_shell_select_item() since these need to be overridden in
GtkMenu.
* gtk/gtkoptionmenu.c (gtk_opttion_menu_position): Change menu
positioning behaviour to fit to scrolling menus.
(gtk_option_menu_key_press, gtk_option_menu_button_press): Select
the current item so that it is prelighted when the menu pops up.
This is a workaround to the fact that the menu doesn't get the
initial enter event (due to grabs).
* gtk/gtkfilesel.c, gtk/gtkinputdialog.c, gtk/testgtk.c:
s/gtk_menu_append/gtk_menu_shell_append/
* gtk/gtknotebook.c:
s/gtk_menu_insert/gtk_menu_shell_insert/
* gtk/testgtk.c (create_menu, create_menus):
Create the first menu with 50 items so that menu scrolling
can be tested.
Patch from Jonathan Blandford <jrb@redhat.com>
* gtk/gtkmenuitem.[ch] (gtk_menu_item_toggle_size_request): new
system to handle size requests. First, we ask what the size of
the toggle is. Then, when allocating the size, we allocate the
toggle_size first. This way we can have multiple menu-item
classes w/o needing a seperate class for each.
* gtk/gtkmenu.c (gtk_menu_size_request): Actually use the new system.
* gtk/gtkmenu.c (gtk_menu_size_allocate): Use the new system.
* gtk/gtkcheckmenuitem.c
(gtk_check_menu_item_toggle_size_request): New function to handle
the toggle size-request.
2000-11-08 17:34:52 +00:00
|
|
|
|
return TRUE;
|
2000-09-02 02:43:50 +00:00
|
|
|
|
|
2010-12-23 20:50:18 +00:00
|
|
|
|
return GTK_WIDGET_CLASS (gtk_menu_parent_class)->enter_notify_event (widget, event);
|
2000-09-02 02:43:50 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
|
gtk_menu_leave_notify (GtkWidget *widget,
|
2010-12-23 20:50:18 +00:00
|
|
|
|
GdkEventCrossing *event)
|
2000-09-02 02:43:50 +00:00
|
|
|
|
{
|
|
|
|
|
GtkMenuShell *menu_shell;
|
|
|
|
|
GtkMenu *menu;
|
|
|
|
|
GtkMenuItem *menu_item;
|
Add note about GtkMenuPositionFunc API changes.
2000-11-08 Alexander Larsson <alexl@redhat.com>
* docs/Changes-2.0.txt: Add note about GtkMenuPositionFunc
API changes.
* gtk/gtkmenu.c: Add support for scrolling menus.
Remove gtk_menu_append/prepend/insert, these have been moved to
gtkcompat.h as #defines.
* gtk/gtkcompat.h.in:
Add compatibility #defines for gtk_menu_append/prepend/insert
* gtk/gtkmenu.h: Add data needed for scrolling menus.
GtkMenuPositionFunc gets an extra argument push_in.
gtk_menu_append/prepend/insert removed.
* gtk/gtkmenuitem.c (gtk_menu_item_position_menu): Change menu
positioning behaviour to fit to scrolling menus.
* gtk/gtkmenuitem.c (gtk_menu_item_forall): Don't recurse
into menuitem->submeny. That is wrong, and broke torn
off submenus of torn off menus, since they were unrealized
when the first menu was unrealized.
* gtk/gtkmenushell.[ch]: Virtualize gtk_menu_shell_insert() and
gtk_menu_shell_select_item() since these need to be overridden in
GtkMenu.
* gtk/gtkoptionmenu.c (gtk_opttion_menu_position): Change menu
positioning behaviour to fit to scrolling menus.
(gtk_option_menu_key_press, gtk_option_menu_button_press): Select
the current item so that it is prelighted when the menu pops up.
This is a workaround to the fact that the menu doesn't get the
initial enter event (due to grabs).
* gtk/gtkfilesel.c, gtk/gtkinputdialog.c, gtk/testgtk.c:
s/gtk_menu_append/gtk_menu_shell_append/
* gtk/gtknotebook.c:
s/gtk_menu_insert/gtk_menu_shell_insert/
* gtk/testgtk.c (create_menu, create_menus):
Create the first menu with 50 items so that menu scrolling
can be tested.
Patch from Jonathan Blandford <jrb@redhat.com>
* gtk/gtkmenuitem.[ch] (gtk_menu_item_toggle_size_request): new
system to handle size requests. First, we ask what the size of
the toggle is. Then, when allocating the size, we allocate the
toggle_size first. This way we can have multiple menu-item
classes w/o needing a seperate class for each.
* gtk/gtkmenu.c (gtk_menu_size_request): Actually use the new system.
* gtk/gtkmenu.c (gtk_menu_size_allocate): Use the new system.
* gtk/gtkcheckmenuitem.c
(gtk_check_menu_item_toggle_size_request): New function to handle
the toggle size-request.
2000-11-08 17:34:52 +00:00
|
|
|
|
GtkWidget *event_widget;
|
2011-12-12 17:11:57 +00:00
|
|
|
|
GdkDevice *source_device;
|
2000-09-02 02:43:50 +00:00
|
|
|
|
|
2008-08-09 04:20:14 +00:00
|
|
|
|
if (event->mode == GDK_CROSSING_GTK_GRAB ||
|
|
|
|
|
event->mode == GDK_CROSSING_GTK_UNGRAB ||
|
|
|
|
|
event->mode == GDK_CROSSING_STATE_CHANGED)
|
|
|
|
|
return TRUE;
|
|
|
|
|
|
2000-09-02 02:43:50 +00:00
|
|
|
|
menu = GTK_MENU (widget);
|
2010-12-23 20:50:18 +00:00
|
|
|
|
menu_shell = GTK_MENU_SHELL (widget);
|
|
|
|
|
|
2000-09-02 02:43:50 +00:00
|
|
|
|
if (gtk_menu_navigating_submenu (menu, event->x_root, event->y_root))
|
2010-12-23 20:50:18 +00:00
|
|
|
|
return TRUE;
|
Add note about GtkMenuPositionFunc API changes.
2000-11-08 Alexander Larsson <alexl@redhat.com>
* docs/Changes-2.0.txt: Add note about GtkMenuPositionFunc
API changes.
* gtk/gtkmenu.c: Add support for scrolling menus.
Remove gtk_menu_append/prepend/insert, these have been moved to
gtkcompat.h as #defines.
* gtk/gtkcompat.h.in:
Add compatibility #defines for gtk_menu_append/prepend/insert
* gtk/gtkmenu.h: Add data needed for scrolling menus.
GtkMenuPositionFunc gets an extra argument push_in.
gtk_menu_append/prepend/insert removed.
* gtk/gtkmenuitem.c (gtk_menu_item_position_menu): Change menu
positioning behaviour to fit to scrolling menus.
* gtk/gtkmenuitem.c (gtk_menu_item_forall): Don't recurse
into menuitem->submeny. That is wrong, and broke torn
off submenus of torn off menus, since they were unrealized
when the first menu was unrealized.
* gtk/gtkmenushell.[ch]: Virtualize gtk_menu_shell_insert() and
gtk_menu_shell_select_item() since these need to be overridden in
GtkMenu.
* gtk/gtkoptionmenu.c (gtk_opttion_menu_position): Change menu
positioning behaviour to fit to scrolling menus.
(gtk_option_menu_key_press, gtk_option_menu_button_press): Select
the current item so that it is prelighted when the menu pops up.
This is a workaround to the fact that the menu doesn't get the
initial enter event (due to grabs).
* gtk/gtkfilesel.c, gtk/gtkinputdialog.c, gtk/testgtk.c:
s/gtk_menu_append/gtk_menu_shell_append/
* gtk/gtknotebook.c:
s/gtk_menu_insert/gtk_menu_shell_insert/
* gtk/testgtk.c (create_menu, create_menus):
Create the first menu with 50 items so that menu scrolling
can be tested.
Patch from Jonathan Blandford <jrb@redhat.com>
* gtk/gtkmenuitem.[ch] (gtk_menu_item_toggle_size_request): new
system to handle size requests. First, we ask what the size of
the toggle is. Then, when allocating the size, we allocate the
toggle_size first. This way we can have multiple menu-item
classes w/o needing a seperate class for each.
* gtk/gtkmenu.c (gtk_menu_size_request): Actually use the new system.
* gtk/gtkmenu.c (gtk_menu_size_allocate): Use the new system.
* gtk/gtkcheckmenuitem.c
(gtk_check_menu_item_toggle_size_request): New function to handle
the toggle size-request.
2000-11-08 17:34:52 +00:00
|
|
|
|
|
2011-12-12 17:11:57 +00:00
|
|
|
|
source_device = gdk_event_get_source_device ((GdkEvent *) event);
|
|
|
|
|
|
|
|
|
|
if (gdk_device_get_source (source_device) != GDK_SOURCE_TOUCHSCREEN)
|
|
|
|
|
gtk_menu_handle_scrolling (menu, event->x_root, event->y_root, FALSE, TRUE);
|
2006-02-22 10:10:23 +00:00
|
|
|
|
|
2000-09-02 02:43:50 +00:00
|
|
|
|
event_widget = gtk_get_event_widget ((GdkEvent*) event);
|
2010-12-23 20:50:18 +00:00
|
|
|
|
|
2006-02-22 10:10:23 +00:00
|
|
|
|
if (!GTK_IS_MENU_ITEM (event_widget))
|
2000-09-02 02:43:50 +00:00
|
|
|
|
return TRUE;
|
2010-03-14 20:11:48 +00:00
|
|
|
|
|
2010-12-23 20:50:18 +00:00
|
|
|
|
menu_item = GTK_MENU_ITEM (event_widget);
|
|
|
|
|
|
|
|
|
|
/* Here we check to see if we're leaving an active menu item
|
|
|
|
|
* with a submenu, in which case we enter submenu navigation mode.
|
2000-09-02 02:43:50 +00:00
|
|
|
|
*/
|
2010-12-23 23:21:53 +00:00
|
|
|
|
if (menu_shell->priv->active_menu_item != NULL
|
2010-12-27 01:36:51 +00:00
|
|
|
|
&& menu_item->priv->submenu != NULL
|
|
|
|
|
&& menu_item->priv->submenu_placement == GTK_LEFT_RIGHT)
|
2000-09-02 02:43:50 +00:00
|
|
|
|
{
|
2010-12-27 01:36:51 +00:00
|
|
|
|
if (GTK_MENU_SHELL (menu_item->priv->submenu)->priv->active)
|
2010-12-23 20:50:18 +00:00
|
|
|
|
{
|
|
|
|
|
gtk_menu_set_submenu_navigation_region (menu, menu_item, event);
|
|
|
|
|
return TRUE;
|
|
|
|
|
}
|
2010-12-23 23:21:53 +00:00
|
|
|
|
else if (menu_item == GTK_MENU_ITEM (menu_shell->priv->active_menu_item))
|
2010-12-23 20:50:18 +00:00
|
|
|
|
{
|
|
|
|
|
/* We are leaving an active menu item with nonactive submenu.
|
|
|
|
|
* Deselect it so we don't surprise the user with by popping
|
|
|
|
|
* up a submenu _after_ he left the item.
|
|
|
|
|
*/
|
|
|
|
|
gtk_menu_shell_deselect (menu_shell);
|
|
|
|
|
return TRUE;
|
|
|
|
|
}
|
2000-09-02 02:43:50 +00:00
|
|
|
|
}
|
2010-12-23 20:50:18 +00:00
|
|
|
|
|
|
|
|
|
return GTK_WIDGET_CLASS (gtk_menu_parent_class)->leave_notify_event (widget, event);
|
2000-09-02 02:43:50 +00:00
|
|
|
|
}
|
|
|
|
|
|
2011-12-12 17:11:57 +00:00
|
|
|
|
static gboolean
|
|
|
|
|
pointer_on_menu_widget (GtkMenu *menu,
|
|
|
|
|
gdouble x_root,
|
|
|
|
|
gdouble y_root)
|
|
|
|
|
{
|
|
|
|
|
GtkMenuPrivate *priv = menu->priv;
|
|
|
|
|
GtkAllocation allocation;
|
|
|
|
|
gint window_x, window_y;
|
|
|
|
|
|
|
|
|
|
gtk_widget_get_allocation (GTK_WIDGET (menu), &allocation);
|
|
|
|
|
gdk_window_get_position (gtk_widget_get_window (priv->toplevel),
|
|
|
|
|
&window_x, &window_y);
|
|
|
|
|
|
|
|
|
|
if (x_root >= window_x && x_root < window_x + allocation.width &&
|
|
|
|
|
y_root >= window_y && y_root < window_y + allocation.height)
|
|
|
|
|
return TRUE;
|
|
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
|
gtk_menu_captured_event (GtkWidget *widget,
|
|
|
|
|
GdkEvent *event)
|
|
|
|
|
{
|
|
|
|
|
GdkDevice *source_device;
|
|
|
|
|
gboolean retval = FALSE;
|
|
|
|
|
GtkMenuPrivate *priv;
|
|
|
|
|
GtkMenu *menu;
|
|
|
|
|
gdouble x_root, y_root;
|
|
|
|
|
guint button;
|
|
|
|
|
GdkModifierType state;
|
|
|
|
|
|
|
|
|
|
menu = GTK_MENU (widget);
|
|
|
|
|
priv = menu->priv;
|
|
|
|
|
|
2012-07-13 13:03:30 +00:00
|
|
|
|
if (!priv->upper_arrow_visible && !priv->lower_arrow_visible && priv->drag_start_y < 0)
|
2011-12-12 17:11:57 +00:00
|
|
|
|
return retval;
|
|
|
|
|
|
|
|
|
|
source_device = gdk_event_get_source_device (event);
|
|
|
|
|
gdk_event_get_root_coords (event, &x_root, &y_root);
|
|
|
|
|
|
|
|
|
|
switch (event->type)
|
|
|
|
|
{
|
|
|
|
|
case GDK_TOUCH_BEGIN:
|
|
|
|
|
case GDK_BUTTON_PRESS:
|
|
|
|
|
if ((!gdk_event_get_button (event, &button) || button == 1) &&
|
|
|
|
|
gdk_device_get_source (source_device) == GDK_SOURCE_TOUCHSCREEN &&
|
|
|
|
|
pointer_on_menu_widget (menu, x_root, y_root))
|
|
|
|
|
{
|
|
|
|
|
priv->drag_start_y = event->button.y_root;
|
|
|
|
|
priv->initial_drag_offset = priv->scroll_offset;
|
|
|
|
|
priv->drag_scroll_started = FALSE;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
priv->drag_start_y = -1;
|
|
|
|
|
|
|
|
|
|
priv->drag_already_pressed = TRUE;
|
|
|
|
|
break;
|
|
|
|
|
case GDK_TOUCH_END:
|
|
|
|
|
case GDK_BUTTON_RELEASE:
|
|
|
|
|
if (priv->drag_scroll_started)
|
|
|
|
|
{
|
|
|
|
|
priv->drag_scroll_started = FALSE;
|
|
|
|
|
priv->drag_start_y = -1;
|
|
|
|
|
priv->drag_already_pressed = FALSE;
|
|
|
|
|
retval = TRUE;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case GDK_TOUCH_UPDATE:
|
|
|
|
|
case GDK_MOTION_NOTIFY:
|
2012-07-13 12:47:38 +00:00
|
|
|
|
if ((!gdk_event_get_state (event, &state) || (state & GDK_BUTTON1_MASK) != 0) &&
|
2011-12-12 17:11:57 +00:00
|
|
|
|
gdk_device_get_source (source_device) == GDK_SOURCE_TOUCHSCREEN)
|
|
|
|
|
{
|
|
|
|
|
if (!priv->drag_already_pressed)
|
|
|
|
|
{
|
|
|
|
|
if (pointer_on_menu_widget (menu, x_root, y_root))
|
|
|
|
|
{
|
|
|
|
|
priv->drag_start_y = y_root;
|
|
|
|
|
priv->initial_drag_offset = priv->scroll_offset;
|
|
|
|
|
priv->drag_scroll_started = FALSE;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
priv->drag_start_y = -1;
|
|
|
|
|
|
|
|
|
|
priv->drag_already_pressed = TRUE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (priv->drag_start_y < 0 && !priv->drag_scroll_started)
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
if (priv->drag_scroll_started)
|
|
|
|
|
{
|
|
|
|
|
gint offset, view_height;
|
|
|
|
|
GtkBorder arrow_border;
|
|
|
|
|
gdouble y_diff;
|
|
|
|
|
|
|
|
|
|
y_diff = y_root - priv->drag_start_y;
|
|
|
|
|
offset = priv->initial_drag_offset - y_diff;
|
|
|
|
|
|
|
|
|
|
view_height = gdk_window_get_height (gtk_widget_get_window (widget));
|
|
|
|
|
get_arrows_border (menu, &arrow_border);
|
|
|
|
|
|
|
|
|
|
if (priv->upper_arrow_visible)
|
|
|
|
|
view_height -= arrow_border.top;
|
|
|
|
|
|
|
|
|
|
if (priv->lower_arrow_visible)
|
|
|
|
|
view_height -= arrow_border.bottom;
|
|
|
|
|
|
2012-07-13 13:03:30 +00:00
|
|
|
|
offset = CLAMP (offset,
|
|
|
|
|
MIN (priv->scroll_offset, 0),
|
|
|
|
|
MAX (priv->scroll_offset, priv->requested_height - view_height));
|
|
|
|
|
|
2019-01-17 18:27:51 +00:00
|
|
|
|
gtk_menu_scroll_to (menu, offset, GTK_MENU_SCROLL_FLAG_NONE);
|
2011-12-12 17:11:57 +00:00
|
|
|
|
|
|
|
|
|
retval = TRUE;
|
|
|
|
|
}
|
|
|
|
|
else if (gtk_drag_check_threshold (widget,
|
|
|
|
|
0, priv->drag_start_y,
|
|
|
|
|
0, y_root))
|
|
|
|
|
{
|
|
|
|
|
priv->drag_scroll_started = TRUE;
|
|
|
|
|
gtk_menu_shell_deselect (GTK_MENU_SHELL (menu));
|
|
|
|
|
retval = TRUE;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case GDK_ENTER_NOTIFY:
|
|
|
|
|
case GDK_LEAVE_NOTIFY:
|
|
|
|
|
if (priv->drag_scroll_started)
|
|
|
|
|
retval = TRUE;
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return retval;
|
|
|
|
|
}
|
|
|
|
|
|
2010-12-23 20:50:18 +00:00
|
|
|
|
static void
|
2000-09-02 02:43:50 +00:00
|
|
|
|
gtk_menu_stop_navigating_submenu (GtkMenu *menu)
|
|
|
|
|
{
|
2010-12-23 20:50:18 +00:00
|
|
|
|
GtkMenuPrivate *priv = menu->priv;
|
2010-06-16 11:14:01 +00:00
|
|
|
|
|
|
|
|
|
priv->navigation_x = 0;
|
|
|
|
|
priv->navigation_y = 0;
|
|
|
|
|
priv->navigation_width = 0;
|
|
|
|
|
priv->navigation_height = 0;
|
|
|
|
|
|
2010-12-23 20:50:18 +00:00
|
|
|
|
if (priv->navigation_timeout)
|
2000-09-02 02:43:50 +00:00
|
|
|
|
{
|
2010-12-23 20:50:18 +00:00
|
|
|
|
g_source_remove (priv->navigation_timeout);
|
|
|
|
|
priv->navigation_timeout = 0;
|
2000-09-02 02:43:50 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* When the timeout is elapsed, the navigation region is destroyed
|
|
|
|
|
* and the menuitem under the pointer (if any) is selected.
|
|
|
|
|
*/
|
|
|
|
|
static gboolean
|
|
|
|
|
gtk_menu_stop_navigating_submenu_cb (gpointer user_data)
|
|
|
|
|
{
|
2010-05-25 22:38:44 +00:00
|
|
|
|
GtkMenuPopdownData *popdown_data = user_data;
|
|
|
|
|
GtkMenu *menu = popdown_data->menu;
|
2010-12-23 20:50:18 +00:00
|
|
|
|
GtkMenuPrivate *priv = menu->priv;
|
2000-09-02 02:43:50 +00:00
|
|
|
|
GdkWindow *child_window;
|
|
|
|
|
|
|
|
|
|
gtk_menu_stop_navigating_submenu (menu);
|
2010-12-23 20:50:18 +00:00
|
|
|
|
|
2010-03-02 06:16:02 +00:00
|
|
|
|
if (gtk_widget_get_realized (GTK_WIDGET (menu)))
|
2000-09-02 02:43:50 +00:00
|
|
|
|
{
|
2010-12-23 20:50:18 +00:00
|
|
|
|
child_window = gdk_window_get_device_position (priv->bin_window,
|
2010-05-25 22:38:44 +00:00
|
|
|
|
popdown_data->device,
|
|
|
|
|
NULL, NULL, NULL);
|
2000-09-02 02:43:50 +00:00
|
|
|
|
|
|
|
|
|
if (child_window)
|
2010-12-23 20:50:18 +00:00
|
|
|
|
{
|
|
|
|
|
GdkEvent *send_event = gdk_event_new (GDK_ENTER_NOTIFY);
|
2002-10-03 20:53:30 +00:00
|
|
|
|
|
2010-12-23 20:50:18 +00:00
|
|
|
|
send_event->crossing.window = g_object_ref (child_window);
|
|
|
|
|
send_event->crossing.time = GDK_CURRENT_TIME; /* Bogus */
|
|
|
|
|
send_event->crossing.send_event = TRUE;
|
2010-05-25 22:38:44 +00:00
|
|
|
|
gdk_event_set_device (send_event, popdown_data->device);
|
2001-02-17 06:04:40 +00:00
|
|
|
|
|
2010-12-23 20:50:18 +00:00
|
|
|
|
GTK_WIDGET_CLASS (gtk_menu_parent_class)->enter_notify_event (GTK_WIDGET (menu), (GdkEventCrossing *)send_event);
|
2000-09-02 02:43:50 +00:00
|
|
|
|
|
2010-12-23 20:50:18 +00:00
|
|
|
|
gdk_event_free (send_event);
|
|
|
|
|
}
|
2000-09-02 02:43:50 +00:00
|
|
|
|
}
|
|
|
|
|
|
2010-12-23 20:50:18 +00:00
|
|
|
|
return FALSE;
|
2000-09-02 02:43:50 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
|
gtk_menu_navigating_submenu (GtkMenu *menu,
|
2010-12-23 20:50:18 +00:00
|
|
|
|
gint event_x,
|
|
|
|
|
gint event_y)
|
2000-09-02 02:43:50 +00:00
|
|
|
|
{
|
2010-12-23 20:50:18 +00:00
|
|
|
|
GtkMenuPrivate *priv = menu->priv;
|
|
|
|
|
gint width, height;
|
2000-09-02 02:43:50 +00:00
|
|
|
|
|
2010-06-16 11:14:01 +00:00
|
|
|
|
if (!gtk_menu_has_navigation_triangle (menu))
|
|
|
|
|
return FALSE;
|
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
|
|
|
|
|
2010-06-16 11:14:01 +00:00
|
|
|
|
width = priv->navigation_width;
|
|
|
|
|
height = priv->navigation_height;
|
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
|
|
|
|
|
2010-12-23 20:50:18 +00:00
|
|
|
|
/* Check if x/y are in the triangle spanned by the navigation parameters */
|
2010-06-16 11:14:01 +00:00
|
|
|
|
|
|
|
|
|
/* 1) Move the coordinates so the triangle starts at 0,0 */
|
|
|
|
|
event_x -= priv->navigation_x;
|
|
|
|
|
event_y -= priv->navigation_y;
|
|
|
|
|
|
|
|
|
|
/* 2) Ensure both legs move along the positive axis */
|
|
|
|
|
if (width < 0)
|
|
|
|
|
{
|
|
|
|
|
event_x = -event_x;
|
|
|
|
|
width = -width;
|
|
|
|
|
}
|
|
|
|
|
if (height < 0)
|
|
|
|
|
{
|
|
|
|
|
event_y = -event_y;
|
|
|
|
|
height = -height;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* 3) Check that the given coordinate is inside the triangle. The formula
|
|
|
|
|
* is a transformed form of this formula: x/w + y/h <= 1
|
|
|
|
|
*/
|
|
|
|
|
if (event_x >= 0 && event_y >= 0 &&
|
|
|
|
|
event_x * height + event_y * width <= width * height)
|
|
|
|
|
{
|
|
|
|
|
return TRUE;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
gtk_menu_stop_navigating_submenu (menu);
|
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
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
|
|
|
|
}
|
|
|
|
|
|
2000-09-02 02:43:50 +00:00
|
|
|
|
static void
|
|
|
|
|
gtk_menu_set_submenu_navigation_region (GtkMenu *menu,
|
2010-12-23 20:50:18 +00:00
|
|
|
|
GtkMenuItem *menu_item,
|
|
|
|
|
GdkEventCrossing *event)
|
2000-09-02 02:43:50 +00:00
|
|
|
|
{
|
2010-12-23 20:50:18 +00:00
|
|
|
|
GtkMenuPrivate *priv = menu->priv;
|
2000-09-02 02:43:50 +00:00
|
|
|
|
GtkWidget *event_widget;
|
2010-08-11 21:08:37 +00:00
|
|
|
|
GdkWindow *window;
|
2018-05-06 10:41:12 +00:00
|
|
|
|
int submenu_left;
|
|
|
|
|
int submenu_right;
|
|
|
|
|
int submenu_top;
|
|
|
|
|
int submenu_bottom;
|
|
|
|
|
int width;
|
2000-09-02 02:43:50 +00:00
|
|
|
|
|
2010-12-27 01:36:51 +00:00
|
|
|
|
g_return_if_fail (menu_item->priv->submenu != NULL);
|
2000-09-02 02:43:50 +00:00
|
|
|
|
g_return_if_fail (event != NULL);
|
2010-06-16 11:14:01 +00:00
|
|
|
|
|
2000-09-02 02:43:50 +00:00
|
|
|
|
event_widget = gtk_get_event_widget ((GdkEvent*) event);
|
2010-08-11 21:08:37 +00:00
|
|
|
|
|
2010-12-27 01:36:51 +00:00
|
|
|
|
window = gtk_widget_get_window (menu_item->priv->submenu);
|
2010-08-11 21:08:37 +00:00
|
|
|
|
gdk_window_get_origin (window, &submenu_left, &submenu_top);
|
|
|
|
|
|
2010-09-20 14:39:25 +00:00
|
|
|
|
submenu_right = submenu_left + gdk_window_get_width (window);
|
|
|
|
|
submenu_bottom = submenu_top + gdk_window_get_height (window);
|
2010-08-11 21:08:37 +00:00
|
|
|
|
|
2010-09-20 14:39:25 +00:00
|
|
|
|
width = gdk_window_get_width (gtk_widget_get_window (event_widget));
|
2010-08-11 21:08:37 +00:00
|
|
|
|
|
2000-09-02 02:43:50 +00:00
|
|
|
|
if (event->x >= 0 && event->x < width)
|
|
|
|
|
{
|
2018-05-06 10:41:12 +00:00
|
|
|
|
GtkMenuPopdownData *popdown_data;
|
|
|
|
|
/* The calculations below assume floored coordinates */
|
|
|
|
|
int x_root = floor (event->x_root);
|
|
|
|
|
int y_root = floor (event->y_root);
|
|
|
|
|
|
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_stop_navigating_submenu (menu);
|
|
|
|
|
|
2010-06-16 11:14:01 +00:00
|
|
|
|
/* The navigation region is the triangle closest to the x/y
|
|
|
|
|
* location of the rectangle. This is why the width or height
|
|
|
|
|
* can be negative.
|
|
|
|
|
*/
|
2010-12-27 01:36:51 +00:00
|
|
|
|
if (menu_item->priv->submenu_direction == GTK_DIRECTION_RIGHT)
|
2010-12-23 20:50:18 +00:00
|
|
|
|
{
|
|
|
|
|
/* right */
|
2010-06-16 11:14:01 +00:00
|
|
|
|
priv->navigation_x = submenu_left;
|
2016-11-15 02:57:43 +00:00
|
|
|
|
priv->navigation_width = x_root - submenu_left;
|
2010-12-23 20:50:18 +00:00
|
|
|
|
}
|
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
|
|
|
|
else
|
2010-12-23 20:50:18 +00:00
|
|
|
|
{
|
|
|
|
|
/* left */
|
2010-06-16 11:14:01 +00:00
|
|
|
|
priv->navigation_x = submenu_right;
|
2016-11-15 02:57:43 +00:00
|
|
|
|
priv->navigation_width = x_root - submenu_right;
|
2010-12-23 20:50:18 +00:00
|
|
|
|
}
|
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
|
|
|
|
|
2000-09-02 02:43:50 +00:00
|
|
|
|
if (event->y < 0)
|
2010-12-23 20:50:18 +00:00
|
|
|
|
{
|
|
|
|
|
/* top */
|
2016-11-15 02:57:43 +00:00
|
|
|
|
priv->navigation_y = y_root;
|
|
|
|
|
priv->navigation_height = submenu_top - y_root - NAVIGATION_REGION_OVERSHOOT;
|
2000-09-02 02:43:50 +00:00
|
|
|
|
|
2010-12-23 20:50:18 +00:00
|
|
|
|
if (priv->navigation_height >= 0)
|
|
|
|
|
return;
|
|
|
|
|
}
|
2000-09-02 02:43:50 +00:00
|
|
|
|
else
|
2010-12-23 20:50:18 +00:00
|
|
|
|
{
|
|
|
|
|
/* bottom */
|
2016-11-15 02:57:43 +00:00
|
|
|
|
priv->navigation_y = y_root;
|
|
|
|
|
priv->navigation_height = submenu_bottom - y_root + NAVIGATION_REGION_OVERSHOOT;
|
2000-09-02 02:43:50 +00:00
|
|
|
|
|
2010-12-23 20:50:18 +00:00
|
|
|
|
if (priv->navigation_height <= 0)
|
|
|
|
|
return;
|
|
|
|
|
}
|
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
|
|
|
|
|
2010-05-25 22:38:44 +00:00
|
|
|
|
popdown_data = g_new (GtkMenuPopdownData, 1);
|
|
|
|
|
popdown_data->menu = menu;
|
|
|
|
|
popdown_data->device = gdk_event_get_device ((GdkEvent *) event);
|
|
|
|
|
|
2010-12-23 20:50:18 +00:00
|
|
|
|
priv->navigation_timeout = gdk_threads_add_timeout_full (G_PRIORITY_DEFAULT,
|
2013-06-26 18:08:37 +00:00
|
|
|
|
MENU_POPDOWN_DELAY,
|
2010-05-25 22:38:44 +00:00
|
|
|
|
gtk_menu_stop_navigating_submenu_cb,
|
|
|
|
|
popdown_data,
|
|
|
|
|
(GDestroyNotify) g_free);
|
2013-10-22 13:43:43 +00:00
|
|
|
|
g_source_set_name_by_id (priv->navigation_timeout, "[gtk+] gtk_menu_stop_navigating_submenu_cb");
|
2000-09-02 02:43:50 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
|
static void
|
|
|
|
|
gtk_menu_deactivate (GtkMenuShell *menu_shell)
|
|
|
|
|
{
|
1998-03-09 07:36:55 +00:00
|
|
|
|
GtkWidget *parent;
|
2010-12-23 20:50:18 +00:00
|
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
|
g_return_if_fail (GTK_IS_MENU (menu_shell));
|
2010-12-23 20:50:18 +00:00
|
|
|
|
|
2010-12-23 23:21:53 +00:00
|
|
|
|
parent = menu_shell->priv->parent_menu_shell;
|
2010-12-23 20:50:18 +00:00
|
|
|
|
|
2010-12-23 23:21:53 +00:00
|
|
|
|
menu_shell->priv->activate_time = 0;
|
1997-11-24 22:37:52 +00:00
|
|
|
|
gtk_menu_popdown (GTK_MENU (menu_shell));
|
2010-12-23 20:50:18 +00:00
|
|
|
|
|
1998-03-09 07:36:55 +00:00
|
|
|
|
if (parent)
|
|
|
|
|
gtk_menu_shell_deactivate (GTK_MENU_SHELL (parent));
|
1997-11-24 22:37:52 +00:00
|
|
|
|
}
|
1998-01-02 20:22:38 +00:00
|
|
|
|
|
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
|
|
|
|
static void
|
2016-06-14 19:42:13 +00:00
|
|
|
|
gtk_menu_position_legacy (GtkMenu *menu,
|
|
|
|
|
gboolean set_scroll_offset)
|
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
|
|
|
|
{
|
2010-12-23 20:50:18 +00:00
|
|
|
|
GtkMenuPrivate *priv = menu->priv;
|
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
|
|
|
|
GtkWidget *widget;
|
1999-02-10 02:35:09 +00:00
|
|
|
|
GtkRequisition requisition;
|
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
|
|
|
|
gint x, y;
|
Add note about GtkMenuPositionFunc API changes.
2000-11-08 Alexander Larsson <alexl@redhat.com>
* docs/Changes-2.0.txt: Add note about GtkMenuPositionFunc
API changes.
* gtk/gtkmenu.c: Add support for scrolling menus.
Remove gtk_menu_append/prepend/insert, these have been moved to
gtkcompat.h as #defines.
* gtk/gtkcompat.h.in:
Add compatibility #defines for gtk_menu_append/prepend/insert
* gtk/gtkmenu.h: Add data needed for scrolling menus.
GtkMenuPositionFunc gets an extra argument push_in.
gtk_menu_append/prepend/insert removed.
* gtk/gtkmenuitem.c (gtk_menu_item_position_menu): Change menu
positioning behaviour to fit to scrolling menus.
* gtk/gtkmenuitem.c (gtk_menu_item_forall): Don't recurse
into menuitem->submeny. That is wrong, and broke torn
off submenus of torn off menus, since they were unrealized
when the first menu was unrealized.
* gtk/gtkmenushell.[ch]: Virtualize gtk_menu_shell_insert() and
gtk_menu_shell_select_item() since these need to be overridden in
GtkMenu.
* gtk/gtkoptionmenu.c (gtk_opttion_menu_position): Change menu
positioning behaviour to fit to scrolling menus.
(gtk_option_menu_key_press, gtk_option_menu_button_press): Select
the current item so that it is prelighted when the menu pops up.
This is a workaround to the fact that the menu doesn't get the
initial enter event (due to grabs).
* gtk/gtkfilesel.c, gtk/gtkinputdialog.c, gtk/testgtk.c:
s/gtk_menu_append/gtk_menu_shell_append/
* gtk/gtknotebook.c:
s/gtk_menu_insert/gtk_menu_shell_insert/
* gtk/testgtk.c (create_menu, create_menus):
Create the first menu with 50 items so that menu scrolling
can be tested.
Patch from Jonathan Blandford <jrb@redhat.com>
* gtk/gtkmenuitem.[ch] (gtk_menu_item_toggle_size_request): new
system to handle size requests. First, we ask what the size of
the toggle is. Then, when allocating the size, we allocate the
toggle_size first. This way we can have multiple menu-item
classes w/o needing a seperate class for each.
* gtk/gtkmenu.c (gtk_menu_size_request): Actually use the new system.
* gtk/gtkmenu.c (gtk_menu_size_allocate): Use the new system.
* gtk/gtkcheckmenuitem.c
(gtk_check_menu_item_toggle_size_request): New function to handle
the toggle size-request.
2000-11-08 17:34:52 +00:00
|
|
|
|
gint scroll_offset;
|
2016-04-11 02:59:53 +00:00
|
|
|
|
GdkDisplay *display;
|
|
|
|
|
GdkMonitor *monitor;
|
|
|
|
|
GdkRectangle workarea;
|
|
|
|
|
gint monitor_num;
|
2010-05-25 22:38:44 +00:00
|
|
|
|
GdkDevice *pointer;
|
2014-06-06 22:00:36 +00:00
|
|
|
|
GtkBorder border;
|
2016-04-11 02:59:53 +00:00
|
|
|
|
gint i;
|
2010-05-25 22:38:44 +00:00
|
|
|
|
|
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
|
|
|
|
widget = GTK_WIDGET (menu);
|
|
|
|
|
|
2016-04-11 02:59:53 +00:00
|
|
|
|
display = gtk_widget_get_display (widget);
|
2010-06-15 23:09:41 +00:00
|
|
|
|
pointer = _gtk_menu_shell_get_grab_device (GTK_MENU_SHELL (menu));
|
2016-04-11 02:59:53 +00:00
|
|
|
|
gdk_device_get_position (pointer, NULL, &x, &y);
|
2010-05-25 22:38:44 +00:00
|
|
|
|
|
2014-09-24 23:50:28 +00:00
|
|
|
|
/* Realize so we have the proper width and height to figure out
|
2010-12-23 20:50:18 +00:00
|
|
|
|
* the right place to popup the menu.
|
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
|
|
|
|
*/
|
2011-05-25 02:48:20 +00:00
|
|
|
|
gtk_widget_realize (priv->toplevel);
|
2014-06-06 22:00:36 +00:00
|
|
|
|
|
|
|
|
|
_gtk_window_get_shadow_width (GTK_WINDOW (priv->toplevel), &border);
|
|
|
|
|
|
2014-07-15 23:09:05 +00:00
|
|
|
|
requisition.width = gtk_widget_get_allocated_width (widget);
|
|
|
|
|
requisition.height = gtk_widget_get_allocated_height (widget);
|
Add note about GtkMenuPositionFunc API changes.
2000-11-08 Alexander Larsson <alexl@redhat.com>
* docs/Changes-2.0.txt: Add note about GtkMenuPositionFunc
API changes.
* gtk/gtkmenu.c: Add support for scrolling menus.
Remove gtk_menu_append/prepend/insert, these have been moved to
gtkcompat.h as #defines.
* gtk/gtkcompat.h.in:
Add compatibility #defines for gtk_menu_append/prepend/insert
* gtk/gtkmenu.h: Add data needed for scrolling menus.
GtkMenuPositionFunc gets an extra argument push_in.
gtk_menu_append/prepend/insert removed.
* gtk/gtkmenuitem.c (gtk_menu_item_position_menu): Change menu
positioning behaviour to fit to scrolling menus.
* gtk/gtkmenuitem.c (gtk_menu_item_forall): Don't recurse
into menuitem->submeny. That is wrong, and broke torn
off submenus of torn off menus, since they were unrealized
when the first menu was unrealized.
* gtk/gtkmenushell.[ch]: Virtualize gtk_menu_shell_insert() and
gtk_menu_shell_select_item() since these need to be overridden in
GtkMenu.
* gtk/gtkoptionmenu.c (gtk_opttion_menu_position): Change menu
positioning behaviour to fit to scrolling menus.
(gtk_option_menu_key_press, gtk_option_menu_button_press): Select
the current item so that it is prelighted when the menu pops up.
This is a workaround to the fact that the menu doesn't get the
initial enter event (due to grabs).
* gtk/gtkfilesel.c, gtk/gtkinputdialog.c, gtk/testgtk.c:
s/gtk_menu_append/gtk_menu_shell_append/
* gtk/gtknotebook.c:
s/gtk_menu_insert/gtk_menu_shell_insert/
* gtk/testgtk.c (create_menu, create_menus):
Create the first menu with 50 items so that menu scrolling
can be tested.
Patch from Jonathan Blandford <jrb@redhat.com>
* gtk/gtkmenuitem.[ch] (gtk_menu_item_toggle_size_request): new
system to handle size requests. First, we ask what the size of
the toggle is. Then, when allocating the size, we allocate the
toggle_size first. This way we can have multiple menu-item
classes w/o needing a seperate class for each.
* gtk/gtkmenu.c (gtk_menu_size_request): Actually use the new system.
* gtk/gtkmenu.c (gtk_menu_size_allocate): Use the new system.
* gtk/gtkcheckmenuitem.c
(gtk_check_menu_item_toggle_size_request): New function to handle
the toggle size-request.
2000-11-08 17:34:52 +00:00
|
|
|
|
|
2016-04-11 02:59:53 +00:00
|
|
|
|
monitor = gdk_display_get_monitor_at_point (display, x, y);
|
|
|
|
|
monitor_num = 0;
|
|
|
|
|
for (i = 0; ; i++)
|
2002-12-14 06:05:00 +00:00
|
|
|
|
{
|
2016-04-11 02:59:53 +00:00
|
|
|
|
GdkMonitor *m = gdk_display_get_monitor (display, i);
|
|
|
|
|
|
|
|
|
|
if (m == monitor)
|
|
|
|
|
{
|
|
|
|
|
monitor_num = i;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
if (m == NULL)
|
|
|
|
|
break;
|
2002-12-14 06:05:00 +00:00
|
|
|
|
}
|
|
|
|
|
|
2016-04-11 02:59:53 +00:00
|
|
|
|
priv->monitor_num = monitor_num;
|
2010-12-23 20:50:18 +00:00
|
|
|
|
priv->initially_pushed_in = FALSE;
|
2002-12-14 06:05:00 +00:00
|
|
|
|
|
2010-12-23 20:50:18 +00:00
|
|
|
|
/* Set the type hint here to allow custom position functions
|
|
|
|
|
* to set a different hint
|
|
|
|
|
*/
|
|
|
|
|
if (!gtk_widget_get_visible (priv->toplevel))
|
|
|
|
|
gtk_window_set_type_hint (GTK_WINDOW (priv->toplevel), GDK_WINDOW_TYPE_HINT_POPUP_MENU);
|
2006-04-25 14:27:32 +00:00
|
|
|
|
|
2010-12-23 20:50:18 +00:00
|
|
|
|
if (priv->position_func)
|
2003-11-12 20:53:03 +00:00
|
|
|
|
{
|
2010-12-23 20:50:18 +00:00
|
|
|
|
(* priv->position_func) (menu, &x, &y, &priv->initially_pushed_in,
|
|
|
|
|
priv->position_func_data);
|
2009-06-22 04:53:14 +00:00
|
|
|
|
|
2010-12-23 20:50:18 +00:00
|
|
|
|
if (priv->monitor_num < 0)
|
2016-04-11 02:59:53 +00:00
|
|
|
|
priv->monitor_num = monitor_num;
|
2004-07-06 13:28:42 +00:00
|
|
|
|
|
2016-04-11 02:59:53 +00:00
|
|
|
|
monitor = gdk_display_get_monitor (display, priv->monitor_num);
|
|
|
|
|
gdk_monitor_get_workarea (monitor, &workarea);
|
2003-11-12 20:53:03 +00:00
|
|
|
|
}
|
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
|
|
|
|
else
|
|
|
|
|
{
|
2003-08-04 22:09:02 +00:00
|
|
|
|
gint space_left, space_right, space_above, space_below;
|
|
|
|
|
gint needed_width;
|
|
|
|
|
gint needed_height;
|
2011-05-17 18:10:19 +00:00
|
|
|
|
GtkBorder padding;
|
2014-03-05 11:59:24 +00:00
|
|
|
|
GtkBorder margin;
|
2003-08-04 22:09:02 +00:00
|
|
|
|
gboolean rtl = (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL);
|
|
|
|
|
|
2011-05-17 18:10:19 +00:00
|
|
|
|
get_menu_padding (widget, &padding);
|
2014-03-05 11:59:24 +00:00
|
|
|
|
get_menu_margin (widget, &margin);
|
2010-11-21 18:40:28 +00:00
|
|
|
|
|
2003-08-04 22:09:02 +00:00
|
|
|
|
/* The placement of popup menus horizontally works like this (with
|
|
|
|
|
* RTL in parentheses)
|
|
|
|
|
*
|
|
|
|
|
* - If there is enough room to the right (left) of the mouse cursor,
|
|
|
|
|
* position the menu there.
|
2010-12-23 20:50:18 +00:00
|
|
|
|
*
|
|
|
|
|
* - Otherwise, if if there is enough room to the left (right) of the
|
2003-08-04 22:09:02 +00:00
|
|
|
|
* mouse cursor, position the menu there.
|
2010-12-23 20:50:18 +00:00
|
|
|
|
*
|
2003-08-04 22:09:02 +00:00
|
|
|
|
* - Otherwise if the menu is smaller than the monitor, position it
|
|
|
|
|
* on the side of the mouse cursor that has the most space available
|
|
|
|
|
*
|
|
|
|
|
* - Otherwise (if there is simply not enough room for the menu on the
|
|
|
|
|
* monitor), position it as far left (right) as possible.
|
|
|
|
|
*
|
|
|
|
|
* Positioning in the vertical direction is similar: first try below
|
|
|
|
|
* mouse cursor, then above.
|
|
|
|
|
*/
|
2016-04-11 02:59:53 +00:00
|
|
|
|
monitor = gdk_display_get_monitor (display, priv->monitor_num);
|
|
|
|
|
gdk_monitor_get_workarea (monitor, &workarea);
|
2003-11-12 20:53:03 +00:00
|
|
|
|
|
2016-04-11 02:59:53 +00:00
|
|
|
|
space_left = x - workarea.x;
|
|
|
|
|
space_right = workarea.x + workarea.width - x - 1;
|
|
|
|
|
space_above = y - workarea.y;
|
|
|
|
|
space_below = workarea.y + workarea.height - y - 1;
|
2003-08-04 22:09:02 +00:00
|
|
|
|
|
2010-12-23 20:50:18 +00:00
|
|
|
|
/* Position horizontally. */
|
2003-08-04 22:09:02 +00:00
|
|
|
|
|
2010-12-23 20:50:18 +00:00
|
|
|
|
/* the amount of space we need to position the menu.
|
|
|
|
|
* Note the menu is offset "thickness" pixels
|
2003-08-04 22:09:02 +00:00
|
|
|
|
*/
|
2011-05-17 18:10:19 +00:00
|
|
|
|
needed_width = requisition.width - padding.left;
|
2003-08-04 22:09:02 +00:00
|
|
|
|
|
|
|
|
|
if (needed_width <= space_left ||
|
2010-12-23 20:50:18 +00:00
|
|
|
|
needed_width <= space_right)
|
|
|
|
|
{
|
|
|
|
|
if ((rtl && needed_width <= space_left) ||
|
|
|
|
|
(!rtl && needed_width > space_right))
|
|
|
|
|
{
|
|
|
|
|
/* position left */
|
2014-03-05 11:59:24 +00:00
|
|
|
|
x = x - margin.left + padding.left - requisition.width + 1;
|
2010-12-23 20:50:18 +00:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
/* position right */
|
2014-03-05 11:59:24 +00:00
|
|
|
|
x = x + margin.right - padding.right;
|
2010-12-23 20:50:18 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* x is clamped on-screen further down */
|
|
|
|
|
}
|
2016-04-11 02:59:53 +00:00
|
|
|
|
else if (requisition.width <= workarea.width)
|
2010-12-23 20:50:18 +00:00
|
|
|
|
{
|
|
|
|
|
/* the menu is too big to fit on either side of the mouse
|
|
|
|
|
* cursor, but smaller than the monitor. Position it on
|
|
|
|
|
* the side that has the most space
|
|
|
|
|
*/
|
|
|
|
|
if (space_left > space_right)
|
|
|
|
|
{
|
|
|
|
|
/* left justify */
|
2016-04-11 02:59:53 +00:00
|
|
|
|
x = workarea.x;
|
2010-12-23 20:50:18 +00:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
/* right justify */
|
2016-04-11 02:59:53 +00:00
|
|
|
|
x = workarea.x + workarea.width - requisition.width;
|
2010-12-23 20:50:18 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2003-08-04 22:09:02 +00:00
|
|
|
|
else /* menu is simply too big for the monitor */
|
2010-12-23 20:50:18 +00:00
|
|
|
|
{
|
|
|
|
|
if (rtl)
|
|
|
|
|
{
|
|
|
|
|
/* right justify */
|
2016-04-11 02:59:53 +00:00
|
|
|
|
x = workarea.x + workarea.width - requisition.width;
|
2010-12-23 20:50:18 +00:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
/* left justify */
|
2016-04-11 02:59:53 +00:00
|
|
|
|
x = workarea.x;
|
2010-12-23 20:50:18 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Position vertically.
|
|
|
|
|
* The algorithm is the same as above, but simpler
|
|
|
|
|
* because we don't have to take RTL into account.
|
2003-08-04 22:09:02 +00:00
|
|
|
|
*/
|
2011-05-17 18:10:19 +00:00
|
|
|
|
needed_height = requisition.height - padding.top;
|
2003-08-04 22:09:02 +00:00
|
|
|
|
|
|
|
|
|
if (needed_height <= space_above ||
|
2010-12-23 20:50:18 +00:00
|
|
|
|
needed_height <= space_below)
|
|
|
|
|
{
|
|
|
|
|
if (needed_height <= space_below)
|
2014-03-05 11:59:24 +00:00
|
|
|
|
y = y + margin.top - padding.top;
|
2010-12-23 20:50:18 +00:00
|
|
|
|
else
|
2014-03-05 11:59:24 +00:00
|
|
|
|
y = y - margin.bottom + padding.bottom - requisition.height + 1;
|
2010-12-23 20:50:18 +00:00
|
|
|
|
|
2016-04-11 02:59:53 +00:00
|
|
|
|
y = CLAMP (y, workarea.y,
|
|
|
|
|
workarea.y + workarea.height - requisition.height);
|
2010-12-23 20:50:18 +00:00
|
|
|
|
}
|
2003-08-04 22:09:02 +00:00
|
|
|
|
else if (needed_height > space_below && needed_height > space_above)
|
2010-12-23 20:50:18 +00:00
|
|
|
|
{
|
|
|
|
|
if (space_below >= space_above)
|
2016-04-11 02:59:53 +00:00
|
|
|
|
y = workarea.y + workarea.height - requisition.height;
|
2010-12-23 20:50:18 +00:00
|
|
|
|
else
|
2016-04-11 02:59:53 +00:00
|
|
|
|
y = workarea.y;
|
2010-12-23 20:50:18 +00:00
|
|
|
|
}
|
2003-08-04 22:09:02 +00:00
|
|
|
|
else
|
2010-12-23 20:50:18 +00:00
|
|
|
|
{
|
2016-04-11 02:59:53 +00:00
|
|
|
|
y = workarea.y;
|
2010-12-23 20:50:18 +00:00
|
|
|
|
}
|
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
|
|
|
|
}
|
Adapt cast macros to standard.
Fri Nov 19 10:34:41 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtkgamma.h: Adapt cast macros to standard.
[ Merges from 1.2 ]
Tue Nov 16 10:15:54 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtkitemfactory.c (gtk_item_factory_parse_path):
If translation does not include a '/', use entire
translation instead of crashing.
Sun Oct 31 22:21:11 1999 Tim Janik <timj@gtk.org>
* docs/gtk_tut.sgml:
s/gtk_accel_group_attach/gtk_window_add_accel_group/.
Sat Oct 30 09:09:09 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtkselection.c (gtk_target_list_remove): Use
g_list_remove_link, not g_list_remove.
[ From Geert Bevin <gbevin@thunderstorms.org> ]
Sun Oct 24 07:41:40 1999 Tim Janik <timj@gtk.org>
* gtk/gtkclist.c (real_undo_selection): commented out g_print()
statement upon unselection (how the heck did that slip in?).
Sat Oct 23 03:03:08 1999 Tim Janik <timj@gtk.org>
* gtk/gtktext.c (gtk_text_freeze):
(gtk_text_thaw): undraw/draw cursor here to avoid unnecessary scrolling
in frozen state (and aparently crashes). patch provided by Anders
Melchiorsen <and@kampsax.dtu.dk>.
Sat Oct 23 02:53:20 1999 Tim Janik <timj@gtk.org>
* fix insensitive default/focus widget activation,
reported by Matt Goodall <mgg@isotek.co.uk>.
* gtk/gtkwindow.c (gtk_window_key_press_event):
(gtk_window_activate_default):
(gtk_window_activate_focus):
return handled=FALSE for actiavtion of insensitive default
widgets. return handled=TRUE for activation of insensitive
focus widgets. don't activate in either case.
Tue Oct 19 09:55:08 1999 Owen Taylor <otaylor@redhat.com>
* gtk-config.in (lib_gtk): Switch order of @x_cflags@
and $glib_cflags to match library order and in the
theory that an old version of GLib is more likely to
be in the include directory for X then vice-versa.
(Bug #2776)
Tue Oct 19 09:46:49 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtkrc.c (gtk_rc_init): Always use LC_CTYPE
to determine the locale for fontsets, not LC_MESSAGES;
the user may want English messages with a handling
for non-English languages. (LC_CTYPE=ru_RU LC_MESSAGES=fr_FR
will still be broken) (Bug #2891)
Tue Oct 19 20:36:42 1999 Changwoo Ryu <cwryu@adam.kaist.ac.kr>
* gtk/gtkrc.ko: Fixed the wrong number of "*"'s.
Tue Oct 19 12:15:13 1999 Changwoo Ryu <cwryu@adam.kaist.ac.kr>
* gtk/gtkrc.ko: Changed the Korean default fontset.
Fri Oct 8 02:32:47 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtklayout.c (gtk_layout_adjustment_changed): Fix bug
where when scrolling to the left or top double exposes
were done, causing major slowdowns.
Thu Oct 7 18:31:55 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtkrc.c (gtk_rc_init): Always normalize codeset
names to lowercase and alphanumeric, before looking
them up.
* gtk/Makefile.am: Install codeset variant gtkrc files
with normalized names.
Thu Oct 7 22:52:42 1999 Tim Janik <timj@gtk.org>
* gtk/gtkitemfactory.c (gtk_item_factory_popup_with_data): even
popup menus when the menu is already visible, but its parent
is still hidden, (happens after tornoff window got hidden).
Thu Oct 7 11:09:55 1999 Owen Taylor <otaylor@redhat.com>
* gtk/Makefile.am (install-data-local): Fix
a typo where gtkrc.vi_VN.tcvn5712 wasn't getting
deleted, causing error messages on install.
Thu Oct 7 11:03:06 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtk[hv]paned.c (gtk_{h,v}paned_draw): Redraw
the handle as well, since we now sometimes ignore
exposes on the handle while resizing.
Wed Oct 6 18:02:31 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtkrc.c (gtk_rc_append_default_pixmap_path): Fix stupid
extra g_free introduced in one of the last one or two
commits.
Wed Oct 6 16:38:36 1999 Owen Taylor <otaylor@redhat.com>
* gtk/Makefile.am gtk/gtkrc*: Make naming of gtkrc files
consistent, put each style that a gtkrc.* file creates
in a unique namespace, remove old files before installing.
Wed Oct 6 14:31:16 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtkrc.c (gtk_rc_init): Avoid leaking memory when
gtk_rc_init is called multiple times. (Yes, people who
do that have bugs in their code.)
Tue Oct 5 11:36:57 PDT 1999 Manish Singh <yosh@gimp.org>
* gtk/Makefile.am: listing gtkrc in gtkconf_DATA seems to barf.
Remove it since it's generated by the Makefile anyway
Tue Oct 5 02:43:41 1999 Owen Taylor <otaylor@redhat.com>
* gdk/gdkinputcommon.h (gdk_input_device_new): Free
device->info.axes for core pointer.
Thu Sep 30 13:55:25 1999 Owen Taylor <otaylor@redhat.com>
* gtk/testgtk.c (destroy_idle_test): Rename idle to
idle_id, to deal with obsolete, broken C libraries.
Mon Sep 27 02:50:15 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtkvscale.c (gtk_vscale_draw): Don't add in
allocation->x/y twice!
* gtk/gtkhscale.c: Make usage of gtk_hscale_pos_trough()
consistent with gtk_vscale_pos_trough().
Sun Sep 26 19:44:34 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtkcontainer.c (gtk_container_queue_resize): We may
be queueing a resize on a toplevel container between
the time we show it and when we map it. So, we need
to test GTK_WIDGET_VISIBLE() for toplevels, and only
use GTK_WIDGET_DRAWABLE() for child windows.
Thu Sep 23 16:41:03 1999 Owen Taylor <otaylor@redhat.com>
* gtk/Makefile.am (LDADDS): Add GDK_WLIBS to LDADDS
(fixes bug #2144)
Fri Sep 24 00:51:45 1999 Tim Janik <timj@gtk.org>
* gtk/gtkcontainer.c (gtk_container_queue_resize): check for
container DRAWABLE (instead of VISIBLE), so we don't queue
resizes on non-toplevel containers.
Sun Sep 19 18:13:31 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtkselection.[ch]: Make the data argument
const guchar *.
Sat Sep 18 21:27:40 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwindow.c: Try to behave sensibly if
the focus widget is the window itself. (Should
we allow this at all?)
Fri Sep 17 09:57:15 1999 Tim Janik <timj@gtk.org>
* gtk/gtkwidget.c (gtk_widget_set_sensitive):
* gtk/gtknotebook.c (gtk_notebook_set_scrollable):
* gtk/gtknotebook.c (gtk_notebook_set_show_border):
* gtk/gtkclist.c (gtk_notebook_set_show_border): make gboolean args
in prototypes and implementations consistent (Tomas Ogren).
* gtk/gtklayout.c (gtk_layout_remove): unset GTK_IS_OFFSCREEN flag
before the widget is unparented (reported by damon).
* gtk/gtkdnd.c: make the cursor and icon data _unsigned_ char,
since we provide unsigned data anyways.
Thu Sep 16 21:32:01 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtktooltips.c (gtk_tooltips_set_tip): Delay
the call to gtk_tooltips_layout_text() until later.
* gtk/gtktooltips.c (gtk_tooltips_draw_tips):
Call gtk_widget_ensure_style() before using the style.
Wed Sep 15 02:52:19 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwidget.c (gtk_widget_event): Added workaround
for old widgets that don't propagate draws to all
children. (Namely gnome-dock for gnome-libs <= 1.0.16)
Tue Sep 14 19:22:19 1999 Tim Janik <timj@gtk.org>
* gtk/gtkwidget.c (gtk_widget_queue_resize): don't queue the parent
for a redraw but just the widget that requested the resize.
Tue Sep 14 18:29:47 1999 Tim Janik <timj@gtk.org>
* gtk/gtkcontainer.c: added new widget level method
gtk_container_set_reallocate_redraws() and a GtkContainer flag
reallocate_redraws : 1 to reflect the setting, exported this through
the argument system as a boolean ::reallocate_redraws.
* gtk/gtkwidget.c (gtk_widget_size_allocate): when queueing redraws
on the widget because the allocation changes, do so as well for
widget->parent if the parent has reallocate_redraws set to TRUE.
with that containers requesting reallocation redraws get automatically
redrawn if their children changed allocation (this unfortunately
affects also other children that didn't change allocation, but we
cannot work around that before 1.3).
Tue Sep 14 18:23:01 1999 Tim Janik <timj@gtk.org>
* gtk/gtkwidget.c (gtk_widget_idle_draw): only emit ::draw if width
_and_ height are >0 (not _or_).
* gtk/gtktable.c (gtk_table_remove): use gtk_widget_queue_resize()
instead of gtk_container_queue_resize(), which is a core gtk internal
function (must have been on crack when i queued that).
* gtk/gtkprivate.h: added new private flag GTK_FULLDRAW_PENDING, so
we can check more reliably if we want to discard expose events.
* gtk/gtkwidget.c: added setting/unsetting of the GTK_FULLDRAW_PENDING
flag.
* gtk/gtkwidget.c (gtk_widget_event): don't discard synthesized exposes,
we simply trust these events. for deciding whether to discard exposes,
check GTK_FULLDRAW_PENDING instead of RESIZE_PENDING.
Mon Sep 13 15:01:21 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwidget.c (gtk_widget_queue_clear_area): Ignore
queues of areas that are completely off screen.
* gtk/gtkwidget.c (gtk_widget_idle_draw): Fix broken
logic for handleboxes.
* gtk/gtkwidget.c (gtk_widget_queue_draw_data): Add santity
check on width/height.
Mon Sep 13 02:22:47 1999 Tim Janik <timj@gtk.org>
* gtk/Makefile.am: backed out Raja's recent VPATH build "improvements",
we are fine with using $@ the way we do (if we actually encounter
brokeness with $@ in VPATH builds because of additional path prefixes,
we need to use $(@F) actually).
Mon Sep 13 01:34:53 1999 Tim Janik <timj@gtk.org>
* gtk/gtksignal.c: renamed two variables, hopefully didn't introduce
short lived bugs, that would allow language bindings to do surgeries
to our guts.
Fri Sep 10 15:22:50 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwindow.c (gtk_window_size_allocate): Fix typo
where comparison was being done against an uninitialized
value causing intermittant results depending on
compiler flags. Also make it clearer that we aren't
ever initializing the child as 0x0 (though this will
be caught in gtk_widget_size_allocate())
Fri Sep 10 10:06:56 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwindow.c (gtk_window_set_transient_for): Move
gtk_window_unset_transient_for() call after we do checks
involving the old transient parent.
[ From Lance Capser <lmc@cyberhighway.net> ]
1999-09-07 Raja R Harinath <harinath@cs.umn.edu>
* gtk/Makefile.am (gtk.defs): Go back to using `touch' to create
an empty file.
Mon Sep 6 00:11:56 1999 Lars Hamann <lars@gtk.org>
* gtk/gtkctree.c (gtk_ctree_is_ancestor): return FALSE if node has
no children. (Reported by: Chris Rogers <gandalf@pobox.com>)
1999-09-03 Raja R Harinath <harinath@cs.umn.edu>
* gtk/Makefile.am (gen_sources): Improve VPATH builds.
`$@' is valid only in the build dir, not after we've done
`cd $srcdir'. Also use `test -f' instead of less portable
`test -e'.
Fri Sep 3 15:59:56 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtktext.c (correct_cache_insert): Rewrite
for simplicity, and hopefully correctness.
(Fixes bug #1322, which was a segfault when
on some insertions with the properties around
the insertion set up just wrong.)
* gtk/gtktext.c (gtk_text_adjustment): When we receive
a "changed" signal, clamp the new value to the adjustment
bounds to avoid segfaulting if someone tries to change
the adjustment to a bogus value. (Bug #1795)
Thu Sep 2 16:33:59 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtkmain.c: Ignore unexpected destroy notifies
for children, for toplevel windows handle them
like delete_event.
* gtk/gtkplug.c: Add an unrealize handler so that
we unref plug->socket_window when we are done
with it.
Fri Sep 3 14:52:54 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtktext.c (clear_area): Fix stupid signedness
problem that was causing background to sometimes
be misaligned.
Fri Sep 3 12:26:33 1999 Owen Taylor <otaylor@redhat.com>
[ Fixes pointed out by Ettore Perazzoli <ettore@comm2000.it> ]
* gtk/gtkmenu.c (gtk_menu_position): Make
sure we never position menus with negative x, y,
since gtk_widget_set_uposition() can't handle that.
* gtk/gtkmenuitem.c (gtk_menu_item_position_menu):
Modify the positioning code a bit so that we always
put the top-left corner onscreen. (This is for
UI reasons, gtk_menu_position() now takes care of
gtk_widet_set_uposition() brokeness.)
Fri Sep 3 03:06:30 1999 Tim Janik <timj@gtk.org>
* gtk/Makefile.am: fixed up things for -jx, x > 1.
Sun Sep 5 08:48:51 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwidget.c (gtk_widget_modify_style): Ref the
RC style that is passed in. The lack of the ref
before was a bug. If people worked around this
bug, this will introduce a slight memory leak
in their code. The code should typically look like:
rc_style = gtk_rc_style_new ();
[...]
gtk_widget_modify_style (widget, rc_style);
gtk_rc_style_unref (rc_style);
* gtk/gtkwidget.c (gtk_widget_modify_style): Reset
the style if it was already set.
* gtk/gtkwidget.c (gtk_widget_set_name): Only set the
style if it was set before.
Thu Sep 2 19:02:37 1999 Owen Taylor <otaylor@redhat.com>
* gtk/testgtk.c (main): Add a check to see if we
are being run from the correct directory and
to quit nicely if we are not.
* gtk/gtkrc.c (gtk_rc_slist_remove_all): Make function
static.
Thu Sep 2 23:00:03 1999 Tim Janik <timj@gtk.org>
* gtk/gtkenums.h (GtkWindowPosition): added GTK_WIN_POS_CENTER_ALWAYS.
* gtk/gtkwindow.c:
queue resizes unconditionally (gtk_widget_queue_resize will figure
what to do if the window is not realized).
(gtk_window_move_resize): only recenter the window
for GTK_WIN_POS_CENTER_ALWAYS.
(gtk_window_compute_reposition): handle GTK_WIN_POS_CENTER_ALWAYS in
the same way as GTK_WIN_POS_CENTER.
Thu Sep 2 22:39:27 1999 Tim Janik <timj@gtk.org>
* gtk/gtkwindow.c (gtk_window_reposition): check for the last position
with (!(info->last_flags & GDK_HINT_POS)) instead of
(!info->last_flags & GDK_HINT_POS).
* gtk/gtkwindow.c (gtk_window_move_resize): constrain new_width and
new_height unconditionally, because we use these values even if
!default_size_changed && !hints_changed.
comented the (default_size_changed || hints_changed) case with
respect to resize rejects from the window manager.
* gtk/gtkwindow.c (gtk_window_move_resize): save info->last values
in the zvt condition hack, since this includes the window hints, set
the hints after the handling_resize case.
* gtk/gtkwindow.c (gtk_window_show): constrain the default size that a
window is initially shown with to the geometry.
Thu Sep 2 07:38:56 1999 Tim Janik <timj@gtk.org>
* gtk/gtkwindow.c (gtk_window_move_resize):
s/size_changed/default_size_changed/g so i know what's
really going on (frying brain on smaller flame now).
Thu Sep 2 05:47:47 1999 Tim Janik <timj@gtk.org>
* gtk/gtkwindow.c (gtk_window_move_resize): queue a new resize if
we have size_changed upon handling_resize. this is a gross
workaround for the broken zvt widget and should be removed in
1.3 again (search for FIXME).
Owen provided an accurate comment for this:
/* We could be here for two reasons
* 1) We coincidentally got a resize while handling
* another resize.
* 2) Our computation of size_changed was completely
* screwed up, probably because one of our children
* is broken. It's probably a zvt widget.
*
* For 1), we could just go ahead and ask for the
* new size right now, but doing that for 2)
* might well be fighting the user (and can even
* trigger a loop). Since we really don't want to
* do that, we requeue a resize in hopes that
* by the time it gets handled, the child has seen
* the light and is willing to go along with the
* new size. (this happens for the zvt widget, since
* the size_allocate() above will have stored the
* requisition corresponding to the new size in the
* zvt widget)
*
* This doesn't buy us anything for 1), but it shouldn't
* hurt us too badly, since it is what would have
* happened if we had gotten the configure event before
* the new size had been set.
*/
Wed Sep 1 20:46:11 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtkrc.c: deal properly with the fact that RC
style lists may include rc styles more than once.
* gtk/gtkrc.c (gtk_rc_append_pixmap_path): Removed
unused static function.
* gtk/gtkrc.c (gtk_rc_find_pixmap_in_path): Keep a
stack of directories of RC files currently being
parsed and implicitely add them to pixmap path.
This fixes a bug where the directory would get
appended then overwritten by pixmap_path declarations.
(bug #1462, from Peter Wainright <prw@wainpr.demon.co.uk>)
* gtk/gtkthemes.c (gtk_theme_engine_unref): Call
theme's exit function. (Patch from Peter Wainwright,
bug #1454)
* gtk/gtkradiomenuitem.c (gtk_radio_menu_item_destroy):
Add a destroy() handler to take care of removing
group for menu item. (Fixes bug #1197)
* gtk/gtkwidget.c (gtk_widget_size_request): Fixed thinko
in warning message.
Wed Sep 1 21:27:42 1999 Tim Janik <timj@gtk.org>
* gtk/gtkwindow.c (gtk_window_move_resize): don't require a server
roundtrip to figure window's width and height, since we know that
anyways from widget->allocation.
Wed Sep 1 12:37:44 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwindow.c (gtk_window_move_resize): Compute
the hints after we request the new size.
Wed Sep 1 10:38:37 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwindow.c (gtk_window_compute_hints): Removed
GTK_WIDGET_REALIZED() assertion - we can compute the
hints before we are realized.
* gtk/gtkwindow.c (gtk_window_move_resize): Reorder
hint changing so that we have a value of hints_changed
when we decide whether to constrain the window size.
* gtk/gtkwindow.c (gtk_window_move_resize): Spelling fix.
* gtk/gtkwindow.c (gtk_window_constrain_size): cleanups,
change back to G_MAXINT.
Wed Sep 1 06:54:59 1999 Tim Janik <timj@gtk.org>
* gtk/gtkwindow.c (gtk_window_get_geometry_info): zero initialize
new GtkWindowGeometryInfo, so fields like GdkGeometry geometry
contain uncluttered values.
(gtk_window_compute_hints): simply assert that window is realized
and that geometry_info is valid, since we rely on this anyways.
(gtk_window_constrain_size): major cleanups to the code.
if (flags & GDK_HINT_BASE_SIZE) use geometry's base width and height
for the base size, instead of the minimums. use 32767 as max width
and height (like in gtkwindow.c) instead of G_MAXINT.
Wed Sep 1 04:41:25 1999 Tim Janik <timj@gtk.org>
* cleaned up the GtkContainer.need_resize flag handling mess, we
only need to force resize requests when we were prematurely
realized, or our widget tree was modified when we were temporarily
hidden. handling these cases directly upon showing the window (i.e.
while the GdkWindow is still unmapped) avoids the need to wait for
a configure event response and therefore makes the GUI more snappier
and avoids blank windows during the roundtrip.
* gtk/gtkwidget.c:
(gtk_widget_hide):
(gtk_widget_show): don't queue resizes on toplevels, they know how
to deal with matters.
* gtk/gtkcontainer.c (gtk_container_queue_resize): set the ->need_resize
flag directly for not visible resize containers and spare us unecessary
signal emissions.
* gtk/gtkwindow.c:
(gtk_window_realize): if we need to enforce premature size allocation,
queue a container resize so we are correctly resized later on.
(gtk_window_init):
(gtk_window_size_request):
don't freak around with the ->need_resize flag,
gtk_container_queue_resize() will care about that.
(gtk_window_show):
handle initial resizing issues here, we can handle matters better in
this place, especially since we know that our GdkWindow is still
unmapped.
(gtk_window_move_resize):
don't care about ->need_resize at all.
handle size changes properly that occoured while we waited for a
configure event.
Tue Aug 31 15:58:46 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwidget.c (gtk_widget_set_uposition):
* gtk/gtkwindow.[hc] (gtk_window_reposition):
Move the hint setting code from gtk_widget_set_uposition
to here; set the hints so that we respect any previously
set geometry hints.
* gtk/gtkwindow.c (gtk_window_compute_reposition): Don't
change the window hints here or move the window here,
let that happen in gtk_window_move_resize().
Tue Aug 31 06:58:52 1999 Tim Janik <timj@gtk.org>
* gtk/gtkwidget.c (gtk_widget_event): when discarding exposes due
to already queued resizes (and therefore redraws) on a widget, check
its anchestry as well.
* gtk/gtkcontainer.c:
(gtk_container_queue_resize): clear resize widgets for resize
containers before aborting prematurely. this is especially important
for toplevels which may need imemdiate processing or their resize
handler to be queued.
(gtk_container_dequeue_resize_handler): added new internal function for
gtkwindow.c.
* gtk/gtkwindow.c (gtk_window_move_resize): if we are resizing due to a
configure event, take possible changes in window position into account
as well.
if we request a new window size, queue up a resize handler that will
last until the configure event response arrives.
combined the ->need_resize case (initial show) with the general size
(hints) changed case and added even more comments.
if !auto_shrink, only revert to the old allocation if the new size
is smaller than the current allocation.
Tue Aug 31 11:55:20 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwindow.c (gtk_window_set_arg, gtk_window_set_policy,
gtk_window_set_geometry_hints
gtk_window_set_default_size):
When hints are set, queue a resize so that the hints will
be eventually reset on the toplevel.
* gtk/gtkwindow.c (gtk_window_show): Use
gtk_window_compute_default_size(). Clear the need_resize flag
on the initail map so that we don't unnecessarily trigger the
resize code.
* gtk/gtkwindow.c (gtk_window_move_resize): Split apart
into separate functions. Compare the hints we are setting
with what we set last time so that we can accurately
tell when we need to reset the hints.
* gtk/gtkwindow.c (gtk_window_compute_default_size): New
function to figure out the size from requisition
and default_size.
* gtk/gtkwindow.c (gtk_window_constrain_size): Function
from fvwm to constrain a size to the geometry hints.
* gtk/gtkwindow.c (gtk_window_compare_hints): New function
to compare two sets of geometry hints.
* gtk/gtkwindow.c (gtk_window_compute_hints): Renamed
from gtk_window_set_hints(), just compute the hints,
don't set them.
* gtk/gtkwindow.c (gtk_window_compute_reposition): Move
code from gtk_window_move_resize() to separate function,
rationalize a bit.
Tue Aug 31 13:05:03 1999 Owen Taylor <otaylor@redhat.com>
* gtkrc.h: Move the ref_count member out of the GtkRcStyle
structure into a new private structure.
* gtkrc.c: Split GtkRcStyle into public/private.
In the private part, add a list of pointers to the
RcStyle lists this RcStyle participates in.
* gtkrc.c: When a RcStyle is free, remove all
lists referencing it from the
realized_style_ht hash, and free those lists.
* gtk/gtkrc.c (gtk_rc_clear_styles): Don't call
gtk_rc_init(), since that adds the default styles
to the list of parsed RC files again.
* gtk/gtkrc.c: Use gtk_rc_style_find() consistently.
Thu Aug 26 14:14:42 1999 Tim Janik <timj@gtk.org>
* gtk/gtkwidget.c (gtk_widget_size_allocate): reactivated the sanity
checks that ensure that a widget's allocation is at least 1 in width
and height. (GNOME note: this doesn't affect old panel code anymore,
because GtkSocket will request width and height of at least 1 since
Fri Jul 23).
* gtk/gtkwindow.c (gtk_window_realize): if the widget hasn't been
allocated yet (happens if the user realizes the window prematurely),
size request and allocate it.
(gtk_window_size_allocate): guard against guint underflows.
Wed Aug 25 19:01:36 1999 Lars Hamann <lars@gtk.org>
* gtk/Makefile.am (gtk_built_sources): reordered stamp-gtk.defs
in gtk_built_sources, so gtk.defs gets built prior to all other
sources.
Mon Aug 23 19:11:17 1999 Tim Janik <timj@gtk.org>
* gtk/Makefile.am:
invoke indent on gtkmarshal.*.
rewrote source generation rules, use COPYING as oldest source tag for
a piggyback rule to generate all sources from (don't touch it ;).
major cleanups, strip spaces on build rules for GNU Make.
* gtk/genmarshal.pl: don't operate on hardcoded filenames but take
source and target files from commandline arguments. don't invoke indent.
Sat Aug 21 14:07:36 1999 Lars Hamann <lars@gtk.org>
* gtk/gtknotebook.c (gtk_notebook_real_switch_page): queue_resize
notebook after switch to avoid drawing problems.
(Bug#856 Reported by: Theodore Roth <troth@netmagic.net>)
(gtk_notebook_pages_allocate): don't map not visible tab_labels,
show them instead.
(Bug#1805 Reported by: Dave Cole <dave@dccs.com.au>)
Sat Aug 21 14:07:36 1999 Lars Hamann <lars@gtk.org>
* gtk/gtknotebook.c (gtk_notebook_real_switch_page): queue_resize
notebook after switch to avoid drawing problems.
(Bug#856 Reported by: Theodore Roth <troth@netmagic.net>)
(gtk_notebook_pages_allocate): don't map not visible tab_labels,
show them instead.
(Bug#1805 Reported by: Dave Cole <dave@dccs.com.au>)
Wed Aug 18 09:20:10 1999 Tim Janik <timj@gtk.org>
* gtk/gtkwindow.c:
we use window->need_resize from configure_event now, to indicate that
the gtkwindow should keep its allocation (e.g. because the user resized
the window through window manager handles). resize_count is now reliably
used to figure whether we got the allocation we requested from the
window manager.
configure events get queued as resizes now, the real stuff (size
computation and allocation) now only goes on in gtk_window_move_resize().
GtkWindow's requisition now contains its *real* requisition (like all
other widgets), *not* taking usize into account.
geometry_info->last_{width|height} is now updated from set_hints() only
so it always contains the last hints we set for the window manager.
made some event handlers return TRUE instead of FALSE.
the overall code should be much more straight forward now, and the
significant code portions are accompanied by comments now.
(gtk_window_set_hints):
removed requisition argument and made it
fetch the requisition through gtk_widget_get_child_requisition.
we also don't move the gdkwindow here anymore, gtk_window_move_resize()
does that now.
(gtk_window_show):
ensure that the widget is realized before calling
gtk_container_check_resize() (and thus gtk_window_move_resize()), also
ensure that we got properly size requested and allocated before
realization.
(gtk_window_configure_event):
ignore plain window moves, or reallocate the widget tree through the
resize queue otherwise.
(gtk_window_move_resize):
mostly rewrote this function to figure window manager hints more
reliably, coalesce window moves and resizes to reduce configure events
and do actuall size allocations.
Tue Aug 17 07:43:04 1999 Tim Janik <timj@gtk.org>
* gtk/gtkwidget.c (gtk_widget_event): discard expose events for widgets
that have a resize pending, because a redraw is already queued for them.
* gtk/gtkcontainer.c: removed ugly connect_to ::size_allocate signal
hack to clear resize_widgets.
* gtk/gtkwidget.c (gtk_widget_size_allocate): call clear_resize_widgets
for resize containers prior to size allocation. (this is also a bit
ugly, but avoids side effects for stopped emissions and is thus more
reliable).
(gtk_widget_unparent): removed disconnect call for clear_resize_widgets.
* gtk/gtktooltips.c (gtk_tooltips_paint_window): renamed this
function from gtk_tooltips_expose, as we connect to ::expose_event
*and* ::draw now.
1999-08-18 Federico Mena Quintero <federico@redhat.com>
* gtk/gtkselection.c (gtk_target_list_ref): Added missing sanity
checks.
(gtk_target_list_unref): Likewise.
* gtk/gtkthemes.c (gtk_theme_engine_unref): Likewise.
Tue Aug 17 15:47:07 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtkcolorsel.c (gtk_color_selection_draw_value_bar):
guard against division by zero. (Fixes bug #1339)
Tue Aug 17 10:56:49 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtkentry.c (gtk_move_{forward,backward}_word):
Prevent the trivial leak of information of allowing
word motion when the entry is not visible.
Tue Aug 17 10:28:52 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtkfilesel.c (gtk_file_selection_fileop_error): Propagate
modality to error dialog as well as confirmation dialogs.
(Bug #1803, reported by Rosanna Wing Sze Yuen)
Wed Aug 11 01:04:57 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtktreeitem.c (gtk_tree_item_draw_lines): Honor
tree->view_lines.
(gtk-guy-990611-3.patch: Guy Harris <guy@netapp.com>)
* gtk/Makefile.am (install-data-local): Solaris apparently
has various troubles with ln -f; use rm first instead.
(gtk-guy-990611-2.patch: Guy Harris <guy@netapp.com>)
1999-07-30 Raja R Harinath <harinath@cs.umn.edu>
* gtk/Makefile.am (stamp-m): Don't `mv' from builddir to srcdir,
use `cp' followed by `rm' (the `rm' was already there).
July 30, 1999 Elliot Lee <sopwith@redhat.com>
* configure.in: Fix autoconf warnings about cross compilation by
trying to provide sane defaults for AC_TRY_RUN.
* gtk/Makefile.am: If we refer to gtkmarshal.[ch] in $(srcdir),
put them into $(srcdir) when generated. Also add a dependency of
gtksignal.h on gtkmarshal.h for -j builds.
* gtk/gtk(dnd,style,gamma).c: Minor warning fixes.
Wed Jul 28 09:29:19 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtkmain.c (gtk_main_iteration_do): Added missing
GDK_THREADS_{LEAVE,ENTER} pair.
(From Paul Fisher <pnfisher@redhat.com>)
Fri Jul 23 01:00:15 1999 Tim Janik <timj@gtk.org>
* gtk/gtksocket.c (gtk_socket_size_request): asure that the requested
width and height are always >0 (owen).
Fri Jul 23 00:00:47 1999 Tim Janik <timj@gtk.org>
* gtk/gtkwidget.c (gtk_widget_size_allocate): backed out my recent
change that assured that a widget's allocated with and height are
always >1, since this breaks *buggy* panel code. unfortunately this
back-breaks the gimp's color selector.
* gtk/gtkdrawingarea.c (gtk_drawing_area_size_allocate): asure that our
allocation is always >0 in width and height, before sending the
configure event; this is a *gross* hack to get the gimp back to work.
* marked both cases with TODO-1.3
Wed Jul 21 15:47:39 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtktext.c: Don't display wrap indicators when
text is not editable and word wrap is on.
Wed Jul 21 08:21:40 1999 Tim Janik <timj@gtk.org>
* gtk/gtkitemfactory.c (gtk_item_factory_create_item): special case
option menus here as they are not derived from menu shell, assure that
the option menu has a menu we can add items to.
Tue Jul 20 23:29:48 1999 Tim Janik <timj@gtk.org>
* gtk/gtknotebook.c (gtk_notebook_page_allocate): convert allocation->
width/height to (gint) before calculations and check against < 0 to
avoid guint wraparounds.
Sun Jul 18 00:35:49 1999 Tim Janik <timj@gtk.org>
* gtk/gtkwidget.c (gtk_widget_size_allocate): ensure that the allocated
width and height is never zero. sanity check both dimensions against
32767 and issue a warning if the allocation is greater than that.
Wed Jul 7 15:03:30 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtkmain.c (gtk_events_pending): Unlock around call
to g_main_pending() as well.
Wed Jul 7 14:59:01 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtkmain.c (gtk_main_iteration): Unlock around
call to g_main_iteration() - since that will regrab
GTK+ lock to process events.
Thu Jul 1 15:01:55 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwindow.c
- Regularize with the rest of GTK+ by making widget->requisition
not reflect the set_usize()
- Always recompute geometry hints, then check if they
changed before sending them to the X server. The
previous checks for changes would fail in a number
of circumstances.
Thu Jul 1 11:55:59 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtkstyle.c: Include <stdlib.h> for strcmp().
Wed Jun 30 19:26:36 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtkdnd.c:
- Code cleanups
- Instantaneously update on modifier key presses
- Allow cancellation of the drag with Escape.
Tue Jun 29 17:04:09 1999 Owen Taylor <otaylor@redhat.com>
* gtk/testgtk.c (create_handle_box): Set the policy
to auto_shrink - otherwise the appearance is rather
strange when flipping between horizontal and vertical.
Mon Jun 28 09:29:52 1999 Tim Janik <timj@gtk.org>
* gtk/gtkwindow.c: add ::default_width and ::default_height arguments.
(gtk_window_set_default_size): don't change a value if it's < 0.
queue a resize.
Sun Jun 27 11:00:33 1999 Tim Janik <timj@gtk.org>
* gtk/gtktext.c (gtk_text_insert): don't segfault on NULL inserts.
Mon Jun 28 12:08:25 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtkfilesel.c (cmpl_completion_fullname): Don't
add an extra "/" when concating "/" + filename.
(From Matt Grossman <mattg@oz.net>)
Mon Jun 28 10:57:12 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtkctree.c (draw_cell_pixmap): Reset clip mask
for fg_gc if we set it for drawing pixmap.
Tue Jun 15 12:45:12 1999 Owen Taylor <otaylor@redhat.com>
Fixes from Peter Wainwright <prw@wainpr.demon.co.uk>
* gtk/gtkrc.c (gtk_rc_parse_engine): If rc_style->engine is
already set, call old engine's destroy function and
unref the old engine.
Thu Jun 10 17:59:38 1999 Tim Janik <timj@gtk.org>
* gtk/gtkdrawingarea.c (gtk_drawing_area_size): queue a resize.
Wed Jun 9 15:13:16 1999 Tim Janik <timj@gtk.org>
* gtk/gtkaccelgroup.h: mark certain functions as internal.
Wed Jun 9 13:48:28 1999 Tim Janik <timj@gtk.org>
* gtk/gtkpreview.c (gtk_preview_set_expand): queue a resize if the
expand behaviour changed.
* gtk/gtklabel.c (gtk_label_set_pattern):
(gtk_label_set_justify):
(gtk_label_set_line_wrap):
don't bother invoking queue_clear, the reallocation does
that for us, always free_words so the upcoming resize will
relayout the label's contents.
Wed Jun 9 12:50:48 1999 Tim Janik <timj@gtk.org>
* applied argument implementation patches from Elena Devdariani
<elena@cogent.ca>.
* gtk/gtktoolbar.c: ::orientation, ::toolbar_style, ::space_size,
::space_style, ::relief
* gtk/gtkruler.c: ::lower, ::upper, ::position, ::max_size
* gtk/gtkpreview.c: ::expand
* gtk/gtkpaned.c: ::handle_size, ::gutter_size
* gtk/gtknotebook.c: ::homogeneous
* gtk/gtklabel.c: ::wrap
* gtk/gtklist.c: ::selection_mode
* gtk/gtkhandlebox.c: ::handle_position, ::snap_edge
* gtk/gtkcurve.c: ::curve_type, ::min_x, ::max_x, ::min_y, ::max_y
* gtk/gtkcolorsel.c: ::update_policy, ::use_opacity
* gtk/gtkclist.c: ::sort_type
* gtk/gtkcheckmenuitem.c: ::active, ::show_toggle
* gtk/gtkaspectframe.c: ::xalign, ::yalign, ::ratio, ::obey_child
Tue Jun 1 23:38:38 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtkstyle.c: Removed ill-thought-out part of last
comment.
Tue Jun 1 23:30:09 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtkstyle.c (gtk_style_attach): Get the reference
counting right when we have to attach a new style
for a different visual. (Chi-Deok Hwang <cdhwang@sr.hei.co.kr>)
* gtk/gtkstyle.c: Documented the refcounting
peculularities of gtk_style_attach.
1999-06-01 Tim Janik <timj@dhcpd7.redhat.com>
* gtk/gtkwindow.c (gtk_window_new): added return if fail for invalid
window types.
* examples/packer/pack.c (main): use GTK_WINDOW_TOPLEVEL instead
of GTK_TOPLEVEL for creating the window.
1999-06-01 Tim Janik <timj@dhcpd7.redhat.com>
* gtk/gtkmain.c (gtk_init_check): don't segfault when --gtk-module is
the last argument (reported by Per Winkvist).
Tue May 25 13:13:12 1999 Owen Taylor <otaylor@redhat.com>
Fixes for invisible XOR lines (Frank Loemker
<floemker@TechFak.Uni-Bielefeld.DE>)
* gtk/gtkclist.c (gtk_clist_realize): Always use
a non-zero pixel for GDK_XOR.
* gtk/gtkvpaned.c gtk/gtkhpaned.c:
Use GDK_INVERT instead of GDK_XOR.
Wed May 12 21:56:40 1999 Lars Hamann <lars@gtk.org>
* gtk/gtkclist.c (adjust_adjustments): signal emit value_changed
signals if h/voffsets differ from adjustment values.
Reportet by Jerome Bolliet <bolliet@in2p3.fr>
Mon May 10 04:20:41 1999 Tim Janik <timj@gtk.org>
* gtk/gtkmenushell.c (gtk_menu_shell_activate_item): propagate
::selection-done emissions up to the topmost menu shell.
Fri May 7 10:15:14 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtknotebook.c (gtk_notebook_set_scrollable): Unset
the user data on the window before destroying it.
* gtk/gtknotebook.c (gtk_notebook_unrealize): Add an
unrealize handler to take care of destroying
notebook->panel properly.
(Bug #1198 - Morten Welinder <terra@diku.dk>)
* gtk/gtktext.c (expand_scratch_buffer): Fix reversal
of g_new and g_realloc to stop memory leak. (Actually,
we could just use g_realloc(), but I'm not 100% sure
that is portable).
(Bug #1196 - Morten Welinder <terra@diku.dk>)
Wed Apr 21 00:42:08 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtkplug.h: Removed stray GtkPlugButton declaration.
* gdk/gdkfont.c (gdk_text_measure): Fix the return value
for fontsets.
* gtk/gtkbutton.c (gtkbutton_expose): Fix warning
with bin/button confusion.
Thu May 6 04:53:26 1999 Tim Janik <timj@gtk.org>
* gtk/testgtk.c: in the ItemFactory test, link radio items together,
and show how preselection of radio items is done.
Sun May 2 13:31:14 1999 Tim Janik <timj@gtk.org>
* gtk/gtktreeitem.c (gtk_tree_item_set_subtree):
* gtk/gtktree.c (gtk_tree_add) (gtk_tree_insert):
* gtk/gtktoolbar.c (gtk_toolbar_insert_element):
* gtk/gtkpaned.c (gtk_paned_pack2) (gtk_paned_pack1):
* gtk/gtkscrolledwindow.c (gtk_scrolled_window_add):
* gtk/gtktable.c (gtk_table_attach):
* gtk/gtklist.c (gtk_list_insert_items):
* gtk/gtkmenushell.c (gtk_menu_shell_insert):
* gtk/gtknotebook.c (gtk_notebook_insert_page_menu):
* gtk/gtkpacker.c (gtk_packer_add_defaults) (gtk_packer_add):
* gtk/gtkbin.c (gtk_bin_add):
* gtk/gtkbox.c (gtk_box_pack_start) (gtk_box_pack_end):
* gtk/gtkfixed.c (gtk_fixed_put):
* gtk/gtklayout.c (gtk_layout_put):
general fixups to container_add logic. always realize child if
child->parent is realized, only map the child and queue a resize
if child and child->parent are both visible.
Fri Apr 30 09:02:28 1999 Tim Janik <timj@gtk.org>
* gtk/gtkwidget.c (gtk_widget_real_unrealize): use gtk_container_forall
instead of gtk_container_foreach to walk and unrealize children, so
composite children get also unrealized.
(gtk_widget_real_show): don't call gtk_widget_map() if we don't need to.
(gtk_widget_map): assert that the widget is visible (basic constrain).
(gtk_widget_real_map): assert that the widget is realized (basic
constrain).
Fri Apr 29 00:53:20 1999 Tim Janik <timj@gtk.org>
* gtk/gtkbindings.c (gtk_pattern_spec_init): plugged a memory leak.
Tue May 4 09:32:08 1999 Owen Taylor <otaylor@redhat.com>
* gtk/Makefile.am gtk/gtkrc.iso-8859-2: Add a gtkrc
file for iso-8859-2 locales.
* configure.in (ALL_LINGUAS): ALL_LINGUAS update.
Tue Apr 27 16:38:32 1999 Owen Taylor <otaylor@redhat.com>
* gtk/Makefile.am: Fix typo of static_sources for static_SOURCES.
(Pointed out by andy@rz.uni-karlsruhe.de and others).
Remove some suspicious and useless lines.
Tue May 4 08:44:08 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtkclist.c (gtk_clist_draw, draw_rows): Use
width,height = 0, 0 to mean - here to edge of window,
instead of -1, -1, since the former is all we support.
Tue May 4 08:34:43 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtkmain.c (gtk_main): Correctly free list nodes
when removing from quit_functions list.
Tue Apr 27 14:17:16 1999 Tim Janik <timj@gtk.org>
* gtk/gtkpacker.c (gtk_packer_size_request): remove unused variable.
Tue Apr 27 18:23:35 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtkentry.c (gtk_entry_draw_cursor_on_drawable):
When redrawing characters on non-visible entry, use appropriate
'*' character. (Bug #1130 - Jean-Marc Jacquet <jm@littleigloo.org>)
Tue Apr 27 01:31:40 1999 Lars Hamann <lars@gtk.org>
* gtk/gtkclist.c (drag_dest_cell): compute destination cell
from drag coordinates.
(gtk_clist_drag_data_received) (gtk_clist_drag_motion):
use drag_dest_cell.
* gtk/gtktree (drag_dest_cell)
(gtk_ctree_drag_data_received) (gtk_ctree_drag_motion): likewise.
(Bug #1129)
Wed Apr 21 21:26:11 1999 Tim Janik <timj@gtk.org>
* gtk/gtkitemfactory.c (gtk_item_factory_init): properly initialize
translate_* fields.
(gtk_item_factory_finalize): invoke translate_notify independant from
translate_data.
(gtk_item_factory_set_translate_func): likewise.
(gtk_item_factory_destroy): only remove ifactory pointer from those
widgets that belong to us (stupid me).
Mon Apr 19 12:05:31 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtkrc.c (gtk_rc_style_init): Fixed leak of
rc_style list when lookup succeeeds.
Thu Apr 15 01:11:24 1999 Lars Hamann <lars@gtk.org>
* gtk/gtkctree.c (resync_selection):
* gtk/gtkclist.c (resync_selection): fixed undo_selection bug.
* gtk/gtkclist.c (gtk_clist_button_release): fixed resync_selection
bug.
Fri Apr 9 19:22:19 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtkcolorsel.c gtk/gtkdnd.c gtk/gtkmenuitem.c:
Add some missing GDK_THREADS_ENTER()/LEAVE around
timeouts. (Patches from Sebastian Wilhelmi <wilhelmi@ira.uka.de>)
Thu Apr 8 20:10:33 1999 Tim Janik <timj@gtk.org>
* gtk/gtkentry.c (gtk_entry_key_press): use gtk_widget_activate()
rather than emit_by_name.
* gtk/gtkeditable.c (gtk_editable_insert_text): keep a reference
on the widget across multiple signal emissions.
(gtk_editable_delete_text): same here.
(gtk_editable_class_init): set widget_class->activate_signal after
editable_signals[ACTIVATE] has been created.
Wed Apr 7 22:59:47 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtkpaned.c (gtk_paned_set_position): Don't clamp
position here prematurely -- we might not have the
right ->min_position and ->max_position yet.
Tue Apr 6 16:38:51 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtkselection.c gdk/gdkselection.c: (gtk_selection_request):
Add error traps so if the other end of the connection
dies, we survive.
* gtk/gtkselection.c (gtk_selection_notify): Clean
up properly when selection property retrieval fails.
* gtk/gtkselection.c (gtk_selection_request): Correctly
reject SelectionRequest notifies where the handler
returns no data.
Tue Apr 6 12:24:21 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtkdnd.c (gtk_drag_dest_leave): Only unhighlight
when we've previously highlighted.
* gtk/gtkdnd.c (gtk_drag_dest_handle_event): Don't
emit two "drag_leave" signals for Motif drops.
* gtk/gtkdnd.c (gtk_drag_source_handle_event): Send
back the correct status messages when dropping from
Motif onto a proxy window that is rejecting the
drop.
Sat Mar 27 23:32:13 1999 Tim Janik <timj@gtk.org>
* gtk/gtkarg.[hc]: added functions from GLE, gtk_arg_reset() to free
the value and reset type to GTK_TYPE_INVALID, and gtk_arg_values_equal()
to compare two argument values. added gtk_arg_to_valueloc() to set a
variable from an arg through its location (pointer).
* gtk/gtkobject.[hc]: implemented gtk_object_get() in terms of
gtk_object_arg_get() and gtk_arg_to_valueloc(), floats are collected
as gfloat*, uchars are collected as guchar*, ints are collected as
gint*, etc...
Mon Mar 29 17:45:47 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtkaccelgroup.c gtk/gtkgtkbindings.c:
Include <string.h> instead of <strings.h>.
* gtk/gtkstyle.c: Fix double include of gtkthemes.h
(actually, a lot more duplicate includes occur if
you trace through the sequence of #include's)
gtk-jbb-990320-0: John Bley, jbb6@acpub.duke.edu
Mon Mar 29 17:02:58 1999 Owen Taylor <otaylor@redhat.com>
Patches from Akira Higuchi <a-higuti@math.sci.hokudai.ac.jp>
gtk-a-higuti-990322-[0-3]
* configure.in: Fix confusion between GTK_LOCALE_[C]FLAGS
that was causing -DX_LOCALE not to work.
* gtk/gtkrc.c (gtk_rc_init):
X_LOCALE will never have LC_MESSAGES defined
Thu Mar 25 12:38:31 1999 Tim Janik <timj@gtk.org>
* gtk/gtkrc.c (gtk_rc_append_default_module_path): get $HOME from
g_get_home_dir() (gtk-pmc-990123-0.patch.gz).
* gtk/gtkwindow.c (gtk_window_key_press_event): feature keypad up/down/
left/right as well (gtk-michael-980726-0.patch.gz).
* gtk/gtklabel.[hc]: bunch of miscellaneous cleanups, such as s/0/NULL/
for pointer values, use gchar instead of char. fixed uline allocation
leaks, changed the allocation pattern so we use G_ALLOC_AND_FREE mem
chunks instead of G_ALLOC_ONLY.
(gtk_label_size_request): always alter requisition as passed and leave
widget->requisition alone.
(gtk_label_set_text): allow NULL strings.
(gtk_label_new): likewise.
Wed Mar 24 09:24:03 1999 Tim Janik <timj@gtk.org>
* gtk/gtkdrawingarea.[hc]: type/macro fixups.
Mon Mar 22 05:51:34 1999 Tim Janik <timj@gtk.org>
* gtk/gtkbin.c (gtk_bin_draw): only redraw children that are visible
*and* mapped (i.e. drawable).
(gtk_bin_expose): only send exposes to drawable children.
* gtk/gtkbox.c (gtk_box_draw): only redraw children that are drawable.
(gtk_box_expose): only send exposes to drawable children.
* gtk/gtkhscale.c (gtk_hscale_draw):
* gtk/gtkvscale.c (gtk_vscale_draw):
hm, this is an ugly one. we first compute the size of our trough area
here (window relative) and then check intersection with the draw_area
which is parent relative because we're a NO_WINDOW widget, so we need
to offset the trough area by allocation.x and allocation.y before the
check. (this must not be done for the background area though, since
that's already computed parent relative).
Mon Mar 22 00:41:39 1999 Lars Hamann <lars@gtk.org>
* gtk/gtkclist.c (gtk_clist_unrealize): unmap clist if neccessary,
unrealize title buttons.
Fri Mar 19 00:00:22 1999 Lars Hamann <lars@gtk.org>
* gtk/gtkclist.c (gtk_clist_column_title_passive)
(gtk_clist_column_title_active):
only connect/disconnect to GtkWidgetClass::event to block mouse events.
* gtk/gtkclist.c (vertical_timeout) (horizontal_timeout):
zero initialize event, removed superfluous gdk_window_get_pointer call
* gtk/gtklist.c (gtk_list_vertical_timeout)
(gtk_list_horizontal_timeout): removed superfluous
gdk_window_get_pointer call
Wed Mar 17 09:00:00 1999 Tim Janik <timj@gtk.org>
* plugging problems reported by "Bruce Mitchener, Jr."
<bruce@puremagic.com> due to a purify session.
* gtk/gtkstyle.c:
(gtk_style_ref):
(gtk_style_unref): assert ref_count to be > 0.
* gtk/gtkclist.c (gtk_clist_set_cell_style): { 0 } initilaize
the requisition.
(gtk_clist_set_shift): likewise.
* gtk/gtklayout.c: introduce gtk_layout_finalize() to unref the
adjustments.
* gtk/gtklist.c (gtk_list_horizontal_timeout): zero initialize the
event before sending it and set send_event to TRUE (which needs to
be done for *all* synthesized events).
(gtk_list_vertical_timeout): likewise.
* gtk/gtktipsquery.c (gtk_tips_query_destroy): plug small memory
leaks.
* gtk/gtkdrawingarea.c (gtk_drawing_area_send_configure): set send_event
to TRUE when synthesizing events.
[ *** end of merges from 1.2 *** ]
1999-11-22 21:52:50 +00:00
|
|
|
|
|
Add note about GtkMenuPositionFunc API changes.
2000-11-08 Alexander Larsson <alexl@redhat.com>
* docs/Changes-2.0.txt: Add note about GtkMenuPositionFunc
API changes.
* gtk/gtkmenu.c: Add support for scrolling menus.
Remove gtk_menu_append/prepend/insert, these have been moved to
gtkcompat.h as #defines.
* gtk/gtkcompat.h.in:
Add compatibility #defines for gtk_menu_append/prepend/insert
* gtk/gtkmenu.h: Add data needed for scrolling menus.
GtkMenuPositionFunc gets an extra argument push_in.
gtk_menu_append/prepend/insert removed.
* gtk/gtkmenuitem.c (gtk_menu_item_position_menu): Change menu
positioning behaviour to fit to scrolling menus.
* gtk/gtkmenuitem.c (gtk_menu_item_forall): Don't recurse
into menuitem->submeny. That is wrong, and broke torn
off submenus of torn off menus, since they were unrealized
when the first menu was unrealized.
* gtk/gtkmenushell.[ch]: Virtualize gtk_menu_shell_insert() and
gtk_menu_shell_select_item() since these need to be overridden in
GtkMenu.
* gtk/gtkoptionmenu.c (gtk_opttion_menu_position): Change menu
positioning behaviour to fit to scrolling menus.
(gtk_option_menu_key_press, gtk_option_menu_button_press): Select
the current item so that it is prelighted when the menu pops up.
This is a workaround to the fact that the menu doesn't get the
initial enter event (due to grabs).
* gtk/gtkfilesel.c, gtk/gtkinputdialog.c, gtk/testgtk.c:
s/gtk_menu_append/gtk_menu_shell_append/
* gtk/gtknotebook.c:
s/gtk_menu_insert/gtk_menu_shell_insert/
* gtk/testgtk.c (create_menu, create_menus):
Create the first menu with 50 items so that menu scrolling
can be tested.
Patch from Jonathan Blandford <jrb@redhat.com>
* gtk/gtkmenuitem.[ch] (gtk_menu_item_toggle_size_request): new
system to handle size requests. First, we ask what the size of
the toggle is. Then, when allocating the size, we allocate the
toggle_size first. This way we can have multiple menu-item
classes w/o needing a seperate class for each.
* gtk/gtkmenu.c (gtk_menu_size_request): Actually use the new system.
* gtk/gtkmenu.c (gtk_menu_size_allocate): Use the new system.
* gtk/gtkcheckmenuitem.c
(gtk_check_menu_item_toggle_size_request): New function to handle
the toggle size-request.
2000-11-08 17:34:52 +00:00
|
|
|
|
scroll_offset = 0;
|
|
|
|
|
|
2016-04-11 02:59:53 +00:00
|
|
|
|
if (y + requisition.height > workarea.y + workarea.height)
|
Add note about GtkMenuPositionFunc API changes.
2000-11-08 Alexander Larsson <alexl@redhat.com>
* docs/Changes-2.0.txt: Add note about GtkMenuPositionFunc
API changes.
* gtk/gtkmenu.c: Add support for scrolling menus.
Remove gtk_menu_append/prepend/insert, these have been moved to
gtkcompat.h as #defines.
* gtk/gtkcompat.h.in:
Add compatibility #defines for gtk_menu_append/prepend/insert
* gtk/gtkmenu.h: Add data needed for scrolling menus.
GtkMenuPositionFunc gets an extra argument push_in.
gtk_menu_append/prepend/insert removed.
* gtk/gtkmenuitem.c (gtk_menu_item_position_menu): Change menu
positioning behaviour to fit to scrolling menus.
* gtk/gtkmenuitem.c (gtk_menu_item_forall): Don't recurse
into menuitem->submeny. That is wrong, and broke torn
off submenus of torn off menus, since they were unrealized
when the first menu was unrealized.
* gtk/gtkmenushell.[ch]: Virtualize gtk_menu_shell_insert() and
gtk_menu_shell_select_item() since these need to be overridden in
GtkMenu.
* gtk/gtkoptionmenu.c (gtk_opttion_menu_position): Change menu
positioning behaviour to fit to scrolling menus.
(gtk_option_menu_key_press, gtk_option_menu_button_press): Select
the current item so that it is prelighted when the menu pops up.
This is a workaround to the fact that the menu doesn't get the
initial enter event (due to grabs).
* gtk/gtkfilesel.c, gtk/gtkinputdialog.c, gtk/testgtk.c:
s/gtk_menu_append/gtk_menu_shell_append/
* gtk/gtknotebook.c:
s/gtk_menu_insert/gtk_menu_shell_insert/
* gtk/testgtk.c (create_menu, create_menus):
Create the first menu with 50 items so that menu scrolling
can be tested.
Patch from Jonathan Blandford <jrb@redhat.com>
* gtk/gtkmenuitem.[ch] (gtk_menu_item_toggle_size_request): new
system to handle size requests. First, we ask what the size of
the toggle is. Then, when allocating the size, we allocate the
toggle_size first. This way we can have multiple menu-item
classes w/o needing a seperate class for each.
* gtk/gtkmenu.c (gtk_menu_size_request): Actually use the new system.
* gtk/gtkmenu.c (gtk_menu_size_allocate): Use the new system.
* gtk/gtkcheckmenuitem.c
(gtk_check_menu_item_toggle_size_request): New function to handle
the toggle size-request.
2000-11-08 17:34:52 +00:00
|
|
|
|
{
|
2012-01-06 04:21:30 +00:00
|
|
|
|
if (priv->initially_pushed_in)
|
2016-04-11 02:59:53 +00:00
|
|
|
|
scroll_offset += (workarea.y + workarea.height) - requisition.height - y;
|
|
|
|
|
y = (workarea.y + workarea.height) - requisition.height;
|
2012-01-06 04:21:30 +00:00
|
|
|
|
}
|
Add note about GtkMenuPositionFunc API changes.
2000-11-08 Alexander Larsson <alexl@redhat.com>
* docs/Changes-2.0.txt: Add note about GtkMenuPositionFunc
API changes.
* gtk/gtkmenu.c: Add support for scrolling menus.
Remove gtk_menu_append/prepend/insert, these have been moved to
gtkcompat.h as #defines.
* gtk/gtkcompat.h.in:
Add compatibility #defines for gtk_menu_append/prepend/insert
* gtk/gtkmenu.h: Add data needed for scrolling menus.
GtkMenuPositionFunc gets an extra argument push_in.
gtk_menu_append/prepend/insert removed.
* gtk/gtkmenuitem.c (gtk_menu_item_position_menu): Change menu
positioning behaviour to fit to scrolling menus.
* gtk/gtkmenuitem.c (gtk_menu_item_forall): Don't recurse
into menuitem->submeny. That is wrong, and broke torn
off submenus of torn off menus, since they were unrealized
when the first menu was unrealized.
* gtk/gtkmenushell.[ch]: Virtualize gtk_menu_shell_insert() and
gtk_menu_shell_select_item() since these need to be overridden in
GtkMenu.
* gtk/gtkoptionmenu.c (gtk_opttion_menu_position): Change menu
positioning behaviour to fit to scrolling menus.
(gtk_option_menu_key_press, gtk_option_menu_button_press): Select
the current item so that it is prelighted when the menu pops up.
This is a workaround to the fact that the menu doesn't get the
initial enter event (due to grabs).
* gtk/gtkfilesel.c, gtk/gtkinputdialog.c, gtk/testgtk.c:
s/gtk_menu_append/gtk_menu_shell_append/
* gtk/gtknotebook.c:
s/gtk_menu_insert/gtk_menu_shell_insert/
* gtk/testgtk.c (create_menu, create_menus):
Create the first menu with 50 items so that menu scrolling
can be tested.
Patch from Jonathan Blandford <jrb@redhat.com>
* gtk/gtkmenuitem.[ch] (gtk_menu_item_toggle_size_request): new
system to handle size requests. First, we ask what the size of
the toggle is. Then, when allocating the size, we allocate the
toggle_size first. This way we can have multiple menu-item
classes w/o needing a seperate class for each.
* gtk/gtkmenu.c (gtk_menu_size_request): Actually use the new system.
* gtk/gtkmenu.c (gtk_menu_size_allocate): Use the new system.
* gtk/gtkcheckmenuitem.c
(gtk_check_menu_item_toggle_size_request): New function to handle
the toggle size-request.
2000-11-08 17:34:52 +00:00
|
|
|
|
|
2016-04-11 02:59:53 +00:00
|
|
|
|
if (y < workarea.y)
|
2012-01-06 04:21:30 +00:00
|
|
|
|
{
|
|
|
|
|
if (priv->initially_pushed_in)
|
2016-04-11 02:59:53 +00:00
|
|
|
|
scroll_offset += workarea.y - y;
|
|
|
|
|
y = workarea.y;
|
2011-12-23 04:44:17 +00:00
|
|
|
|
}
|
2010-12-23 20:50:18 +00:00
|
|
|
|
|
2016-04-11 02:59:53 +00:00
|
|
|
|
x = CLAMP (x, workarea.x, MAX (workarea.x, workarea.x + workarea.width - requisition.width));
|
2012-01-06 04:21:30 +00:00
|
|
|
|
|
2014-06-06 22:00:36 +00:00
|
|
|
|
x -= border.left;
|
|
|
|
|
y -= border.top;
|
|
|
|
|
|
2010-12-23 23:21:53 +00:00
|
|
|
|
if (GTK_MENU_SHELL (menu)->priv->active)
|
2003-08-13 20:45:37 +00:00
|
|
|
|
{
|
2010-12-23 20:50:18 +00:00
|
|
|
|
priv->have_position = TRUE;
|
|
|
|
|
priv->position_x = x;
|
|
|
|
|
priv->position_y = y;
|
2003-08-13 20:45:37 +00:00
|
|
|
|
}
|
2010-12-23 20:50:18 +00:00
|
|
|
|
|
2011-12-23 04:45:28 +00:00
|
|
|
|
if (scroll_offset != 0)
|
2007-05-09 15:46:41 +00:00
|
|
|
|
{
|
|
|
|
|
GtkBorder arrow_border;
|
|
|
|
|
|
|
|
|
|
get_arrows_border (menu, &arrow_border);
|
|
|
|
|
scroll_offset += arrow_border.top;
|
|
|
|
|
}
|
2010-12-23 20:50:18 +00:00
|
|
|
|
|
2010-12-23 23:21:53 +00:00
|
|
|
|
gtk_window_move (GTK_WINDOW (GTK_MENU_SHELL (menu)->priv->active ? priv->toplevel : priv->tearoff_window),
|
2010-12-23 20:50:18 +00:00
|
|
|
|
x, y);
|
2002-08-02 22:03:23 +00:00
|
|
|
|
|
2010-12-23 23:21:53 +00:00
|
|
|
|
if (!GTK_MENU_SHELL (menu)->priv->active)
|
2002-08-02 22:03:23 +00:00
|
|
|
|
{
|
2010-12-23 20:50:18 +00:00
|
|
|
|
gtk_window_resize (GTK_WINDOW (priv->tearoff_window),
|
|
|
|
|
requisition.width, requisition.height);
|
2002-08-02 22:03:23 +00:00
|
|
|
|
}
|
2010-08-21 01:15:35 +00:00
|
|
|
|
|
2010-10-31 19:52:32 +00:00
|
|
|
|
if (set_scroll_offset)
|
2010-12-23 20:50:18 +00:00
|
|
|
|
priv->scroll_offset = scroll_offset;
|
Add note about GtkMenuPositionFunc API changes.
2000-11-08 Alexander Larsson <alexl@redhat.com>
* docs/Changes-2.0.txt: Add note about GtkMenuPositionFunc
API changes.
* gtk/gtkmenu.c: Add support for scrolling menus.
Remove gtk_menu_append/prepend/insert, these have been moved to
gtkcompat.h as #defines.
* gtk/gtkcompat.h.in:
Add compatibility #defines for gtk_menu_append/prepend/insert
* gtk/gtkmenu.h: Add data needed for scrolling menus.
GtkMenuPositionFunc gets an extra argument push_in.
gtk_menu_append/prepend/insert removed.
* gtk/gtkmenuitem.c (gtk_menu_item_position_menu): Change menu
positioning behaviour to fit to scrolling menus.
* gtk/gtkmenuitem.c (gtk_menu_item_forall): Don't recurse
into menuitem->submeny. That is wrong, and broke torn
off submenus of torn off menus, since they were unrealized
when the first menu was unrealized.
* gtk/gtkmenushell.[ch]: Virtualize gtk_menu_shell_insert() and
gtk_menu_shell_select_item() since these need to be overridden in
GtkMenu.
* gtk/gtkoptionmenu.c (gtk_opttion_menu_position): Change menu
positioning behaviour to fit to scrolling menus.
(gtk_option_menu_key_press, gtk_option_menu_button_press): Select
the current item so that it is prelighted when the menu pops up.
This is a workaround to the fact that the menu doesn't get the
initial enter event (due to grabs).
* gtk/gtkfilesel.c, gtk/gtkinputdialog.c, gtk/testgtk.c:
s/gtk_menu_append/gtk_menu_shell_append/
* gtk/gtknotebook.c:
s/gtk_menu_insert/gtk_menu_shell_insert/
* gtk/testgtk.c (create_menu, create_menus):
Create the first menu with 50 items so that menu scrolling
can be tested.
Patch from Jonathan Blandford <jrb@redhat.com>
* gtk/gtkmenuitem.[ch] (gtk_menu_item_toggle_size_request): new
system to handle size requests. First, we ask what the size of
the toggle is. Then, when allocating the size, we allocate the
toggle_size first. This way we can have multiple menu-item
classes w/o needing a seperate class for each.
* gtk/gtkmenu.c (gtk_menu_size_request): Actually use the new system.
* gtk/gtkmenu.c (gtk_menu_size_allocate): Use the new system.
* gtk/gtkcheckmenuitem.c
(gtk_check_menu_item_toggle_size_request): New function to handle
the toggle size-request.
2000-11-08 17:34:52 +00:00
|
|
|
|
}
|
|
|
|
|
|
2016-06-14 19:42:13 +00:00
|
|
|
|
static GdkGravity
|
|
|
|
|
get_horizontally_flipped_anchor (GdkGravity anchor)
|
|
|
|
|
{
|
|
|
|
|
switch (anchor)
|
|
|
|
|
{
|
|
|
|
|
case GDK_GRAVITY_STATIC:
|
|
|
|
|
case GDK_GRAVITY_NORTH_WEST:
|
|
|
|
|
return GDK_GRAVITY_NORTH_EAST;
|
|
|
|
|
case GDK_GRAVITY_NORTH:
|
|
|
|
|
return GDK_GRAVITY_NORTH;
|
|
|
|
|
case GDK_GRAVITY_NORTH_EAST:
|
|
|
|
|
return GDK_GRAVITY_NORTH_WEST;
|
|
|
|
|
case GDK_GRAVITY_WEST:
|
|
|
|
|
return GDK_GRAVITY_EAST;
|
|
|
|
|
case GDK_GRAVITY_CENTER:
|
|
|
|
|
return GDK_GRAVITY_CENTER;
|
|
|
|
|
case GDK_GRAVITY_EAST:
|
|
|
|
|
return GDK_GRAVITY_WEST;
|
|
|
|
|
case GDK_GRAVITY_SOUTH_WEST:
|
|
|
|
|
return GDK_GRAVITY_SOUTH_EAST;
|
|
|
|
|
case GDK_GRAVITY_SOUTH:
|
|
|
|
|
return GDK_GRAVITY_SOUTH;
|
|
|
|
|
case GDK_GRAVITY_SOUTH_EAST:
|
|
|
|
|
return GDK_GRAVITY_SOUTH_WEST;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
g_warning ("unknown GdkGravity: %d", anchor);
|
|
|
|
|
return anchor;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
gtk_menu_position (GtkMenu *menu,
|
|
|
|
|
gboolean set_scroll_offset)
|
|
|
|
|
{
|
|
|
|
|
GtkMenuPrivate *priv = menu->priv;
|
|
|
|
|
GdkWindow *rect_window = NULL;
|
|
|
|
|
GdkRectangle rect;
|
|
|
|
|
GtkTextDirection text_direction = GTK_TEXT_DIR_NONE;
|
|
|
|
|
GdkGravity rect_anchor;
|
|
|
|
|
GdkGravity menu_anchor;
|
2016-10-14 08:41:50 +00:00
|
|
|
|
GdkAnchorHints anchor_hints;
|
|
|
|
|
gint rect_anchor_dx, rect_anchor_dy;
|
2016-06-14 19:42:13 +00:00
|
|
|
|
GdkWindow *toplevel;
|
2016-10-14 08:41:50 +00:00
|
|
|
|
gboolean emulated_move_to_rect = FALSE;
|
|
|
|
|
|
|
|
|
|
rect_anchor = priv->rect_anchor;
|
|
|
|
|
menu_anchor = priv->menu_anchor;
|
|
|
|
|
anchor_hints = priv->anchor_hints;
|
|
|
|
|
rect_anchor_dx = priv->rect_anchor_dx;
|
|
|
|
|
rect_anchor_dy = priv->rect_anchor_dy;
|
2016-06-14 19:42:13 +00:00
|
|
|
|
|
|
|
|
|
if (priv->rect_window)
|
|
|
|
|
{
|
|
|
|
|
rect_window = priv->rect_window;
|
|
|
|
|
rect = priv->rect;
|
|
|
|
|
}
|
|
|
|
|
else if (priv->widget)
|
|
|
|
|
{
|
|
|
|
|
rect_window = gtk_widget_get_window (priv->widget);
|
|
|
|
|
gtk_widget_get_allocation (priv->widget, &rect);
|
|
|
|
|
text_direction = gtk_widget_get_direction (priv->widget);
|
|
|
|
|
}
|
2016-10-14 08:41:50 +00:00
|
|
|
|
else if (!priv->position_func)
|
|
|
|
|
{
|
|
|
|
|
GtkWidget *attach_widget;
|
|
|
|
|
GdkDevice *grab_device;
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* One of the legacy gtk_menu_popup*() functions were used to popup but
|
|
|
|
|
* without a custom positioning function, so make an attempt to let the
|
|
|
|
|
* backend do the position constraining when required conditions are met.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
grab_device = _gtk_menu_shell_get_grab_device (GTK_MENU_SHELL (menu));
|
|
|
|
|
attach_widget = gtk_menu_get_attach_widget (menu);
|
|
|
|
|
|
|
|
|
|
if (grab_device && attach_widget)
|
|
|
|
|
{
|
2016-10-28 07:49:29 +00:00
|
|
|
|
rect.x = 0;
|
|
|
|
|
rect.y = 0;
|
|
|
|
|
rect.width = 1;
|
|
|
|
|
rect.height = 1;
|
2016-10-14 08:41:50 +00:00
|
|
|
|
|
|
|
|
|
rect_window = gtk_widget_get_window (attach_widget);
|
|
|
|
|
gdk_window_get_device_position (rect_window, grab_device,
|
|
|
|
|
&rect.x, &rect.y, NULL);
|
|
|
|
|
text_direction = gtk_widget_get_direction (attach_widget);
|
|
|
|
|
rect_anchor = GDK_GRAVITY_SOUTH_EAST;
|
|
|
|
|
menu_anchor = GDK_GRAVITY_NORTH_WEST;
|
|
|
|
|
anchor_hints = GDK_ANCHOR_FLIP | GDK_ANCHOR_SLIDE | GDK_ANCHOR_RESIZE;
|
|
|
|
|
rect_anchor_dx = 0;
|
|
|
|
|
rect_anchor_dy = 0;
|
|
|
|
|
emulated_move_to_rect = TRUE;
|
|
|
|
|
}
|
|
|
|
|
}
|
2016-06-14 19:42:13 +00:00
|
|
|
|
|
|
|
|
|
if (!rect_window)
|
|
|
|
|
{
|
2019-01-17 18:14:37 +00:00
|
|
|
|
gtk_window_set_unlimited_guessed_size (GTK_WINDOW (priv->toplevel),
|
|
|
|
|
FALSE, FALSE);
|
2016-06-14 19:42:13 +00:00
|
|
|
|
gtk_menu_position_legacy (menu, set_scroll_offset);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2019-01-17 18:14:37 +00:00
|
|
|
|
gtk_window_set_unlimited_guessed_size (GTK_WINDOW (priv->toplevel),
|
|
|
|
|
!!(anchor_hints & GDK_ANCHOR_RESIZE_X),
|
|
|
|
|
!!(anchor_hints & GDK_ANCHOR_RESIZE_Y));
|
|
|
|
|
|
2016-06-14 19:42:13 +00:00
|
|
|
|
/* Realize so we have the proper width and height to figure out
|
|
|
|
|
* the right place to popup the menu.
|
|
|
|
|
*/
|
|
|
|
|
gtk_widget_realize (priv->toplevel);
|
menu: Force recalculation of size before positioning
On X11, the position of the menu is calculated synchronously by
gdk_window_move_to_rect(). This means that calculating the window size
when showing is too late, as that'd mean the size used when calculating
the position is out-of-date. The first time a menu is mapped, however,
the size is calculated during realization; but a window is only realized
once, so it doesn't work for subsequent maps.
Currently, this is harmless, as a GtkMenu can change its size however it
wants after it has been mapped. This, however, is problematic, as it
means the position calculated by gdk_window_move_to_rect() might no
longer be valid, or constraints made by the same function might no
longer be respected.
Thus, this is a preparation for making GtkMenu popups stay the same size
until they are remapped again at a later point.
2019-02-07 08:55:51 +00:00
|
|
|
|
gtk_window_move_resize (GTK_WINDOW (priv->toplevel));
|
2016-06-14 19:42:13 +00:00
|
|
|
|
|
|
|
|
|
if (!gtk_widget_get_visible (priv->toplevel))
|
|
|
|
|
gtk_window_set_type_hint (GTK_WINDOW (priv->toplevel), priv->menu_type_hint);
|
|
|
|
|
|
|
|
|
|
if (text_direction == GTK_TEXT_DIR_NONE)
|
|
|
|
|
text_direction = gtk_widget_get_direction (GTK_WIDGET (menu));
|
|
|
|
|
|
|
|
|
|
if (text_direction == GTK_TEXT_DIR_RTL)
|
|
|
|
|
{
|
2016-10-14 08:41:50 +00:00
|
|
|
|
rect_anchor = get_horizontally_flipped_anchor (rect_anchor);
|
|
|
|
|
menu_anchor = get_horizontally_flipped_anchor (menu_anchor);
|
2016-06-14 19:42:13 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
toplevel = gtk_widget_get_window (priv->toplevel);
|
|
|
|
|
|
|
|
|
|
gdk_window_set_transient_for (toplevel, rect_window);
|
|
|
|
|
|
|
|
|
|
g_signal_handlers_disconnect_by_func (toplevel, moved_to_rect_cb, menu);
|
2016-10-14 08:41:50 +00:00
|
|
|
|
|
2019-02-06 18:30:54 +00:00
|
|
|
|
g_signal_connect (toplevel, "moved-to-rect", G_CALLBACK (moved_to_rect_cb),
|
|
|
|
|
menu);
|
|
|
|
|
priv->emulated_move_to_rect = emulated_move_to_rect;
|
2016-06-14 19:42:13 +00:00
|
|
|
|
|
2018-06-05 13:01:52 +00:00
|
|
|
|
gdk_window_move_to_rect (toplevel,
|
|
|
|
|
&rect,
|
|
|
|
|
rect_anchor,
|
|
|
|
|
menu_anchor,
|
|
|
|
|
anchor_hints,
|
|
|
|
|
rect_anchor_dx,
|
|
|
|
|
rect_anchor_dy);
|
2016-06-14 19:42:13 +00:00
|
|
|
|
}
|
|
|
|
|
|
Add note about GtkMenuPositionFunc API changes.
2000-11-08 Alexander Larsson <alexl@redhat.com>
* docs/Changes-2.0.txt: Add note about GtkMenuPositionFunc
API changes.
* gtk/gtkmenu.c: Add support for scrolling menus.
Remove gtk_menu_append/prepend/insert, these have been moved to
gtkcompat.h as #defines.
* gtk/gtkcompat.h.in:
Add compatibility #defines for gtk_menu_append/prepend/insert
* gtk/gtkmenu.h: Add data needed for scrolling menus.
GtkMenuPositionFunc gets an extra argument push_in.
gtk_menu_append/prepend/insert removed.
* gtk/gtkmenuitem.c (gtk_menu_item_position_menu): Change menu
positioning behaviour to fit to scrolling menus.
* gtk/gtkmenuitem.c (gtk_menu_item_forall): Don't recurse
into menuitem->submeny. That is wrong, and broke torn
off submenus of torn off menus, since they were unrealized
when the first menu was unrealized.
* gtk/gtkmenushell.[ch]: Virtualize gtk_menu_shell_insert() and
gtk_menu_shell_select_item() since these need to be overridden in
GtkMenu.
* gtk/gtkoptionmenu.c (gtk_opttion_menu_position): Change menu
positioning behaviour to fit to scrolling menus.
(gtk_option_menu_key_press, gtk_option_menu_button_press): Select
the current item so that it is prelighted when the menu pops up.
This is a workaround to the fact that the menu doesn't get the
initial enter event (due to grabs).
* gtk/gtkfilesel.c, gtk/gtkinputdialog.c, gtk/testgtk.c:
s/gtk_menu_append/gtk_menu_shell_append/
* gtk/gtknotebook.c:
s/gtk_menu_insert/gtk_menu_shell_insert/
* gtk/testgtk.c (create_menu, create_menus):
Create the first menu with 50 items so that menu scrolling
can be tested.
Patch from Jonathan Blandford <jrb@redhat.com>
* gtk/gtkmenuitem.[ch] (gtk_menu_item_toggle_size_request): new
system to handle size requests. First, we ask what the size of
the toggle is. Then, when allocating the size, we allocate the
toggle_size first. This way we can have multiple menu-item
classes w/o needing a seperate class for each.
* gtk/gtkmenu.c (gtk_menu_size_request): Actually use the new system.
* gtk/gtkmenu.c (gtk_menu_size_allocate): Use the new system.
* gtk/gtkcheckmenuitem.c
(gtk_check_menu_item_toggle_size_request): New function to handle
the toggle size-request.
2000-11-08 17:34:52 +00:00
|
|
|
|
static void
|
2002-11-09 20:52:31 +00:00
|
|
|
|
gtk_menu_remove_scroll_timeout (GtkMenu *menu)
|
Add note about GtkMenuPositionFunc API changes.
2000-11-08 Alexander Larsson <alexl@redhat.com>
* docs/Changes-2.0.txt: Add note about GtkMenuPositionFunc
API changes.
* gtk/gtkmenu.c: Add support for scrolling menus.
Remove gtk_menu_append/prepend/insert, these have been moved to
gtkcompat.h as #defines.
* gtk/gtkcompat.h.in:
Add compatibility #defines for gtk_menu_append/prepend/insert
* gtk/gtkmenu.h: Add data needed for scrolling menus.
GtkMenuPositionFunc gets an extra argument push_in.
gtk_menu_append/prepend/insert removed.
* gtk/gtkmenuitem.c (gtk_menu_item_position_menu): Change menu
positioning behaviour to fit to scrolling menus.
* gtk/gtkmenuitem.c (gtk_menu_item_forall): Don't recurse
into menuitem->submeny. That is wrong, and broke torn
off submenus of torn off menus, since they were unrealized
when the first menu was unrealized.
* gtk/gtkmenushell.[ch]: Virtualize gtk_menu_shell_insert() and
gtk_menu_shell_select_item() since these need to be overridden in
GtkMenu.
* gtk/gtkoptionmenu.c (gtk_opttion_menu_position): Change menu
positioning behaviour to fit to scrolling menus.
(gtk_option_menu_key_press, gtk_option_menu_button_press): Select
the current item so that it is prelighted when the menu pops up.
This is a workaround to the fact that the menu doesn't get the
initial enter event (due to grabs).
* gtk/gtkfilesel.c, gtk/gtkinputdialog.c, gtk/testgtk.c:
s/gtk_menu_append/gtk_menu_shell_append/
* gtk/gtknotebook.c:
s/gtk_menu_insert/gtk_menu_shell_insert/
* gtk/testgtk.c (create_menu, create_menus):
Create the first menu with 50 items so that menu scrolling
can be tested.
Patch from Jonathan Blandford <jrb@redhat.com>
* gtk/gtkmenuitem.[ch] (gtk_menu_item_toggle_size_request): new
system to handle size requests. First, we ask what the size of
the toggle is. Then, when allocating the size, we allocate the
toggle_size first. This way we can have multiple menu-item
classes w/o needing a seperate class for each.
* gtk/gtkmenu.c (gtk_menu_size_request): Actually use the new system.
* gtk/gtkmenu.c (gtk_menu_size_allocate): Use the new system.
* gtk/gtkcheckmenuitem.c
(gtk_check_menu_item_toggle_size_request): New function to handle
the toggle size-request.
2000-11-08 17:34:52 +00:00
|
|
|
|
{
|
2010-12-23 20:50:18 +00:00
|
|
|
|
GtkMenuPrivate *priv = menu->priv;
|
|
|
|
|
|
|
|
|
|
if (priv->scroll_timeout)
|
Add note about GtkMenuPositionFunc API changes.
2000-11-08 Alexander Larsson <alexl@redhat.com>
* docs/Changes-2.0.txt: Add note about GtkMenuPositionFunc
API changes.
* gtk/gtkmenu.c: Add support for scrolling menus.
Remove gtk_menu_append/prepend/insert, these have been moved to
gtkcompat.h as #defines.
* gtk/gtkcompat.h.in:
Add compatibility #defines for gtk_menu_append/prepend/insert
* gtk/gtkmenu.h: Add data needed for scrolling menus.
GtkMenuPositionFunc gets an extra argument push_in.
gtk_menu_append/prepend/insert removed.
* gtk/gtkmenuitem.c (gtk_menu_item_position_menu): Change menu
positioning behaviour to fit to scrolling menus.
* gtk/gtkmenuitem.c (gtk_menu_item_forall): Don't recurse
into menuitem->submeny. That is wrong, and broke torn
off submenus of torn off menus, since they were unrealized
when the first menu was unrealized.
* gtk/gtkmenushell.[ch]: Virtualize gtk_menu_shell_insert() and
gtk_menu_shell_select_item() since these need to be overridden in
GtkMenu.
* gtk/gtkoptionmenu.c (gtk_opttion_menu_position): Change menu
positioning behaviour to fit to scrolling menus.
(gtk_option_menu_key_press, gtk_option_menu_button_press): Select
the current item so that it is prelighted when the menu pops up.
This is a workaround to the fact that the menu doesn't get the
initial enter event (due to grabs).
* gtk/gtkfilesel.c, gtk/gtkinputdialog.c, gtk/testgtk.c:
s/gtk_menu_append/gtk_menu_shell_append/
* gtk/gtknotebook.c:
s/gtk_menu_insert/gtk_menu_shell_insert/
* gtk/testgtk.c (create_menu, create_menus):
Create the first menu with 50 items so that menu scrolling
can be tested.
Patch from Jonathan Blandford <jrb@redhat.com>
* gtk/gtkmenuitem.[ch] (gtk_menu_item_toggle_size_request): new
system to handle size requests. First, we ask what the size of
the toggle is. Then, when allocating the size, we allocate the
toggle_size first. This way we can have multiple menu-item
classes w/o needing a seperate class for each.
* gtk/gtkmenu.c (gtk_menu_size_request): Actually use the new system.
* gtk/gtkmenu.c (gtk_menu_size_allocate): Use the new system.
* gtk/gtkcheckmenuitem.c
(gtk_check_menu_item_toggle_size_request): New function to handle
the toggle size-request.
2000-11-08 17:34:52 +00:00
|
|
|
|
{
|
2010-12-23 20:50:18 +00:00
|
|
|
|
g_source_remove (priv->scroll_timeout);
|
|
|
|
|
priv->scroll_timeout = 0;
|
Add note about GtkMenuPositionFunc API changes.
2000-11-08 Alexander Larsson <alexl@redhat.com>
* docs/Changes-2.0.txt: Add note about GtkMenuPositionFunc
API changes.
* gtk/gtkmenu.c: Add support for scrolling menus.
Remove gtk_menu_append/prepend/insert, these have been moved to
gtkcompat.h as #defines.
* gtk/gtkcompat.h.in:
Add compatibility #defines for gtk_menu_append/prepend/insert
* gtk/gtkmenu.h: Add data needed for scrolling menus.
GtkMenuPositionFunc gets an extra argument push_in.
gtk_menu_append/prepend/insert removed.
* gtk/gtkmenuitem.c (gtk_menu_item_position_menu): Change menu
positioning behaviour to fit to scrolling menus.
* gtk/gtkmenuitem.c (gtk_menu_item_forall): Don't recurse
into menuitem->submeny. That is wrong, and broke torn
off submenus of torn off menus, since they were unrealized
when the first menu was unrealized.
* gtk/gtkmenushell.[ch]: Virtualize gtk_menu_shell_insert() and
gtk_menu_shell_select_item() since these need to be overridden in
GtkMenu.
* gtk/gtkoptionmenu.c (gtk_opttion_menu_position): Change menu
positioning behaviour to fit to scrolling menus.
(gtk_option_menu_key_press, gtk_option_menu_button_press): Select
the current item so that it is prelighted when the menu pops up.
This is a workaround to the fact that the menu doesn't get the
initial enter event (due to grabs).
* gtk/gtkfilesel.c, gtk/gtkinputdialog.c, gtk/testgtk.c:
s/gtk_menu_append/gtk_menu_shell_append/
* gtk/gtknotebook.c:
s/gtk_menu_insert/gtk_menu_shell_insert/
* gtk/testgtk.c (create_menu, create_menus):
Create the first menu with 50 items so that menu scrolling
can be tested.
Patch from Jonathan Blandford <jrb@redhat.com>
* gtk/gtkmenuitem.[ch] (gtk_menu_item_toggle_size_request): new
system to handle size requests. First, we ask what the size of
the toggle is. Then, when allocating the size, we allocate the
toggle_size first. This way we can have multiple menu-item
classes w/o needing a seperate class for each.
* gtk/gtkmenu.c (gtk_menu_size_request): Actually use the new system.
* gtk/gtkmenu.c (gtk_menu_size_allocate): Use the new system.
* gtk/gtkcheckmenuitem.c
(gtk_check_menu_item_toggle_size_request): New function to handle
the toggle size-request.
2000-11-08 17:34:52 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2002-11-09 20:52:31 +00:00
|
|
|
|
static void
|
|
|
|
|
gtk_menu_stop_scrolling (GtkMenu *menu)
|
|
|
|
|
{
|
2010-12-23 20:50:18 +00:00
|
|
|
|
GtkMenuPrivate *priv = menu->priv;
|
2015-12-21 01:30:52 +00:00
|
|
|
|
GtkCssNode *top_arrow_node, *bottom_arrow_node;
|
2015-11-03 01:45:46 +00:00
|
|
|
|
GtkStateFlags state;
|
2006-02-22 10:10:23 +00:00
|
|
|
|
|
2002-11-09 20:52:31 +00:00
|
|
|
|
gtk_menu_remove_scroll_timeout (menu);
|
2011-12-12 17:48:30 +00:00
|
|
|
|
priv->upper_arrow_prelight = FALSE;
|
|
|
|
|
priv->lower_arrow_prelight = FALSE;
|
2015-11-03 01:45:46 +00:00
|
|
|
|
|
2015-12-21 01:30:52 +00:00
|
|
|
|
top_arrow_node = gtk_css_gadget_get_node (priv->top_arrow_gadget);
|
|
|
|
|
state = gtk_css_node_get_state (top_arrow_node);
|
|
|
|
|
gtk_css_node_set_state (top_arrow_node, state & ~GTK_STATE_FLAG_PRELIGHT);
|
|
|
|
|
|
|
|
|
|
bottom_arrow_node = gtk_css_gadget_get_node (priv->bottom_arrow_gadget);
|
|
|
|
|
state = gtk_css_node_get_state (bottom_arrow_node);
|
|
|
|
|
gtk_css_node_set_state (bottom_arrow_node, state & ~GTK_STATE_FLAG_PRELIGHT);
|
2002-11-09 20:52:31 +00:00
|
|
|
|
}
|
Add note about GtkMenuPositionFunc API changes.
2000-11-08 Alexander Larsson <alexl@redhat.com>
* docs/Changes-2.0.txt: Add note about GtkMenuPositionFunc
API changes.
* gtk/gtkmenu.c: Add support for scrolling menus.
Remove gtk_menu_append/prepend/insert, these have been moved to
gtkcompat.h as #defines.
* gtk/gtkcompat.h.in:
Add compatibility #defines for gtk_menu_append/prepend/insert
* gtk/gtkmenu.h: Add data needed for scrolling menus.
GtkMenuPositionFunc gets an extra argument push_in.
gtk_menu_append/prepend/insert removed.
* gtk/gtkmenuitem.c (gtk_menu_item_position_menu): Change menu
positioning behaviour to fit to scrolling menus.
* gtk/gtkmenuitem.c (gtk_menu_item_forall): Don't recurse
into menuitem->submeny. That is wrong, and broke torn
off submenus of torn off menus, since they were unrealized
when the first menu was unrealized.
* gtk/gtkmenushell.[ch]: Virtualize gtk_menu_shell_insert() and
gtk_menu_shell_select_item() since these need to be overridden in
GtkMenu.
* gtk/gtkoptionmenu.c (gtk_opttion_menu_position): Change menu
positioning behaviour to fit to scrolling menus.
(gtk_option_menu_key_press, gtk_option_menu_button_press): Select
the current item so that it is prelighted when the menu pops up.
This is a workaround to the fact that the menu doesn't get the
initial enter event (due to grabs).
* gtk/gtkfilesel.c, gtk/gtkinputdialog.c, gtk/testgtk.c:
s/gtk_menu_append/gtk_menu_shell_append/
* gtk/gtknotebook.c:
s/gtk_menu_insert/gtk_menu_shell_insert/
* gtk/testgtk.c (create_menu, create_menus):
Create the first menu with 50 items so that menu scrolling
can be tested.
Patch from Jonathan Blandford <jrb@redhat.com>
* gtk/gtkmenuitem.[ch] (gtk_menu_item_toggle_size_request): new
system to handle size requests. First, we ask what the size of
the toggle is. Then, when allocating the size, we allocate the
toggle_size first. This way we can have multiple menu-item
classes w/o needing a seperate class for each.
* gtk/gtkmenu.c (gtk_menu_size_request): Actually use the new system.
* gtk/gtkmenu.c (gtk_menu_size_allocate): Use the new system.
* gtk/gtkcheckmenuitem.c
(gtk_check_menu_item_toggle_size_request): New function to handle
the toggle size-request.
2000-11-08 17:34:52 +00:00
|
|
|
|
|
|
|
|
|
static void
|
2019-01-17 18:27:51 +00:00
|
|
|
|
sync_arrows_state (GtkMenu *menu)
|
Add note about GtkMenuPositionFunc API changes.
2000-11-08 Alexander Larsson <alexl@redhat.com>
* docs/Changes-2.0.txt: Add note about GtkMenuPositionFunc
API changes.
* gtk/gtkmenu.c: Add support for scrolling menus.
Remove gtk_menu_append/prepend/insert, these have been moved to
gtkcompat.h as #defines.
* gtk/gtkcompat.h.in:
Add compatibility #defines for gtk_menu_append/prepend/insert
* gtk/gtkmenu.h: Add data needed for scrolling menus.
GtkMenuPositionFunc gets an extra argument push_in.
gtk_menu_append/prepend/insert removed.
* gtk/gtkmenuitem.c (gtk_menu_item_position_menu): Change menu
positioning behaviour to fit to scrolling menus.
* gtk/gtkmenuitem.c (gtk_menu_item_forall): Don't recurse
into menuitem->submeny. That is wrong, and broke torn
off submenus of torn off menus, since they were unrealized
when the first menu was unrealized.
* gtk/gtkmenushell.[ch]: Virtualize gtk_menu_shell_insert() and
gtk_menu_shell_select_item() since these need to be overridden in
GtkMenu.
* gtk/gtkoptionmenu.c (gtk_opttion_menu_position): Change menu
positioning behaviour to fit to scrolling menus.
(gtk_option_menu_key_press, gtk_option_menu_button_press): Select
the current item so that it is prelighted when the menu pops up.
This is a workaround to the fact that the menu doesn't get the
initial enter event (due to grabs).
* gtk/gtkfilesel.c, gtk/gtkinputdialog.c, gtk/testgtk.c:
s/gtk_menu_append/gtk_menu_shell_append/
* gtk/gtknotebook.c:
s/gtk_menu_insert/gtk_menu_shell_insert/
* gtk/testgtk.c (create_menu, create_menus):
Create the first menu with 50 items so that menu scrolling
can be tested.
Patch from Jonathan Blandford <jrb@redhat.com>
* gtk/gtkmenuitem.[ch] (gtk_menu_item_toggle_size_request): new
system to handle size requests. First, we ask what the size of
the toggle is. Then, when allocating the size, we allocate the
toggle_size first. This way we can have multiple menu-item
classes w/o needing a seperate class for each.
* gtk/gtkmenu.c (gtk_menu_size_request): Actually use the new system.
* gtk/gtkmenu.c (gtk_menu_size_allocate): Use the new system.
* gtk/gtkcheckmenuitem.c
(gtk_check_menu_item_toggle_size_request): New function to handle
the toggle size-request.
2000-11-08 17:34:52 +00:00
|
|
|
|
{
|
2010-12-23 20:50:18 +00:00
|
|
|
|
GtkMenuPrivate *priv = menu->priv;
|
2015-12-21 01:30:52 +00:00
|
|
|
|
GtkCssNode *top_arrow_node, *bottom_arrow_node;
|
2019-01-17 18:27:51 +00:00
|
|
|
|
|
|
|
|
|
top_arrow_node = gtk_css_gadget_get_node (priv->top_arrow_gadget);
|
|
|
|
|
gtk_css_node_set_visible (top_arrow_node, priv->upper_arrow_visible);
|
|
|
|
|
gtk_css_node_set_state (top_arrow_node, priv->upper_arrow_state);
|
|
|
|
|
|
|
|
|
|
bottom_arrow_node = gtk_css_gadget_get_node (priv->bottom_arrow_gadget);
|
|
|
|
|
gtk_css_node_set_visible (bottom_arrow_node, priv->lower_arrow_visible);
|
|
|
|
|
gtk_css_node_set_state (bottom_arrow_node, priv->lower_arrow_state);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
gtk_menu_scroll_to (GtkMenu *menu,
|
|
|
|
|
gint offset,
|
|
|
|
|
GtkMenuScrollFlag flags)
|
|
|
|
|
{
|
|
|
|
|
GtkMenuPrivate *priv = menu->priv;
|
2011-05-17 18:10:19 +00:00
|
|
|
|
GtkBorder arrow_border, padding;
|
Add note about GtkMenuPositionFunc API changes.
2000-11-08 Alexander Larsson <alexl@redhat.com>
* docs/Changes-2.0.txt: Add note about GtkMenuPositionFunc
API changes.
* gtk/gtkmenu.c: Add support for scrolling menus.
Remove gtk_menu_append/prepend/insert, these have been moved to
gtkcompat.h as #defines.
* gtk/gtkcompat.h.in:
Add compatibility #defines for gtk_menu_append/prepend/insert
* gtk/gtkmenu.h: Add data needed for scrolling menus.
GtkMenuPositionFunc gets an extra argument push_in.
gtk_menu_append/prepend/insert removed.
* gtk/gtkmenuitem.c (gtk_menu_item_position_menu): Change menu
positioning behaviour to fit to scrolling menus.
* gtk/gtkmenuitem.c (gtk_menu_item_forall): Don't recurse
into menuitem->submeny. That is wrong, and broke torn
off submenus of torn off menus, since they were unrealized
when the first menu was unrealized.
* gtk/gtkmenushell.[ch]: Virtualize gtk_menu_shell_insert() and
gtk_menu_shell_select_item() since these need to be overridden in
GtkMenu.
* gtk/gtkoptionmenu.c (gtk_opttion_menu_position): Change menu
positioning behaviour to fit to scrolling menus.
(gtk_option_menu_key_press, gtk_option_menu_button_press): Select
the current item so that it is prelighted when the menu pops up.
This is a workaround to the fact that the menu doesn't get the
initial enter event (due to grabs).
* gtk/gtkfilesel.c, gtk/gtkinputdialog.c, gtk/testgtk.c:
s/gtk_menu_append/gtk_menu_shell_append/
* gtk/gtknotebook.c:
s/gtk_menu_insert/gtk_menu_shell_insert/
* gtk/testgtk.c (create_menu, create_menus):
Create the first menu with 50 items so that menu scrolling
can be tested.
Patch from Jonathan Blandford <jrb@redhat.com>
* gtk/gtkmenuitem.[ch] (gtk_menu_item_toggle_size_request): new
system to handle size requests. First, we ask what the size of
the toggle is. Then, when allocating the size, we allocate the
toggle_size first. This way we can have multiple menu-item
classes w/o needing a seperate class for each.
* gtk/gtkmenu.c (gtk_menu_size_request): Actually use the new system.
* gtk/gtkmenu.c (gtk_menu_size_allocate): Use the new system.
* gtk/gtkcheckmenuitem.c
(gtk_check_menu_item_toggle_size_request): New function to handle
the toggle size-request.
2000-11-08 17:34:52 +00:00
|
|
|
|
GtkWidget *widget;
|
|
|
|
|
gint x, y;
|
|
|
|
|
gint view_width, view_height;
|
2010-11-30 23:55:14 +00:00
|
|
|
|
gint border_width;
|
Add note about GtkMenuPositionFunc API changes.
2000-11-08 Alexander Larsson <alexl@redhat.com>
* docs/Changes-2.0.txt: Add note about GtkMenuPositionFunc
API changes.
* gtk/gtkmenu.c: Add support for scrolling menus.
Remove gtk_menu_append/prepend/insert, these have been moved to
gtkcompat.h as #defines.
* gtk/gtkcompat.h.in:
Add compatibility #defines for gtk_menu_append/prepend/insert
* gtk/gtkmenu.h: Add data needed for scrolling menus.
GtkMenuPositionFunc gets an extra argument push_in.
gtk_menu_append/prepend/insert removed.
* gtk/gtkmenuitem.c (gtk_menu_item_position_menu): Change menu
positioning behaviour to fit to scrolling menus.
* gtk/gtkmenuitem.c (gtk_menu_item_forall): Don't recurse
into menuitem->submeny. That is wrong, and broke torn
off submenus of torn off menus, since they were unrealized
when the first menu was unrealized.
* gtk/gtkmenushell.[ch]: Virtualize gtk_menu_shell_insert() and
gtk_menu_shell_select_item() since these need to be overridden in
GtkMenu.
* gtk/gtkoptionmenu.c (gtk_opttion_menu_position): Change menu
positioning behaviour to fit to scrolling menus.
(gtk_option_menu_key_press, gtk_option_menu_button_press): Select
the current item so that it is prelighted when the menu pops up.
This is a workaround to the fact that the menu doesn't get the
initial enter event (due to grabs).
* gtk/gtkfilesel.c, gtk/gtkinputdialog.c, gtk/testgtk.c:
s/gtk_menu_append/gtk_menu_shell_append/
* gtk/gtknotebook.c:
s/gtk_menu_insert/gtk_menu_shell_insert/
* gtk/testgtk.c (create_menu, create_menus):
Create the first menu with 50 items so that menu scrolling
can be tested.
Patch from Jonathan Blandford <jrb@redhat.com>
* gtk/gtkmenuitem.[ch] (gtk_menu_item_toggle_size_request): new
system to handle size requests. First, we ask what the size of
the toggle is. Then, when allocating the size, we allocate the
toggle_size first. This way we can have multiple menu-item
classes w/o needing a seperate class for each.
* gtk/gtkmenu.c (gtk_menu_size_request): Actually use the new system.
* gtk/gtkmenu.c (gtk_menu_size_allocate): Use the new system.
* gtk/gtkcheckmenuitem.c
(gtk_check_menu_item_toggle_size_request): New function to handle
the toggle size-request.
2000-11-08 17:34:52 +00:00
|
|
|
|
gint menu_height;
|
2010-08-11 21:08:37 +00:00
|
|
|
|
|
Add note about GtkMenuPositionFunc API changes.
2000-11-08 Alexander Larsson <alexl@redhat.com>
* docs/Changes-2.0.txt: Add note about GtkMenuPositionFunc
API changes.
* gtk/gtkmenu.c: Add support for scrolling menus.
Remove gtk_menu_append/prepend/insert, these have been moved to
gtkcompat.h as #defines.
* gtk/gtkcompat.h.in:
Add compatibility #defines for gtk_menu_append/prepend/insert
* gtk/gtkmenu.h: Add data needed for scrolling menus.
GtkMenuPositionFunc gets an extra argument push_in.
gtk_menu_append/prepend/insert removed.
* gtk/gtkmenuitem.c (gtk_menu_item_position_menu): Change menu
positioning behaviour to fit to scrolling menus.
* gtk/gtkmenuitem.c (gtk_menu_item_forall): Don't recurse
into menuitem->submeny. That is wrong, and broke torn
off submenus of torn off menus, since they were unrealized
when the first menu was unrealized.
* gtk/gtkmenushell.[ch]: Virtualize gtk_menu_shell_insert() and
gtk_menu_shell_select_item() since these need to be overridden in
GtkMenu.
* gtk/gtkoptionmenu.c (gtk_opttion_menu_position): Change menu
positioning behaviour to fit to scrolling menus.
(gtk_option_menu_key_press, gtk_option_menu_button_press): Select
the current item so that it is prelighted when the menu pops up.
This is a workaround to the fact that the menu doesn't get the
initial enter event (due to grabs).
* gtk/gtkfilesel.c, gtk/gtkinputdialog.c, gtk/testgtk.c:
s/gtk_menu_append/gtk_menu_shell_append/
* gtk/gtknotebook.c:
s/gtk_menu_insert/gtk_menu_shell_insert/
* gtk/testgtk.c (create_menu, create_menus):
Create the first menu with 50 items so that menu scrolling
can be tested.
Patch from Jonathan Blandford <jrb@redhat.com>
* gtk/gtkmenuitem.[ch] (gtk_menu_item_toggle_size_request): new
system to handle size requests. First, we ask what the size of
the toggle is. Then, when allocating the size, we allocate the
toggle_size first. This way we can have multiple menu-item
classes w/o needing a seperate class for each.
* gtk/gtkmenu.c (gtk_menu_size_request): Actually use the new system.
* gtk/gtkmenu.c (gtk_menu_size_allocate): Use the new system.
* gtk/gtkcheckmenuitem.c
(gtk_check_menu_item_toggle_size_request): New function to handle
the toggle size-request.
2000-11-08 17:34:52 +00:00
|
|
|
|
widget = GTK_WIDGET (menu);
|
|
|
|
|
|
2011-01-05 18:18:50 +00:00
|
|
|
|
if (priv->tearoff_active && priv->tearoff_adjustment)
|
|
|
|
|
gtk_adjustment_set_value (priv->tearoff_adjustment, offset);
|
2010-12-23 20:50:18 +00:00
|
|
|
|
|
Add note about GtkMenuPositionFunc API changes.
2000-11-08 Alexander Larsson <alexl@redhat.com>
* docs/Changes-2.0.txt: Add note about GtkMenuPositionFunc
API changes.
* gtk/gtkmenu.c: Add support for scrolling menus.
Remove gtk_menu_append/prepend/insert, these have been moved to
gtkcompat.h as #defines.
* gtk/gtkcompat.h.in:
Add compatibility #defines for gtk_menu_append/prepend/insert
* gtk/gtkmenu.h: Add data needed for scrolling menus.
GtkMenuPositionFunc gets an extra argument push_in.
gtk_menu_append/prepend/insert removed.
* gtk/gtkmenuitem.c (gtk_menu_item_position_menu): Change menu
positioning behaviour to fit to scrolling menus.
* gtk/gtkmenuitem.c (gtk_menu_item_forall): Don't recurse
into menuitem->submeny. That is wrong, and broke torn
off submenus of torn off menus, since they were unrealized
when the first menu was unrealized.
* gtk/gtkmenushell.[ch]: Virtualize gtk_menu_shell_insert() and
gtk_menu_shell_select_item() since these need to be overridden in
GtkMenu.
* gtk/gtkoptionmenu.c (gtk_opttion_menu_position): Change menu
positioning behaviour to fit to scrolling menus.
(gtk_option_menu_key_press, gtk_option_menu_button_press): Select
the current item so that it is prelighted when the menu pops up.
This is a workaround to the fact that the menu doesn't get the
initial enter event (due to grabs).
* gtk/gtkfilesel.c, gtk/gtkinputdialog.c, gtk/testgtk.c:
s/gtk_menu_append/gtk_menu_shell_append/
* gtk/gtknotebook.c:
s/gtk_menu_insert/gtk_menu_shell_insert/
* gtk/testgtk.c (create_menu, create_menus):
Create the first menu with 50 items so that menu scrolling
can be tested.
Patch from Jonathan Blandford <jrb@redhat.com>
* gtk/gtkmenuitem.[ch] (gtk_menu_item_toggle_size_request): new
system to handle size requests. First, we ask what the size of
the toggle is. Then, when allocating the size, we allocate the
toggle_size first. This way we can have multiple menu-item
classes w/o needing a seperate class for each.
* gtk/gtkmenu.c (gtk_menu_size_request): Actually use the new system.
* gtk/gtkmenu.c (gtk_menu_size_allocate): Use the new system.
* gtk/gtkcheckmenuitem.c
(gtk_check_menu_item_toggle_size_request): New function to handle
the toggle size-request.
2000-11-08 17:34:52 +00:00
|
|
|
|
/* Move/resize the viewport according to arrows: */
|
2011-12-23 04:42:12 +00:00
|
|
|
|
view_width = gtk_widget_get_allocated_width (widget);
|
|
|
|
|
view_height = gtk_widget_get_allocated_height (widget);
|
2010-08-11 21:08:37 +00:00
|
|
|
|
|
2011-05-17 18:10:19 +00:00
|
|
|
|
get_menu_padding (widget, &padding);
|
2006-02-22 10:10:23 +00:00
|
|
|
|
|
2010-06-02 04:28:22 +00:00
|
|
|
|
border_width = gtk_container_get_border_width (GTK_CONTAINER (menu));
|
Add note about GtkMenuPositionFunc API changes.
2000-11-08 Alexander Larsson <alexl@redhat.com>
* docs/Changes-2.0.txt: Add note about GtkMenuPositionFunc
API changes.
* gtk/gtkmenu.c: Add support for scrolling menus.
Remove gtk_menu_append/prepend/insert, these have been moved to
gtkcompat.h as #defines.
* gtk/gtkcompat.h.in:
Add compatibility #defines for gtk_menu_append/prepend/insert
* gtk/gtkmenu.h: Add data needed for scrolling menus.
GtkMenuPositionFunc gets an extra argument push_in.
gtk_menu_append/prepend/insert removed.
* gtk/gtkmenuitem.c (gtk_menu_item_position_menu): Change menu
positioning behaviour to fit to scrolling menus.
* gtk/gtkmenuitem.c (gtk_menu_item_forall): Don't recurse
into menuitem->submeny. That is wrong, and broke torn
off submenus of torn off menus, since they were unrealized
when the first menu was unrealized.
* gtk/gtkmenushell.[ch]: Virtualize gtk_menu_shell_insert() and
gtk_menu_shell_select_item() since these need to be overridden in
GtkMenu.
* gtk/gtkoptionmenu.c (gtk_opttion_menu_position): Change menu
positioning behaviour to fit to scrolling menus.
(gtk_option_menu_key_press, gtk_option_menu_button_press): Select
the current item so that it is prelighted when the menu pops up.
This is a workaround to the fact that the menu doesn't get the
initial enter event (due to grabs).
* gtk/gtkfilesel.c, gtk/gtkinputdialog.c, gtk/testgtk.c:
s/gtk_menu_append/gtk_menu_shell_append/
* gtk/gtknotebook.c:
s/gtk_menu_insert/gtk_menu_shell_insert/
* gtk/testgtk.c (create_menu, create_menus):
Create the first menu with 50 items so that menu scrolling
can be tested.
Patch from Jonathan Blandford <jrb@redhat.com>
* gtk/gtkmenuitem.[ch] (gtk_menu_item_toggle_size_request): new
system to handle size requests. First, we ask what the size of
the toggle is. Then, when allocating the size, we allocate the
toggle_size first. This way we can have multiple menu-item
classes w/o needing a seperate class for each.
* gtk/gtkmenu.c (gtk_menu_size_request): Actually use the new system.
* gtk/gtkmenu.c (gtk_menu_size_allocate): Use the new system.
* gtk/gtkcheckmenuitem.c
(gtk_check_menu_item_toggle_size_request): New function to handle
the toggle size-request.
2000-11-08 17:34:52 +00:00
|
|
|
|
|
2012-11-27 14:04:12 +00:00
|
|
|
|
view_width -= (2 * border_width) + padding.left + padding.right;
|
|
|
|
|
view_height -= (2 * border_width) + padding.top + padding.bottom;
|
|
|
|
|
menu_height = priv->requested_height - (2 * border_width) - padding.top - padding.bottom;
|
2010-08-11 21:08:37 +00:00
|
|
|
|
|
2012-11-27 14:04:12 +00:00
|
|
|
|
x = border_width + padding.left;
|
|
|
|
|
y = border_width + padding.top;
|
2002-12-14 22:43:52 +00:00
|
|
|
|
|
2015-12-21 02:44:10 +00:00
|
|
|
|
if (!priv->tearoff_active)
|
2006-02-22 10:10:23 +00:00
|
|
|
|
{
|
|
|
|
|
if (view_height < menu_height ||
|
2010-12-23 20:50:18 +00:00
|
|
|
|
(offset > 0 && priv->scroll_offset > 0) ||
|
|
|
|
|
(offset < 0 && priv->scroll_offset < 0))
|
2006-02-22 10:10:23 +00:00
|
|
|
|
{
|
2010-12-23 20:50:18 +00:00
|
|
|
|
GtkStateFlags upper_arrow_previous_state = priv->upper_arrow_state;
|
|
|
|
|
GtkStateFlags lower_arrow_previous_state = priv->lower_arrow_state;
|
2019-01-17 18:27:51 +00:00
|
|
|
|
gboolean should_offset_by_arrow;
|
2006-02-22 10:10:23 +00:00
|
|
|
|
|
2010-12-23 20:50:18 +00:00
|
|
|
|
if (!priv->upper_arrow_visible || !priv->lower_arrow_visible)
|
2006-02-22 10:10:23 +00:00
|
|
|
|
gtk_widget_queue_draw (GTK_WIDGET (menu));
|
|
|
|
|
|
2019-02-05 14:18:41 +00:00
|
|
|
|
if (!priv->upper_arrow_visible &&
|
2019-01-17 18:27:51 +00:00
|
|
|
|
flags & GTK_MENU_SCROLL_FLAG_ADAPT)
|
|
|
|
|
should_offset_by_arrow = TRUE;
|
|
|
|
|
else
|
|
|
|
|
should_offset_by_arrow = FALSE;
|
|
|
|
|
|
2010-12-23 20:50:18 +00:00
|
|
|
|
priv->upper_arrow_visible = priv->lower_arrow_visible = TRUE;
|
2006-02-22 10:10:23 +00:00
|
|
|
|
|
2019-01-17 18:27:51 +00:00
|
|
|
|
if (flags & GTK_MENU_SCROLL_FLAG_ADAPT)
|
|
|
|
|
sync_arrows_state (menu);
|
|
|
|
|
|
2010-12-23 20:50:18 +00:00
|
|
|
|
get_arrows_border (menu, &arrow_border);
|
2019-01-17 18:27:51 +00:00
|
|
|
|
if (should_offset_by_arrow)
|
|
|
|
|
offset += arrow_border.top;
|
2010-12-23 20:50:18 +00:00
|
|
|
|
y += arrow_border.top;
|
|
|
|
|
view_height -= arrow_border.top;
|
|
|
|
|
view_height -= arrow_border.bottom;
|
2007-05-09 15:46:41 +00:00
|
|
|
|
|
2006-02-22 10:10:23 +00:00
|
|
|
|
if (offset <= 0)
|
2010-11-21 18:40:28 +00:00
|
|
|
|
priv->upper_arrow_state |= GTK_STATE_FLAG_INSENSITIVE;
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
priv->upper_arrow_state &= ~(GTK_STATE_FLAG_INSENSITIVE);
|
|
|
|
|
|
2010-12-23 20:50:18 +00:00
|
|
|
|
if (priv->upper_arrow_prelight)
|
2010-11-21 18:40:28 +00:00
|
|
|
|
priv->upper_arrow_state |= GTK_STATE_FLAG_PRELIGHT;
|
|
|
|
|
else
|
|
|
|
|
priv->upper_arrow_state &= ~(GTK_STATE_FLAG_PRELIGHT);
|
|
|
|
|
}
|
2006-02-22 10:10:23 +00:00
|
|
|
|
|
|
|
|
|
if (offset >= menu_height - view_height)
|
2010-11-21 18:40:28 +00:00
|
|
|
|
priv->lower_arrow_state |= GTK_STATE_FLAG_INSENSITIVE;
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
priv->lower_arrow_state &= ~(GTK_STATE_FLAG_INSENSITIVE);
|
|
|
|
|
|
2010-12-23 20:50:18 +00:00
|
|
|
|
if (priv->lower_arrow_prelight)
|
2010-11-21 18:40:28 +00:00
|
|
|
|
priv->lower_arrow_state |= GTK_STATE_FLAG_PRELIGHT;
|
|
|
|
|
else
|
|
|
|
|
priv->lower_arrow_state &= ~(GTK_STATE_FLAG_PRELIGHT);
|
|
|
|
|
}
|
2006-02-22 10:10:23 +00:00
|
|
|
|
|
|
|
|
|
if ((priv->upper_arrow_state != upper_arrow_previous_state) ||
|
|
|
|
|
(priv->lower_arrow_state != lower_arrow_previous_state))
|
|
|
|
|
gtk_widget_queue_draw (GTK_WIDGET (menu));
|
|
|
|
|
|
2010-11-21 18:40:28 +00:00
|
|
|
|
if ((upper_arrow_previous_state & GTK_STATE_FLAG_INSENSITIVE) == 0 &&
|
|
|
|
|
(priv->upper_arrow_state & GTK_STATE_FLAG_INSENSITIVE) != 0)
|
2006-02-22 10:10:23 +00:00
|
|
|
|
{
|
|
|
|
|
/* At the upper border, possibly remove timeout */
|
2010-12-23 20:50:18 +00:00
|
|
|
|
if (priv->scroll_step < 0)
|
2006-02-22 10:10:23 +00:00
|
|
|
|
{
|
|
|
|
|
gtk_menu_stop_scrolling (menu);
|
|
|
|
|
gtk_widget_queue_draw (GTK_WIDGET (menu));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2010-11-21 18:40:28 +00:00
|
|
|
|
if ((lower_arrow_previous_state & GTK_STATE_FLAG_INSENSITIVE) == 0 &&
|
|
|
|
|
(priv->lower_arrow_state & GTK_STATE_FLAG_INSENSITIVE) != 0)
|
2006-02-22 10:10:23 +00:00
|
|
|
|
{
|
|
|
|
|
/* At the lower border, possibly remove timeout */
|
2010-12-23 20:50:18 +00:00
|
|
|
|
if (priv->scroll_step > 0)
|
2006-02-22 10:10:23 +00:00
|
|
|
|
{
|
|
|
|
|
gtk_menu_stop_scrolling (menu);
|
|
|
|
|
gtk_widget_queue_draw (GTK_WIDGET (menu));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2010-12-23 20:50:18 +00:00
|
|
|
|
else if (priv->upper_arrow_visible || priv->lower_arrow_visible)
|
2006-02-22 10:10:23 +00:00
|
|
|
|
{
|
|
|
|
|
offset = 0;
|
|
|
|
|
|
2010-12-23 20:50:18 +00:00
|
|
|
|
priv->upper_arrow_visible = priv->lower_arrow_visible = FALSE;
|
|
|
|
|
priv->upper_arrow_prelight = priv->lower_arrow_prelight = FALSE;
|
2006-02-22 10:10:23 +00:00
|
|
|
|
|
|
|
|
|
gtk_menu_stop_scrolling (menu);
|
|
|
|
|
gtk_widget_queue_draw (GTK_WIDGET (menu));
|
|
|
|
|
}
|
|
|
|
|
}
|
2002-08-02 22:03:23 +00:00
|
|
|
|
|
2019-01-17 18:27:51 +00:00
|
|
|
|
sync_arrows_state (menu);
|
2015-11-03 01:45:46 +00:00
|
|
|
|
|
2002-10-17 20:09:39 +00:00
|
|
|
|
/* Scroll the menu: */
|
2010-03-02 06:16:02 +00:00
|
|
|
|
if (gtk_widget_get_realized (widget))
|
2012-07-13 12:49:47 +00:00
|
|
|
|
{
|
|
|
|
|
gdk_window_move (priv->bin_window, 0, -offset);
|
|
|
|
|
gdk_window_move_resize (priv->view_window, x, y, view_width, view_height);
|
|
|
|
|
}
|
Add note about GtkMenuPositionFunc API changes.
2000-11-08 Alexander Larsson <alexl@redhat.com>
* docs/Changes-2.0.txt: Add note about GtkMenuPositionFunc
API changes.
* gtk/gtkmenu.c: Add support for scrolling menus.
Remove gtk_menu_append/prepend/insert, these have been moved to
gtkcompat.h as #defines.
* gtk/gtkcompat.h.in:
Add compatibility #defines for gtk_menu_append/prepend/insert
* gtk/gtkmenu.h: Add data needed for scrolling menus.
GtkMenuPositionFunc gets an extra argument push_in.
gtk_menu_append/prepend/insert removed.
* gtk/gtkmenuitem.c (gtk_menu_item_position_menu): Change menu
positioning behaviour to fit to scrolling menus.
* gtk/gtkmenuitem.c (gtk_menu_item_forall): Don't recurse
into menuitem->submeny. That is wrong, and broke torn
off submenus of torn off menus, since they were unrealized
when the first menu was unrealized.
* gtk/gtkmenushell.[ch]: Virtualize gtk_menu_shell_insert() and
gtk_menu_shell_select_item() since these need to be overridden in
GtkMenu.
* gtk/gtkoptionmenu.c (gtk_opttion_menu_position): Change menu
positioning behaviour to fit to scrolling menus.
(gtk_option_menu_key_press, gtk_option_menu_button_press): Select
the current item so that it is prelighted when the menu pops up.
This is a workaround to the fact that the menu doesn't get the
initial enter event (due to grabs).
* gtk/gtkfilesel.c, gtk/gtkinputdialog.c, gtk/testgtk.c:
s/gtk_menu_append/gtk_menu_shell_append/
* gtk/gtknotebook.c:
s/gtk_menu_insert/gtk_menu_shell_insert/
* gtk/testgtk.c (create_menu, create_menus):
Create the first menu with 50 items so that menu scrolling
can be tested.
Patch from Jonathan Blandford <jrb@redhat.com>
* gtk/gtkmenuitem.[ch] (gtk_menu_item_toggle_size_request): new
system to handle size requests. First, we ask what the size of
the toggle is. Then, when allocating the size, we allocate the
toggle_size first. This way we can have multiple menu-item
classes w/o needing a seperate class for each.
* gtk/gtkmenu.c (gtk_menu_size_request): Actually use the new system.
* gtk/gtkmenu.c (gtk_menu_size_allocate): Use the new system.
* gtk/gtkcheckmenuitem.c
(gtk_check_menu_item_toggle_size_request): New function to handle
the toggle size-request.
2000-11-08 17:34:52 +00:00
|
|
|
|
|
2010-12-23 20:50:18 +00:00
|
|
|
|
priv->scroll_offset = offset;
|
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
|
|
|
|
}
|
1998-09-01 18:41:26 +00:00
|
|
|
|
|
2002-12-14 22:43:52 +00:00
|
|
|
|
static gboolean
|
|
|
|
|
compute_child_offset (GtkMenu *menu,
|
2010-12-23 20:50:18 +00:00
|
|
|
|
GtkWidget *menu_item,
|
|
|
|
|
gint *offset,
|
|
|
|
|
gint *height,
|
|
|
|
|
gboolean *is_last_child)
|
2002-12-14 22:43:52 +00:00
|
|
|
|
{
|
2010-12-23 20:50:18 +00:00
|
|
|
|
GtkMenuPrivate *priv = menu->priv;
|
2005-11-10 14:33:51 +00:00
|
|
|
|
gint item_top_attach;
|
|
|
|
|
gint item_bottom_attach;
|
2002-12-14 22:43:52 +00:00
|
|
|
|
gint child_offset = 0;
|
The table menu patch! Turns GtkMenu into a table, so you can attach menu
Wed Sep 10 22:25:04 2003 Kristian Rietveld <kris@gtk.org>
The table menu patch! Turns GtkMenu into a table, so you can attach
menu items in numerous new ways! Be creative!
Contains some bug fixes and RTL adaptions from Matthias Clasen.
* gtk/gtkmenu.c [toplevel]: introduce ATTACH_INFO_KEY, extend
GtkMenuPrivate, introduce AttachInfo, add child properties enum,
(gtk_menu_free_private), (gtk_menu_get_private): we have to free
the heights array in the private struct,
(gtk_menu_class_init): reorder code a bit, install child properties,
(get_attach_info), (get_child_attach): new utility functions,
(gtk_menu_set_child_property), (gtk_menu_get_child_property): introduce
child properties, for the attach info,
(gtk_menu_remove): remove AttachInfo from menu item,
(gtk_menu_real_insert): implemented algorithm to automagically place
inserted menu items at the correct place in the table,
(gtk_menu_size_request), (gtk_menu_size_allocate),
(compute_child_offset): reworked/rewritten to support table menus,
(gtk_menu_attach): new function,
(find_child_containing), (gtk_menu_move_current): new functions to
get table menu keynav right.
* gtk/gtkmenu.h: add gtk_menu_attach() prototype.
2003-09-10 20:32:33 +00:00
|
|
|
|
gint i;
|
2002-12-14 22:43:52 +00:00
|
|
|
|
|
2004-03-15 02:03:59 +00:00
|
|
|
|
get_effective_child_attach (menu_item, NULL, NULL,
|
2010-12-23 20:50:18 +00:00
|
|
|
|
&item_top_attach, &item_bottom_attach);
|
2002-12-14 22:43:52 +00:00
|
|
|
|
|
2010-12-23 20:50:18 +00:00
|
|
|
|
/* there is a possibility that we get called before _size_request,
|
|
|
|
|
* so check the height table for safety.
|
The table menu patch! Turns GtkMenu into a table, so you can attach menu
Wed Sep 10 22:25:04 2003 Kristian Rietveld <kris@gtk.org>
The table menu patch! Turns GtkMenu into a table, so you can attach
menu items in numerous new ways! Be creative!
Contains some bug fixes and RTL adaptions from Matthias Clasen.
* gtk/gtkmenu.c [toplevel]: introduce ATTACH_INFO_KEY, extend
GtkMenuPrivate, introduce AttachInfo, add child properties enum,
(gtk_menu_free_private), (gtk_menu_get_private): we have to free
the heights array in the private struct,
(gtk_menu_class_init): reorder code a bit, install child properties,
(get_attach_info), (get_child_attach): new utility functions,
(gtk_menu_set_child_property), (gtk_menu_get_child_property): introduce
child properties, for the attach info,
(gtk_menu_remove): remove AttachInfo from menu item,
(gtk_menu_real_insert): implemented algorithm to automagically place
inserted menu items at the correct place in the table,
(gtk_menu_size_request), (gtk_menu_size_allocate),
(compute_child_offset): reworked/rewritten to support table menus,
(gtk_menu_attach): new function,
(find_child_containing), (gtk_menu_move_current): new functions to
get table menu keynav right.
* gtk/gtkmenu.h: add gtk_menu_attach() prototype.
2003-09-10 20:32:33 +00:00
|
|
|
|
*/
|
2004-03-15 02:03:59 +00:00
|
|
|
|
if (!priv->heights || priv->heights_length < gtk_menu_get_n_rows (menu))
|
The table menu patch! Turns GtkMenu into a table, so you can attach menu
Wed Sep 10 22:25:04 2003 Kristian Rietveld <kris@gtk.org>
The table menu patch! Turns GtkMenu into a table, so you can attach
menu items in numerous new ways! Be creative!
Contains some bug fixes and RTL adaptions from Matthias Clasen.
* gtk/gtkmenu.c [toplevel]: introduce ATTACH_INFO_KEY, extend
GtkMenuPrivate, introduce AttachInfo, add child properties enum,
(gtk_menu_free_private), (gtk_menu_get_private): we have to free
the heights array in the private struct,
(gtk_menu_class_init): reorder code a bit, install child properties,
(get_attach_info), (get_child_attach): new utility functions,
(gtk_menu_set_child_property), (gtk_menu_get_child_property): introduce
child properties, for the attach info,
(gtk_menu_remove): remove AttachInfo from menu item,
(gtk_menu_real_insert): implemented algorithm to automagically place
inserted menu items at the correct place in the table,
(gtk_menu_size_request), (gtk_menu_size_allocate),
(compute_child_offset): reworked/rewritten to support table menus,
(gtk_menu_attach): new function,
(find_child_containing), (gtk_menu_move_current): new functions to
get table menu keynav right.
* gtk/gtkmenu.h: add gtk_menu_attach() prototype.
2003-09-10 20:32:33 +00:00
|
|
|
|
return FALSE;
|
|
|
|
|
|
2011-02-23 09:26:21 +00:00
|
|
|
|
/* when we have a row with only invisible children, its height will
|
The table menu patch! Turns GtkMenu into a table, so you can attach menu
Wed Sep 10 22:25:04 2003 Kristian Rietveld <kris@gtk.org>
The table menu patch! Turns GtkMenu into a table, so you can attach
menu items in numerous new ways! Be creative!
Contains some bug fixes and RTL adaptions from Matthias Clasen.
* gtk/gtkmenu.c [toplevel]: introduce ATTACH_INFO_KEY, extend
GtkMenuPrivate, introduce AttachInfo, add child properties enum,
(gtk_menu_free_private), (gtk_menu_get_private): we have to free
the heights array in the private struct,
(gtk_menu_class_init): reorder code a bit, install child properties,
(get_attach_info), (get_child_attach): new utility functions,
(gtk_menu_set_child_property), (gtk_menu_get_child_property): introduce
child properties, for the attach info,
(gtk_menu_remove): remove AttachInfo from menu item,
(gtk_menu_real_insert): implemented algorithm to automagically place
inserted menu items at the correct place in the table,
(gtk_menu_size_request), (gtk_menu_size_allocate),
(compute_child_offset): reworked/rewritten to support table menus,
(gtk_menu_attach): new function,
(find_child_containing), (gtk_menu_move_current): new functions to
get table menu keynav right.
* gtk/gtkmenu.h: add gtk_menu_attach() prototype.
2003-09-10 20:32:33 +00:00
|
|
|
|
* be zero, so there's no need to check WIDGET_VISIBLE here
|
|
|
|
|
*/
|
|
|
|
|
for (i = 0; i < item_top_attach; i++)
|
|
|
|
|
child_offset += priv->heights[i];
|
|
|
|
|
|
|
|
|
|
if (is_last_child)
|
2004-03-15 02:03:59 +00:00
|
|
|
|
*is_last_child = (item_bottom_attach == gtk_menu_get_n_rows (menu));
|
The table menu patch! Turns GtkMenu into a table, so you can attach menu
Wed Sep 10 22:25:04 2003 Kristian Rietveld <kris@gtk.org>
The table menu patch! Turns GtkMenu into a table, so you can attach
menu items in numerous new ways! Be creative!
Contains some bug fixes and RTL adaptions from Matthias Clasen.
* gtk/gtkmenu.c [toplevel]: introduce ATTACH_INFO_KEY, extend
GtkMenuPrivate, introduce AttachInfo, add child properties enum,
(gtk_menu_free_private), (gtk_menu_get_private): we have to free
the heights array in the private struct,
(gtk_menu_class_init): reorder code a bit, install child properties,
(get_attach_info), (get_child_attach): new utility functions,
(gtk_menu_set_child_property), (gtk_menu_get_child_property): introduce
child properties, for the attach info,
(gtk_menu_remove): remove AttachInfo from menu item,
(gtk_menu_real_insert): implemented algorithm to automagically place
inserted menu items at the correct place in the table,
(gtk_menu_size_request), (gtk_menu_size_allocate),
(compute_child_offset): reworked/rewritten to support table menus,
(gtk_menu_attach): new function,
(find_child_containing), (gtk_menu_move_current): new functions to
get table menu keynav right.
* gtk/gtkmenu.h: add gtk_menu_attach() prototype.
2003-09-10 20:32:33 +00:00
|
|
|
|
if (offset)
|
|
|
|
|
*offset = child_offset;
|
|
|
|
|
if (height)
|
|
|
|
|
*height = priv->heights[item_top_attach];
|
|
|
|
|
|
|
|
|
|
return TRUE;
|
2002-12-14 22:43:52 +00:00
|
|
|
|
}
|
|
|
|
|
|
Add note about GtkMenuPositionFunc API changes.
2000-11-08 Alexander Larsson <alexl@redhat.com>
* docs/Changes-2.0.txt: Add note about GtkMenuPositionFunc
API changes.
* gtk/gtkmenu.c: Add support for scrolling menus.
Remove gtk_menu_append/prepend/insert, these have been moved to
gtkcompat.h as #defines.
* gtk/gtkcompat.h.in:
Add compatibility #defines for gtk_menu_append/prepend/insert
* gtk/gtkmenu.h: Add data needed for scrolling menus.
GtkMenuPositionFunc gets an extra argument push_in.
gtk_menu_append/prepend/insert removed.
* gtk/gtkmenuitem.c (gtk_menu_item_position_menu): Change menu
positioning behaviour to fit to scrolling menus.
* gtk/gtkmenuitem.c (gtk_menu_item_forall): Don't recurse
into menuitem->submeny. That is wrong, and broke torn
off submenus of torn off menus, since they were unrealized
when the first menu was unrealized.
* gtk/gtkmenushell.[ch]: Virtualize gtk_menu_shell_insert() and
gtk_menu_shell_select_item() since these need to be overridden in
GtkMenu.
* gtk/gtkoptionmenu.c (gtk_opttion_menu_position): Change menu
positioning behaviour to fit to scrolling menus.
(gtk_option_menu_key_press, gtk_option_menu_button_press): Select
the current item so that it is prelighted when the menu pops up.
This is a workaround to the fact that the menu doesn't get the
initial enter event (due to grabs).
* gtk/gtkfilesel.c, gtk/gtkinputdialog.c, gtk/testgtk.c:
s/gtk_menu_append/gtk_menu_shell_append/
* gtk/gtknotebook.c:
s/gtk_menu_insert/gtk_menu_shell_insert/
* gtk/testgtk.c (create_menu, create_menus):
Create the first menu with 50 items so that menu scrolling
can be tested.
Patch from Jonathan Blandford <jrb@redhat.com>
* gtk/gtkmenuitem.[ch] (gtk_menu_item_toggle_size_request): new
system to handle size requests. First, we ask what the size of
the toggle is. Then, when allocating the size, we allocate the
toggle_size first. This way we can have multiple menu-item
classes w/o needing a seperate class for each.
* gtk/gtkmenu.c (gtk_menu_size_request): Actually use the new system.
* gtk/gtkmenu.c (gtk_menu_size_allocate): Use the new system.
* gtk/gtkcheckmenuitem.c
(gtk_check_menu_item_toggle_size_request): New function to handle
the toggle size-request.
2000-11-08 17:34:52 +00:00
|
|
|
|
static void
|
2008-09-03 13:18:34 +00:00
|
|
|
|
gtk_menu_scroll_item_visible (GtkMenuShell *menu_shell,
|
2010-12-23 20:50:18 +00:00
|
|
|
|
GtkWidget *menu_item)
|
Add note about GtkMenuPositionFunc API changes.
2000-11-08 Alexander Larsson <alexl@redhat.com>
* docs/Changes-2.0.txt: Add note about GtkMenuPositionFunc
API changes.
* gtk/gtkmenu.c: Add support for scrolling menus.
Remove gtk_menu_append/prepend/insert, these have been moved to
gtkcompat.h as #defines.
* gtk/gtkcompat.h.in:
Add compatibility #defines for gtk_menu_append/prepend/insert
* gtk/gtkmenu.h: Add data needed for scrolling menus.
GtkMenuPositionFunc gets an extra argument push_in.
gtk_menu_append/prepend/insert removed.
* gtk/gtkmenuitem.c (gtk_menu_item_position_menu): Change menu
positioning behaviour to fit to scrolling menus.
* gtk/gtkmenuitem.c (gtk_menu_item_forall): Don't recurse
into menuitem->submeny. That is wrong, and broke torn
off submenus of torn off menus, since they were unrealized
when the first menu was unrealized.
* gtk/gtkmenushell.[ch]: Virtualize gtk_menu_shell_insert() and
gtk_menu_shell_select_item() since these need to be overridden in
GtkMenu.
* gtk/gtkoptionmenu.c (gtk_opttion_menu_position): Change menu
positioning behaviour to fit to scrolling menus.
(gtk_option_menu_key_press, gtk_option_menu_button_press): Select
the current item so that it is prelighted when the menu pops up.
This is a workaround to the fact that the menu doesn't get the
initial enter event (due to grabs).
* gtk/gtkfilesel.c, gtk/gtkinputdialog.c, gtk/testgtk.c:
s/gtk_menu_append/gtk_menu_shell_append/
* gtk/gtknotebook.c:
s/gtk_menu_insert/gtk_menu_shell_insert/
* gtk/testgtk.c (create_menu, create_menus):
Create the first menu with 50 items so that menu scrolling
can be tested.
Patch from Jonathan Blandford <jrb@redhat.com>
* gtk/gtkmenuitem.[ch] (gtk_menu_item_toggle_size_request): new
system to handle size requests. First, we ask what the size of
the toggle is. Then, when allocating the size, we allocate the
toggle_size first. This way we can have multiple menu-item
classes w/o needing a seperate class for each.
* gtk/gtkmenu.c (gtk_menu_size_request): Actually use the new system.
* gtk/gtkmenu.c (gtk_menu_size_allocate): Use the new system.
* gtk/gtkcheckmenuitem.c
(gtk_check_menu_item_toggle_size_request): New function to handle
the toggle size-request.
2000-11-08 17:34:52 +00:00
|
|
|
|
{
|
2010-08-11 21:08:37 +00:00
|
|
|
|
GtkMenu *menu = GTK_MENU (menu_shell);
|
2010-12-23 20:50:18 +00:00
|
|
|
|
GtkMenuPrivate *priv = menu->priv;
|
2010-08-11 21:08:37 +00:00
|
|
|
|
GtkWidget *widget = GTK_WIDGET (menu_shell);
|
Add note about GtkMenuPositionFunc API changes.
2000-11-08 Alexander Larsson <alexl@redhat.com>
* docs/Changes-2.0.txt: Add note about GtkMenuPositionFunc
API changes.
* gtk/gtkmenu.c: Add support for scrolling menus.
Remove gtk_menu_append/prepend/insert, these have been moved to
gtkcompat.h as #defines.
* gtk/gtkcompat.h.in:
Add compatibility #defines for gtk_menu_append/prepend/insert
* gtk/gtkmenu.h: Add data needed for scrolling menus.
GtkMenuPositionFunc gets an extra argument push_in.
gtk_menu_append/prepend/insert removed.
* gtk/gtkmenuitem.c (gtk_menu_item_position_menu): Change menu
positioning behaviour to fit to scrolling menus.
* gtk/gtkmenuitem.c (gtk_menu_item_forall): Don't recurse
into menuitem->submeny. That is wrong, and broke torn
off submenus of torn off menus, since they were unrealized
when the first menu was unrealized.
* gtk/gtkmenushell.[ch]: Virtualize gtk_menu_shell_insert() and
gtk_menu_shell_select_item() since these need to be overridden in
GtkMenu.
* gtk/gtkoptionmenu.c (gtk_opttion_menu_position): Change menu
positioning behaviour to fit to scrolling menus.
(gtk_option_menu_key_press, gtk_option_menu_button_press): Select
the current item so that it is prelighted when the menu pops up.
This is a workaround to the fact that the menu doesn't get the
initial enter event (due to grabs).
* gtk/gtkfilesel.c, gtk/gtkinputdialog.c, gtk/testgtk.c:
s/gtk_menu_append/gtk_menu_shell_append/
* gtk/gtknotebook.c:
s/gtk_menu_insert/gtk_menu_shell_insert/
* gtk/testgtk.c (create_menu, create_menus):
Create the first menu with 50 items so that menu scrolling
can be tested.
Patch from Jonathan Blandford <jrb@redhat.com>
* gtk/gtkmenuitem.[ch] (gtk_menu_item_toggle_size_request): new
system to handle size requests. First, we ask what the size of
the toggle is. Then, when allocating the size, we allocate the
toggle_size first. This way we can have multiple menu-item
classes w/o needing a seperate class for each.
* gtk/gtkmenu.c (gtk_menu_size_request): Actually use the new system.
* gtk/gtkmenu.c (gtk_menu_size_allocate): Use the new system.
* gtk/gtkcheckmenuitem.c
(gtk_check_menu_item_toggle_size_request): New function to handle
the toggle size-request.
2000-11-08 17:34:52 +00:00
|
|
|
|
gint child_offset, child_height;
|
2011-01-24 02:50:39 +00:00
|
|
|
|
gint height;
|
Add note about GtkMenuPositionFunc API changes.
2000-11-08 Alexander Larsson <alexl@redhat.com>
* docs/Changes-2.0.txt: Add note about GtkMenuPositionFunc
API changes.
* gtk/gtkmenu.c: Add support for scrolling menus.
Remove gtk_menu_append/prepend/insert, these have been moved to
gtkcompat.h as #defines.
* gtk/gtkcompat.h.in:
Add compatibility #defines for gtk_menu_append/prepend/insert
* gtk/gtkmenu.h: Add data needed for scrolling menus.
GtkMenuPositionFunc gets an extra argument push_in.
gtk_menu_append/prepend/insert removed.
* gtk/gtkmenuitem.c (gtk_menu_item_position_menu): Change menu
positioning behaviour to fit to scrolling menus.
* gtk/gtkmenuitem.c (gtk_menu_item_forall): Don't recurse
into menuitem->submeny. That is wrong, and broke torn
off submenus of torn off menus, since they were unrealized
when the first menu was unrealized.
* gtk/gtkmenushell.[ch]: Virtualize gtk_menu_shell_insert() and
gtk_menu_shell_select_item() since these need to be overridden in
GtkMenu.
* gtk/gtkoptionmenu.c (gtk_opttion_menu_position): Change menu
positioning behaviour to fit to scrolling menus.
(gtk_option_menu_key_press, gtk_option_menu_button_press): Select
the current item so that it is prelighted when the menu pops up.
This is a workaround to the fact that the menu doesn't get the
initial enter event (due to grabs).
* gtk/gtkfilesel.c, gtk/gtkinputdialog.c, gtk/testgtk.c:
s/gtk_menu_append/gtk_menu_shell_append/
* gtk/gtknotebook.c:
s/gtk_menu_insert/gtk_menu_shell_insert/
* gtk/testgtk.c (create_menu, create_menus):
Create the first menu with 50 items so that menu scrolling
can be tested.
Patch from Jonathan Blandford <jrb@redhat.com>
* gtk/gtkmenuitem.[ch] (gtk_menu_item_toggle_size_request): new
system to handle size requests. First, we ask what the size of
the toggle is. Then, when allocating the size, we allocate the
toggle_size first. This way we can have multiple menu-item
classes w/o needing a seperate class for each.
* gtk/gtkmenu.c (gtk_menu_size_request): Actually use the new system.
* gtk/gtkmenu.c (gtk_menu_size_allocate): Use the new system.
* gtk/gtkcheckmenuitem.c
(gtk_check_menu_item_toggle_size_request): New function to handle
the toggle size-request.
2000-11-08 17:34:52 +00:00
|
|
|
|
gint y;
|
|
|
|
|
gint arrow_height;
|
|
|
|
|
gboolean last_child = 0;
|
|
|
|
|
|
|
|
|
|
/* We need to check if the selected item fully visible.
|
|
|
|
|
* If not we need to scroll the menu so that it becomes fully
|
|
|
|
|
* visible.
|
|
|
|
|
*/
|
2002-12-14 22:43:52 +00:00
|
|
|
|
if (compute_child_offset (menu, menu_item,
|
2010-12-23 20:50:18 +00:00
|
|
|
|
&child_offset, &child_height, &last_child))
|
Add note about GtkMenuPositionFunc API changes.
2000-11-08 Alexander Larsson <alexl@redhat.com>
* docs/Changes-2.0.txt: Add note about GtkMenuPositionFunc
API changes.
* gtk/gtkmenu.c: Add support for scrolling menus.
Remove gtk_menu_append/prepend/insert, these have been moved to
gtkcompat.h as #defines.
* gtk/gtkcompat.h.in:
Add compatibility #defines for gtk_menu_append/prepend/insert
* gtk/gtkmenu.h: Add data needed for scrolling menus.
GtkMenuPositionFunc gets an extra argument push_in.
gtk_menu_append/prepend/insert removed.
* gtk/gtkmenuitem.c (gtk_menu_item_position_menu): Change menu
positioning behaviour to fit to scrolling menus.
* gtk/gtkmenuitem.c (gtk_menu_item_forall): Don't recurse
into menuitem->submeny. That is wrong, and broke torn
off submenus of torn off menus, since they were unrealized
when the first menu was unrealized.
* gtk/gtkmenushell.[ch]: Virtualize gtk_menu_shell_insert() and
gtk_menu_shell_select_item() since these need to be overridden in
GtkMenu.
* gtk/gtkoptionmenu.c (gtk_opttion_menu_position): Change menu
positioning behaviour to fit to scrolling menus.
(gtk_option_menu_key_press, gtk_option_menu_button_press): Select
the current item so that it is prelighted when the menu pops up.
This is a workaround to the fact that the menu doesn't get the
initial enter event (due to grabs).
* gtk/gtkfilesel.c, gtk/gtkinputdialog.c, gtk/testgtk.c:
s/gtk_menu_append/gtk_menu_shell_append/
* gtk/gtknotebook.c:
s/gtk_menu_insert/gtk_menu_shell_insert/
* gtk/testgtk.c (create_menu, create_menus):
Create the first menu with 50 items so that menu scrolling
can be tested.
Patch from Jonathan Blandford <jrb@redhat.com>
* gtk/gtkmenuitem.[ch] (gtk_menu_item_toggle_size_request): new
system to handle size requests. First, we ask what the size of
the toggle is. Then, when allocating the size, we allocate the
toggle_size first. This way we can have multiple menu-item
classes w/o needing a seperate class for each.
* gtk/gtkmenu.c (gtk_menu_size_request): Actually use the new system.
* gtk/gtkmenu.c (gtk_menu_size_allocate): Use the new system.
* gtk/gtkcheckmenuitem.c
(gtk_check_menu_item_toggle_size_request): New function to handle
the toggle size-request.
2000-11-08 17:34:52 +00:00
|
|
|
|
{
|
2011-01-12 19:35:04 +00:00
|
|
|
|
GtkBorder padding;
|
2010-12-23 20:50:18 +00:00
|
|
|
|
|
|
|
|
|
y = priv->scroll_offset;
|
2010-09-20 14:39:25 +00:00
|
|
|
|
height = gdk_window_get_height (gtk_widget_get_window (widget));
|
Add note about GtkMenuPositionFunc API changes.
2000-11-08 Alexander Larsson <alexl@redhat.com>
* docs/Changes-2.0.txt: Add note about GtkMenuPositionFunc
API changes.
* gtk/gtkmenu.c: Add support for scrolling menus.
Remove gtk_menu_append/prepend/insert, these have been moved to
gtkcompat.h as #defines.
* gtk/gtkcompat.h.in:
Add compatibility #defines for gtk_menu_append/prepend/insert
* gtk/gtkmenu.h: Add data needed for scrolling menus.
GtkMenuPositionFunc gets an extra argument push_in.
gtk_menu_append/prepend/insert removed.
* gtk/gtkmenuitem.c (gtk_menu_item_position_menu): Change menu
positioning behaviour to fit to scrolling menus.
* gtk/gtkmenuitem.c (gtk_menu_item_forall): Don't recurse
into menuitem->submeny. That is wrong, and broke torn
off submenus of torn off menus, since they were unrealized
when the first menu was unrealized.
* gtk/gtkmenushell.[ch]: Virtualize gtk_menu_shell_insert() and
gtk_menu_shell_select_item() since these need to be overridden in
GtkMenu.
* gtk/gtkoptionmenu.c (gtk_opttion_menu_position): Change menu
positioning behaviour to fit to scrolling menus.
(gtk_option_menu_key_press, gtk_option_menu_button_press): Select
the current item so that it is prelighted when the menu pops up.
This is a workaround to the fact that the menu doesn't get the
initial enter event (due to grabs).
* gtk/gtkfilesel.c, gtk/gtkinputdialog.c, gtk/testgtk.c:
s/gtk_menu_append/gtk_menu_shell_append/
* gtk/gtknotebook.c:
s/gtk_menu_insert/gtk_menu_shell_insert/
* gtk/testgtk.c (create_menu, create_menus):
Create the first menu with 50 items so that menu scrolling
can be tested.
Patch from Jonathan Blandford <jrb@redhat.com>
* gtk/gtkmenuitem.[ch] (gtk_menu_item_toggle_size_request): new
system to handle size requests. First, we ask what the size of
the toggle is. Then, when allocating the size, we allocate the
toggle_size first. This way we can have multiple menu-item
classes w/o needing a seperate class for each.
* gtk/gtkmenu.c (gtk_menu_size_request): Actually use the new system.
* gtk/gtkmenu.c (gtk_menu_size_allocate): Use the new system.
* gtk/gtkcheckmenuitem.c
(gtk_check_menu_item_toggle_size_request): New function to handle
the toggle size-request.
2000-11-08 17:34:52 +00:00
|
|
|
|
|
2011-05-17 18:10:19 +00:00
|
|
|
|
get_menu_padding (widget, &padding);
|
2011-01-12 19:35:04 +00:00
|
|
|
|
|
2010-08-11 21:08:37 +00:00
|
|
|
|
height -= 2 * gtk_container_get_border_width (GTK_CONTAINER (menu)) +
|
2012-11-27 14:04:12 +00:00
|
|
|
|
padding.top + padding.bottom;
|
|
|
|
|
|
2002-12-14 22:43:52 +00:00
|
|
|
|
if (child_offset < y)
|
2010-12-23 20:50:18 +00:00
|
|
|
|
{
|
|
|
|
|
/* Ignore the enter event we might get if the pointer
|
|
|
|
|
* is on the menu
|
|
|
|
|
*/
|
2010-12-23 23:21:53 +00:00
|
|
|
|
menu_shell->priv->ignore_enter = TRUE;
|
2019-01-17 18:27:51 +00:00
|
|
|
|
gtk_menu_scroll_to (menu, child_offset, GTK_MENU_SCROLL_FLAG_NONE);
|
2010-12-23 20:50:18 +00:00
|
|
|
|
}
|
Add note about GtkMenuPositionFunc API changes.
2000-11-08 Alexander Larsson <alexl@redhat.com>
* docs/Changes-2.0.txt: Add note about GtkMenuPositionFunc
API changes.
* gtk/gtkmenu.c: Add support for scrolling menus.
Remove gtk_menu_append/prepend/insert, these have been moved to
gtkcompat.h as #defines.
* gtk/gtkcompat.h.in:
Add compatibility #defines for gtk_menu_append/prepend/insert
* gtk/gtkmenu.h: Add data needed for scrolling menus.
GtkMenuPositionFunc gets an extra argument push_in.
gtk_menu_append/prepend/insert removed.
* gtk/gtkmenuitem.c (gtk_menu_item_position_menu): Change menu
positioning behaviour to fit to scrolling menus.
* gtk/gtkmenuitem.c (gtk_menu_item_forall): Don't recurse
into menuitem->submeny. That is wrong, and broke torn
off submenus of torn off menus, since they were unrealized
when the first menu was unrealized.
* gtk/gtkmenushell.[ch]: Virtualize gtk_menu_shell_insert() and
gtk_menu_shell_select_item() since these need to be overridden in
GtkMenu.
* gtk/gtkoptionmenu.c (gtk_opttion_menu_position): Change menu
positioning behaviour to fit to scrolling menus.
(gtk_option_menu_key_press, gtk_option_menu_button_press): Select
the current item so that it is prelighted when the menu pops up.
This is a workaround to the fact that the menu doesn't get the
initial enter event (due to grabs).
* gtk/gtkfilesel.c, gtk/gtkinputdialog.c, gtk/testgtk.c:
s/gtk_menu_append/gtk_menu_shell_append/
* gtk/gtknotebook.c:
s/gtk_menu_insert/gtk_menu_shell_insert/
* gtk/testgtk.c (create_menu, create_menus):
Create the first menu with 50 items so that menu scrolling
can be tested.
Patch from Jonathan Blandford <jrb@redhat.com>
* gtk/gtkmenuitem.[ch] (gtk_menu_item_toggle_size_request): new
system to handle size requests. First, we ask what the size of
the toggle is. Then, when allocating the size, we allocate the
toggle_size first. This way we can have multiple menu-item
classes w/o needing a seperate class for each.
* gtk/gtkmenu.c (gtk_menu_size_request): Actually use the new system.
* gtk/gtkmenu.c (gtk_menu_size_allocate): Use the new system.
* gtk/gtkcheckmenuitem.c
(gtk_check_menu_item_toggle_size_request): New function to handle
the toggle size-request.
2000-11-08 17:34:52 +00:00
|
|
|
|
else
|
2010-12-23 20:50:18 +00:00
|
|
|
|
{
|
2007-05-09 15:46:41 +00:00
|
|
|
|
GtkBorder arrow_border;
|
|
|
|
|
|
|
|
|
|
arrow_height = 0;
|
|
|
|
|
|
|
|
|
|
get_arrows_border (menu, &arrow_border);
|
2010-12-23 20:50:18 +00:00
|
|
|
|
if (!priv->tearoff_active)
|
2007-05-09 15:46:41 +00:00
|
|
|
|
arrow_height = arrow_border.top + arrow_border.bottom;
|
2010-12-23 20:50:18 +00:00
|
|
|
|
|
|
|
|
|
if (child_offset + child_height > y + height - arrow_height)
|
|
|
|
|
{
|
2015-12-21 02:44:10 +00:00
|
|
|
|
arrow_height = arrow_border.bottom + arrow_border.top;
|
2010-12-23 20:50:18 +00:00
|
|
|
|
y = child_offset + child_height - height + arrow_height;
|
2015-12-21 02:44:10 +00:00
|
|
|
|
|
2010-12-23 20:50:18 +00:00
|
|
|
|
/* Ignore the enter event we might get if the pointer
|
|
|
|
|
* is on the menu
|
|
|
|
|
*/
|
2010-12-23 23:21:53 +00:00
|
|
|
|
menu_shell->priv->ignore_enter = TRUE;
|
2019-01-17 18:27:51 +00:00
|
|
|
|
gtk_menu_scroll_to (menu, y, GTK_MENU_SCROLL_FLAG_NONE);
|
2010-12-23 20:50:18 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
Add note about GtkMenuPositionFunc API changes.
2000-11-08 Alexander Larsson <alexl@redhat.com>
* docs/Changes-2.0.txt: Add note about GtkMenuPositionFunc
API changes.
* gtk/gtkmenu.c: Add support for scrolling menus.
Remove gtk_menu_append/prepend/insert, these have been moved to
gtkcompat.h as #defines.
* gtk/gtkcompat.h.in:
Add compatibility #defines for gtk_menu_append/prepend/insert
* gtk/gtkmenu.h: Add data needed for scrolling menus.
GtkMenuPositionFunc gets an extra argument push_in.
gtk_menu_append/prepend/insert removed.
* gtk/gtkmenuitem.c (gtk_menu_item_position_menu): Change menu
positioning behaviour to fit to scrolling menus.
* gtk/gtkmenuitem.c (gtk_menu_item_forall): Don't recurse
into menuitem->submeny. That is wrong, and broke torn
off submenus of torn off menus, since they were unrealized
when the first menu was unrealized.
* gtk/gtkmenushell.[ch]: Virtualize gtk_menu_shell_insert() and
gtk_menu_shell_select_item() since these need to be overridden in
GtkMenu.
* gtk/gtkoptionmenu.c (gtk_opttion_menu_position): Change menu
positioning behaviour to fit to scrolling menus.
(gtk_option_menu_key_press, gtk_option_menu_button_press): Select
the current item so that it is prelighted when the menu pops up.
This is a workaround to the fact that the menu doesn't get the
initial enter event (due to grabs).
* gtk/gtkfilesel.c, gtk/gtkinputdialog.c, gtk/testgtk.c:
s/gtk_menu_append/gtk_menu_shell_append/
* gtk/gtknotebook.c:
s/gtk_menu_insert/gtk_menu_shell_insert/
* gtk/testgtk.c (create_menu, create_menus):
Create the first menu with 50 items so that menu scrolling
can be tested.
Patch from Jonathan Blandford <jrb@redhat.com>
* gtk/gtkmenuitem.[ch] (gtk_menu_item_toggle_size_request): new
system to handle size requests. First, we ask what the size of
the toggle is. Then, when allocating the size, we allocate the
toggle_size first. This way we can have multiple menu-item
classes w/o needing a seperate class for each.
* gtk/gtkmenu.c (gtk_menu_size_request): Actually use the new system.
* gtk/gtkmenu.c (gtk_menu_size_allocate): Use the new system.
* gtk/gtkcheckmenuitem.c
(gtk_check_menu_item_toggle_size_request): New function to handle
the toggle size-request.
2000-11-08 17:34:52 +00:00
|
|
|
|
}
|
2001-09-22 14:55:02 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
2008-09-03 13:18:34 +00:00
|
|
|
|
gtk_menu_select_item (GtkMenuShell *menu_shell,
|
2010-12-23 20:50:18 +00:00
|
|
|
|
GtkWidget *menu_item)
|
2001-09-22 14:55:02 +00:00
|
|
|
|
{
|
|
|
|
|
GtkMenu *menu = GTK_MENU (menu_shell);
|
|
|
|
|
|
2010-03-02 06:16:02 +00:00
|
|
|
|
if (gtk_widget_get_realized (GTK_WIDGET (menu)))
|
2001-09-22 14:55:02 +00:00
|
|
|
|
gtk_menu_scroll_item_visible (menu_shell, menu_item);
|
Add note about GtkMenuPositionFunc API changes.
2000-11-08 Alexander Larsson <alexl@redhat.com>
* docs/Changes-2.0.txt: Add note about GtkMenuPositionFunc
API changes.
* gtk/gtkmenu.c: Add support for scrolling menus.
Remove gtk_menu_append/prepend/insert, these have been moved to
gtkcompat.h as #defines.
* gtk/gtkcompat.h.in:
Add compatibility #defines for gtk_menu_append/prepend/insert
* gtk/gtkmenu.h: Add data needed for scrolling menus.
GtkMenuPositionFunc gets an extra argument push_in.
gtk_menu_append/prepend/insert removed.
* gtk/gtkmenuitem.c (gtk_menu_item_position_menu): Change menu
positioning behaviour to fit to scrolling menus.
* gtk/gtkmenuitem.c (gtk_menu_item_forall): Don't recurse
into menuitem->submeny. That is wrong, and broke torn
off submenus of torn off menus, since they were unrealized
when the first menu was unrealized.
* gtk/gtkmenushell.[ch]: Virtualize gtk_menu_shell_insert() and
gtk_menu_shell_select_item() since these need to be overridden in
GtkMenu.
* gtk/gtkoptionmenu.c (gtk_opttion_menu_position): Change menu
positioning behaviour to fit to scrolling menus.
(gtk_option_menu_key_press, gtk_option_menu_button_press): Select
the current item so that it is prelighted when the menu pops up.
This is a workaround to the fact that the menu doesn't get the
initial enter event (due to grabs).
* gtk/gtkfilesel.c, gtk/gtkinputdialog.c, gtk/testgtk.c:
s/gtk_menu_append/gtk_menu_shell_append/
* gtk/gtknotebook.c:
s/gtk_menu_insert/gtk_menu_shell_insert/
* gtk/testgtk.c (create_menu, create_menus):
Create the first menu with 50 items so that menu scrolling
can be tested.
Patch from Jonathan Blandford <jrb@redhat.com>
* gtk/gtkmenuitem.[ch] (gtk_menu_item_toggle_size_request): new
system to handle size requests. First, we ask what the size of
the toggle is. Then, when allocating the size, we allocate the
toggle_size first. This way we can have multiple menu-item
classes w/o needing a seperate class for each.
* gtk/gtkmenu.c (gtk_menu_size_request): Actually use the new system.
* gtk/gtkmenu.c (gtk_menu_size_allocate): Use the new system.
* gtk/gtkcheckmenuitem.c
(gtk_check_menu_item_toggle_size_request): New function to handle
the toggle size-request.
2000-11-08 17:34:52 +00:00
|
|
|
|
|
2006-05-02 23:56:43 +00:00
|
|
|
|
GTK_MENU_SHELL_CLASS (gtk_menu_parent_class)->select_item (menu_shell, menu_item);
|
Add note about GtkMenuPositionFunc API changes.
2000-11-08 Alexander Larsson <alexl@redhat.com>
* docs/Changes-2.0.txt: Add note about GtkMenuPositionFunc
API changes.
* gtk/gtkmenu.c: Add support for scrolling menus.
Remove gtk_menu_append/prepend/insert, these have been moved to
gtkcompat.h as #defines.
* gtk/gtkcompat.h.in:
Add compatibility #defines for gtk_menu_append/prepend/insert
* gtk/gtkmenu.h: Add data needed for scrolling menus.
GtkMenuPositionFunc gets an extra argument push_in.
gtk_menu_append/prepend/insert removed.
* gtk/gtkmenuitem.c (gtk_menu_item_position_menu): Change menu
positioning behaviour to fit to scrolling menus.
* gtk/gtkmenuitem.c (gtk_menu_item_forall): Don't recurse
into menuitem->submeny. That is wrong, and broke torn
off submenus of torn off menus, since they were unrealized
when the first menu was unrealized.
* gtk/gtkmenushell.[ch]: Virtualize gtk_menu_shell_insert() and
gtk_menu_shell_select_item() since these need to be overridden in
GtkMenu.
* gtk/gtkoptionmenu.c (gtk_opttion_menu_position): Change menu
positioning behaviour to fit to scrolling menus.
(gtk_option_menu_key_press, gtk_option_menu_button_press): Select
the current item so that it is prelighted when the menu pops up.
This is a workaround to the fact that the menu doesn't get the
initial enter event (due to grabs).
* gtk/gtkfilesel.c, gtk/gtkinputdialog.c, gtk/testgtk.c:
s/gtk_menu_append/gtk_menu_shell_append/
* gtk/gtknotebook.c:
s/gtk_menu_insert/gtk_menu_shell_insert/
* gtk/testgtk.c (create_menu, create_menus):
Create the first menu with 50 items so that menu scrolling
can be tested.
Patch from Jonathan Blandford <jrb@redhat.com>
* gtk/gtkmenuitem.[ch] (gtk_menu_item_toggle_size_request): new
system to handle size requests. First, we ask what the size of
the toggle is. Then, when allocating the size, we allocate the
toggle_size first. This way we can have multiple menu-item
classes w/o needing a seperate class for each.
* gtk/gtkmenu.c (gtk_menu_size_request): Actually use the new system.
* gtk/gtkmenu.c (gtk_menu_size_allocate): Use the new system.
* gtk/gtkcheckmenuitem.c
(gtk_check_menu_item_toggle_size_request): New function to handle
the toggle size-request.
2000-11-08 17:34:52 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
1998-09-01 18:41:26 +00:00
|
|
|
|
/* Reparent the menu, taking care of the refcounting
|
Add note about GtkMenuPositionFunc API changes.
2000-11-08 Alexander Larsson <alexl@redhat.com>
* docs/Changes-2.0.txt: Add note about GtkMenuPositionFunc
API changes.
* gtk/gtkmenu.c: Add support for scrolling menus.
Remove gtk_menu_append/prepend/insert, these have been moved to
gtkcompat.h as #defines.
* gtk/gtkcompat.h.in:
Add compatibility #defines for gtk_menu_append/prepend/insert
* gtk/gtkmenu.h: Add data needed for scrolling menus.
GtkMenuPositionFunc gets an extra argument push_in.
gtk_menu_append/prepend/insert removed.
* gtk/gtkmenuitem.c (gtk_menu_item_position_menu): Change menu
positioning behaviour to fit to scrolling menus.
* gtk/gtkmenuitem.c (gtk_menu_item_forall): Don't recurse
into menuitem->submeny. That is wrong, and broke torn
off submenus of torn off menus, since they were unrealized
when the first menu was unrealized.
* gtk/gtkmenushell.[ch]: Virtualize gtk_menu_shell_insert() and
gtk_menu_shell_select_item() since these need to be overridden in
GtkMenu.
* gtk/gtkoptionmenu.c (gtk_opttion_menu_position): Change menu
positioning behaviour to fit to scrolling menus.
(gtk_option_menu_key_press, gtk_option_menu_button_press): Select
the current item so that it is prelighted when the menu pops up.
This is a workaround to the fact that the menu doesn't get the
initial enter event (due to grabs).
* gtk/gtkfilesel.c, gtk/gtkinputdialog.c, gtk/testgtk.c:
s/gtk_menu_append/gtk_menu_shell_append/
* gtk/gtknotebook.c:
s/gtk_menu_insert/gtk_menu_shell_insert/
* gtk/testgtk.c (create_menu, create_menus):
Create the first menu with 50 items so that menu scrolling
can be tested.
Patch from Jonathan Blandford <jrb@redhat.com>
* gtk/gtkmenuitem.[ch] (gtk_menu_item_toggle_size_request): new
system to handle size requests. First, we ask what the size of
the toggle is. Then, when allocating the size, we allocate the
toggle_size first. This way we can have multiple menu-item
classes w/o needing a seperate class for each.
* gtk/gtkmenu.c (gtk_menu_size_request): Actually use the new system.
* gtk/gtkmenu.c (gtk_menu_size_allocate): Use the new system.
* gtk/gtkcheckmenuitem.c
(gtk_check_menu_item_toggle_size_request): New function to handle
the toggle size-request.
2000-11-08 17:34:52 +00:00
|
|
|
|
*
|
|
|
|
|
* If unrealize is true we force a unrealize while reparenting the parent.
|
|
|
|
|
* This can help eliminate flicker in some cases.
|
|
|
|
|
*
|
|
|
|
|
* What happens is that when the menu is unrealized and then re-realized,
|
|
|
|
|
* the allocations are as follows:
|
|
|
|
|
*
|
2010-12-23 20:50:18 +00:00
|
|
|
|
* parent - 1x1 at (0,0)
|
Add note about GtkMenuPositionFunc API changes.
2000-11-08 Alexander Larsson <alexl@redhat.com>
* docs/Changes-2.0.txt: Add note about GtkMenuPositionFunc
API changes.
* gtk/gtkmenu.c: Add support for scrolling menus.
Remove gtk_menu_append/prepend/insert, these have been moved to
gtkcompat.h as #defines.
* gtk/gtkcompat.h.in:
Add compatibility #defines for gtk_menu_append/prepend/insert
* gtk/gtkmenu.h: Add data needed for scrolling menus.
GtkMenuPositionFunc gets an extra argument push_in.
gtk_menu_append/prepend/insert removed.
* gtk/gtkmenuitem.c (gtk_menu_item_position_menu): Change menu
positioning behaviour to fit to scrolling menus.
* gtk/gtkmenuitem.c (gtk_menu_item_forall): Don't recurse
into menuitem->submeny. That is wrong, and broke torn
off submenus of torn off menus, since they were unrealized
when the first menu was unrealized.
* gtk/gtkmenushell.[ch]: Virtualize gtk_menu_shell_insert() and
gtk_menu_shell_select_item() since these need to be overridden in
GtkMenu.
* gtk/gtkoptionmenu.c (gtk_opttion_menu_position): Change menu
positioning behaviour to fit to scrolling menus.
(gtk_option_menu_key_press, gtk_option_menu_button_press): Select
the current item so that it is prelighted when the menu pops up.
This is a workaround to the fact that the menu doesn't get the
initial enter event (due to grabs).
* gtk/gtkfilesel.c, gtk/gtkinputdialog.c, gtk/testgtk.c:
s/gtk_menu_append/gtk_menu_shell_append/
* gtk/gtknotebook.c:
s/gtk_menu_insert/gtk_menu_shell_insert/
* gtk/testgtk.c (create_menu, create_menus):
Create the first menu with 50 items so that menu scrolling
can be tested.
Patch from Jonathan Blandford <jrb@redhat.com>
* gtk/gtkmenuitem.[ch] (gtk_menu_item_toggle_size_request): new
system to handle size requests. First, we ask what the size of
the toggle is. Then, when allocating the size, we allocate the
toggle_size first. This way we can have multiple menu-item
classes w/o needing a seperate class for each.
* gtk/gtkmenu.c (gtk_menu_size_request): Actually use the new system.
* gtk/gtkmenu.c (gtk_menu_size_allocate): Use the new system.
* gtk/gtkcheckmenuitem.c
(gtk_check_menu_item_toggle_size_request): New function to handle
the toggle size-request.
2000-11-08 17:34:52 +00:00
|
|
|
|
* child1 - 100x20 at (0,0)
|
|
|
|
|
* child2 - 100x20 at (0,20)
|
|
|
|
|
* child3 - 100x20 at (0,40)
|
|
|
|
|
*
|
|
|
|
|
* That is, the parent is small but the children are full sized. Then,
|
|
|
|
|
* when the queued_resize gets processed, the parent gets resized to
|
2010-12-23 20:50:18 +00:00
|
|
|
|
* full size.
|
Add note about GtkMenuPositionFunc API changes.
2000-11-08 Alexander Larsson <alexl@redhat.com>
* docs/Changes-2.0.txt: Add note about GtkMenuPositionFunc
API changes.
* gtk/gtkmenu.c: Add support for scrolling menus.
Remove gtk_menu_append/prepend/insert, these have been moved to
gtkcompat.h as #defines.
* gtk/gtkcompat.h.in:
Add compatibility #defines for gtk_menu_append/prepend/insert
* gtk/gtkmenu.h: Add data needed for scrolling menus.
GtkMenuPositionFunc gets an extra argument push_in.
gtk_menu_append/prepend/insert removed.
* gtk/gtkmenuitem.c (gtk_menu_item_position_menu): Change menu
positioning behaviour to fit to scrolling menus.
* gtk/gtkmenuitem.c (gtk_menu_item_forall): Don't recurse
into menuitem->submeny. That is wrong, and broke torn
off submenus of torn off menus, since they were unrealized
when the first menu was unrealized.
* gtk/gtkmenushell.[ch]: Virtualize gtk_menu_shell_insert() and
gtk_menu_shell_select_item() since these need to be overridden in
GtkMenu.
* gtk/gtkoptionmenu.c (gtk_opttion_menu_position): Change menu
positioning behaviour to fit to scrolling menus.
(gtk_option_menu_key_press, gtk_option_menu_button_press): Select
the current item so that it is prelighted when the menu pops up.
This is a workaround to the fact that the menu doesn't get the
initial enter event (due to grabs).
* gtk/gtkfilesel.c, gtk/gtkinputdialog.c, gtk/testgtk.c:
s/gtk_menu_append/gtk_menu_shell_append/
* gtk/gtknotebook.c:
s/gtk_menu_insert/gtk_menu_shell_insert/
* gtk/testgtk.c (create_menu, create_menus):
Create the first menu with 50 items so that menu scrolling
can be tested.
Patch from Jonathan Blandford <jrb@redhat.com>
* gtk/gtkmenuitem.[ch] (gtk_menu_item_toggle_size_request): new
system to handle size requests. First, we ask what the size of
the toggle is. Then, when allocating the size, we allocate the
toggle_size first. This way we can have multiple menu-item
classes w/o needing a seperate class for each.
* gtk/gtkmenu.c (gtk_menu_size_request): Actually use the new system.
* gtk/gtkmenu.c (gtk_menu_size_allocate): Use the new system.
* gtk/gtkcheckmenuitem.c
(gtk_check_menu_item_toggle_size_request): New function to handle
the toggle size-request.
2000-11-08 17:34:52 +00:00
|
|
|
|
*
|
|
|
|
|
* But in order to eliminate flicker when scrolling, gdkgeometry-x11.c
|
|
|
|
|
* contains the following logic:
|
2010-12-23 20:50:18 +00:00
|
|
|
|
*
|
|
|
|
|
* - if a move or resize operation on a window would change the clip
|
Add note about GtkMenuPositionFunc API changes.
2000-11-08 Alexander Larsson <alexl@redhat.com>
* docs/Changes-2.0.txt: Add note about GtkMenuPositionFunc
API changes.
* gtk/gtkmenu.c: Add support for scrolling menus.
Remove gtk_menu_append/prepend/insert, these have been moved to
gtkcompat.h as #defines.
* gtk/gtkcompat.h.in:
Add compatibility #defines for gtk_menu_append/prepend/insert
* gtk/gtkmenu.h: Add data needed for scrolling menus.
GtkMenuPositionFunc gets an extra argument push_in.
gtk_menu_append/prepend/insert removed.
* gtk/gtkmenuitem.c (gtk_menu_item_position_menu): Change menu
positioning behaviour to fit to scrolling menus.
* gtk/gtkmenuitem.c (gtk_menu_item_forall): Don't recurse
into menuitem->submeny. That is wrong, and broke torn
off submenus of torn off menus, since they were unrealized
when the first menu was unrealized.
* gtk/gtkmenushell.[ch]: Virtualize gtk_menu_shell_insert() and
gtk_menu_shell_select_item() since these need to be overridden in
GtkMenu.
* gtk/gtkoptionmenu.c (gtk_opttion_menu_position): Change menu
positioning behaviour to fit to scrolling menus.
(gtk_option_menu_key_press, gtk_option_menu_button_press): Select
the current item so that it is prelighted when the menu pops up.
This is a workaround to the fact that the menu doesn't get the
initial enter event (due to grabs).
* gtk/gtkfilesel.c, gtk/gtkinputdialog.c, gtk/testgtk.c:
s/gtk_menu_append/gtk_menu_shell_append/
* gtk/gtknotebook.c:
s/gtk_menu_insert/gtk_menu_shell_insert/
* gtk/testgtk.c (create_menu, create_menus):
Create the first menu with 50 items so that menu scrolling
can be tested.
Patch from Jonathan Blandford <jrb@redhat.com>
* gtk/gtkmenuitem.[ch] (gtk_menu_item_toggle_size_request): new
system to handle size requests. First, we ask what the size of
the toggle is. Then, when allocating the size, we allocate the
toggle_size first. This way we can have multiple menu-item
classes w/o needing a seperate class for each.
* gtk/gtkmenu.c (gtk_menu_size_request): Actually use the new system.
* gtk/gtkmenu.c (gtk_menu_size_allocate): Use the new system.
* gtk/gtkcheckmenuitem.c
(gtk_check_menu_item_toggle_size_request): New function to handle
the toggle size-request.
2000-11-08 17:34:52 +00:00
|
|
|
|
* region on the children, then before the window is resized
|
|
|
|
|
* the background for children is temporarily set to None, the
|
|
|
|
|
* move/resize done, and the background for the children restored.
|
|
|
|
|
*
|
|
|
|
|
* So, at the point where the parent is resized to final size, the
|
|
|
|
|
* background for the children is temporarily None, and thus they
|
|
|
|
|
* are not cleared to the background color and the previous background
|
|
|
|
|
* (the image of the menu) is left in place.
|
1998-09-01 18:41:26 +00:00
|
|
|
|
*/
|
2010-12-23 20:50:18 +00:00
|
|
|
|
static void
|
2008-09-03 13:18:34 +00:00
|
|
|
|
gtk_menu_reparent (GtkMenu *menu,
|
|
|
|
|
GtkWidget *new_parent,
|
|
|
|
|
gboolean unrealize)
|
1998-09-01 18:41:26 +00:00
|
|
|
|
{
|
2010-09-18 23:55:42 +00:00
|
|
|
|
GObject *object = G_OBJECT (menu);
|
1998-09-01 18:41:26 +00:00
|
|
|
|
GtkWidget *widget = GTK_WIDGET (menu);
|
2005-11-23 18:06:58 +00:00
|
|
|
|
gboolean was_floating = g_object_is_floating (object);
|
GTK_MENU_DIR_CHILD: check for the existance of
Thu Sep 3 04:22:20 1998 Tim Janik <timj@gtk.org>
* gtk/gtkmenushell.c (gtk_real_menu_shell_move_current):
GTK_MENU_DIR_CHILD: check for the existance of
menu_shell->active_menu_item before accessing its child.
GTK_MENU_DIR_PREV:
GTK_MENU_DIR_NEXT: if we haven't had an active item and still
don't, make a default selection.
Wed Sep 2 00:28:58 1998 Tim Janik <timj@gtk.org>
* gtk/gtkwidget.c (gtk_widget_propagate_state): iterate
the children with _forall for sensitivity changes and with
_foreach on pure state changes. this fixes a lot of the
old inclusions of internal widgets into _foreach calls.
* gtk/gtktree.c: removed gtk_tree_foreach, let gtk_tree_forall
do the work. don't walk the subtrees of first level children.
* gtk/gtktreeitem.c: provide a _forall implementation,
which walks the subtrees as well for include_internals.
* gtk/gtkmenuitem.c: provide a _forall implementation, which walks
the submenus as well for include_internals.
* gtk/gtkscrolledwindow.c: removed gtk_scrolled_window_foreach and
implemented gtk_scrolled_window_forall, which will iterate over
the viewport and the scrollbars for gtk_container_forall or
iterate over the viewports children for gtk_container_foreach.
* gtk/gtktoolbar.c:
* gtk/gtktable.c:
* gtk/gtkpaned.c:
* gtk/gtkpacker.c:
* gtk/gtkmenushell.c:
* gtk/gtklist.c:
* gtk/gtkfixed.c:
* gtk/gtkclist.c:
* gtk/gtkbox.c:
* gtk/gtkbin.c:
* gtk/gtknotebook.c:
removed the old gtk_*_foreach functions and provided gtk_*_forall.
* gtk/gtknotebook.c:
(gtk_notebook_real_switch_page): expose tabs.
(gtk_notebook_page_num): new function to return the page number
of a distinct child.
(gtk_notebook_focus): minor fixups. foxus handling is still screwed
under some circumstances.
* gtk/gtktreeitem.c:
(gtk_real_tree_item_select):
(gtk_real_tree_item_deselect): major fixes.
some general fixups wrt queue_redraw, and tree items not being
NO_WINDOW widgets.
* gtk/gtklistitem.c:
(gtk_real_list_item_select):
(gtk_real_list_item_deselect):
(gtk_real_list_item_toggle):
removed unneccessary queue_redraw calls.
Wed Aug 30 09:42:07 1998 Tim Janik <timj@gtk.org>
* gtk/gtkoptionmenu.c: allow optionmenus to have the focus and
automatically popup the menu on space bar.
Wed Aug 26 06:40:34 1998 Tim Janik <timj@gtk.org>
* gtk/gtkcontainer.h:
* gtk/gtkcontainer.c: implemented gtk_container_forall() (as a class
method), which acts similar to gtk_container_foreach(), but iterates
over internal children. the GtkContainer::foreach signal vanished in
favour of a new class method ->forall() that optionally includes
internal widgets.
* gtk/gtkclist.c (gtk_clist_init): provide no _foreach implementation
but a _forall implementation, since all child widgets we have are
internal ones.
(column_button_create): set the parent window prior
to gtk_widget_set_parent().
* gtk/gtkwidget.c:
exchanged all calls to gtk_container_foreach() with
gtk_container_forall().
* gtk/gtkwidget.h:
* gtk/gtkwidget.c: added the GTK_COMPOSITE_CHILD, exported through
the GtkWidget::composite_child argument. to have a widget created
with the flag initially, two new functions got added to wrap a widgets
creation:
gtk_widget_push_composite_flag() and gtk_widget_pop_composite_flag().
Wed Aug 25 23:37:39 1998 Tim Janik <timj@gtk.org>
* gtk/gtktooltips.h:
* gtk/gtktooltips.c: exported gtk_tooltips_create_window() as
gtk_tooltips_force_window(), so tooltips->tip_window can be accessed
prior to the first tip being set.
don't put an extra reference on the window, since it is a toplevel,
it wont get destroyed from anywhere else.
* overall macro and GtkType fixups.
1998-09-03 02:38:53 +00:00
|
|
|
|
|
2005-11-23 18:06:58 +00:00
|
|
|
|
g_object_ref_sink (object);
|
1998-09-01 18:41:26 +00:00
|
|
|
|
|
|
|
|
|
if (unrealize)
|
|
|
|
|
{
|
2002-10-05 01:51:16 +00:00
|
|
|
|
g_object_ref (object);
|
2010-08-11 21:08:37 +00:00
|
|
|
|
gtk_container_remove (GTK_CONTAINER (gtk_widget_get_parent (widget)), widget);
|
1998-09-01 18:41:26 +00:00
|
|
|
|
gtk_container_add (GTK_CONTAINER (new_parent), widget);
|
2002-10-05 01:51:16 +00:00
|
|
|
|
g_object_unref (object);
|
1998-09-01 18:41:26 +00:00
|
|
|
|
}
|
|
|
|
|
else
|
2014-05-17 18:37:54 +00:00
|
|
|
|
{
|
|
|
|
|
G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
|
|
|
|
|
gtk_widget_reparent (widget, new_parent);
|
|
|
|
|
G_GNUC_END_IGNORE_DEPRECATIONS;
|
|
|
|
|
}
|
2010-09-18 23:55:42 +00:00
|
|
|
|
|
1998-09-01 18:41:26 +00:00
|
|
|
|
if (was_floating)
|
2010-09-18 23:55:42 +00:00
|
|
|
|
g_object_force_floating (object);
|
1998-09-01 18:41:26 +00:00
|
|
|
|
else
|
2002-10-05 01:51:16 +00:00
|
|
|
|
g_object_unref (object);
|
1998-09-01 18:41:26 +00:00
|
|
|
|
}
|
|
|
|
|
|
GTK_MENU_DIR_CHILD: check for the existance of
Thu Sep 3 04:22:20 1998 Tim Janik <timj@gtk.org>
* gtk/gtkmenushell.c (gtk_real_menu_shell_move_current):
GTK_MENU_DIR_CHILD: check for the existance of
menu_shell->active_menu_item before accessing its child.
GTK_MENU_DIR_PREV:
GTK_MENU_DIR_NEXT: if we haven't had an active item and still
don't, make a default selection.
Wed Sep 2 00:28:58 1998 Tim Janik <timj@gtk.org>
* gtk/gtkwidget.c (gtk_widget_propagate_state): iterate
the children with _forall for sensitivity changes and with
_foreach on pure state changes. this fixes a lot of the
old inclusions of internal widgets into _foreach calls.
* gtk/gtktree.c: removed gtk_tree_foreach, let gtk_tree_forall
do the work. don't walk the subtrees of first level children.
* gtk/gtktreeitem.c: provide a _forall implementation,
which walks the subtrees as well for include_internals.
* gtk/gtkmenuitem.c: provide a _forall implementation, which walks
the submenus as well for include_internals.
* gtk/gtkscrolledwindow.c: removed gtk_scrolled_window_foreach and
implemented gtk_scrolled_window_forall, which will iterate over
the viewport and the scrollbars for gtk_container_forall or
iterate over the viewports children for gtk_container_foreach.
* gtk/gtktoolbar.c:
* gtk/gtktable.c:
* gtk/gtkpaned.c:
* gtk/gtkpacker.c:
* gtk/gtkmenushell.c:
* gtk/gtklist.c:
* gtk/gtkfixed.c:
* gtk/gtkclist.c:
* gtk/gtkbox.c:
* gtk/gtkbin.c:
* gtk/gtknotebook.c:
removed the old gtk_*_foreach functions and provided gtk_*_forall.
* gtk/gtknotebook.c:
(gtk_notebook_real_switch_page): expose tabs.
(gtk_notebook_page_num): new function to return the page number
of a distinct child.
(gtk_notebook_focus): minor fixups. foxus handling is still screwed
under some circumstances.
* gtk/gtktreeitem.c:
(gtk_real_tree_item_select):
(gtk_real_tree_item_deselect): major fixes.
some general fixups wrt queue_redraw, and tree items not being
NO_WINDOW widgets.
* gtk/gtklistitem.c:
(gtk_real_list_item_select):
(gtk_real_list_item_deselect):
(gtk_real_list_item_toggle):
removed unneccessary queue_redraw calls.
Wed Aug 30 09:42:07 1998 Tim Janik <timj@gtk.org>
* gtk/gtkoptionmenu.c: allow optionmenus to have the focus and
automatically popup the menu on space bar.
Wed Aug 26 06:40:34 1998 Tim Janik <timj@gtk.org>
* gtk/gtkcontainer.h:
* gtk/gtkcontainer.c: implemented gtk_container_forall() (as a class
method), which acts similar to gtk_container_foreach(), but iterates
over internal children. the GtkContainer::foreach signal vanished in
favour of a new class method ->forall() that optionally includes
internal widgets.
* gtk/gtkclist.c (gtk_clist_init): provide no _foreach implementation
but a _forall implementation, since all child widgets we have are
internal ones.
(column_button_create): set the parent window prior
to gtk_widget_set_parent().
* gtk/gtkwidget.c:
exchanged all calls to gtk_container_foreach() with
gtk_container_forall().
* gtk/gtkwidget.h:
* gtk/gtkwidget.c: added the GTK_COMPOSITE_CHILD, exported through
the GtkWidget::composite_child argument. to have a widget created
with the flag initially, two new functions got added to wrap a widgets
creation:
gtk_widget_push_composite_flag() and gtk_widget_pop_composite_flag().
Wed Aug 25 23:37:39 1998 Tim Janik <timj@gtk.org>
* gtk/gtktooltips.h:
* gtk/gtktooltips.c: exported gtk_tooltips_create_window() as
gtk_tooltips_force_window(), so tooltips->tip_window can be accessed
prior to the first tip being set.
don't put an extra reference on the window, since it is a toplevel,
it wont get destroyed from anywhere else.
* overall macro and GtkType fixups.
1998-09-03 02:38:53 +00:00
|
|
|
|
static void
|
|
|
|
|
gtk_menu_show_all (GtkWidget *widget)
|
|
|
|
|
{
|
|
|
|
|
/* Show children, but not self. */
|
|
|
|
|
gtk_container_foreach (GTK_CONTAINER (widget), (GtkCallback) gtk_widget_show_all, NULL);
|
|
|
|
|
}
|
1998-09-01 18:41:26 +00:00
|
|
|
|
|
Integrate Erwann Chenede's multihead changes for the gtk/ directory.
Mon Apr 29 18:28:00 2002 Owen Taylor <otaylor@redhat.com>
Integrate Erwann Chenede's multihead changes for the gtk/ directory.
* gtk/gtkclipboard.[ch]: Add gtk_clipboard_get_for_display(),
make internals multihead aware.
* gtk/gtkcolorsel.[ch]: Add
gtk_color_selection_set_change_palette_with_screen_hook () [ugh!]
make up for non-multihead safety of
gtk_color_selection_set_change_palette_hook()
* gtk/gtkinvisible.[ch] gtk/gtkmenu.[ch] gtkwindow.[ch]: Add
gtk_{invisible,menu,window}_set_screen(); add "screen" properties
for GtkWindow and GtkMenu.
* gtk/gtkplug.[ch]: Add gtk_plug_construct_for_display(),
gtk_plug_new_for_display(). Multihead fixes.
* gtk/gtkselection.[ch]: Add gtk_selection_owner_set_for_display(),
make internals multihead aware.
* gtk/gtksettings.[ch]: Add gtk_settings_get_for_screen(), get
rid of now-useless gtk_settings_constructor().
* gtk/gtkstyle.[ch]: Add gtk_style_get_font_for_display(), fix
check/radio button indicators bitmap handling to be multihead
safe.
* gtk/gtkwidget.[ch]: Add gtk_widget_get_screen(), gtk_widget_has_screen(),
gtk_widget_get_display(), gtk_widget_get_clipboard(),
gtk_widget_get_root_window().
* gtk/gtkbindings.c gtk/gtkbutton.c gtk/gtkclist.c gtk/gtkcombo.c
gtk/gtkctree.c gtk/gtkdnd.c gtk/gtkfilesel.c gtk/gtkgamma.c
gtk/gtkhandlebox.c gtk/gtkhsv.c gtk/gtkimcontext.c gtk/gtklabel.c
gtk/gtklist.c gtk/gtkmain.c gtk/gtkmenuitem.c gtk/gtkmenushell.c
gtk/gtknotebook.c gtk/gtkoldeditable.c gtk/gtkoptionmenu.c
gtk/gtkpaned.c gtk/gtkpreview.c gtk/gtksocket.c gtk/gtktext.c
gtk/gtktextbuffer.c gtk/gtktextview.c gtk/gtktipsquery.c
gtk/gtktooltips.c gtk/gtktreeview.c gtk/gtktreeviewcolumn.c:
misc mechanical multihead-safety fixes.
* gtk/gtkclipboard.c: Use a GtkImage rather than a pixmap for
the dropper, look up the color palette only at realization time,
other multihead fixes.
* gtk/gtkcombo.c (gtk_combo_unrealize): Popdown the list when
unrealizing.
* gtk/gtkentry.c: Only claim ownership of the primary selection
when realized, misc multihead fixes.
* gtk/gtkfontsel.c: Only fill in fonts when attached to a screen,
fix gtk_font_selection_get_font() for multihead.
* gtk/gtkgc.c: make the depth => drawable hash per-screen.
* gtk/gtkinvisible.c: Add a constructor that realizes the
widget, so we get a realized widget with g_object_new() as
well gtk_invisible_new() as before.
* gtk/gtkmain.c: Get rid of unused gtk_visual/gtk_colormap
variables.
* gtk/gtktextdisplay.c: Add warnings if stipple bitmaps
are used on the wrong screen.
* gtk/gtktoolbar.c: Make handling of GtkSettings-based layout
read properties and connect to settings when the screen is changed,
rather than on init/finalize.
* gtk/gtkwindow.c: Fix icon handing to be multihead safe ...
default icon pixmaps/mask are only shared between windows on the
same screen. Misc multihead fixes.
Sat Apr 27 13:49:53 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtkclipboard.c (gtk_clipboard_get_for_display):
Update docs to reference GDK_SELECTION_CLIPBOARD rather GDK_NONE.
2002-04-29 Alex Larsson <alexl@redhat.com>
* gdk/linux-fb/gdkproperty-fb.c (gdk_property_get):
Fix silly bug, noticed by Sven Neumann.
Sun Apr 28 22:43:55 2002 Jonathan Blandford <jrb@gnome.org>
* gtk/gtktreemodelsort.c (gtk_tree_model_sort_set_sort_func): Fix
so that you can set a new sort func.
2002-04-29 22:53:45 +00:00
|
|
|
|
/**
|
|
|
|
|
* gtk_menu_set_screen:
|
2010-12-23 20:50:18 +00:00
|
|
|
|
* @menu: a #GtkMenu
|
2009-12-10 10:23:40 +00:00
|
|
|
|
* @screen: (allow-none): a #GdkScreen, or %NULL if the screen should be
|
2010-12-23 20:50:18 +00:00
|
|
|
|
* determined by the widget the menu is attached to
|
Integrate Erwann Chenede's multihead changes for the gtk/ directory.
Mon Apr 29 18:28:00 2002 Owen Taylor <otaylor@redhat.com>
Integrate Erwann Chenede's multihead changes for the gtk/ directory.
* gtk/gtkclipboard.[ch]: Add gtk_clipboard_get_for_display(),
make internals multihead aware.
* gtk/gtkcolorsel.[ch]: Add
gtk_color_selection_set_change_palette_with_screen_hook () [ugh!]
make up for non-multihead safety of
gtk_color_selection_set_change_palette_hook()
* gtk/gtkinvisible.[ch] gtk/gtkmenu.[ch] gtkwindow.[ch]: Add
gtk_{invisible,menu,window}_set_screen(); add "screen" properties
for GtkWindow and GtkMenu.
* gtk/gtkplug.[ch]: Add gtk_plug_construct_for_display(),
gtk_plug_new_for_display(). Multihead fixes.
* gtk/gtkselection.[ch]: Add gtk_selection_owner_set_for_display(),
make internals multihead aware.
* gtk/gtksettings.[ch]: Add gtk_settings_get_for_screen(), get
rid of now-useless gtk_settings_constructor().
* gtk/gtkstyle.[ch]: Add gtk_style_get_font_for_display(), fix
check/radio button indicators bitmap handling to be multihead
safe.
* gtk/gtkwidget.[ch]: Add gtk_widget_get_screen(), gtk_widget_has_screen(),
gtk_widget_get_display(), gtk_widget_get_clipboard(),
gtk_widget_get_root_window().
* gtk/gtkbindings.c gtk/gtkbutton.c gtk/gtkclist.c gtk/gtkcombo.c
gtk/gtkctree.c gtk/gtkdnd.c gtk/gtkfilesel.c gtk/gtkgamma.c
gtk/gtkhandlebox.c gtk/gtkhsv.c gtk/gtkimcontext.c gtk/gtklabel.c
gtk/gtklist.c gtk/gtkmain.c gtk/gtkmenuitem.c gtk/gtkmenushell.c
gtk/gtknotebook.c gtk/gtkoldeditable.c gtk/gtkoptionmenu.c
gtk/gtkpaned.c gtk/gtkpreview.c gtk/gtksocket.c gtk/gtktext.c
gtk/gtktextbuffer.c gtk/gtktextview.c gtk/gtktipsquery.c
gtk/gtktooltips.c gtk/gtktreeview.c gtk/gtktreeviewcolumn.c:
misc mechanical multihead-safety fixes.
* gtk/gtkclipboard.c: Use a GtkImage rather than a pixmap for
the dropper, look up the color palette only at realization time,
other multihead fixes.
* gtk/gtkcombo.c (gtk_combo_unrealize): Popdown the list when
unrealizing.
* gtk/gtkentry.c: Only claim ownership of the primary selection
when realized, misc multihead fixes.
* gtk/gtkfontsel.c: Only fill in fonts when attached to a screen,
fix gtk_font_selection_get_font() for multihead.
* gtk/gtkgc.c: make the depth => drawable hash per-screen.
* gtk/gtkinvisible.c: Add a constructor that realizes the
widget, so we get a realized widget with g_object_new() as
well gtk_invisible_new() as before.
* gtk/gtkmain.c: Get rid of unused gtk_visual/gtk_colormap
variables.
* gtk/gtktextdisplay.c: Add warnings if stipple bitmaps
are used on the wrong screen.
* gtk/gtktoolbar.c: Make handling of GtkSettings-based layout
read properties and connect to settings when the screen is changed,
rather than on init/finalize.
* gtk/gtkwindow.c: Fix icon handing to be multihead safe ...
default icon pixmaps/mask are only shared between windows on the
same screen. Misc multihead fixes.
Sat Apr 27 13:49:53 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtkclipboard.c (gtk_clipboard_get_for_display):
Update docs to reference GDK_SELECTION_CLIPBOARD rather GDK_NONE.
2002-04-29 Alex Larsson <alexl@redhat.com>
* gdk/linux-fb/gdkproperty-fb.c (gdk_property_get):
Fix silly bug, noticed by Sven Neumann.
Sun Apr 28 22:43:55 2002 Jonathan Blandford <jrb@gnome.org>
* gtk/gtktreemodelsort.c (gtk_tree_model_sort_set_sort_func): Fix
so that you can set a new sort func.
2002-04-29 22:53:45 +00:00
|
|
|
|
*
|
2002-11-21 19:12:43 +00:00
|
|
|
|
* Sets the #GdkScreen on which the menu will be displayed.
|
2009-12-10 10:23:40 +00:00
|
|
|
|
*
|
2002-11-28 00:33:17 +00:00
|
|
|
|
* Since: 2.2
|
2010-12-23 20:50:18 +00:00
|
|
|
|
*/
|
Integrate Erwann Chenede's multihead changes for the gtk/ directory.
Mon Apr 29 18:28:00 2002 Owen Taylor <otaylor@redhat.com>
Integrate Erwann Chenede's multihead changes for the gtk/ directory.
* gtk/gtkclipboard.[ch]: Add gtk_clipboard_get_for_display(),
make internals multihead aware.
* gtk/gtkcolorsel.[ch]: Add
gtk_color_selection_set_change_palette_with_screen_hook () [ugh!]
make up for non-multihead safety of
gtk_color_selection_set_change_palette_hook()
* gtk/gtkinvisible.[ch] gtk/gtkmenu.[ch] gtkwindow.[ch]: Add
gtk_{invisible,menu,window}_set_screen(); add "screen" properties
for GtkWindow and GtkMenu.
* gtk/gtkplug.[ch]: Add gtk_plug_construct_for_display(),
gtk_plug_new_for_display(). Multihead fixes.
* gtk/gtkselection.[ch]: Add gtk_selection_owner_set_for_display(),
make internals multihead aware.
* gtk/gtksettings.[ch]: Add gtk_settings_get_for_screen(), get
rid of now-useless gtk_settings_constructor().
* gtk/gtkstyle.[ch]: Add gtk_style_get_font_for_display(), fix
check/radio button indicators bitmap handling to be multihead
safe.
* gtk/gtkwidget.[ch]: Add gtk_widget_get_screen(), gtk_widget_has_screen(),
gtk_widget_get_display(), gtk_widget_get_clipboard(),
gtk_widget_get_root_window().
* gtk/gtkbindings.c gtk/gtkbutton.c gtk/gtkclist.c gtk/gtkcombo.c
gtk/gtkctree.c gtk/gtkdnd.c gtk/gtkfilesel.c gtk/gtkgamma.c
gtk/gtkhandlebox.c gtk/gtkhsv.c gtk/gtkimcontext.c gtk/gtklabel.c
gtk/gtklist.c gtk/gtkmain.c gtk/gtkmenuitem.c gtk/gtkmenushell.c
gtk/gtknotebook.c gtk/gtkoldeditable.c gtk/gtkoptionmenu.c
gtk/gtkpaned.c gtk/gtkpreview.c gtk/gtksocket.c gtk/gtktext.c
gtk/gtktextbuffer.c gtk/gtktextview.c gtk/gtktipsquery.c
gtk/gtktooltips.c gtk/gtktreeview.c gtk/gtktreeviewcolumn.c:
misc mechanical multihead-safety fixes.
* gtk/gtkclipboard.c: Use a GtkImage rather than a pixmap for
the dropper, look up the color palette only at realization time,
other multihead fixes.
* gtk/gtkcombo.c (gtk_combo_unrealize): Popdown the list when
unrealizing.
* gtk/gtkentry.c: Only claim ownership of the primary selection
when realized, misc multihead fixes.
* gtk/gtkfontsel.c: Only fill in fonts when attached to a screen,
fix gtk_font_selection_get_font() for multihead.
* gtk/gtkgc.c: make the depth => drawable hash per-screen.
* gtk/gtkinvisible.c: Add a constructor that realizes the
widget, so we get a realized widget with g_object_new() as
well gtk_invisible_new() as before.
* gtk/gtkmain.c: Get rid of unused gtk_visual/gtk_colormap
variables.
* gtk/gtktextdisplay.c: Add warnings if stipple bitmaps
are used on the wrong screen.
* gtk/gtktoolbar.c: Make handling of GtkSettings-based layout
read properties and connect to settings when the screen is changed,
rather than on init/finalize.
* gtk/gtkwindow.c: Fix icon handing to be multihead safe ...
default icon pixmaps/mask are only shared between windows on the
same screen. Misc multihead fixes.
Sat Apr 27 13:49:53 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtkclipboard.c (gtk_clipboard_get_for_display):
Update docs to reference GDK_SELECTION_CLIPBOARD rather GDK_NONE.
2002-04-29 Alex Larsson <alexl@redhat.com>
* gdk/linux-fb/gdkproperty-fb.c (gdk_property_get):
Fix silly bug, noticed by Sven Neumann.
Sun Apr 28 22:43:55 2002 Jonathan Blandford <jrb@gnome.org>
* gtk/gtktreemodelsort.c (gtk_tree_model_sort_set_sort_func): Fix
so that you can set a new sort func.
2002-04-29 22:53:45 +00:00
|
|
|
|
void
|
2010-12-23 20:50:18 +00:00
|
|
|
|
gtk_menu_set_screen (GtkMenu *menu,
|
|
|
|
|
GdkScreen *screen)
|
Integrate Erwann Chenede's multihead changes for the gtk/ directory.
Mon Apr 29 18:28:00 2002 Owen Taylor <otaylor@redhat.com>
Integrate Erwann Chenede's multihead changes for the gtk/ directory.
* gtk/gtkclipboard.[ch]: Add gtk_clipboard_get_for_display(),
make internals multihead aware.
* gtk/gtkcolorsel.[ch]: Add
gtk_color_selection_set_change_palette_with_screen_hook () [ugh!]
make up for non-multihead safety of
gtk_color_selection_set_change_palette_hook()
* gtk/gtkinvisible.[ch] gtk/gtkmenu.[ch] gtkwindow.[ch]: Add
gtk_{invisible,menu,window}_set_screen(); add "screen" properties
for GtkWindow and GtkMenu.
* gtk/gtkplug.[ch]: Add gtk_plug_construct_for_display(),
gtk_plug_new_for_display(). Multihead fixes.
* gtk/gtkselection.[ch]: Add gtk_selection_owner_set_for_display(),
make internals multihead aware.
* gtk/gtksettings.[ch]: Add gtk_settings_get_for_screen(), get
rid of now-useless gtk_settings_constructor().
* gtk/gtkstyle.[ch]: Add gtk_style_get_font_for_display(), fix
check/radio button indicators bitmap handling to be multihead
safe.
* gtk/gtkwidget.[ch]: Add gtk_widget_get_screen(), gtk_widget_has_screen(),
gtk_widget_get_display(), gtk_widget_get_clipboard(),
gtk_widget_get_root_window().
* gtk/gtkbindings.c gtk/gtkbutton.c gtk/gtkclist.c gtk/gtkcombo.c
gtk/gtkctree.c gtk/gtkdnd.c gtk/gtkfilesel.c gtk/gtkgamma.c
gtk/gtkhandlebox.c gtk/gtkhsv.c gtk/gtkimcontext.c gtk/gtklabel.c
gtk/gtklist.c gtk/gtkmain.c gtk/gtkmenuitem.c gtk/gtkmenushell.c
gtk/gtknotebook.c gtk/gtkoldeditable.c gtk/gtkoptionmenu.c
gtk/gtkpaned.c gtk/gtkpreview.c gtk/gtksocket.c gtk/gtktext.c
gtk/gtktextbuffer.c gtk/gtktextview.c gtk/gtktipsquery.c
gtk/gtktooltips.c gtk/gtktreeview.c gtk/gtktreeviewcolumn.c:
misc mechanical multihead-safety fixes.
* gtk/gtkclipboard.c: Use a GtkImage rather than a pixmap for
the dropper, look up the color palette only at realization time,
other multihead fixes.
* gtk/gtkcombo.c (gtk_combo_unrealize): Popdown the list when
unrealizing.
* gtk/gtkentry.c: Only claim ownership of the primary selection
when realized, misc multihead fixes.
* gtk/gtkfontsel.c: Only fill in fonts when attached to a screen,
fix gtk_font_selection_get_font() for multihead.
* gtk/gtkgc.c: make the depth => drawable hash per-screen.
* gtk/gtkinvisible.c: Add a constructor that realizes the
widget, so we get a realized widget with g_object_new() as
well gtk_invisible_new() as before.
* gtk/gtkmain.c: Get rid of unused gtk_visual/gtk_colormap
variables.
* gtk/gtktextdisplay.c: Add warnings if stipple bitmaps
are used on the wrong screen.
* gtk/gtktoolbar.c: Make handling of GtkSettings-based layout
read properties and connect to settings when the screen is changed,
rather than on init/finalize.
* gtk/gtkwindow.c: Fix icon handing to be multihead safe ...
default icon pixmaps/mask are only shared between windows on the
same screen. Misc multihead fixes.
Sat Apr 27 13:49:53 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtkclipboard.c (gtk_clipboard_get_for_display):
Update docs to reference GDK_SELECTION_CLIPBOARD rather GDK_NONE.
2002-04-29 Alex Larsson <alexl@redhat.com>
* gdk/linux-fb/gdkproperty-fb.c (gdk_property_get):
Fix silly bug, noticed by Sven Neumann.
Sun Apr 28 22:43:55 2002 Jonathan Blandford <jrb@gnome.org>
* gtk/gtktreemodelsort.c (gtk_tree_model_sort_set_sort_func): Fix
so that you can set a new sort func.
2002-04-29 22:53:45 +00:00
|
|
|
|
{
|
|
|
|
|
g_return_if_fail (GTK_IS_MENU (menu));
|
2010-12-23 20:50:18 +00:00
|
|
|
|
g_return_if_fail (screen == NULL || GDK_IS_SCREEN (screen));
|
2002-11-14 05:46:34 +00:00
|
|
|
|
|
2005-09-01 05:11:46 +00:00
|
|
|
|
g_object_set_data (G_OBJECT (menu), I_("gtk-menu-explicit-screen"), screen);
|
2002-11-14 05:46:34 +00:00
|
|
|
|
|
|
|
|
|
if (screen)
|
|
|
|
|
{
|
2002-12-14 04:07:08 +00:00
|
|
|
|
menu_change_screen (menu, screen);
|
2002-11-14 05:46:34 +00:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
GtkWidget *attach_widget = gtk_menu_get_attach_widget (menu);
|
|
|
|
|
if (attach_widget)
|
2010-12-23 20:50:18 +00:00
|
|
|
|
attach_widget_screen_changed (attach_widget, NULL, menu);
|
2002-11-14 05:46:34 +00:00
|
|
|
|
}
|
Integrate Erwann Chenede's multihead changes for the gtk/ directory.
Mon Apr 29 18:28:00 2002 Owen Taylor <otaylor@redhat.com>
Integrate Erwann Chenede's multihead changes for the gtk/ directory.
* gtk/gtkclipboard.[ch]: Add gtk_clipboard_get_for_display(),
make internals multihead aware.
* gtk/gtkcolorsel.[ch]: Add
gtk_color_selection_set_change_palette_with_screen_hook () [ugh!]
make up for non-multihead safety of
gtk_color_selection_set_change_palette_hook()
* gtk/gtkinvisible.[ch] gtk/gtkmenu.[ch] gtkwindow.[ch]: Add
gtk_{invisible,menu,window}_set_screen(); add "screen" properties
for GtkWindow and GtkMenu.
* gtk/gtkplug.[ch]: Add gtk_plug_construct_for_display(),
gtk_plug_new_for_display(). Multihead fixes.
* gtk/gtkselection.[ch]: Add gtk_selection_owner_set_for_display(),
make internals multihead aware.
* gtk/gtksettings.[ch]: Add gtk_settings_get_for_screen(), get
rid of now-useless gtk_settings_constructor().
* gtk/gtkstyle.[ch]: Add gtk_style_get_font_for_display(), fix
check/radio button indicators bitmap handling to be multihead
safe.
* gtk/gtkwidget.[ch]: Add gtk_widget_get_screen(), gtk_widget_has_screen(),
gtk_widget_get_display(), gtk_widget_get_clipboard(),
gtk_widget_get_root_window().
* gtk/gtkbindings.c gtk/gtkbutton.c gtk/gtkclist.c gtk/gtkcombo.c
gtk/gtkctree.c gtk/gtkdnd.c gtk/gtkfilesel.c gtk/gtkgamma.c
gtk/gtkhandlebox.c gtk/gtkhsv.c gtk/gtkimcontext.c gtk/gtklabel.c
gtk/gtklist.c gtk/gtkmain.c gtk/gtkmenuitem.c gtk/gtkmenushell.c
gtk/gtknotebook.c gtk/gtkoldeditable.c gtk/gtkoptionmenu.c
gtk/gtkpaned.c gtk/gtkpreview.c gtk/gtksocket.c gtk/gtktext.c
gtk/gtktextbuffer.c gtk/gtktextview.c gtk/gtktipsquery.c
gtk/gtktooltips.c gtk/gtktreeview.c gtk/gtktreeviewcolumn.c:
misc mechanical multihead-safety fixes.
* gtk/gtkclipboard.c: Use a GtkImage rather than a pixmap for
the dropper, look up the color palette only at realization time,
other multihead fixes.
* gtk/gtkcombo.c (gtk_combo_unrealize): Popdown the list when
unrealizing.
* gtk/gtkentry.c: Only claim ownership of the primary selection
when realized, misc multihead fixes.
* gtk/gtkfontsel.c: Only fill in fonts when attached to a screen,
fix gtk_font_selection_get_font() for multihead.
* gtk/gtkgc.c: make the depth => drawable hash per-screen.
* gtk/gtkinvisible.c: Add a constructor that realizes the
widget, so we get a realized widget with g_object_new() as
well gtk_invisible_new() as before.
* gtk/gtkmain.c: Get rid of unused gtk_visual/gtk_colormap
variables.
* gtk/gtktextdisplay.c: Add warnings if stipple bitmaps
are used on the wrong screen.
* gtk/gtktoolbar.c: Make handling of GtkSettings-based layout
read properties and connect to settings when the screen is changed,
rather than on init/finalize.
* gtk/gtkwindow.c: Fix icon handing to be multihead safe ...
default icon pixmaps/mask are only shared between windows on the
same screen. Misc multihead fixes.
Sat Apr 27 13:49:53 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtkclipboard.c (gtk_clipboard_get_for_display):
Update docs to reference GDK_SELECTION_CLIPBOARD rather GDK_NONE.
2002-04-29 Alex Larsson <alexl@redhat.com>
* gdk/linux-fb/gdkproperty-fb.c (gdk_property_get):
Fix silly bug, noticed by Sven Neumann.
Sun Apr 28 22:43:55 2002 Jonathan Blandford <jrb@gnome.org>
* gtk/gtktreemodelsort.c (gtk_tree_model_sort_set_sort_func): Fix
so that you can set a new sort func.
2002-04-29 22:53:45 +00:00
|
|
|
|
}
|
Add note about GtkMenuPositionFunc API changes.
2000-11-08 Alexander Larsson <alexl@redhat.com>
* docs/Changes-2.0.txt: Add note about GtkMenuPositionFunc
API changes.
* gtk/gtkmenu.c: Add support for scrolling menus.
Remove gtk_menu_append/prepend/insert, these have been moved to
gtkcompat.h as #defines.
* gtk/gtkcompat.h.in:
Add compatibility #defines for gtk_menu_append/prepend/insert
* gtk/gtkmenu.h: Add data needed for scrolling menus.
GtkMenuPositionFunc gets an extra argument push_in.
gtk_menu_append/prepend/insert removed.
* gtk/gtkmenuitem.c (gtk_menu_item_position_menu): Change menu
positioning behaviour to fit to scrolling menus.
* gtk/gtkmenuitem.c (gtk_menu_item_forall): Don't recurse
into menuitem->submeny. That is wrong, and broke torn
off submenus of torn off menus, since they were unrealized
when the first menu was unrealized.
* gtk/gtkmenushell.[ch]: Virtualize gtk_menu_shell_insert() and
gtk_menu_shell_select_item() since these need to be overridden in
GtkMenu.
* gtk/gtkoptionmenu.c (gtk_opttion_menu_position): Change menu
positioning behaviour to fit to scrolling menus.
(gtk_option_menu_key_press, gtk_option_menu_button_press): Select
the current item so that it is prelighted when the menu pops up.
This is a workaround to the fact that the menu doesn't get the
initial enter event (due to grabs).
* gtk/gtkfilesel.c, gtk/gtkinputdialog.c, gtk/testgtk.c:
s/gtk_menu_append/gtk_menu_shell_append/
* gtk/gtknotebook.c:
s/gtk_menu_insert/gtk_menu_shell_insert/
* gtk/testgtk.c (create_menu, create_menus):
Create the first menu with 50 items so that menu scrolling
can be tested.
Patch from Jonathan Blandford <jrb@redhat.com>
* gtk/gtkmenuitem.[ch] (gtk_menu_item_toggle_size_request): new
system to handle size requests. First, we ask what the size of
the toggle is. Then, when allocating the size, we allocate the
toggle_size first. This way we can have multiple menu-item
classes w/o needing a seperate class for each.
* gtk/gtkmenu.c (gtk_menu_size_request): Actually use the new system.
* gtk/gtkmenu.c (gtk_menu_size_allocate): Use the new system.
* gtk/gtkcheckmenuitem.c
(gtk_check_menu_item_toggle_size_request): New function to handle
the toggle size-request.
2000-11-08 17:34:52 +00:00
|
|
|
|
|
The table menu patch! Turns GtkMenu into a table, so you can attach menu
Wed Sep 10 22:25:04 2003 Kristian Rietveld <kris@gtk.org>
The table menu patch! Turns GtkMenu into a table, so you can attach
menu items in numerous new ways! Be creative!
Contains some bug fixes and RTL adaptions from Matthias Clasen.
* gtk/gtkmenu.c [toplevel]: introduce ATTACH_INFO_KEY, extend
GtkMenuPrivate, introduce AttachInfo, add child properties enum,
(gtk_menu_free_private), (gtk_menu_get_private): we have to free
the heights array in the private struct,
(gtk_menu_class_init): reorder code a bit, install child properties,
(get_attach_info), (get_child_attach): new utility functions,
(gtk_menu_set_child_property), (gtk_menu_get_child_property): introduce
child properties, for the attach info,
(gtk_menu_remove): remove AttachInfo from menu item,
(gtk_menu_real_insert): implemented algorithm to automagically place
inserted menu items at the correct place in the table,
(gtk_menu_size_request), (gtk_menu_size_allocate),
(compute_child_offset): reworked/rewritten to support table menus,
(gtk_menu_attach): new function,
(find_child_containing), (gtk_menu_move_current): new functions to
get table menu keynav right.
* gtk/gtkmenu.h: add gtk_menu_attach() prototype.
2003-09-10 20:32:33 +00:00
|
|
|
|
/**
|
|
|
|
|
* gtk_menu_attach:
|
2010-12-23 20:50:18 +00:00
|
|
|
|
* @menu: a #GtkMenu
|
|
|
|
|
* @child: a #GtkMenuItem
|
|
|
|
|
* @left_attach: The column number to attach the left side of the item to
|
|
|
|
|
* @right_attach: The column number to attach the right side of the item to
|
|
|
|
|
* @top_attach: The row number to attach the top of the item to
|
|
|
|
|
* @bottom_attach: The row number to attach the bottom of the item to
|
The table menu patch! Turns GtkMenu into a table, so you can attach menu
Wed Sep 10 22:25:04 2003 Kristian Rietveld <kris@gtk.org>
The table menu patch! Turns GtkMenu into a table, so you can attach
menu items in numerous new ways! Be creative!
Contains some bug fixes and RTL adaptions from Matthias Clasen.
* gtk/gtkmenu.c [toplevel]: introduce ATTACH_INFO_KEY, extend
GtkMenuPrivate, introduce AttachInfo, add child properties enum,
(gtk_menu_free_private), (gtk_menu_get_private): we have to free
the heights array in the private struct,
(gtk_menu_class_init): reorder code a bit, install child properties,
(get_attach_info), (get_child_attach): new utility functions,
(gtk_menu_set_child_property), (gtk_menu_get_child_property): introduce
child properties, for the attach info,
(gtk_menu_remove): remove AttachInfo from menu item,
(gtk_menu_real_insert): implemented algorithm to automagically place
inserted menu items at the correct place in the table,
(gtk_menu_size_request), (gtk_menu_size_allocate),
(compute_child_offset): reworked/rewritten to support table menus,
(gtk_menu_attach): new function,
(find_child_containing), (gtk_menu_move_current): new functions to
get table menu keynav right.
* gtk/gtkmenu.h: add gtk_menu_attach() prototype.
2003-09-10 20:32:33 +00:00
|
|
|
|
*
|
2014-02-07 19:03:49 +00:00
|
|
|
|
* Adds a new #GtkMenuItem to a (table) menu. The number of “cells” that
|
The table menu patch! Turns GtkMenu into a table, so you can attach menu
Wed Sep 10 22:25:04 2003 Kristian Rietveld <kris@gtk.org>
The table menu patch! Turns GtkMenu into a table, so you can attach
menu items in numerous new ways! Be creative!
Contains some bug fixes and RTL adaptions from Matthias Clasen.
* gtk/gtkmenu.c [toplevel]: introduce ATTACH_INFO_KEY, extend
GtkMenuPrivate, introduce AttachInfo, add child properties enum,
(gtk_menu_free_private), (gtk_menu_get_private): we have to free
the heights array in the private struct,
(gtk_menu_class_init): reorder code a bit, install child properties,
(get_attach_info), (get_child_attach): new utility functions,
(gtk_menu_set_child_property), (gtk_menu_get_child_property): introduce
child properties, for the attach info,
(gtk_menu_remove): remove AttachInfo from menu item,
(gtk_menu_real_insert): implemented algorithm to automagically place
inserted menu items at the correct place in the table,
(gtk_menu_size_request), (gtk_menu_size_allocate),
(compute_child_offset): reworked/rewritten to support table menus,
(gtk_menu_attach): new function,
(find_child_containing), (gtk_menu_move_current): new functions to
get table menu keynav right.
* gtk/gtkmenu.h: add gtk_menu_attach() prototype.
2003-09-10 20:32:33 +00:00
|
|
|
|
* an item will occupy is specified by @left_attach, @right_attach,
|
|
|
|
|
* @top_attach and @bottom_attach. These each represent the leftmost,
|
|
|
|
|
* rightmost, uppermost and lower column and row numbers of the table.
|
|
|
|
|
* (Columns and rows are indexed from zero).
|
|
|
|
|
*
|
2004-01-20 21:11:30 +00:00
|
|
|
|
* Note that this function is not related to gtk_menu_detach().
|
|
|
|
|
*
|
The table menu patch! Turns GtkMenu into a table, so you can attach menu
Wed Sep 10 22:25:04 2003 Kristian Rietveld <kris@gtk.org>
The table menu patch! Turns GtkMenu into a table, so you can attach
menu items in numerous new ways! Be creative!
Contains some bug fixes and RTL adaptions from Matthias Clasen.
* gtk/gtkmenu.c [toplevel]: introduce ATTACH_INFO_KEY, extend
GtkMenuPrivate, introduce AttachInfo, add child properties enum,
(gtk_menu_free_private), (gtk_menu_get_private): we have to free
the heights array in the private struct,
(gtk_menu_class_init): reorder code a bit, install child properties,
(get_attach_info), (get_child_attach): new utility functions,
(gtk_menu_set_child_property), (gtk_menu_get_child_property): introduce
child properties, for the attach info,
(gtk_menu_remove): remove AttachInfo from menu item,
(gtk_menu_real_insert): implemented algorithm to automagically place
inserted menu items at the correct place in the table,
(gtk_menu_size_request), (gtk_menu_size_allocate),
(compute_child_offset): reworked/rewritten to support table menus,
(gtk_menu_attach): new function,
(find_child_containing), (gtk_menu_move_current): new functions to
get table menu keynav right.
* gtk/gtkmenu.h: add gtk_menu_attach() prototype.
2003-09-10 20:32:33 +00:00
|
|
|
|
* Since: 2.4
|
2010-12-23 20:50:18 +00:00
|
|
|
|
*/
|
The table menu patch! Turns GtkMenu into a table, so you can attach menu
Wed Sep 10 22:25:04 2003 Kristian Rietveld <kris@gtk.org>
The table menu patch! Turns GtkMenu into a table, so you can attach
menu items in numerous new ways! Be creative!
Contains some bug fixes and RTL adaptions from Matthias Clasen.
* gtk/gtkmenu.c [toplevel]: introduce ATTACH_INFO_KEY, extend
GtkMenuPrivate, introduce AttachInfo, add child properties enum,
(gtk_menu_free_private), (gtk_menu_get_private): we have to free
the heights array in the private struct,
(gtk_menu_class_init): reorder code a bit, install child properties,
(get_attach_info), (get_child_attach): new utility functions,
(gtk_menu_set_child_property), (gtk_menu_get_child_property): introduce
child properties, for the attach info,
(gtk_menu_remove): remove AttachInfo from menu item,
(gtk_menu_real_insert): implemented algorithm to automagically place
inserted menu items at the correct place in the table,
(gtk_menu_size_request), (gtk_menu_size_allocate),
(compute_child_offset): reworked/rewritten to support table menus,
(gtk_menu_attach): new function,
(find_child_containing), (gtk_menu_move_current): new functions to
get table menu keynav right.
* gtk/gtkmenu.h: add gtk_menu_attach() prototype.
2003-09-10 20:32:33 +00:00
|
|
|
|
void
|
|
|
|
|
gtk_menu_attach (GtkMenu *menu,
|
|
|
|
|
GtkWidget *child,
|
|
|
|
|
guint left_attach,
|
|
|
|
|
guint right_attach,
|
|
|
|
|
guint top_attach,
|
|
|
|
|
guint bottom_attach)
|
|
|
|
|
{
|
2004-03-15 02:03:59 +00:00
|
|
|
|
GtkMenuShell *menu_shell;
|
2010-08-11 21:08:37 +00:00
|
|
|
|
GtkWidget *parent;
|
2015-11-03 02:49:10 +00:00
|
|
|
|
GtkCssNode *widget_node, *child_node;
|
2010-08-11 21:08:37 +00:00
|
|
|
|
|
The table menu patch! Turns GtkMenu into a table, so you can attach menu
Wed Sep 10 22:25:04 2003 Kristian Rietveld <kris@gtk.org>
The table menu patch! Turns GtkMenu into a table, so you can attach
menu items in numerous new ways! Be creative!
Contains some bug fixes and RTL adaptions from Matthias Clasen.
* gtk/gtkmenu.c [toplevel]: introduce ATTACH_INFO_KEY, extend
GtkMenuPrivate, introduce AttachInfo, add child properties enum,
(gtk_menu_free_private), (gtk_menu_get_private): we have to free
the heights array in the private struct,
(gtk_menu_class_init): reorder code a bit, install child properties,
(get_attach_info), (get_child_attach): new utility functions,
(gtk_menu_set_child_property), (gtk_menu_get_child_property): introduce
child properties, for the attach info,
(gtk_menu_remove): remove AttachInfo from menu item,
(gtk_menu_real_insert): implemented algorithm to automagically place
inserted menu items at the correct place in the table,
(gtk_menu_size_request), (gtk_menu_size_allocate),
(compute_child_offset): reworked/rewritten to support table menus,
(gtk_menu_attach): new function,
(find_child_containing), (gtk_menu_move_current): new functions to
get table menu keynav right.
* gtk/gtkmenu.h: add gtk_menu_attach() prototype.
2003-09-10 20:32:33 +00:00
|
|
|
|
g_return_if_fail (GTK_IS_MENU (menu));
|
|
|
|
|
g_return_if_fail (GTK_IS_MENU_ITEM (child));
|
2010-08-11 21:08:37 +00:00
|
|
|
|
parent = gtk_widget_get_parent (child);
|
|
|
|
|
g_return_if_fail (parent == NULL || parent == GTK_WIDGET (menu));
|
The table menu patch! Turns GtkMenu into a table, so you can attach menu
Wed Sep 10 22:25:04 2003 Kristian Rietveld <kris@gtk.org>
The table menu patch! Turns GtkMenu into a table, so you can attach
menu items in numerous new ways! Be creative!
Contains some bug fixes and RTL adaptions from Matthias Clasen.
* gtk/gtkmenu.c [toplevel]: introduce ATTACH_INFO_KEY, extend
GtkMenuPrivate, introduce AttachInfo, add child properties enum,
(gtk_menu_free_private), (gtk_menu_get_private): we have to free
the heights array in the private struct,
(gtk_menu_class_init): reorder code a bit, install child properties,
(get_attach_info), (get_child_attach): new utility functions,
(gtk_menu_set_child_property), (gtk_menu_get_child_property): introduce
child properties, for the attach info,
(gtk_menu_remove): remove AttachInfo from menu item,
(gtk_menu_real_insert): implemented algorithm to automagically place
inserted menu items at the correct place in the table,
(gtk_menu_size_request), (gtk_menu_size_allocate),
(compute_child_offset): reworked/rewritten to support table menus,
(gtk_menu_attach): new function,
(find_child_containing), (gtk_menu_move_current): new functions to
get table menu keynav right.
* gtk/gtkmenu.h: add gtk_menu_attach() prototype.
2003-09-10 20:32:33 +00:00
|
|
|
|
g_return_if_fail (left_attach < right_attach);
|
|
|
|
|
g_return_if_fail (top_attach < bottom_attach);
|
|
|
|
|
|
2004-03-15 02:03:59 +00:00
|
|
|
|
menu_shell = GTK_MENU_SHELL (menu);
|
2010-08-11 21:08:37 +00:00
|
|
|
|
|
|
|
|
|
if (!parent)
|
2004-01-20 21:11:30 +00:00
|
|
|
|
{
|
2004-03-15 02:03:59 +00:00
|
|
|
|
AttachInfo *ai = get_attach_info (child);
|
2010-12-23 20:50:18 +00:00
|
|
|
|
|
2004-03-15 02:03:59 +00:00
|
|
|
|
ai->left_attach = left_attach;
|
|
|
|
|
ai->right_attach = right_attach;
|
|
|
|
|
ai->top_attach = top_attach;
|
|
|
|
|
ai->bottom_attach = bottom_attach;
|
2010-12-23 20:50:18 +00:00
|
|
|
|
|
2010-12-23 23:21:53 +00:00
|
|
|
|
menu_shell->priv->children = g_list_append (menu_shell->priv->children, child);
|
2004-01-20 21:11:30 +00:00
|
|
|
|
|
2015-11-03 02:49:10 +00:00
|
|
|
|
widget_node = gtk_widget_get_css_node (GTK_WIDGET (menu));
|
|
|
|
|
child_node = gtk_widget_get_css_node (child);
|
2015-12-21 01:30:52 +00:00
|
|
|
|
gtk_css_node_insert_before (widget_node, child_node,
|
|
|
|
|
gtk_css_gadget_get_node (menu->priv->bottom_arrow_gadget));
|
2015-11-03 02:49:10 +00:00
|
|
|
|
|
2004-01-20 21:11:30 +00:00
|
|
|
|
gtk_widget_set_parent (child, GTK_WIDGET (menu));
|
The table menu patch! Turns GtkMenu into a table, so you can attach menu
Wed Sep 10 22:25:04 2003 Kristian Rietveld <kris@gtk.org>
The table menu patch! Turns GtkMenu into a table, so you can attach
menu items in numerous new ways! Be creative!
Contains some bug fixes and RTL adaptions from Matthias Clasen.
* gtk/gtkmenu.c [toplevel]: introduce ATTACH_INFO_KEY, extend
GtkMenuPrivate, introduce AttachInfo, add child properties enum,
(gtk_menu_free_private), (gtk_menu_get_private): we have to free
the heights array in the private struct,
(gtk_menu_class_init): reorder code a bit, install child properties,
(get_attach_info), (get_child_attach): new utility functions,
(gtk_menu_set_child_property), (gtk_menu_get_child_property): introduce
child properties, for the attach info,
(gtk_menu_remove): remove AttachInfo from menu item,
(gtk_menu_real_insert): implemented algorithm to automagically place
inserted menu items at the correct place in the table,
(gtk_menu_size_request), (gtk_menu_size_allocate),
(compute_child_offset): reworked/rewritten to support table menus,
(gtk_menu_attach): new function,
(find_child_containing), (gtk_menu_move_current): new functions to
get table menu keynav right.
* gtk/gtkmenu.h: add gtk_menu_attach() prototype.
2003-09-10 20:32:33 +00:00
|
|
|
|
|
2004-03-15 02:03:59 +00:00
|
|
|
|
menu_queue_resize (menu);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2010-08-11 21:08:37 +00:00
|
|
|
|
gtk_container_child_set (GTK_CONTAINER (parent), child,
|
2010-12-23 20:50:18 +00:00
|
|
|
|
"left-attach", left_attach,
|
|
|
|
|
"right-attach", right_attach,
|
|
|
|
|
"top-attach", top_attach,
|
|
|
|
|
"bottom-attach", bottom_attach,
|
|
|
|
|
NULL);
|
2004-03-15 02:03:59 +00:00
|
|
|
|
}
|
The table menu patch! Turns GtkMenu into a table, so you can attach menu
Wed Sep 10 22:25:04 2003 Kristian Rietveld <kris@gtk.org>
The table menu patch! Turns GtkMenu into a table, so you can attach
menu items in numerous new ways! Be creative!
Contains some bug fixes and RTL adaptions from Matthias Clasen.
* gtk/gtkmenu.c [toplevel]: introduce ATTACH_INFO_KEY, extend
GtkMenuPrivate, introduce AttachInfo, add child properties enum,
(gtk_menu_free_private), (gtk_menu_get_private): we have to free
the heights array in the private struct,
(gtk_menu_class_init): reorder code a bit, install child properties,
(get_attach_info), (get_child_attach): new utility functions,
(gtk_menu_set_child_property), (gtk_menu_get_child_property): introduce
child properties, for the attach info,
(gtk_menu_remove): remove AttachInfo from menu item,
(gtk_menu_real_insert): implemented algorithm to automagically place
inserted menu items at the correct place in the table,
(gtk_menu_size_request), (gtk_menu_size_allocate),
(compute_child_offset): reworked/rewritten to support table menus,
(gtk_menu_attach): new function,
(find_child_containing), (gtk_menu_move_current): new functions to
get table menu keynav right.
* gtk/gtkmenu.h: add gtk_menu_attach() prototype.
2003-09-10 20:32:33 +00:00
|
|
|
|
}
|
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_get_popup_delay (GtkMenuShell *menu_shell)
|
|
|
|
|
{
|
2013-06-26 18:08:37 +00:00
|
|
|
|
return MENU_POPUP_DELAY;
|
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
|
|
|
|
}
|
2002-12-14 22:43:52 +00:00
|
|
|
|
|
The table menu patch! Turns GtkMenu into a table, so you can attach menu
Wed Sep 10 22:25:04 2003 Kristian Rietveld <kris@gtk.org>
The table menu patch! Turns GtkMenu into a table, so you can attach
menu items in numerous new ways! Be creative!
Contains some bug fixes and RTL adaptions from Matthias Clasen.
* gtk/gtkmenu.c [toplevel]: introduce ATTACH_INFO_KEY, extend
GtkMenuPrivate, introduce AttachInfo, add child properties enum,
(gtk_menu_free_private), (gtk_menu_get_private): we have to free
the heights array in the private struct,
(gtk_menu_class_init): reorder code a bit, install child properties,
(get_attach_info), (get_child_attach): new utility functions,
(gtk_menu_set_child_property), (gtk_menu_get_child_property): introduce
child properties, for the attach info,
(gtk_menu_remove): remove AttachInfo from menu item,
(gtk_menu_real_insert): implemented algorithm to automagically place
inserted menu items at the correct place in the table,
(gtk_menu_size_request), (gtk_menu_size_allocate),
(compute_child_offset): reworked/rewritten to support table menus,
(gtk_menu_attach): new function,
(find_child_containing), (gtk_menu_move_current): new functions to
get table menu keynav right.
* gtk/gtkmenu.h: add gtk_menu_attach() prototype.
2003-09-10 20:32:33 +00:00
|
|
|
|
static GtkWidget *
|
|
|
|
|
find_child_containing (GtkMenuShell *menu_shell,
|
|
|
|
|
int left,
|
|
|
|
|
int right,
|
|
|
|
|
int top,
|
|
|
|
|
int bottom)
|
|
|
|
|
{
|
|
|
|
|
GList *list;
|
|
|
|
|
|
|
|
|
|
/* find a child which includes the area given by
|
|
|
|
|
* left, right, top, bottom.
|
|
|
|
|
*/
|
2010-12-23 23:21:53 +00:00
|
|
|
|
for (list = menu_shell->priv->children; list; list = list->next)
|
The table menu patch! Turns GtkMenu into a table, so you can attach menu
Wed Sep 10 22:25:04 2003 Kristian Rietveld <kris@gtk.org>
The table menu patch! Turns GtkMenu into a table, so you can attach
menu items in numerous new ways! Be creative!
Contains some bug fixes and RTL adaptions from Matthias Clasen.
* gtk/gtkmenu.c [toplevel]: introduce ATTACH_INFO_KEY, extend
GtkMenuPrivate, introduce AttachInfo, add child properties enum,
(gtk_menu_free_private), (gtk_menu_get_private): we have to free
the heights array in the private struct,
(gtk_menu_class_init): reorder code a bit, install child properties,
(get_attach_info), (get_child_attach): new utility functions,
(gtk_menu_set_child_property), (gtk_menu_get_child_property): introduce
child properties, for the attach info,
(gtk_menu_remove): remove AttachInfo from menu item,
(gtk_menu_real_insert): implemented algorithm to automagically place
inserted menu items at the correct place in the table,
(gtk_menu_size_request), (gtk_menu_size_allocate),
(compute_child_offset): reworked/rewritten to support table menus,
(gtk_menu_attach): new function,
(find_child_containing), (gtk_menu_move_current): new functions to
get table menu keynav right.
* gtk/gtkmenu.h: add gtk_menu_attach() prototype.
2003-09-10 20:32:33 +00:00
|
|
|
|
{
|
2005-11-10 14:33:51 +00:00
|
|
|
|
gint l, r, t, b;
|
The table menu patch! Turns GtkMenu into a table, so you can attach menu
Wed Sep 10 22:25:04 2003 Kristian Rietveld <kris@gtk.org>
The table menu patch! Turns GtkMenu into a table, so you can attach
menu items in numerous new ways! Be creative!
Contains some bug fixes and RTL adaptions from Matthias Clasen.
* gtk/gtkmenu.c [toplevel]: introduce ATTACH_INFO_KEY, extend
GtkMenuPrivate, introduce AttachInfo, add child properties enum,
(gtk_menu_free_private), (gtk_menu_get_private): we have to free
the heights array in the private struct,
(gtk_menu_class_init): reorder code a bit, install child properties,
(get_attach_info), (get_child_attach): new utility functions,
(gtk_menu_set_child_property), (gtk_menu_get_child_property): introduce
child properties, for the attach info,
(gtk_menu_remove): remove AttachInfo from menu item,
(gtk_menu_real_insert): implemented algorithm to automagically place
inserted menu items at the correct place in the table,
(gtk_menu_size_request), (gtk_menu_size_allocate),
(compute_child_offset): reworked/rewritten to support table menus,
(gtk_menu_attach): new function,
(find_child_containing), (gtk_menu_move_current): new functions to
get table menu keynav right.
* gtk/gtkmenu.h: add gtk_menu_attach() prototype.
2003-09-10 20:32:33 +00:00
|
|
|
|
|
|
|
|
|
if (!_gtk_menu_item_is_selectable (list->data))
|
|
|
|
|
continue;
|
|
|
|
|
|
2004-03-15 02:03:59 +00:00
|
|
|
|
get_effective_child_attach (list->data, &l, &r, &t, &b);
|
The table menu patch! Turns GtkMenu into a table, so you can attach menu
Wed Sep 10 22:25:04 2003 Kristian Rietveld <kris@gtk.org>
The table menu patch! Turns GtkMenu into a table, so you can attach
menu items in numerous new ways! Be creative!
Contains some bug fixes and RTL adaptions from Matthias Clasen.
* gtk/gtkmenu.c [toplevel]: introduce ATTACH_INFO_KEY, extend
GtkMenuPrivate, introduce AttachInfo, add child properties enum,
(gtk_menu_free_private), (gtk_menu_get_private): we have to free
the heights array in the private struct,
(gtk_menu_class_init): reorder code a bit, install child properties,
(get_attach_info), (get_child_attach): new utility functions,
(gtk_menu_set_child_property), (gtk_menu_get_child_property): introduce
child properties, for the attach info,
(gtk_menu_remove): remove AttachInfo from menu item,
(gtk_menu_real_insert): implemented algorithm to automagically place
inserted menu items at the correct place in the table,
(gtk_menu_size_request), (gtk_menu_size_allocate),
(compute_child_offset): reworked/rewritten to support table menus,
(gtk_menu_attach): new function,
(find_child_containing), (gtk_menu_move_current): new functions to
get table menu keynav right.
* gtk/gtkmenu.h: add gtk_menu_attach() prototype.
2003-09-10 20:32:33 +00:00
|
|
|
|
|
2010-12-23 20:50:18 +00:00
|
|
|
|
if (l <= left && right <= r && t <= top && bottom <= b)
|
The table menu patch! Turns GtkMenu into a table, so you can attach menu
Wed Sep 10 22:25:04 2003 Kristian Rietveld <kris@gtk.org>
The table menu patch! Turns GtkMenu into a table, so you can attach
menu items in numerous new ways! Be creative!
Contains some bug fixes and RTL adaptions from Matthias Clasen.
* gtk/gtkmenu.c [toplevel]: introduce ATTACH_INFO_KEY, extend
GtkMenuPrivate, introduce AttachInfo, add child properties enum,
(gtk_menu_free_private), (gtk_menu_get_private): we have to free
the heights array in the private struct,
(gtk_menu_class_init): reorder code a bit, install child properties,
(get_attach_info), (get_child_attach): new utility functions,
(gtk_menu_set_child_property), (gtk_menu_get_child_property): introduce
child properties, for the attach info,
(gtk_menu_remove): remove AttachInfo from menu item,
(gtk_menu_real_insert): implemented algorithm to automagically place
inserted menu items at the correct place in the table,
(gtk_menu_size_request), (gtk_menu_size_allocate),
(compute_child_offset): reworked/rewritten to support table menus,
(gtk_menu_attach): new function,
(find_child_containing), (gtk_menu_move_current): new functions to
get table menu keynav right.
* gtk/gtkmenu.h: add gtk_menu_attach() prototype.
2003-09-10 20:32:33 +00:00
|
|
|
|
return GTK_WIDGET (list->data);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
2008-09-03 13:18:34 +00:00
|
|
|
|
gtk_menu_move_current (GtkMenuShell *menu_shell,
|
|
|
|
|
GtkMenuDirectionType direction)
|
The table menu patch! Turns GtkMenu into a table, so you can attach menu
Wed Sep 10 22:25:04 2003 Kristian Rietveld <kris@gtk.org>
The table menu patch! Turns GtkMenu into a table, so you can attach
menu items in numerous new ways! Be creative!
Contains some bug fixes and RTL adaptions from Matthias Clasen.
* gtk/gtkmenu.c [toplevel]: introduce ATTACH_INFO_KEY, extend
GtkMenuPrivate, introduce AttachInfo, add child properties enum,
(gtk_menu_free_private), (gtk_menu_get_private): we have to free
the heights array in the private struct,
(gtk_menu_class_init): reorder code a bit, install child properties,
(get_attach_info), (get_child_attach): new utility functions,
(gtk_menu_set_child_property), (gtk_menu_get_child_property): introduce
child properties, for the attach info,
(gtk_menu_remove): remove AttachInfo from menu item,
(gtk_menu_real_insert): implemented algorithm to automagically place
inserted menu items at the correct place in the table,
(gtk_menu_size_request), (gtk_menu_size_allocate),
(compute_child_offset): reworked/rewritten to support table menus,
(gtk_menu_attach): new function,
(find_child_containing), (gtk_menu_move_current): new functions to
get table menu keynav right.
* gtk/gtkmenu.h: add gtk_menu_attach() prototype.
2003-09-10 20:32:33 +00:00
|
|
|
|
{
|
2004-03-15 02:03:59 +00:00
|
|
|
|
GtkMenu *menu = GTK_MENU (menu_shell);
|
2005-02-11 07:15:11 +00:00
|
|
|
|
gint i;
|
2005-11-10 14:33:51 +00:00
|
|
|
|
gint l, r, t, b;
|
2005-02-11 07:15:11 +00:00
|
|
|
|
GtkWidget *match = NULL;
|
|
|
|
|
|
|
|
|
|
if (gtk_widget_get_direction (GTK_WIDGET (menu_shell)) == GTK_TEXT_DIR_RTL)
|
|
|
|
|
{
|
|
|
|
|
switch (direction)
|
2010-12-23 20:50:18 +00:00
|
|
|
|
{
|
|
|
|
|
case GTK_MENU_DIR_CHILD:
|
|
|
|
|
direction = GTK_MENU_DIR_PARENT;
|
|
|
|
|
break;
|
|
|
|
|
case GTK_MENU_DIR_PARENT:
|
|
|
|
|
direction = GTK_MENU_DIR_CHILD;
|
|
|
|
|
break;
|
|
|
|
|
default: ;
|
|
|
|
|
}
|
2005-02-11 07:15:11 +00:00
|
|
|
|
}
|
The table menu patch! Turns GtkMenu into a table, so you can attach menu
Wed Sep 10 22:25:04 2003 Kristian Rietveld <kris@gtk.org>
The table menu patch! Turns GtkMenu into a table, so you can attach
menu items in numerous new ways! Be creative!
Contains some bug fixes and RTL adaptions from Matthias Clasen.
* gtk/gtkmenu.c [toplevel]: introduce ATTACH_INFO_KEY, extend
GtkMenuPrivate, introduce AttachInfo, add child properties enum,
(gtk_menu_free_private), (gtk_menu_get_private): we have to free
the heights array in the private struct,
(gtk_menu_class_init): reorder code a bit, install child properties,
(get_attach_info), (get_child_attach): new utility functions,
(gtk_menu_set_child_property), (gtk_menu_get_child_property): introduce
child properties, for the attach info,
(gtk_menu_remove): remove AttachInfo from menu item,
(gtk_menu_real_insert): implemented algorithm to automagically place
inserted menu items at the correct place in the table,
(gtk_menu_size_request), (gtk_menu_size_allocate),
(compute_child_offset): reworked/rewritten to support table menus,
(gtk_menu_attach): new function,
(find_child_containing), (gtk_menu_move_current): new functions to
get table menu keynav right.
* gtk/gtkmenu.h: add gtk_menu_attach() prototype.
2003-09-10 20:32:33 +00:00
|
|
|
|
|
|
|
|
|
/* use special table menu key bindings */
|
2010-12-23 23:21:53 +00:00
|
|
|
|
if (menu_shell->priv->active_menu_item && gtk_menu_get_n_columns (menu) > 1)
|
The table menu patch! Turns GtkMenu into a table, so you can attach menu
Wed Sep 10 22:25:04 2003 Kristian Rietveld <kris@gtk.org>
The table menu patch! Turns GtkMenu into a table, so you can attach
menu items in numerous new ways! Be creative!
Contains some bug fixes and RTL adaptions from Matthias Clasen.
* gtk/gtkmenu.c [toplevel]: introduce ATTACH_INFO_KEY, extend
GtkMenuPrivate, introduce AttachInfo, add child properties enum,
(gtk_menu_free_private), (gtk_menu_get_private): we have to free
the heights array in the private struct,
(gtk_menu_class_init): reorder code a bit, install child properties,
(get_attach_info), (get_child_attach): new utility functions,
(gtk_menu_set_child_property), (gtk_menu_get_child_property): introduce
child properties, for the attach info,
(gtk_menu_remove): remove AttachInfo from menu item,
(gtk_menu_real_insert): implemented algorithm to automagically place
inserted menu items at the correct place in the table,
(gtk_menu_size_request), (gtk_menu_size_allocate),
(compute_child_offset): reworked/rewritten to support table menus,
(gtk_menu_attach): new function,
(find_child_containing), (gtk_menu_move_current): new functions to
get table menu keynav right.
* gtk/gtkmenu.h: add gtk_menu_attach() prototype.
2003-09-10 20:32:33 +00:00
|
|
|
|
{
|
2010-12-23 23:21:53 +00:00
|
|
|
|
get_effective_child_attach (menu_shell->priv->active_menu_item, &l, &r, &t, &b);
|
The table menu patch! Turns GtkMenu into a table, so you can attach menu
Wed Sep 10 22:25:04 2003 Kristian Rietveld <kris@gtk.org>
The table menu patch! Turns GtkMenu into a table, so you can attach
menu items in numerous new ways! Be creative!
Contains some bug fixes and RTL adaptions from Matthias Clasen.
* gtk/gtkmenu.c [toplevel]: introduce ATTACH_INFO_KEY, extend
GtkMenuPrivate, introduce AttachInfo, add child properties enum,
(gtk_menu_free_private), (gtk_menu_get_private): we have to free
the heights array in the private struct,
(gtk_menu_class_init): reorder code a bit, install child properties,
(get_attach_info), (get_child_attach): new utility functions,
(gtk_menu_set_child_property), (gtk_menu_get_child_property): introduce
child properties, for the attach info,
(gtk_menu_remove): remove AttachInfo from menu item,
(gtk_menu_real_insert): implemented algorithm to automagically place
inserted menu items at the correct place in the table,
(gtk_menu_size_request), (gtk_menu_size_allocate),
(compute_child_offset): reworked/rewritten to support table menus,
(gtk_menu_attach): new function,
(find_child_containing), (gtk_menu_move_current): new functions to
get table menu keynav right.
* gtk/gtkmenu.h: add gtk_menu_attach() prototype.
2003-09-10 20:32:33 +00:00
|
|
|
|
|
|
|
|
|
if (direction == GTK_MENU_DIR_NEXT)
|
|
|
|
|
{
|
2010-12-23 20:50:18 +00:00
|
|
|
|
for (i = b; i < gtk_menu_get_n_rows (menu); i++)
|
The table menu patch! Turns GtkMenu into a table, so you can attach menu
Wed Sep 10 22:25:04 2003 Kristian Rietveld <kris@gtk.org>
The table menu patch! Turns GtkMenu into a table, so you can attach
menu items in numerous new ways! Be creative!
Contains some bug fixes and RTL adaptions from Matthias Clasen.
* gtk/gtkmenu.c [toplevel]: introduce ATTACH_INFO_KEY, extend
GtkMenuPrivate, introduce AttachInfo, add child properties enum,
(gtk_menu_free_private), (gtk_menu_get_private): we have to free
the heights array in the private struct,
(gtk_menu_class_init): reorder code a bit, install child properties,
(get_attach_info), (get_child_attach): new utility functions,
(gtk_menu_set_child_property), (gtk_menu_get_child_property): introduce
child properties, for the attach info,
(gtk_menu_remove): remove AttachInfo from menu item,
(gtk_menu_real_insert): implemented algorithm to automagically place
inserted menu items at the correct place in the table,
(gtk_menu_size_request), (gtk_menu_size_allocate),
(compute_child_offset): reworked/rewritten to support table menus,
(gtk_menu_attach): new function,
(find_child_containing), (gtk_menu_move_current): new functions to
get table menu keynav right.
* gtk/gtkmenu.h: add gtk_menu_attach() prototype.
2003-09-10 20:32:33 +00:00
|
|
|
|
{
|
|
|
|
|
match = find_child_containing (menu_shell, l, l + 1, i, i + 1);
|
|
|
|
|
if (match)
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
2010-12-23 20:50:18 +00:00
|
|
|
|
if (!match)
|
|
|
|
|
{
|
|
|
|
|
/* wrap around */
|
|
|
|
|
for (i = 0; i < t; i++)
|
|
|
|
|
{
|
The table menu patch! Turns GtkMenu into a table, so you can attach menu
Wed Sep 10 22:25:04 2003 Kristian Rietveld <kris@gtk.org>
The table menu patch! Turns GtkMenu into a table, so you can attach
menu items in numerous new ways! Be creative!
Contains some bug fixes and RTL adaptions from Matthias Clasen.
* gtk/gtkmenu.c [toplevel]: introduce ATTACH_INFO_KEY, extend
GtkMenuPrivate, introduce AttachInfo, add child properties enum,
(gtk_menu_free_private), (gtk_menu_get_private): we have to free
the heights array in the private struct,
(gtk_menu_class_init): reorder code a bit, install child properties,
(get_attach_info), (get_child_attach): new utility functions,
(gtk_menu_set_child_property), (gtk_menu_get_child_property): introduce
child properties, for the attach info,
(gtk_menu_remove): remove AttachInfo from menu item,
(gtk_menu_real_insert): implemented algorithm to automagically place
inserted menu items at the correct place in the table,
(gtk_menu_size_request), (gtk_menu_size_allocate),
(compute_child_offset): reworked/rewritten to support table menus,
(gtk_menu_attach): new function,
(find_child_containing), (gtk_menu_move_current): new functions to
get table menu keynav right.
* gtk/gtkmenu.h: add gtk_menu_attach() prototype.
2003-09-10 20:32:33 +00:00
|
|
|
|
match = find_child_containing (menu_shell,
|
|
|
|
|
l, l + 1, i, i + 1);
|
|
|
|
|
if (match)
|
|
|
|
|
break;
|
2010-12-23 20:50:18 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
The table menu patch! Turns GtkMenu into a table, so you can attach menu
Wed Sep 10 22:25:04 2003 Kristian Rietveld <kris@gtk.org>
The table menu patch! Turns GtkMenu into a table, so you can attach
menu items in numerous new ways! Be creative!
Contains some bug fixes and RTL adaptions from Matthias Clasen.
* gtk/gtkmenu.c [toplevel]: introduce ATTACH_INFO_KEY, extend
GtkMenuPrivate, introduce AttachInfo, add child properties enum,
(gtk_menu_free_private), (gtk_menu_get_private): we have to free
the heights array in the private struct,
(gtk_menu_class_init): reorder code a bit, install child properties,
(get_attach_info), (get_child_attach): new utility functions,
(gtk_menu_set_child_property), (gtk_menu_get_child_property): introduce
child properties, for the attach info,
(gtk_menu_remove): remove AttachInfo from menu item,
(gtk_menu_real_insert): implemented algorithm to automagically place
inserted menu items at the correct place in the table,
(gtk_menu_size_request), (gtk_menu_size_allocate),
(compute_child_offset): reworked/rewritten to support table menus,
(gtk_menu_attach): new function,
(find_child_containing), (gtk_menu_move_current): new functions to
get table menu keynav right.
* gtk/gtkmenu.h: add gtk_menu_attach() prototype.
2003-09-10 20:32:33 +00:00
|
|
|
|
else if (direction == GTK_MENU_DIR_PREV)
|
|
|
|
|
{
|
|
|
|
|
for (i = t; i > 0; i--)
|
|
|
|
|
{
|
2010-12-23 20:50:18 +00:00
|
|
|
|
match = find_child_containing (menu_shell,
|
|
|
|
|
l, l + 1, i - 1, i);
|
The table menu patch! Turns GtkMenu into a table, so you can attach menu
Wed Sep 10 22:25:04 2003 Kristian Rietveld <kris@gtk.org>
The table menu patch! Turns GtkMenu into a table, so you can attach
menu items in numerous new ways! Be creative!
Contains some bug fixes and RTL adaptions from Matthias Clasen.
* gtk/gtkmenu.c [toplevel]: introduce ATTACH_INFO_KEY, extend
GtkMenuPrivate, introduce AttachInfo, add child properties enum,
(gtk_menu_free_private), (gtk_menu_get_private): we have to free
the heights array in the private struct,
(gtk_menu_class_init): reorder code a bit, install child properties,
(get_attach_info), (get_child_attach): new utility functions,
(gtk_menu_set_child_property), (gtk_menu_get_child_property): introduce
child properties, for the attach info,
(gtk_menu_remove): remove AttachInfo from menu item,
(gtk_menu_real_insert): implemented algorithm to automagically place
inserted menu items at the correct place in the table,
(gtk_menu_size_request), (gtk_menu_size_allocate),
(compute_child_offset): reworked/rewritten to support table menus,
(gtk_menu_attach): new function,
(find_child_containing), (gtk_menu_move_current): new functions to
get table menu keynav right.
* gtk/gtkmenu.h: add gtk_menu_attach() prototype.
2003-09-10 20:32:33 +00:00
|
|
|
|
if (match)
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
2010-12-23 20:50:18 +00:00
|
|
|
|
if (!match)
|
|
|
|
|
{
|
|
|
|
|
/* wrap around */
|
|
|
|
|
for (i = gtk_menu_get_n_rows (menu); i > b; i--)
|
|
|
|
|
{
|
The table menu patch! Turns GtkMenu into a table, so you can attach menu
Wed Sep 10 22:25:04 2003 Kristian Rietveld <kris@gtk.org>
The table menu patch! Turns GtkMenu into a table, so you can attach
menu items in numerous new ways! Be creative!
Contains some bug fixes and RTL adaptions from Matthias Clasen.
* gtk/gtkmenu.c [toplevel]: introduce ATTACH_INFO_KEY, extend
GtkMenuPrivate, introduce AttachInfo, add child properties enum,
(gtk_menu_free_private), (gtk_menu_get_private): we have to free
the heights array in the private struct,
(gtk_menu_class_init): reorder code a bit, install child properties,
(get_attach_info), (get_child_attach): new utility functions,
(gtk_menu_set_child_property), (gtk_menu_get_child_property): introduce
child properties, for the attach info,
(gtk_menu_remove): remove AttachInfo from menu item,
(gtk_menu_real_insert): implemented algorithm to automagically place
inserted menu items at the correct place in the table,
(gtk_menu_size_request), (gtk_menu_size_allocate),
(compute_child_offset): reworked/rewritten to support table menus,
(gtk_menu_attach): new function,
(find_child_containing), (gtk_menu_move_current): new functions to
get table menu keynav right.
* gtk/gtkmenu.h: add gtk_menu_attach() prototype.
2003-09-10 20:32:33 +00:00
|
|
|
|
match = find_child_containing (menu_shell,
|
|
|
|
|
l, l + 1, i - 1, i);
|
|
|
|
|
if (match)
|
2010-12-23 20:50:18 +00:00
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2005-02-11 07:15:11 +00:00
|
|
|
|
else if (direction == GTK_MENU_DIR_PARENT)
|
The table menu patch! Turns GtkMenu into a table, so you can attach menu
Wed Sep 10 22:25:04 2003 Kristian Rietveld <kris@gtk.org>
The table menu patch! Turns GtkMenu into a table, so you can attach
menu items in numerous new ways! Be creative!
Contains some bug fixes and RTL adaptions from Matthias Clasen.
* gtk/gtkmenu.c [toplevel]: introduce ATTACH_INFO_KEY, extend
GtkMenuPrivate, introduce AttachInfo, add child properties enum,
(gtk_menu_free_private), (gtk_menu_get_private): we have to free
the heights array in the private struct,
(gtk_menu_class_init): reorder code a bit, install child properties,
(get_attach_info), (get_child_attach): new utility functions,
(gtk_menu_set_child_property), (gtk_menu_get_child_property): introduce
child properties, for the attach info,
(gtk_menu_remove): remove AttachInfo from menu item,
(gtk_menu_real_insert): implemented algorithm to automagically place
inserted menu items at the correct place in the table,
(gtk_menu_size_request), (gtk_menu_size_allocate),
(compute_child_offset): reworked/rewritten to support table menus,
(gtk_menu_attach): new function,
(find_child_containing), (gtk_menu_move_current): new functions to
get table menu keynav right.
* gtk/gtkmenu.h: add gtk_menu_attach() prototype.
2003-09-10 20:32:33 +00:00
|
|
|
|
{
|
|
|
|
|
/* we go one left if possible */
|
|
|
|
|
if (l > 0)
|
2010-12-23 20:50:18 +00:00
|
|
|
|
match = find_child_containing (menu_shell,
|
|
|
|
|
l - 1, l, t, t + 1);
|
The table menu patch! Turns GtkMenu into a table, so you can attach menu
Wed Sep 10 22:25:04 2003 Kristian Rietveld <kris@gtk.org>
The table menu patch! Turns GtkMenu into a table, so you can attach
menu items in numerous new ways! Be creative!
Contains some bug fixes and RTL adaptions from Matthias Clasen.
* gtk/gtkmenu.c [toplevel]: introduce ATTACH_INFO_KEY, extend
GtkMenuPrivate, introduce AttachInfo, add child properties enum,
(gtk_menu_free_private), (gtk_menu_get_private): we have to free
the heights array in the private struct,
(gtk_menu_class_init): reorder code a bit, install child properties,
(get_attach_info), (get_child_attach): new utility functions,
(gtk_menu_set_child_property), (gtk_menu_get_child_property): introduce
child properties, for the attach info,
(gtk_menu_remove): remove AttachInfo from menu item,
(gtk_menu_real_insert): implemented algorithm to automagically place
inserted menu items at the correct place in the table,
(gtk_menu_size_request), (gtk_menu_size_allocate),
(compute_child_offset): reworked/rewritten to support table menus,
(gtk_menu_attach): new function,
(find_child_containing), (gtk_menu_move_current): new functions to
get table menu keynav right.
* gtk/gtkmenu.h: add gtk_menu_attach() prototype.
2003-09-10 20:32:33 +00:00
|
|
|
|
|
|
|
|
|
if (!match)
|
|
|
|
|
{
|
2010-12-23 23:21:53 +00:00
|
|
|
|
GtkWidget *parent = menu_shell->priv->parent_menu_shell;
|
The table menu patch! Turns GtkMenu into a table, so you can attach menu
Wed Sep 10 22:25:04 2003 Kristian Rietveld <kris@gtk.org>
The table menu patch! Turns GtkMenu into a table, so you can attach
menu items in numerous new ways! Be creative!
Contains some bug fixes and RTL adaptions from Matthias Clasen.
* gtk/gtkmenu.c [toplevel]: introduce ATTACH_INFO_KEY, extend
GtkMenuPrivate, introduce AttachInfo, add child properties enum,
(gtk_menu_free_private), (gtk_menu_get_private): we have to free
the heights array in the private struct,
(gtk_menu_class_init): reorder code a bit, install child properties,
(get_attach_info), (get_child_attach): new utility functions,
(gtk_menu_set_child_property), (gtk_menu_get_child_property): introduce
child properties, for the attach info,
(gtk_menu_remove): remove AttachInfo from menu item,
(gtk_menu_real_insert): implemented algorithm to automagically place
inserted menu items at the correct place in the table,
(gtk_menu_size_request), (gtk_menu_size_allocate),
(compute_child_offset): reworked/rewritten to support table menus,
(gtk_menu_attach): new function,
(find_child_containing), (gtk_menu_move_current): new functions to
get table menu keynav right.
* gtk/gtkmenu.h: add gtk_menu_attach() prototype.
2003-09-10 20:32:33 +00:00
|
|
|
|
|
|
|
|
|
if (!parent
|
2010-12-23 23:21:53 +00:00
|
|
|
|
|| g_list_length (GTK_MENU_SHELL (parent)->priv->children) <= 1)
|
|
|
|
|
match = menu_shell->priv->active_menu_item;
|
The table menu patch! Turns GtkMenu into a table, so you can attach menu
Wed Sep 10 22:25:04 2003 Kristian Rietveld <kris@gtk.org>
The table menu patch! Turns GtkMenu into a table, so you can attach
menu items in numerous new ways! Be creative!
Contains some bug fixes and RTL adaptions from Matthias Clasen.
* gtk/gtkmenu.c [toplevel]: introduce ATTACH_INFO_KEY, extend
GtkMenuPrivate, introduce AttachInfo, add child properties enum,
(gtk_menu_free_private), (gtk_menu_get_private): we have to free
the heights array in the private struct,
(gtk_menu_class_init): reorder code a bit, install child properties,
(get_attach_info), (get_child_attach): new utility functions,
(gtk_menu_set_child_property), (gtk_menu_get_child_property): introduce
child properties, for the attach info,
(gtk_menu_remove): remove AttachInfo from menu item,
(gtk_menu_real_insert): implemented algorithm to automagically place
inserted menu items at the correct place in the table,
(gtk_menu_size_request), (gtk_menu_size_allocate),
(compute_child_offset): reworked/rewritten to support table menus,
(gtk_menu_attach): new function,
(find_child_containing), (gtk_menu_move_current): new functions to
get table menu keynav right.
* gtk/gtkmenu.h: add gtk_menu_attach() prototype.
2003-09-10 20:32:33 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2005-02-11 07:15:11 +00:00
|
|
|
|
else if (direction == GTK_MENU_DIR_CHILD)
|
The table menu patch! Turns GtkMenu into a table, so you can attach menu
Wed Sep 10 22:25:04 2003 Kristian Rietveld <kris@gtk.org>
The table menu patch! Turns GtkMenu into a table, so you can attach
menu items in numerous new ways! Be creative!
Contains some bug fixes and RTL adaptions from Matthias Clasen.
* gtk/gtkmenu.c [toplevel]: introduce ATTACH_INFO_KEY, extend
GtkMenuPrivate, introduce AttachInfo, add child properties enum,
(gtk_menu_free_private), (gtk_menu_get_private): we have to free
the heights array in the private struct,
(gtk_menu_class_init): reorder code a bit, install child properties,
(get_attach_info), (get_child_attach): new utility functions,
(gtk_menu_set_child_property), (gtk_menu_get_child_property): introduce
child properties, for the attach info,
(gtk_menu_remove): remove AttachInfo from menu item,
(gtk_menu_real_insert): implemented algorithm to automagically place
inserted menu items at the correct place in the table,
(gtk_menu_size_request), (gtk_menu_size_allocate),
(compute_child_offset): reworked/rewritten to support table menus,
(gtk_menu_attach): new function,
(find_child_containing), (gtk_menu_move_current): new functions to
get table menu keynav right.
* gtk/gtkmenu.h: add gtk_menu_attach() prototype.
2003-09-10 20:32:33 +00:00
|
|
|
|
{
|
|
|
|
|
/* we go one right if possible */
|
2010-12-23 20:50:18 +00:00
|
|
|
|
if (r < gtk_menu_get_n_columns (menu))
|
The table menu patch! Turns GtkMenu into a table, so you can attach menu
Wed Sep 10 22:25:04 2003 Kristian Rietveld <kris@gtk.org>
The table menu patch! Turns GtkMenu into a table, so you can attach
menu items in numerous new ways! Be creative!
Contains some bug fixes and RTL adaptions from Matthias Clasen.
* gtk/gtkmenu.c [toplevel]: introduce ATTACH_INFO_KEY, extend
GtkMenuPrivate, introduce AttachInfo, add child properties enum,
(gtk_menu_free_private), (gtk_menu_get_private): we have to free
the heights array in the private struct,
(gtk_menu_class_init): reorder code a bit, install child properties,
(get_attach_info), (get_child_attach): new utility functions,
(gtk_menu_set_child_property), (gtk_menu_get_child_property): introduce
child properties, for the attach info,
(gtk_menu_remove): remove AttachInfo from menu item,
(gtk_menu_real_insert): implemented algorithm to automagically place
inserted menu items at the correct place in the table,
(gtk_menu_size_request), (gtk_menu_size_allocate),
(compute_child_offset): reworked/rewritten to support table menus,
(gtk_menu_attach): new function,
(find_child_containing), (gtk_menu_move_current): new functions to
get table menu keynav right.
* gtk/gtkmenu.h: add gtk_menu_attach() prototype.
2003-09-10 20:32:33 +00:00
|
|
|
|
match = find_child_containing (menu_shell, r, r + 1, t, t + 1);
|
|
|
|
|
|
|
|
|
|
if (!match)
|
|
|
|
|
{
|
2010-12-23 23:21:53 +00:00
|
|
|
|
GtkWidget *parent = menu_shell->priv->parent_menu_shell;
|
The table menu patch! Turns GtkMenu into a table, so you can attach menu
Wed Sep 10 22:25:04 2003 Kristian Rietveld <kris@gtk.org>
The table menu patch! Turns GtkMenu into a table, so you can attach
menu items in numerous new ways! Be creative!
Contains some bug fixes and RTL adaptions from Matthias Clasen.
* gtk/gtkmenu.c [toplevel]: introduce ATTACH_INFO_KEY, extend
GtkMenuPrivate, introduce AttachInfo, add child properties enum,
(gtk_menu_free_private), (gtk_menu_get_private): we have to free
the heights array in the private struct,
(gtk_menu_class_init): reorder code a bit, install child properties,
(get_attach_info), (get_child_attach): new utility functions,
(gtk_menu_set_child_property), (gtk_menu_get_child_property): introduce
child properties, for the attach info,
(gtk_menu_remove): remove AttachInfo from menu item,
(gtk_menu_real_insert): implemented algorithm to automagically place
inserted menu items at the correct place in the table,
(gtk_menu_size_request), (gtk_menu_size_allocate),
(compute_child_offset): reworked/rewritten to support table menus,
(gtk_menu_attach): new function,
(find_child_containing), (gtk_menu_move_current): new functions to
get table menu keynav right.
* gtk/gtkmenu.h: add gtk_menu_attach() prototype.
2003-09-10 20:32:33 +00:00
|
|
|
|
|
2010-12-27 01:36:51 +00:00
|
|
|
|
if (! GTK_MENU_ITEM (menu_shell->priv->active_menu_item)->priv->submenu &&
|
The table menu patch! Turns GtkMenu into a table, so you can attach menu
Wed Sep 10 22:25:04 2003 Kristian Rietveld <kris@gtk.org>
The table menu patch! Turns GtkMenu into a table, so you can attach
menu items in numerous new ways! Be creative!
Contains some bug fixes and RTL adaptions from Matthias Clasen.
* gtk/gtkmenu.c [toplevel]: introduce ATTACH_INFO_KEY, extend
GtkMenuPrivate, introduce AttachInfo, add child properties enum,
(gtk_menu_free_private), (gtk_menu_get_private): we have to free
the heights array in the private struct,
(gtk_menu_class_init): reorder code a bit, install child properties,
(get_attach_info), (get_child_attach): new utility functions,
(gtk_menu_set_child_property), (gtk_menu_get_child_property): introduce
child properties, for the attach info,
(gtk_menu_remove): remove AttachInfo from menu item,
(gtk_menu_real_insert): implemented algorithm to automagically place
inserted menu items at the correct place in the table,
(gtk_menu_size_request), (gtk_menu_size_allocate),
(compute_child_offset): reworked/rewritten to support table menus,
(gtk_menu_attach): new function,
(find_child_containing), (gtk_menu_move_current): new functions to
get table menu keynav right.
* gtk/gtkmenu.h: add gtk_menu_attach() prototype.
2003-09-10 20:32:33 +00:00
|
|
|
|
(!parent ||
|
2010-12-23 23:21:53 +00:00
|
|
|
|
g_list_length (GTK_MENU_SHELL (parent)->priv->children) <= 1))
|
|
|
|
|
match = menu_shell->priv->active_menu_item;
|
The table menu patch! Turns GtkMenu into a table, so you can attach menu
Wed Sep 10 22:25:04 2003 Kristian Rietveld <kris@gtk.org>
The table menu patch! Turns GtkMenu into a table, so you can attach
menu items in numerous new ways! Be creative!
Contains some bug fixes and RTL adaptions from Matthias Clasen.
* gtk/gtkmenu.c [toplevel]: introduce ATTACH_INFO_KEY, extend
GtkMenuPrivate, introduce AttachInfo, add child properties enum,
(gtk_menu_free_private), (gtk_menu_get_private): we have to free
the heights array in the private struct,
(gtk_menu_class_init): reorder code a bit, install child properties,
(get_attach_info), (get_child_attach): new utility functions,
(gtk_menu_set_child_property), (gtk_menu_get_child_property): introduce
child properties, for the attach info,
(gtk_menu_remove): remove AttachInfo from menu item,
(gtk_menu_real_insert): implemented algorithm to automagically place
inserted menu items at the correct place in the table,
(gtk_menu_size_request), (gtk_menu_size_allocate),
(compute_child_offset): reworked/rewritten to support table menus,
(gtk_menu_attach): new function,
(find_child_containing), (gtk_menu_move_current): new functions to
get table menu keynav right.
* gtk/gtkmenu.h: add gtk_menu_attach() prototype.
2003-09-10 20:32:33 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (match)
|
|
|
|
|
{
|
2010-12-23 20:50:18 +00:00
|
|
|
|
gtk_menu_shell_select_item (menu_shell, match);
|
The table menu patch! Turns GtkMenu into a table, so you can attach menu
Wed Sep 10 22:25:04 2003 Kristian Rietveld <kris@gtk.org>
The table menu patch! Turns GtkMenu into a table, so you can attach
menu items in numerous new ways! Be creative!
Contains some bug fixes and RTL adaptions from Matthias Clasen.
* gtk/gtkmenu.c [toplevel]: introduce ATTACH_INFO_KEY, extend
GtkMenuPrivate, introduce AttachInfo, add child properties enum,
(gtk_menu_free_private), (gtk_menu_get_private): we have to free
the heights array in the private struct,
(gtk_menu_class_init): reorder code a bit, install child properties,
(get_attach_info), (get_child_attach): new utility functions,
(gtk_menu_set_child_property), (gtk_menu_get_child_property): introduce
child properties, for the attach info,
(gtk_menu_remove): remove AttachInfo from menu item,
(gtk_menu_real_insert): implemented algorithm to automagically place
inserted menu items at the correct place in the table,
(gtk_menu_size_request), (gtk_menu_size_allocate),
(compute_child_offset): reworked/rewritten to support table menus,
(gtk_menu_attach): new function,
(find_child_containing), (gtk_menu_move_current): new functions to
get table menu keynav right.
* gtk/gtkmenu.h: add gtk_menu_attach() prototype.
2003-09-10 20:32:33 +00:00
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2006-05-02 23:56:43 +00:00
|
|
|
|
GTK_MENU_SHELL_CLASS (gtk_menu_parent_class)->move_current (menu_shell, direction);
|
The table menu patch! Turns GtkMenu into a table, so you can attach menu
Wed Sep 10 22:25:04 2003 Kristian Rietveld <kris@gtk.org>
The table menu patch! Turns GtkMenu into a table, so you can attach
menu items in numerous new ways! Be creative!
Contains some bug fixes and RTL adaptions from Matthias Clasen.
* gtk/gtkmenu.c [toplevel]: introduce ATTACH_INFO_KEY, extend
GtkMenuPrivate, introduce AttachInfo, add child properties enum,
(gtk_menu_free_private), (gtk_menu_get_private): we have to free
the heights array in the private struct,
(gtk_menu_class_init): reorder code a bit, install child properties,
(get_attach_info), (get_child_attach): new utility functions,
(gtk_menu_set_child_property), (gtk_menu_get_child_property): introduce
child properties, for the attach info,
(gtk_menu_remove): remove AttachInfo from menu item,
(gtk_menu_real_insert): implemented algorithm to automagically place
inserted menu items at the correct place in the table,
(gtk_menu_size_request), (gtk_menu_size_allocate),
(compute_child_offset): reworked/rewritten to support table menus,
(gtk_menu_attach): new function,
(find_child_containing), (gtk_menu_move_current): new functions to
get table menu keynav right.
* gtk/gtkmenu.h: add gtk_menu_attach() prototype.
2003-09-10 20:32:33 +00:00
|
|
|
|
}
|
|
|
|
|
|
2002-12-14 22:43:52 +00:00
|
|
|
|
static gint
|
|
|
|
|
get_visible_size (GtkMenu *menu)
|
|
|
|
|
{
|
2010-12-23 20:50:18 +00:00
|
|
|
|
GtkMenuPrivate *priv = menu->priv;
|
2010-08-11 21:08:37 +00:00
|
|
|
|
GtkAllocation allocation;
|
2002-12-14 22:43:52 +00:00
|
|
|
|
GtkWidget *widget = GTK_WIDGET (menu);
|
|
|
|
|
GtkContainer *container = GTK_CONTAINER (menu);
|
2011-01-12 19:35:04 +00:00
|
|
|
|
GtkBorder padding;
|
2010-08-11 21:08:37 +00:00
|
|
|
|
gint menu_height;
|
|
|
|
|
|
|
|
|
|
gtk_widget_get_allocation (widget, &allocation);
|
2011-05-17 18:10:19 +00:00
|
|
|
|
get_menu_padding (widget, &padding);
|
2011-01-12 19:35:04 +00:00
|
|
|
|
|
|
|
|
|
menu_height = (allocation.height -
|
|
|
|
|
(2 * gtk_container_get_border_width (container)) -
|
|
|
|
|
padding.top - padding.bottom);
|
2006-05-10 14:02:20 +00:00
|
|
|
|
|
2010-12-23 20:50:18 +00:00
|
|
|
|
if (!priv->tearoff_active)
|
2007-05-09 15:46:41 +00:00
|
|
|
|
{
|
|
|
|
|
GtkBorder arrow_border;
|
2002-12-14 22:43:52 +00:00
|
|
|
|
|
2007-05-09 15:46:41 +00:00
|
|
|
|
get_arrows_border (menu, &arrow_border);
|
|
|
|
|
menu_height -= arrow_border.top;
|
|
|
|
|
menu_height -= arrow_border.bottom;
|
|
|
|
|
}
|
2010-12-23 20:50:18 +00:00
|
|
|
|
|
2002-12-14 22:43:52 +00:00
|
|
|
|
return menu_height;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Find the sensitive on-screen child containing @y, or if none,
|
|
|
|
|
* the nearest selectable onscreen child. (%NULL if none)
|
|
|
|
|
*/
|
|
|
|
|
static GtkWidget *
|
|
|
|
|
child_at (GtkMenu *menu,
|
2010-12-23 20:50:18 +00:00
|
|
|
|
gint y)
|
2002-12-14 22:43:52 +00:00
|
|
|
|
{
|
2010-12-23 20:50:18 +00:00
|
|
|
|
GtkMenuPrivate *priv = menu->priv;
|
2002-12-14 22:43:52 +00:00
|
|
|
|
GtkMenuShell *menu_shell = GTK_MENU_SHELL (menu);
|
|
|
|
|
GtkWidget *child = NULL;
|
|
|
|
|
gint child_offset = 0;
|
|
|
|
|
GList *children;
|
|
|
|
|
gint menu_height;
|
2010-12-23 20:50:18 +00:00
|
|
|
|
gint lower, upper; /* Onscreen bounds */
|
2002-12-14 22:43:52 +00:00
|
|
|
|
|
|
|
|
|
menu_height = get_visible_size (menu);
|
2010-12-23 20:50:18 +00:00
|
|
|
|
lower = priv->scroll_offset;
|
|
|
|
|
upper = priv->scroll_offset + menu_height;
|
|
|
|
|
|
2010-12-23 23:21:53 +00:00
|
|
|
|
for (children = menu_shell->priv->children; children; children = children->next)
|
2002-12-14 22:43:52 +00:00
|
|
|
|
{
|
2010-03-01 06:47:38 +00:00
|
|
|
|
if (gtk_widget_get_visible (children->data))
|
2010-12-23 20:50:18 +00:00
|
|
|
|
{
|
|
|
|
|
GtkRequisition child_requisition;
|
2002-12-14 22:43:52 +00:00
|
|
|
|
|
2010-09-21 14:35:17 +00:00
|
|
|
|
gtk_widget_get_preferred_size (children->data,
|
|
|
|
|
&child_requisition, NULL);
|
2002-12-14 22:43:52 +00:00
|
|
|
|
|
2010-12-23 20:50:18 +00:00
|
|
|
|
if (_gtk_menu_item_is_selectable (children->data) &&
|
|
|
|
|
child_offset >= lower &&
|
|
|
|
|
child_offset + child_requisition.height <= upper)
|
|
|
|
|
{
|
|
|
|
|
child = children->data;
|
|
|
|
|
|
2013-05-05 14:31:08 +00:00
|
|
|
|
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
|
|
|
|
|
2010-12-23 20:50:18 +00:00
|
|
|
|
if (child_offset + child_requisition.height > y &&
|
|
|
|
|
!GTK_IS_TEAROFF_MENU_ITEM (child))
|
|
|
|
|
return child;
|
2013-05-05 14:31:08 +00:00
|
|
|
|
|
|
|
|
|
G_GNUC_END_IGNORE_DEPRECATIONS
|
|
|
|
|
|
2010-12-23 20:50:18 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
child_offset += child_requisition.height;
|
|
|
|
|
}
|
2002-12-14 22:43:52 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return child;
|
|
|
|
|
}
|
|
|
|
|
|
2003-08-21 19:42:44 +00:00
|
|
|
|
static gint
|
|
|
|
|
get_menu_height (GtkMenu *menu)
|
|
|
|
|
{
|
2010-12-23 20:50:18 +00:00
|
|
|
|
GtkMenuPrivate *priv = menu->priv;
|
2010-08-11 21:08:37 +00:00
|
|
|
|
GtkWidget *widget = GTK_WIDGET (menu);
|
2011-05-17 18:10:19 +00:00
|
|
|
|
GtkBorder padding;
|
2010-08-11 21:08:37 +00:00
|
|
|
|
gint height;
|
2010-08-18 23:42:02 +00:00
|
|
|
|
|
2011-05-17 18:10:19 +00:00
|
|
|
|
get_menu_padding (widget, &padding);
|
2011-01-12 19:35:04 +00:00
|
|
|
|
|
2012-04-25 03:34:12 +00:00
|
|
|
|
height = priv->requested_height;
|
2011-01-12 19:35:04 +00:00
|
|
|
|
height -= (gtk_container_get_border_width (GTK_CONTAINER (widget)) * 2) +
|
2011-05-17 18:10:19 +00:00
|
|
|
|
padding.top + padding.bottom;
|
2003-08-21 19:42:44 +00:00
|
|
|
|
|
2010-12-23 20:50:18 +00:00
|
|
|
|
if (!priv->tearoff_active)
|
2007-05-09 15:46:41 +00:00
|
|
|
|
{
|
|
|
|
|
GtkBorder arrow_border;
|
2003-08-21 19:42:44 +00:00
|
|
|
|
|
2007-05-09 15:46:41 +00:00
|
|
|
|
get_arrows_border (menu, &arrow_border);
|
|
|
|
|
height -= arrow_border.top;
|
|
|
|
|
height -= arrow_border.bottom;
|
|
|
|
|
}
|
2003-08-21 19:42:44 +00:00
|
|
|
|
|
|
|
|
|
return height;
|
|
|
|
|
}
|
|
|
|
|
|
2002-12-14 22:43:52 +00:00
|
|
|
|
static void
|
|
|
|
|
gtk_menu_real_move_scroll (GtkMenu *menu,
|
2010-12-23 20:50:18 +00:00
|
|
|
|
GtkScrollType type)
|
2002-12-14 22:43:52 +00:00
|
|
|
|
{
|
2010-12-23 20:50:18 +00:00
|
|
|
|
GtkMenuPrivate *priv = menu->priv;
|
2003-09-03 21:26:13 +00:00
|
|
|
|
gint page_size = get_visible_size (menu);
|
|
|
|
|
gint end_position = get_menu_height (menu);
|
2002-12-14 22:43:52 +00:00
|
|
|
|
GtkMenuShell *menu_shell = GTK_MENU_SHELL (menu);
|
2010-12-23 20:50:18 +00:00
|
|
|
|
|
2002-12-14 22:43:52 +00:00
|
|
|
|
switch (type)
|
|
|
|
|
{
|
|
|
|
|
case GTK_SCROLL_PAGE_UP:
|
|
|
|
|
case GTK_SCROLL_PAGE_DOWN:
|
|
|
|
|
{
|
2010-12-23 20:50:18 +00:00
|
|
|
|
gint old_offset;
|
2003-08-21 19:42:44 +00:00
|
|
|
|
gint new_offset;
|
2010-12-23 20:50:18 +00:00
|
|
|
|
gint child_offset = 0;
|
|
|
|
|
gboolean old_upper_arrow_visible;
|
|
|
|
|
gint step;
|
|
|
|
|
|
|
|
|
|
if (type == GTK_SCROLL_PAGE_UP)
|
|
|
|
|
step = - page_size;
|
|
|
|
|
else
|
|
|
|
|
step = page_size;
|
|
|
|
|
|
2010-12-23 23:21:53 +00:00
|
|
|
|
if (menu_shell->priv->active_menu_item)
|
2010-12-23 20:50:18 +00:00
|
|
|
|
{
|
|
|
|
|
gint child_height;
|
|
|
|
|
|
2013-11-20 17:31:28 +00:00
|
|
|
|
if (compute_child_offset (menu, menu_shell->priv->active_menu_item,
|
|
|
|
|
&child_offset, &child_height, NULL))
|
|
|
|
|
child_offset += child_height / 2;
|
2010-12-23 20:50:18 +00:00
|
|
|
|
}
|
|
|
|
|
|
2010-12-23 23:21:53 +00:00
|
|
|
|
menu_shell->priv->ignore_enter = TRUE;
|
2010-12-23 20:50:18 +00:00
|
|
|
|
old_upper_arrow_visible = priv->upper_arrow_visible && !priv->tearoff_active;
|
|
|
|
|
old_offset = priv->scroll_offset;
|
|
|
|
|
|
|
|
|
|
new_offset = priv->scroll_offset + step;
|
2003-09-03 21:26:13 +00:00
|
|
|
|
new_offset = CLAMP (new_offset, 0, end_position - page_size);
|
2003-08-21 19:42:44 +00:00
|
|
|
|
|
2019-01-17 18:27:51 +00:00
|
|
|
|
gtk_menu_scroll_to (menu, new_offset, GTK_MENU_SCROLL_FLAG_NONE);
|
2010-12-23 20:50:18 +00:00
|
|
|
|
|
2010-12-23 23:21:53 +00:00
|
|
|
|
if (menu_shell->priv->active_menu_item)
|
2010-12-23 20:50:18 +00:00
|
|
|
|
{
|
|
|
|
|
GtkWidget *new_child;
|
|
|
|
|
gboolean new_upper_arrow_visible = priv->upper_arrow_visible && !priv->tearoff_active;
|
2007-05-09 15:46:41 +00:00
|
|
|
|
GtkBorder arrow_border;
|
2012-04-25 03:34:12 +00:00
|
|
|
|
|
2010-12-23 20:50:18 +00:00
|
|
|
|
get_arrows_border (menu, &arrow_border);
|
2002-12-14 22:43:52 +00:00
|
|
|
|
|
2010-12-23 20:50:18 +00:00
|
|
|
|
if (priv->scroll_offset != old_offset)
|
|
|
|
|
step = priv->scroll_offset - old_offset;
|
2002-12-14 22:43:52 +00:00
|
|
|
|
|
2010-12-23 20:50:18 +00:00
|
|
|
|
step -= (new_upper_arrow_visible - old_upper_arrow_visible) * arrow_border.top;
|
2002-12-14 22:43:52 +00:00
|
|
|
|
|
2010-12-23 20:50:18 +00:00
|
|
|
|
new_child = child_at (menu, child_offset + step);
|
|
|
|
|
if (new_child)
|
|
|
|
|
gtk_menu_shell_select_item (menu_shell, new_child);
|
|
|
|
|
}
|
2002-12-14 22:43:52 +00:00
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case GTK_SCROLL_START:
|
2010-12-23 20:50:18 +00:00
|
|
|
|
/* Ignore the enter event we might get if the pointer is on the menu */
|
2010-12-23 23:21:53 +00:00
|
|
|
|
menu_shell->priv->ignore_enter = TRUE;
|
2002-12-14 22:43:52 +00:00
|
|
|
|
gtk_menu_shell_select_first (menu_shell, TRUE);
|
|
|
|
|
break;
|
|
|
|
|
case GTK_SCROLL_END:
|
2010-12-23 20:50:18 +00:00
|
|
|
|
/* Ignore the enter event we might get if the pointer is on the menu */
|
2010-12-23 23:21:53 +00:00
|
|
|
|
menu_shell->priv->ignore_enter = TRUE;
|
2002-12-14 22:43:52 +00:00
|
|
|
|
_gtk_menu_shell_select_last (menu_shell, TRUE);
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
2003-11-12 20:53:03 +00:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* gtk_menu_set_monitor:
|
|
|
|
|
* @menu: a #GtkMenu
|
|
|
|
|
* @monitor_num: the number of the monitor on which the menu should
|
|
|
|
|
* be popped up
|
2010-12-23 20:50:18 +00:00
|
|
|
|
*
|
|
|
|
|
* Informs GTK+ on which monitor a menu should be popped up.
|
2016-04-11 02:59:53 +00:00
|
|
|
|
* See gdk_monitor_get_geometry().
|
2003-11-12 20:53:03 +00:00
|
|
|
|
*
|
2010-12-23 20:50:18 +00:00
|
|
|
|
* This function should be called from a #GtkMenuPositionFunc
|
|
|
|
|
* if the menu should not appear on the same monitor as the pointer.
|
2014-02-07 18:32:47 +00:00
|
|
|
|
* This information can’t be reliably inferred from the coordinates
|
2010-12-23 20:50:18 +00:00
|
|
|
|
* returned by a #GtkMenuPositionFunc, since, for very long menus,
|
|
|
|
|
* these coordinates may extend beyond the monitor boundaries or even
|
|
|
|
|
* the screen boundaries.
|
2003-11-12 20:53:03 +00:00
|
|
|
|
*
|
|
|
|
|
* Since: 2.4
|
2010-12-23 20:50:18 +00:00
|
|
|
|
*/
|
2004-03-09 01:21:45 +00:00
|
|
|
|
void
|
|
|
|
|
gtk_menu_set_monitor (GtkMenu *menu,
|
2010-12-23 20:50:18 +00:00
|
|
|
|
gint monitor_num)
|
2003-11-12 20:53:03 +00:00
|
|
|
|
{
|
2018-04-17 18:51:53 +00:00
|
|
|
|
GtkMenuPrivate *priv;
|
2010-12-23 20:50:18 +00:00
|
|
|
|
|
2003-11-12 20:53:03 +00:00
|
|
|
|
g_return_if_fail (GTK_IS_MENU (menu));
|
|
|
|
|
|
2018-04-17 18:51:53 +00:00
|
|
|
|
priv = menu->priv;
|
|
|
|
|
|
2014-06-09 13:04:53 +00:00
|
|
|
|
if (priv->monitor_num != monitor_num)
|
|
|
|
|
{
|
|
|
|
|
priv->monitor_num = monitor_num;
|
|
|
|
|
g_object_notify (G_OBJECT (menu), "monitor");
|
|
|
|
|
}
|
2008-06-20 11:06:52 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* gtk_menu_get_monitor:
|
|
|
|
|
* @menu: a #GtkMenu
|
|
|
|
|
*
|
|
|
|
|
* Retrieves the number of the monitor on which to show the menu.
|
|
|
|
|
*
|
|
|
|
|
* Returns: the number of the monitor on which the menu should
|
2008-07-04 21:20:25 +00:00
|
|
|
|
* be popped up or -1, if no monitor has been set
|
2008-06-20 13:54:31 +00:00
|
|
|
|
*
|
|
|
|
|
* Since: 2.14
|
2010-12-23 20:50:18 +00:00
|
|
|
|
*/
|
2008-06-20 11:06:52 +00:00
|
|
|
|
gint
|
|
|
|
|
gtk_menu_get_monitor (GtkMenu *menu)
|
|
|
|
|
{
|
2008-06-21 09:49:00 +00:00
|
|
|
|
g_return_val_if_fail (GTK_IS_MENU (menu), -1);
|
2008-06-20 11:06:52 +00:00
|
|
|
|
|
2010-12-23 20:50:18 +00:00
|
|
|
|
return menu->priv->monitor_num;
|
2003-11-12 20:53:03 +00:00
|
|
|
|
}
|
2004-05-06 07:35:26 +00:00
|
|
|
|
|
2016-11-19 18:51:50 +00:00
|
|
|
|
/**
|
|
|
|
|
* gtk_menu_place_on_monitor:
|
|
|
|
|
* @menu: a #GtkMenu
|
|
|
|
|
* @monitor: the monitor to place the menu on
|
|
|
|
|
*
|
|
|
|
|
* Places @menu on the given monitor.
|
|
|
|
|
*
|
|
|
|
|
* Since: 3.22
|
|
|
|
|
*/
|
2016-04-11 02:59:53 +00:00
|
|
|
|
void
|
|
|
|
|
gtk_menu_place_on_monitor (GtkMenu *menu,
|
|
|
|
|
GdkMonitor *monitor)
|
|
|
|
|
{
|
|
|
|
|
GdkDisplay *display;
|
|
|
|
|
gint i, monitor_num;
|
|
|
|
|
|
|
|
|
|
g_return_if_fail (GTK_IS_MENU (menu));
|
|
|
|
|
|
|
|
|
|
display = gtk_widget_get_display (GTK_WIDGET (menu));
|
|
|
|
|
monitor_num = 0;
|
|
|
|
|
for (i = 0; ; i++)
|
|
|
|
|
{
|
|
|
|
|
GdkMonitor *m = gdk_display_get_monitor (display, i);
|
|
|
|
|
if (m == monitor)
|
|
|
|
|
{
|
|
|
|
|
monitor_num = i;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
if (m == NULL)
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
gtk_menu_set_monitor (menu, monitor_num);
|
|
|
|
|
}
|
|
|
|
|
|
2004-05-06 07:35:26 +00:00
|
|
|
|
/**
|
|
|
|
|
* gtk_menu_get_for_attach_widget:
|
|
|
|
|
* @widget: a #GtkWidget
|
2006-04-24 05:42:12 +00:00
|
|
|
|
*
|
|
|
|
|
* Returns a list of the menus which are attached to this widget.
|
2004-05-06 07:35:26 +00:00
|
|
|
|
* This list is owned by GTK+ and must not be modified.
|
|
|
|
|
*
|
2014-02-19 23:49:43 +00:00
|
|
|
|
* Returns: (element-type GtkWidget) (transfer none): the list
|
2010-12-23 20:50:18 +00:00
|
|
|
|
* of menus attached to his widget.
|
2004-05-06 07:35:26 +00:00
|
|
|
|
*
|
|
|
|
|
* Since: 2.6
|
2010-12-23 20:50:18 +00:00
|
|
|
|
*/
|
2004-05-06 07:35:26 +00:00
|
|
|
|
GList*
|
|
|
|
|
gtk_menu_get_for_attach_widget (GtkWidget *widget)
|
|
|
|
|
{
|
|
|
|
|
GList *list;
|
2010-12-23 20:50:18 +00:00
|
|
|
|
|
2004-05-06 07:35:26 +00:00
|
|
|
|
g_return_val_if_fail (GTK_IS_WIDGET (widget), NULL);
|
2010-12-23 20:50:18 +00:00
|
|
|
|
|
2004-05-06 07:35:26 +00:00
|
|
|
|
list = g_object_get_data (G_OBJECT (widget), ATTACHED_MENUS);
|
2010-12-23 20:50:18 +00:00
|
|
|
|
|
2004-05-06 07:35:26 +00:00
|
|
|
|
return list;
|
|
|
|
|
}
|
|
|
|
|
|
2005-06-27 17:36:34 +00:00
|
|
|
|
static void
|
|
|
|
|
gtk_menu_grab_notify (GtkWidget *widget,
|
2010-12-23 20:50:18 +00:00
|
|
|
|
gboolean was_grabbed)
|
2005-06-27 17:36:34 +00:00
|
|
|
|
{
|
2011-12-12 17:11:57 +00:00
|
|
|
|
GtkMenu *menu;
|
2005-07-05 22:34:07 +00:00
|
|
|
|
GtkWidget *toplevel;
|
|
|
|
|
GtkWindowGroup *group;
|
|
|
|
|
GtkWidget *grab;
|
2010-05-25 22:38:44 +00:00
|
|
|
|
GdkDevice *pointer;
|
|
|
|
|
|
2011-12-12 17:11:57 +00:00
|
|
|
|
menu = GTK_MENU (widget);
|
2010-06-15 23:09:41 +00:00
|
|
|
|
pointer = _gtk_menu_shell_get_grab_device (GTK_MENU_SHELL (widget));
|
2010-05-25 22:38:44 +00:00
|
|
|
|
|
|
|
|
|
if (!pointer ||
|
|
|
|
|
!gtk_widget_device_is_shadowed (widget, pointer))
|
|
|
|
|
return;
|
2005-07-05 22:34:07 +00:00
|
|
|
|
|
|
|
|
|
toplevel = gtk_widget_get_toplevel (widget);
|
2010-05-25 22:38:44 +00:00
|
|
|
|
|
|
|
|
|
if (!GTK_IS_WINDOW (toplevel))
|
|
|
|
|
return;
|
|
|
|
|
|
2006-01-10 04:33:30 +00:00
|
|
|
|
group = gtk_window_get_group (GTK_WINDOW (toplevel));
|
2015-11-26 18:54:54 +00:00
|
|
|
|
grab = gtk_window_group_get_current_grab (group);
|
2005-07-05 22:34:07 +00:00
|
|
|
|
|
2017-08-10 09:56:47 +00:00
|
|
|
|
if (GTK_MENU_SHELL (widget)->priv->active && !GTK_IS_MENU_SHELL (grab) &&
|
|
|
|
|
!gtk_widget_is_ancestor (grab, widget))
|
2010-05-25 22:38:44 +00:00
|
|
|
|
gtk_menu_shell_cancel (GTK_MENU_SHELL (widget));
|
2011-12-12 17:11:57 +00:00
|
|
|
|
|
|
|
|
|
menu->priv->drag_scroll_started = FALSE;
|
2005-06-27 17:36:34 +00:00
|
|
|
|
}
|
|
|
|
|
|
2009-06-24 05:01:51 +00:00
|
|
|
|
/**
|
|
|
|
|
* gtk_menu_set_reserve_toggle_size:
|
|
|
|
|
* @menu: a #GtkMenu
|
|
|
|
|
* @reserve_toggle_size: whether to reserve size for toggles
|
|
|
|
|
*
|
2010-12-23 20:50:18 +00:00
|
|
|
|
* Sets whether the menu should reserve space for drawing toggles
|
2009-06-24 05:01:51 +00:00
|
|
|
|
* or icons, regardless of their actual presence.
|
|
|
|
|
*
|
|
|
|
|
* Since: 2.18
|
|
|
|
|
*/
|
2009-06-22 04:53:14 +00:00
|
|
|
|
void
|
2009-06-24 05:01:51 +00:00
|
|
|
|
gtk_menu_set_reserve_toggle_size (GtkMenu *menu,
|
|
|
|
|
gboolean reserve_toggle_size)
|
2009-06-22 04:53:14 +00:00
|
|
|
|
{
|
2018-04-17 18:51:53 +00:00
|
|
|
|
GtkMenuPrivate *priv;
|
2009-06-24 05:01:51 +00:00
|
|
|
|
gboolean no_toggle_size;
|
2010-12-23 20:50:18 +00:00
|
|
|
|
|
|
|
|
|
g_return_if_fail (GTK_IS_MENU (menu));
|
|
|
|
|
|
2018-04-17 18:51:53 +00:00
|
|
|
|
priv = menu->priv;
|
2009-06-24 05:01:51 +00:00
|
|
|
|
|
2018-04-17 18:51:53 +00:00
|
|
|
|
no_toggle_size = !reserve_toggle_size;
|
2009-06-24 05:01:51 +00:00
|
|
|
|
if (priv->no_toggle_size != no_toggle_size)
|
|
|
|
|
{
|
|
|
|
|
priv->no_toggle_size = no_toggle_size;
|
|
|
|
|
|
|
|
|
|
g_object_notify (G_OBJECT (menu), "reserve-toggle-size");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* gtk_menu_get_reserve_toggle_size:
|
|
|
|
|
* @menu: a #GtkMenu
|
|
|
|
|
*
|
|
|
|
|
* Returns whether the menu reserves space for toggles and
|
|
|
|
|
* icons, regardless of their actual presence.
|
|
|
|
|
*
|
|
|
|
|
* Returns: Whether the menu reserves toggle space
|
|
|
|
|
*
|
|
|
|
|
* Since: 2.18
|
|
|
|
|
*/
|
|
|
|
|
gboolean
|
|
|
|
|
gtk_menu_get_reserve_toggle_size (GtkMenu *menu)
|
|
|
|
|
{
|
2010-12-23 20:50:18 +00:00
|
|
|
|
g_return_val_if_fail (GTK_IS_MENU (menu), FALSE);
|
2009-06-24 05:01:51 +00:00
|
|
|
|
|
2010-12-23 20:50:18 +00:00
|
|
|
|
return !menu->priv->no_toggle_size;
|
2009-06-22 04:53:14 +00:00
|
|
|
|
}
|
2012-09-11 15:38:06 +00:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* gtk_menu_new_from_model:
|
|
|
|
|
* @model: a #GMenuModel
|
|
|
|
|
*
|
|
|
|
|
* Creates a #GtkMenu and populates it with menu items and
|
|
|
|
|
* submenus according to @model.
|
|
|
|
|
*
|
|
|
|
|
* The created menu items are connected to actions found in the
|
|
|
|
|
* #GtkApplicationWindow to which the menu belongs - typically
|
|
|
|
|
* by means of being attached to a widget (see gtk_menu_attach_to_widget())
|
|
|
|
|
* that is contained within the #GtkApplicationWindows widget hierarchy.
|
|
|
|
|
*
|
2013-10-11 08:25:24 +00:00
|
|
|
|
* Actions can also be added using gtk_widget_insert_action_group() on the menu's
|
|
|
|
|
* attach widget or on any of its parent widgets.
|
2013-10-10 17:00:53 +00:00
|
|
|
|
*
|
2012-09-11 15:38:06 +00:00
|
|
|
|
* Returns: a new #GtkMenu
|
|
|
|
|
*
|
|
|
|
|
* Since: 3.4
|
|
|
|
|
*/
|
|
|
|
|
GtkWidget *
|
|
|
|
|
gtk_menu_new_from_model (GMenuModel *model)
|
|
|
|
|
{
|
|
|
|
|
GtkWidget *menu;
|
|
|
|
|
|
|
|
|
|
g_return_val_if_fail (G_IS_MENU_MODEL (model), NULL);
|
|
|
|
|
|
|
|
|
|
menu = gtk_menu_new ();
|
|
|
|
|
gtk_menu_shell_bind_model (GTK_MENU_SHELL (menu), model, NULL, TRUE);
|
|
|
|
|
|
|
|
|
|
return menu;
|
|
|
|
|
}
|