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, see <http://www.gnu.org/licenses/>.
16 */
17
18/*
19 * Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
20 * file for a list of people on the GTK+ Team. See the ChangeLog
21 * files for a list of changes. These files are distributed with
22 * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
23 */
24
25#ifndef __GTK_MENU_ITEM_H__
26#define __GTK_MENU_ITEM_H__
27
28#if !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION)
29#error "Only <gtk/gtk.h> can be included directly."
30#endif
31
32#include <gtk/gtkbin.h>
33
34
35G_BEGIN_DECLS
36
37#define GTK_TYPE_MENU_ITEM (gtk_menu_item_get_type ())
38#define GTK_MENU_ITEM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_MENU_ITEM, GtkMenuItem))
39#define GTK_MENU_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_MENU_ITEM, GtkMenuItemClass))
40#define GTK_IS_MENU_ITEM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_MENU_ITEM))
41#define GTK_IS_MENU_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_MENU_ITEM))
42#define GTK_MENU_ITEM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_MENU_ITEM, GtkMenuItemClass))
43
44
45typedef struct _GtkMenuItem GtkMenuItem;
46typedef struct _GtkMenuItemClass GtkMenuItemClass;
47typedef struct _GtkMenuItemPrivate GtkMenuItemPrivate;
48
49struct _GtkMenuItem
50{
51 GtkBin bin;
52
53 /*< private >*/
54 GtkMenuItemPrivate *priv;
55};
56
57/**
58 * GtkMenuItemClass:
59 * @parent_class: The parent class.
60 * @hide_on_activate: If %TRUE, then we should always
61 * hide the menu when the %GtkMenuItem is activated. Otherwise,
62 * it is up to the caller.
63 * @activate: Signal emitted when the item is activated.
64 * @activate_item: Signal emitted when the item is activated, but also
65 * if the menu item has a submenu.
66 * @toggle_size_request:
67 * @toggle_size_allocate:
68 * @set_label: Sets @text on the #GtkMenuItem label
69 * @get_label: Gets @text from the #GtkMenuItem label
70 * @select: Signal emitted when the item is selected.
71 * @deselect: Signal emitted when the item is deselected.
72 */
73struct _GtkMenuItemClass
74{
75 GtkBinClass parent_class;
76
77 /*< public >*/
78
79 /* If the following flag is true, then we should always
80 * hide the menu when the MenuItem is activated. Otherwise,
81 * it is up to the caller. For instance, when navigating
82 * a menu with the keyboard, <Space> doesn't hide, but
83 * <Return> does.
84 */
85 guint hide_on_activate : 1;
86
87 void (* activate) (GtkMenuItem *menu_item);
88 void (* activate_item) (GtkMenuItem *menu_item);
89 void (* toggle_size_request) (GtkMenuItem *menu_item,
90 gint *requisition);
91 void (* toggle_size_allocate) (GtkMenuItem *menu_item,
92 gint allocation);
93 void (* set_label) (GtkMenuItem *menu_item,
94 const gchar *label);
95 const gchar * (* get_label) (GtkMenuItem *menu_item);
96
97 void (* select) (GtkMenuItem *menu_item);
98 void (* deselect) (GtkMenuItem *menu_item);
99
100 /*< private >*/
101
102 /* Padding for future expansion */
103 void (*_gtk_reserved1) (void);
104 void (*_gtk_reserved2) (void);
105 void (*_gtk_reserved3) (void);
106 void (*_gtk_reserved4) (void);
107};
108
109
110GDK_AVAILABLE_IN_ALL
111GType gtk_menu_item_get_type (void) G_GNUC_CONST;
112
113GDK_AVAILABLE_IN_ALL
114GtkWidget* gtk_menu_item_new (void);
115GDK_AVAILABLE_IN_ALL
116GtkWidget* gtk_menu_item_new_with_label (const gchar *label);
117GDK_AVAILABLE_IN_ALL
118GtkWidget* gtk_menu_item_new_with_mnemonic (const gchar *label);
119GDK_AVAILABLE_IN_ALL
120void gtk_menu_item_set_submenu (GtkMenuItem *menu_item,
121 GtkWidget *submenu);
122GDK_AVAILABLE_IN_ALL
123GtkWidget* gtk_menu_item_get_submenu (GtkMenuItem *menu_item);
124GDK_AVAILABLE_IN_ALL
125void gtk_menu_item_select (GtkMenuItem *menu_item);
126GDK_AVAILABLE_IN_ALL
127void gtk_menu_item_deselect (GtkMenuItem *menu_item);
128GDK_AVAILABLE_IN_ALL
129void gtk_menu_item_activate (GtkMenuItem *menu_item);
130GDK_AVAILABLE_IN_ALL
131void gtk_menu_item_toggle_size_request (GtkMenuItem *menu_item,
132 gint *requisition);
133GDK_AVAILABLE_IN_ALL
134void gtk_menu_item_toggle_size_allocate (GtkMenuItem *menu_item,
135 gint allocation);
136GDK_DEPRECATED_IN_3_2
137void gtk_menu_item_set_right_justified (GtkMenuItem *menu_item,
138 gboolean right_justified);
139GDK_DEPRECATED_IN_3_2
140gboolean gtk_menu_item_get_right_justified (GtkMenuItem *menu_item);
141GDK_AVAILABLE_IN_ALL
142void gtk_menu_item_set_accel_path (GtkMenuItem *menu_item,
143 const gchar *accel_path);
144GDK_AVAILABLE_IN_ALL
145const gchar * gtk_menu_item_get_accel_path (GtkMenuItem *menu_item);
146
147GDK_AVAILABLE_IN_ALL
148void gtk_menu_item_set_label (GtkMenuItem *menu_item,
149 const gchar *label);
150GDK_AVAILABLE_IN_ALL
151const gchar * gtk_menu_item_get_label (GtkMenuItem *menu_item);
152
153GDK_AVAILABLE_IN_ALL
154void gtk_menu_item_set_use_underline (GtkMenuItem *menu_item,
155 gboolean setting);
156GDK_AVAILABLE_IN_ALL
157gboolean gtk_menu_item_get_use_underline (GtkMenuItem *menu_item);
158
159GDK_AVAILABLE_IN_ALL
160void gtk_menu_item_set_reserve_indicator (GtkMenuItem *menu_item,
161 gboolean reserve);
162GDK_AVAILABLE_IN_ALL
163gboolean gtk_menu_item_get_reserve_indicator (GtkMenuItem *menu_item);
164
165G_END_DECLS
166
167#endif /* __GTK_MENU_ITEM_H__ */
168