1/* GTK - The GIMP Toolkit
2 * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
3 *
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version.
8 *
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
13 *
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the
16 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17 * Boston, MA 02111-1307, USA.
18 */
19
20/*
21 * Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
22 * file for a list of people on the GTK+ Team. See the ChangeLog
23 * files for a list of changes. These files are distributed with
24 * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
25 */
26
27#ifndef __GTK_MENU_SHELL_H__
28#define __GTK_MENU_SHELL_H__
29
30
31#if defined(GTK_DISABLE_SINGLE_INCLUDES) && !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION)
32#error "Only <gtk/gtk.h> can be included directly."
33#endif
34
35#include <gtk/gtkcontainer.h>
36
37
38G_BEGIN_DECLS
39
40#define GTK_TYPE_MENU_SHELL (gtk_menu_shell_get_type ())
41#define GTK_MENU_SHELL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_MENU_SHELL, GtkMenuShell))
42#define GTK_MENU_SHELL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_MENU_SHELL, GtkMenuShellClass))
43#define GTK_IS_MENU_SHELL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_MENU_SHELL))
44#define GTK_IS_MENU_SHELL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_MENU_SHELL))
45#define GTK_MENU_SHELL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_MENU_SHELL, GtkMenuShellClass))
46
47
48typedef struct _GtkMenuShell GtkMenuShell;
49typedef struct _GtkMenuShellClass GtkMenuShellClass;
50
51struct _GtkMenuShell
52{
53 GtkContainer container;
54
55 GList *GSEAL (children);
56 GtkWidget *GSEAL (active_menu_item);
57 GtkWidget *GSEAL (parent_menu_shell);
58
59 guint GSEAL (button);
60 guint32 GSEAL (activate_time);
61
62 guint GSEAL (active) : 1;
63 guint GSEAL (have_grab) : 1;
64 guint GSEAL (have_xgrab) : 1;
65 guint GSEAL (ignore_leave) : 1; /* unused */
66 guint GSEAL (menu_flag) : 1; /* unused */
67 guint GSEAL (ignore_enter) : 1;
68 guint GSEAL (keyboard_mode) : 1;
69};
70
71struct _GtkMenuShellClass
72{
73 GtkContainerClass parent_class;
74
75 guint submenu_placement : 1;
76
77 void (*deactivate) (GtkMenuShell *menu_shell);
78 void (*selection_done) (GtkMenuShell *menu_shell);
79
80 void (*move_current) (GtkMenuShell *menu_shell,
81 GtkMenuDirectionType direction);
82 void (*activate_current) (GtkMenuShell *menu_shell,
83 gboolean force_hide);
84 void (*cancel) (GtkMenuShell *menu_shell);
85 void (*select_item) (GtkMenuShell *menu_shell,
86 GtkWidget *menu_item);
87 void (*insert) (GtkMenuShell *menu_shell,
88 GtkWidget *child,
89 gint position);
90 gint (*get_popup_delay) (GtkMenuShell *menu_shell);
91 gboolean (*move_selected) (GtkMenuShell *menu_shell,
92 gint distance);
93
94 /* Padding for future expansion */
95 void (*_gtk_reserved1) (void);
96 void (*_gtk_reserved2) (void);
97};
98
99
100GType gtk_menu_shell_get_type (void) G_GNUC_CONST;
101void gtk_menu_shell_append (GtkMenuShell *menu_shell,
102 GtkWidget *child);
103void gtk_menu_shell_prepend (GtkMenuShell *menu_shell,
104 GtkWidget *child);
105void gtk_menu_shell_insert (GtkMenuShell *menu_shell,
106 GtkWidget *child,
107 gint position);
108void gtk_menu_shell_deactivate (GtkMenuShell *menu_shell);
109void gtk_menu_shell_select_item (GtkMenuShell *menu_shell,
110 GtkWidget *menu_item);
111void gtk_menu_shell_deselect (GtkMenuShell *menu_shell);
112void gtk_menu_shell_activate_item (GtkMenuShell *menu_shell,
113 GtkWidget *menu_item,
114 gboolean force_deactivate);
115void gtk_menu_shell_select_first (GtkMenuShell *menu_shell,
116 gboolean search_sensitive);
117void _gtk_menu_shell_select_last (GtkMenuShell *menu_shell,
118 gboolean search_sensitive);
119gint _gtk_menu_shell_get_popup_delay (GtkMenuShell *menu_shell);
120void gtk_menu_shell_cancel (GtkMenuShell *menu_shell);
121
122void _gtk_menu_shell_add_mnemonic (GtkMenuShell *menu_shell,
123 guint keyval,
124 GtkWidget *target);
125void _gtk_menu_shell_remove_mnemonic (GtkMenuShell *menu_shell,
126 guint keyval,
127 GtkWidget *target);
128
129gboolean gtk_menu_shell_get_take_focus (GtkMenuShell *menu_shell);
130void gtk_menu_shell_set_take_focus (GtkMenuShell *menu_shell,
131 gboolean take_focus);
132
133void _gtk_menu_shell_update_mnemonics (GtkMenuShell *menu_shell);
134void _gtk_menu_shell_set_keyboard_mode (GtkMenuShell *menu_shell,
135 gboolean keyboard_mode);
136gboolean _gtk_menu_shell_get_keyboard_mode (GtkMenuShell *menu_shell);
137
138G_END_DECLS
139
140#endif /* __GTK_MENU_SHELL_H__ */
141