1997-11-24 22:37:52 +00:00
|
|
|
/* GTK - The GIMP Toolkit
|
|
|
|
* Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Library General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Library General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Library General Public
|
1998-04-13 02:02:47 +00:00
|
|
|
* License along with this library; if not, write to the
|
|
|
|
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
|
|
* Boston, MA 02111-1307, USA.
|
1997-11-24 22:37:52 +00:00
|
|
|
*/
|
|
|
|
#include "gtkmain.h"
|
|
|
|
#include "gtkmenuitem.h"
|
|
|
|
#include "gtkmenushell.h"
|
|
|
|
#include "gtksignal.h"
|
|
|
|
|
|
|
|
|
|
|
|
#define MENU_SHELL_TIMEOUT 500
|
|
|
|
#define MENU_SHELL_CLASS(w) GTK_MENU_SHELL_CLASS (GTK_OBJECT (w)->klass)
|
|
|
|
|
|
|
|
|
|
|
|
enum {
|
|
|
|
DEACTIVATE,
|
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
|
|
|
SELECTION_DONE,
|
1997-11-24 22:37:52 +00:00
|
|
|
LAST_SIGNAL
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
static void gtk_menu_shell_class_init (GtkMenuShellClass *klass);
|
|
|
|
static void gtk_menu_shell_init (GtkMenuShell *menu_shell);
|
|
|
|
static void gtk_menu_shell_map (GtkWidget *widget);
|
|
|
|
static void gtk_menu_shell_realize (GtkWidget *widget);
|
|
|
|
static gint gtk_menu_shell_button_press (GtkWidget *widget,
|
|
|
|
GdkEventButton *event);
|
|
|
|
static gint gtk_menu_shell_button_release (GtkWidget *widget,
|
|
|
|
GdkEventButton *event);
|
|
|
|
static gint gtk_menu_shell_enter_notify (GtkWidget *widget,
|
|
|
|
GdkEventCrossing *event);
|
|
|
|
static gint gtk_menu_shell_leave_notify (GtkWidget *widget,
|
|
|
|
GdkEventCrossing *event);
|
|
|
|
static void gtk_menu_shell_add (GtkContainer *container,
|
|
|
|
GtkWidget *widget);
|
|
|
|
static void gtk_menu_shell_remove (GtkContainer *container,
|
|
|
|
GtkWidget *widget);
|
|
|
|
static void gtk_menu_shell_foreach (GtkContainer *container,
|
|
|
|
GtkCallback callback,
|
|
|
|
gpointer callback_data);
|
|
|
|
static void gtk_real_menu_shell_deactivate (GtkMenuShell *menu_shell);
|
|
|
|
static gint gtk_menu_shell_is_item (GtkMenuShell *menu_shell,
|
|
|
|
GtkWidget *child);
|
1998-03-24 01:43:21 +00:00
|
|
|
static GtkWidget *gtk_menu_shell_get_item (GtkMenuShell *menu_shell,
|
|
|
|
GdkEvent *event);
|
1998-06-16 05:20:05 +00:00
|
|
|
static GtkType gtk_menu_shell_child_type (GtkContainer *container);
|
1997-11-24 22:37:52 +00:00
|
|
|
|
|
|
|
|
|
|
|
static GtkContainerClass *parent_class = NULL;
|
1998-03-09 15:16:28 +00:00
|
|
|
static guint menu_shell_signals[LAST_SIGNAL] = { 0 };
|
1997-11-24 22:37:52 +00:00
|
|
|
|
|
|
|
|
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
|
|
|
GtkType
|
1998-05-03 22:41:32 +00:00
|
|
|
gtk_menu_shell_get_type (void)
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
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
|
|
|
static GtkType menu_shell_type = 0;
|
1997-11-24 22:37:52 +00:00
|
|
|
|
|
|
|
if (!menu_shell_type)
|
|
|
|
{
|
|
|
|
GtkTypeInfo menu_shell_info =
|
|
|
|
{
|
|
|
|
"GtkMenuShell",
|
|
|
|
sizeof (GtkMenuShell),
|
|
|
|
sizeof (GtkMenuShellClass),
|
|
|
|
(GtkClassInitFunc) gtk_menu_shell_class_init,
|
|
|
|
(GtkObjectInitFunc) gtk_menu_shell_init,
|
1998-06-28 07:46:10 +00:00
|
|
|
/* reversed_1 */ NULL,
|
|
|
|
/* reversed_2 */ NULL,
|
|
|
|
(GtkClassInitFunc) NULL,
|
1997-11-24 22:37:52 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
menu_shell_type = gtk_type_unique (gtk_container_get_type (), &menu_shell_info);
|
|
|
|
}
|
|
|
|
|
|
|
|
return menu_shell_type;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gtk_menu_shell_class_init (GtkMenuShellClass *klass)
|
|
|
|
{
|
|
|
|
GtkObjectClass *object_class;
|
|
|
|
GtkWidgetClass *widget_class;
|
|
|
|
GtkContainerClass *container_class;
|
|
|
|
|
|
|
|
object_class = (GtkObjectClass*) klass;
|
|
|
|
widget_class = (GtkWidgetClass*) klass;
|
|
|
|
container_class = (GtkContainerClass*) klass;
|
|
|
|
|
|
|
|
parent_class = gtk_type_class (gtk_container_get_type ());
|
|
|
|
|
|
|
|
menu_shell_signals[DEACTIVATE] =
|
|
|
|
gtk_signal_new ("deactivate",
|
|
|
|
GTK_RUN_FIRST,
|
|
|
|
object_class->type,
|
|
|
|
GTK_SIGNAL_OFFSET (GtkMenuShellClass, deactivate),
|
|
|
|
gtk_signal_default_marshaller,
|
|
|
|
GTK_TYPE_NONE, 0);
|
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
|
|
|
menu_shell_signals[SELECTION_DONE] =
|
|
|
|
gtk_signal_new ("selection-done",
|
|
|
|
GTK_RUN_FIRST,
|
|
|
|
object_class->type,
|
|
|
|
GTK_SIGNAL_OFFSET (GtkMenuShellClass, selection_done),
|
|
|
|
gtk_signal_default_marshaller,
|
|
|
|
GTK_TYPE_NONE, 0);
|
1997-11-24 22:37:52 +00:00
|
|
|
gtk_object_class_add_signals (object_class, menu_shell_signals, LAST_SIGNAL);
|
|
|
|
|
|
|
|
widget_class->map = gtk_menu_shell_map;
|
|
|
|
widget_class->realize = gtk_menu_shell_realize;
|
|
|
|
widget_class->button_press_event = gtk_menu_shell_button_press;
|
|
|
|
widget_class->button_release_event = gtk_menu_shell_button_release;
|
|
|
|
widget_class->enter_notify_event = gtk_menu_shell_enter_notify;
|
|
|
|
widget_class->leave_notify_event = gtk_menu_shell_leave_notify;
|
|
|
|
|
|
|
|
container_class->add = gtk_menu_shell_add;
|
|
|
|
container_class->remove = gtk_menu_shell_remove;
|
|
|
|
container_class->foreach = gtk_menu_shell_foreach;
|
1998-06-16 05:20:05 +00:00
|
|
|
container_class->child_type = gtk_menu_shell_child_type;
|
1997-11-24 22:37:52 +00:00
|
|
|
|
|
|
|
klass->submenu_placement = GTK_TOP_BOTTOM;
|
|
|
|
klass->deactivate = gtk_real_menu_shell_deactivate;
|
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
|
|
|
klass->selection_done = NULL;
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
|
|
|
|
1998-06-16 05:20:05 +00:00
|
|
|
static GtkType
|
|
|
|
gtk_menu_shell_child_type (GtkContainer *container)
|
|
|
|
{
|
|
|
|
return GTK_TYPE_MENU_ITEM;
|
|
|
|
}
|
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
static void
|
|
|
|
gtk_menu_shell_init (GtkMenuShell *menu_shell)
|
|
|
|
{
|
|
|
|
menu_shell->children = NULL;
|
|
|
|
menu_shell->active_menu_item = NULL;
|
|
|
|
menu_shell->parent_menu_shell = NULL;
|
|
|
|
menu_shell->active = FALSE;
|
|
|
|
menu_shell->have_grab = FALSE;
|
|
|
|
menu_shell->have_xgrab = FALSE;
|
|
|
|
menu_shell->ignore_leave = FALSE;
|
|
|
|
menu_shell->button = 0;
|
|
|
|
menu_shell->menu_flag = 0;
|
|
|
|
menu_shell->activate_time = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
gtk_menu_shell_append (GtkMenuShell *menu_shell,
|
|
|
|
GtkWidget *child)
|
|
|
|
{
|
|
|
|
gtk_menu_shell_insert (menu_shell, child, -1);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
gtk_menu_shell_prepend (GtkMenuShell *menu_shell,
|
|
|
|
GtkWidget *child)
|
|
|
|
{
|
|
|
|
gtk_menu_shell_insert (menu_shell, child, 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
gtk_menu_shell_insert (GtkMenuShell *menu_shell,
|
|
|
|
GtkWidget *child,
|
|
|
|
gint position)
|
|
|
|
{
|
|
|
|
GList *tmp_list;
|
|
|
|
GList *new_list;
|
|
|
|
gint nchildren;
|
|
|
|
|
|
|
|
g_return_if_fail (menu_shell != NULL);
|
|
|
|
g_return_if_fail (GTK_IS_MENU_SHELL (menu_shell));
|
|
|
|
g_return_if_fail (child != NULL);
|
|
|
|
g_return_if_fail (GTK_IS_MENU_ITEM (child));
|
|
|
|
|
|
|
|
gtk_widget_set_parent (child, GTK_WIDGET (menu_shell));
|
|
|
|
|
|
|
|
if (GTK_WIDGET_VISIBLE (child->parent))
|
|
|
|
{
|
|
|
|
if (GTK_WIDGET_REALIZED (child->parent) &&
|
|
|
|
!GTK_WIDGET_REALIZED (child))
|
|
|
|
gtk_widget_realize (child);
|
|
|
|
|
|
|
|
if (GTK_WIDGET_MAPPED (child->parent) &&
|
|
|
|
!GTK_WIDGET_MAPPED (child))
|
|
|
|
gtk_widget_map (child);
|
|
|
|
}
|
|
|
|
|
|
|
|
nchildren = g_list_length (menu_shell->children);
|
|
|
|
if ((position < 0) || (position > nchildren))
|
|
|
|
position = nchildren;
|
|
|
|
|
|
|
|
if (position == nchildren)
|
|
|
|
{
|
|
|
|
menu_shell->children = g_list_append (menu_shell->children, child);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
tmp_list = g_list_nth (menu_shell->children, position);
|
|
|
|
new_list = g_list_alloc ();
|
|
|
|
new_list->data = child;
|
|
|
|
|
|
|
|
if (tmp_list->prev)
|
|
|
|
tmp_list->prev->next = new_list;
|
|
|
|
new_list->next = tmp_list;
|
|
|
|
new_list->prev = tmp_list->prev;
|
|
|
|
tmp_list->prev = new_list;
|
|
|
|
|
|
|
|
if (tmp_list == menu_shell->children)
|
|
|
|
menu_shell->children = new_list;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (GTK_WIDGET_VISIBLE (menu_shell))
|
|
|
|
gtk_widget_queue_resize (GTK_WIDGET (menu_shell));
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
gtk_menu_shell_deactivate (GtkMenuShell *menu_shell)
|
|
|
|
{
|
|
|
|
g_return_if_fail (menu_shell != NULL);
|
|
|
|
g_return_if_fail (GTK_IS_MENU_SHELL (menu_shell));
|
|
|
|
|
|
|
|
gtk_signal_emit (GTK_OBJECT (menu_shell), menu_shell_signals[DEACTIVATE]);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gtk_menu_shell_map (GtkWidget *widget)
|
|
|
|
{
|
|
|
|
GtkMenuShell *menu_shell;
|
|
|
|
GtkWidget *child;
|
|
|
|
GList *children;
|
|
|
|
|
|
|
|
g_return_if_fail (widget != NULL);
|
|
|
|
g_return_if_fail (GTK_IS_MENU_SHELL (widget));
|
|
|
|
|
|
|
|
menu_shell = GTK_MENU_SHELL (widget);
|
|
|
|
GTK_WIDGET_SET_FLAGS (menu_shell, GTK_MAPPED);
|
|
|
|
gdk_window_show (widget->window);
|
|
|
|
|
|
|
|
children = menu_shell->children;
|
|
|
|
while (children)
|
|
|
|
{
|
|
|
|
child = children->data;
|
|
|
|
children = children->next;
|
|
|
|
|
|
|
|
if (GTK_WIDGET_VISIBLE (child) && !GTK_WIDGET_MAPPED (child))
|
|
|
|
gtk_widget_map (child);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gtk_menu_shell_realize (GtkWidget *widget)
|
|
|
|
{
|
|
|
|
GdkWindowAttr attributes;
|
|
|
|
gint attributes_mask;
|
|
|
|
|
|
|
|
g_return_if_fail (widget != NULL);
|
|
|
|
g_return_if_fail (GTK_IS_MENU_SHELL (widget));
|
|
|
|
|
|
|
|
GTK_WIDGET_SET_FLAGS (widget, GTK_REALIZED);
|
|
|
|
|
|
|
|
attributes.x = widget->allocation.x;
|
|
|
|
attributes.y = widget->allocation.y;
|
|
|
|
attributes.width = widget->allocation.width;
|
|
|
|
attributes.height = widget->allocation.height;
|
|
|
|
attributes.window_type = GDK_WINDOW_CHILD;
|
|
|
|
attributes.wclass = GDK_INPUT_OUTPUT;
|
|
|
|
attributes.visual = gtk_widget_get_visual (widget);
|
|
|
|
attributes.colormap = gtk_widget_get_colormap (widget);
|
|
|
|
attributes.event_mask = gtk_widget_get_events (widget);
|
|
|
|
attributes.event_mask |= (GDK_EXPOSURE_MASK |
|
|
|
|
GDK_BUTTON_PRESS_MASK |
|
|
|
|
GDK_BUTTON_RELEASE_MASK |
|
|
|
|
GDK_ENTER_NOTIFY_MASK |
|
|
|
|
GDK_LEAVE_NOTIFY_MASK);
|
|
|
|
|
|
|
|
attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP;
|
1998-01-18 15:09:10 +00:00
|
|
|
widget->window = gdk_window_new (gtk_widget_get_parent_window (widget), &attributes, attributes_mask);
|
1997-11-24 22:37:52 +00:00
|
|
|
gdk_window_set_user_data (widget->window, widget);
|
|
|
|
|
|
|
|
widget->style = gtk_style_attach (widget->style, widget->window);
|
|
|
|
gtk_style_set_background (widget->style, widget->window, GTK_STATE_NORMAL);
|
|
|
|
}
|
|
|
|
|
|
|
|
static gint
|
|
|
|
gtk_menu_shell_button_press (GtkWidget *widget,
|
|
|
|
GdkEventButton *event)
|
|
|
|
{
|
|
|
|
GtkMenuShell *menu_shell;
|
|
|
|
GtkWidget *menu_item;
|
|
|
|
|
|
|
|
g_return_val_if_fail (widget != NULL, FALSE);
|
|
|
|
g_return_val_if_fail (GTK_IS_MENU_SHELL (widget), FALSE);
|
|
|
|
g_return_val_if_fail (event != NULL, FALSE);
|
|
|
|
|
|
|
|
if (event->type != GDK_BUTTON_PRESS)
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
menu_shell = GTK_MENU_SHELL (widget);
|
|
|
|
|
|
|
|
if (menu_shell->parent_menu_shell)
|
|
|
|
{
|
|
|
|
gtk_widget_event (menu_shell->parent_menu_shell, (GdkEvent*) event);
|
|
|
|
}
|
|
|
|
else if (!menu_shell->active || !menu_shell->button)
|
|
|
|
{
|
|
|
|
if (!menu_shell->active)
|
|
|
|
{
|
|
|
|
gtk_grab_add (GTK_WIDGET (widget));
|
|
|
|
menu_shell->have_grab = TRUE;
|
1998-03-15 13:33:54 +00:00
|
|
|
menu_shell->active = TRUE;
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
1998-03-15 13:33:54 +00:00
|
|
|
menu_shell->button = event->button;
|
|
|
|
|
1998-03-24 01:43:21 +00:00
|
|
|
menu_item = gtk_menu_shell_get_item (menu_shell, (GdkEvent *)event);
|
1998-03-15 13:33:54 +00:00
|
|
|
|
1998-03-24 01:43:21 +00:00
|
|
|
if (menu_item &&
|
|
|
|
GTK_WIDGET_IS_SENSITIVE (menu_item))
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
|
|
|
if ((menu_item->parent == widget) &&
|
|
|
|
(menu_item != menu_shell->active_menu_item))
|
|
|
|
{
|
|
|
|
if (menu_shell->active_menu_item)
|
|
|
|
gtk_menu_item_deselect (GTK_MENU_ITEM (menu_shell->active_menu_item));
|
1998-01-30 23:47:09 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
menu_shell->active_menu_item = menu_item;
|
|
|
|
gtk_menu_item_set_placement (GTK_MENU_ITEM (menu_shell->active_menu_item),
|
|
|
|
MENU_SHELL_CLASS (menu_shell)->submenu_placement);
|
|
|
|
gtk_menu_item_select (GTK_MENU_ITEM (menu_shell->active_menu_item));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
widget = gtk_get_event_widget ((GdkEvent*) event);
|
|
|
|
if (widget == GTK_WIDGET (menu_shell))
|
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
|
|
|
{
|
|
|
|
gtk_menu_shell_deactivate (menu_shell);
|
|
|
|
gtk_signal_emit (GTK_OBJECT (menu_shell), menu_shell_signals[SELECTION_DONE]);
|
|
|
|
}
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static gint
|
|
|
|
gtk_menu_shell_button_release (GtkWidget *widget,
|
|
|
|
GdkEventButton *event)
|
|
|
|
{
|
|
|
|
GtkMenuShell *menu_shell;
|
|
|
|
GtkWidget *menu_item;
|
|
|
|
gint deactivate;
|
|
|
|
|
|
|
|
g_return_val_if_fail (widget != NULL, FALSE);
|
|
|
|
g_return_val_if_fail (GTK_IS_MENU_SHELL (widget), FALSE);
|
|
|
|
g_return_val_if_fail (event != NULL, FALSE);
|
|
|
|
|
|
|
|
menu_shell = GTK_MENU_SHELL (widget);
|
|
|
|
if (menu_shell->active)
|
|
|
|
{
|
1998-03-15 21:46:03 +00:00
|
|
|
if (menu_shell->button && (event->button != menu_shell->button))
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
1998-03-15 21:46:03 +00:00
|
|
|
menu_shell->button = 0;
|
1997-11-24 22:37:52 +00:00
|
|
|
if (menu_shell->parent_menu_shell)
|
|
|
|
gtk_widget_event (menu_shell->parent_menu_shell, (GdkEvent*) event);
|
|
|
|
return TRUE;
|
|
|
|
}
|
1998-03-15 13:33:54 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
menu_shell->button = 0;
|
1998-03-24 01:43:21 +00:00
|
|
|
menu_item = gtk_menu_shell_get_item (menu_shell, (GdkEvent*) event);
|
1998-03-15 13:33:54 +00:00
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
deactivate = TRUE;
|
|
|
|
|
|
|
|
if ((event->time - menu_shell->activate_time) > MENU_SHELL_TIMEOUT)
|
|
|
|
{
|
1998-03-24 01:43:21 +00:00
|
|
|
if (menu_item && (menu_shell->active_menu_item == menu_item))
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
|
|
|
if (GTK_MENU_ITEM (menu_item)->submenu == NULL)
|
|
|
|
{
|
|
|
|
gtk_menu_shell_deactivate (menu_shell);
|
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
|
|
|
|
|
|
|
/* flush the x-queue, so any grabs are removed and
|
|
|
|
* the menu is actually taken down
|
|
|
|
*/
|
|
|
|
gdk_flush ();
|
1997-11-24 22:37:52 +00:00
|
|
|
gtk_widget_activate (menu_item);
|
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
|
|
|
|
|
|
|
gtk_signal_emit (GTK_OBJECT (menu_shell), menu_shell_signals[SELECTION_DONE]);
|
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (menu_shell->parent_menu_shell)
|
|
|
|
{
|
|
|
|
menu_shell->active = TRUE;
|
|
|
|
gtk_widget_event (menu_shell->parent_menu_shell, (GdkEvent*) event);
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
deactivate = FALSE;
|
1998-03-24 01:43:21 +00:00
|
|
|
|
|
|
|
/* If the button click was very fast, or we ended up on a submenu,
|
|
|
|
* leave the menu up
|
|
|
|
*/
|
|
|
|
if (!deactivate ||
|
|
|
|
(menu_item && (menu_shell->active_menu_item == menu_item)))
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
|
|
|
deactivate = FALSE;
|
|
|
|
menu_shell->ignore_leave = TRUE;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
deactivate = TRUE;
|
|
|
|
|
|
|
|
if (deactivate)
|
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
|
|
|
{
|
|
|
|
gtk_menu_shell_deactivate (menu_shell);
|
|
|
|
gtk_signal_emit (GTK_OBJECT (menu_shell), menu_shell_signals[SELECTION_DONE]);
|
|
|
|
}
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static gint
|
|
|
|
gtk_menu_shell_enter_notify (GtkWidget *widget,
|
|
|
|
GdkEventCrossing *event)
|
|
|
|
{
|
|
|
|
GtkMenuShell *menu_shell;
|
|
|
|
GtkWidget *menu_item;
|
|
|
|
|
|
|
|
g_return_val_if_fail (widget != NULL, FALSE);
|
|
|
|
g_return_val_if_fail (GTK_IS_MENU_SHELL (widget), FALSE);
|
|
|
|
g_return_val_if_fail (event != NULL, FALSE);
|
|
|
|
|
|
|
|
menu_shell = GTK_MENU_SHELL (widget);
|
|
|
|
if (menu_shell->active)
|
|
|
|
{
|
|
|
|
menu_item = gtk_get_event_widget ((GdkEvent*) event);
|
|
|
|
|
1998-01-30 23:47:09 +00:00
|
|
|
if (!menu_item || !GTK_WIDGET_IS_SENSITIVE (menu_item))
|
1997-11-24 22:37:52 +00:00
|
|
|
return TRUE;
|
|
|
|
|
|
|
|
if ((menu_item->parent == widget) &&
|
|
|
|
(menu_shell->active_menu_item != menu_item) &&
|
|
|
|
GTK_IS_MENU_ITEM (menu_item))
|
|
|
|
{
|
|
|
|
if ((event->detail != GDK_NOTIFY_INFERIOR) &&
|
|
|
|
(GTK_WIDGET_STATE (menu_item) != GTK_STATE_PRELIGHT))
|
|
|
|
{
|
|
|
|
if (menu_shell->active_menu_item)
|
|
|
|
gtk_menu_item_deselect (GTK_MENU_ITEM (menu_shell->active_menu_item));
|
|
|
|
|
|
|
|
menu_shell->active_menu_item = menu_item;
|
|
|
|
gtk_menu_item_set_placement (GTK_MENU_ITEM (menu_shell->active_menu_item),
|
|
|
|
MENU_SHELL_CLASS (menu_shell)->submenu_placement);
|
|
|
|
gtk_menu_item_select (GTK_MENU_ITEM (menu_shell->active_menu_item));
|
1998-03-15 13:33:54 +00:00
|
|
|
if (GTK_MENU_ITEM (menu_shell->active_menu_item)->submenu)
|
|
|
|
gtk_widget_activate (menu_shell->active_menu_item);
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (menu_shell->parent_menu_shell)
|
|
|
|
{
|
|
|
|
gtk_widget_event (menu_shell->parent_menu_shell, (GdkEvent*) event);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static gint
|
|
|
|
gtk_menu_shell_leave_notify (GtkWidget *widget,
|
|
|
|
GdkEventCrossing *event)
|
|
|
|
{
|
|
|
|
GtkMenuShell *menu_shell;
|
|
|
|
GtkMenuItem *menu_item;
|
|
|
|
GtkWidget *event_widget;
|
|
|
|
|
|
|
|
g_return_val_if_fail (widget != NULL, FALSE);
|
|
|
|
g_return_val_if_fail (GTK_IS_MENU_SHELL (widget), FALSE);
|
|
|
|
g_return_val_if_fail (event != NULL, FALSE);
|
|
|
|
|
|
|
|
if (GTK_WIDGET_VISIBLE (widget))
|
|
|
|
{
|
|
|
|
menu_shell = GTK_MENU_SHELL (widget);
|
|
|
|
event_widget = gtk_get_event_widget ((GdkEvent*) event);
|
|
|
|
|
1998-01-30 23:47:09 +00:00
|
|
|
if (!event_widget || !GTK_IS_MENU_ITEM (event_widget))
|
1997-11-24 22:37:52 +00:00
|
|
|
return TRUE;
|
|
|
|
|
|
|
|
menu_item = GTK_MENU_ITEM (event_widget);
|
|
|
|
|
|
|
|
if (menu_shell->ignore_leave)
|
|
|
|
{
|
|
|
|
menu_shell->ignore_leave = FALSE;
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
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
|
|
|
if (!GTK_WIDGET_IS_SENSITIVE (menu_item))
|
|
|
|
return TRUE;
|
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
if ((menu_shell->active_menu_item == event_widget) &&
|
|
|
|
(menu_item->submenu == NULL))
|
|
|
|
{
|
|
|
|
if ((event->detail != GDK_NOTIFY_INFERIOR) &&
|
|
|
|
(GTK_WIDGET_STATE (menu_item) != GTK_STATE_NORMAL))
|
|
|
|
{
|
|
|
|
gtk_menu_item_deselect (GTK_MENU_ITEM (menu_shell->active_menu_item));
|
|
|
|
menu_shell->active_menu_item = NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (menu_shell->parent_menu_shell)
|
|
|
|
{
|
|
|
|
gtk_widget_event (menu_shell->parent_menu_shell, (GdkEvent*) event);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gtk_menu_shell_add (GtkContainer *container,
|
|
|
|
GtkWidget *widget)
|
|
|
|
{
|
|
|
|
gtk_menu_shell_append (GTK_MENU_SHELL (container), widget);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gtk_menu_shell_remove (GtkContainer *container,
|
|
|
|
GtkWidget *widget)
|
|
|
|
{
|
|
|
|
GtkMenuShell *menu_shell;
|
1998-01-30 23:47:09 +00:00
|
|
|
gint was_visible;
|
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
g_return_if_fail (container != NULL);
|
|
|
|
g_return_if_fail (GTK_IS_MENU_SHELL (container));
|
|
|
|
g_return_if_fail (widget != NULL);
|
|
|
|
g_return_if_fail (GTK_IS_MENU_ITEM (widget));
|
1998-01-30 23:47:09 +00:00
|
|
|
|
|
|
|
was_visible = GTK_WIDGET_VISIBLE (widget);
|
1997-11-24 22:37:52 +00:00
|
|
|
menu_shell = GTK_MENU_SHELL (container);
|
|
|
|
menu_shell->children = g_list_remove (menu_shell->children, widget);
|
1998-01-30 23:47:09 +00:00
|
|
|
|
|
|
|
gtk_widget_unparent (widget);
|
|
|
|
|
1998-06-24 17:15:05 +00:00
|
|
|
/* queue resize regardless of GTK_WIDGET_VISIBLE (container),
|
|
|
|
* since that's what is needed by toplevels.
|
|
|
|
*/
|
|
|
|
if (was_visible)
|
1997-11-24 22:37:52 +00:00
|
|
|
gtk_widget_queue_resize (GTK_WIDGET (container));
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gtk_menu_shell_foreach (GtkContainer *container,
|
|
|
|
GtkCallback callback,
|
|
|
|
gpointer callback_data)
|
|
|
|
{
|
|
|
|
GtkMenuShell *menu_shell;
|
|
|
|
GtkWidget *child;
|
|
|
|
GList *children;
|
|
|
|
|
|
|
|
g_return_if_fail (container != NULL);
|
|
|
|
g_return_if_fail (GTK_IS_MENU_SHELL (container));
|
|
|
|
g_return_if_fail (callback != NULL);
|
|
|
|
|
|
|
|
menu_shell = GTK_MENU_SHELL (container);
|
|
|
|
|
|
|
|
children = menu_shell->children;
|
|
|
|
while (children)
|
|
|
|
{
|
|
|
|
child = children->data;
|
|
|
|
children = children->next;
|
|
|
|
|
|
|
|
(* callback) (child, callback_data);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
gtk_real_menu_shell_deactivate (GtkMenuShell *menu_shell)
|
|
|
|
{
|
|
|
|
g_return_if_fail (menu_shell != NULL);
|
|
|
|
g_return_if_fail (GTK_IS_MENU_SHELL (menu_shell));
|
|
|
|
|
|
|
|
if (menu_shell->active)
|
|
|
|
{
|
|
|
|
menu_shell->button = 0;
|
|
|
|
menu_shell->active = FALSE;
|
|
|
|
|
|
|
|
if (menu_shell->active_menu_item)
|
|
|
|
{
|
|
|
|
gtk_menu_item_deselect (GTK_MENU_ITEM (menu_shell->active_menu_item));
|
|
|
|
menu_shell->active_menu_item = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (menu_shell->have_grab)
|
|
|
|
{
|
|
|
|
menu_shell->have_grab = FALSE;
|
|
|
|
gtk_grab_remove (GTK_WIDGET (menu_shell));
|
|
|
|
}
|
|
|
|
if (menu_shell->have_xgrab)
|
|
|
|
{
|
|
|
|
menu_shell->have_xgrab = FALSE;
|
|
|
|
gdk_pointer_ungrab (GDK_CURRENT_TIME);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static gint
|
|
|
|
gtk_menu_shell_is_item (GtkMenuShell *menu_shell,
|
|
|
|
GtkWidget *child)
|
|
|
|
{
|
1998-03-14 06:22:28 +00:00
|
|
|
GtkWidget *parent;
|
1997-11-24 22:37:52 +00:00
|
|
|
|
|
|
|
g_return_val_if_fail (menu_shell != NULL, FALSE);
|
|
|
|
g_return_val_if_fail (GTK_IS_MENU_SHELL (menu_shell), FALSE);
|
|
|
|
g_return_val_if_fail (child != NULL, FALSE);
|
|
|
|
|
1998-03-14 06:22:28 +00:00
|
|
|
parent = child->parent;
|
1997-11-24 22:37:52 +00:00
|
|
|
while (parent && GTK_IS_MENU_SHELL (parent))
|
|
|
|
{
|
1998-03-14 06:22:28 +00:00
|
|
|
if (parent == (GtkWidget*) menu_shell)
|
1997-11-24 22:37:52 +00:00
|
|
|
return TRUE;
|
1998-03-14 06:22:28 +00:00
|
|
|
parent = GTK_MENU_SHELL (parent)->parent_menu_shell;
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
1998-03-24 01:43:21 +00:00
|
|
|
|
|
|
|
static GtkWidget *
|
|
|
|
gtk_menu_shell_get_item (GtkMenuShell *menu_shell,
|
|
|
|
GdkEvent *event)
|
|
|
|
{
|
|
|
|
GtkWidget *menu_item;
|
|
|
|
|
|
|
|
menu_item = gtk_get_event_widget ((GdkEvent*) event);
|
|
|
|
|
|
|
|
while (menu_item && !GTK_IS_MENU_ITEM (menu_item))
|
|
|
|
menu_item = menu_item->parent;
|
|
|
|
|
|
|
|
if (menu_item && gtk_menu_shell_is_item (menu_shell, menu_item))
|
|
|
|
return menu_item;
|
|
|
|
else
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|