gtkmenuitem.h 6.52 KB
Newer Older
Cody Russell's avatar
Cody Russell committed
1
/* GTK - The GIMP Toolkit
Elliot Lee's avatar
Elliot Lee committed
2 3 4
 * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
 *
 * This library is free software; you can redistribute it and/or
5
 * modify it under the terms of the GNU Lesser General Public
Elliot Lee's avatar
Elliot Lee committed
6 7 8 9 10
 * 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
11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12
 * Lesser General Public License for more details.
Elliot Lee's avatar
Elliot Lee committed
13
 *
14
 * You should have received a copy of the GNU Lesser General Public
Javier Jardon's avatar
Javier Jardon committed
15
 * License along with this library. If not, see <http://www.gnu.org/licenses/>.
Elliot Lee's avatar
Elliot Lee committed
16
 */
17 18

/*
19
 * Modified by the GTK+ Team and others 1997-2000.  See the AUTHORS
20 21
 * file for a list of people on the GTK+ Team.  See the ChangeLog
 * files for a list of changes.  These files are distributed with
22
 * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
23 24
 */

25 26 27
#ifndef __GTK_MENU_ITEM_H__
#define __GTK_MENU_ITEM_H__

28
#if !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION)
29 30 31
#error "Only <gtk/gtk.h> can be included directly."
#endif

Matthias Clasen's avatar
Matthias Clasen committed
32
#include <gtk/gtkbin.h>
Elliot Lee's avatar
Elliot Lee committed
33 34


35
G_BEGIN_DECLS
Elliot Lee's avatar
Elliot Lee committed
36

37 38 39 40 41 42
#define GTK_TYPE_MENU_ITEM            (gtk_menu_item_get_type ())
#define GTK_MENU_ITEM(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_MENU_ITEM, GtkMenuItem))
#define GTK_MENU_ITEM_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_MENU_ITEM, GtkMenuItemClass))
#define GTK_IS_MENU_ITEM(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_MENU_ITEM))
#define GTK_IS_MENU_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_MENU_ITEM))
#define GTK_MENU_ITEM_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_MENU_ITEM, GtkMenuItemClass))
Elliot Lee's avatar
Elliot Lee committed
43 44


45 46 47
typedef struct _GtkMenuItem        GtkMenuItem;
typedef struct _GtkMenuItemClass   GtkMenuItemClass;
typedef struct _GtkMenuItemPrivate GtkMenuItemPrivate;
Elliot Lee's avatar
Elliot Lee committed
48 49 50

struct _GtkMenuItem
{
Matthias Clasen's avatar
Matthias Clasen committed
51
  GtkBin bin;
Tim Janik's avatar
Tim Janik committed
52

53 54
  /*< private >*/
  GtkMenuItemPrivate *priv;
Elliot Lee's avatar
Elliot Lee committed
55 56
};

57 58 59
/**
 * GtkMenuItemClass:
 * @parent_class: The parent class.
60 61 62
 * @hide_on_activate: If %TRUE, then we should always
 *    hide the menu when the %GtkMenuItem is activated. Otherwise,
 *    it is up to the caller.
63 64 65 66 67 68 69 70 71 72
 * @activate: Signal emitted when the item is activated.
 * @activate_item: Signal emitted when the item is activated, but also
 *    if the menu item has a submenu.
 * @toggle_size_request: 
 * @toggle_size_allocate: 
 * @set_label: Sets @text on the #GtkMenuItem label
 * @get_label: Gets @text from the #GtkMenuItem label
 * @select: Signal emitted when the item is selected.
 * @deselect: Signal emitted when the item is deselected.
 */
Elliot Lee's avatar
Elliot Lee committed
73 74
struct _GtkMenuItemClass
{
Matthias Clasen's avatar
Matthias Clasen committed
75
  GtkBinClass parent_class;
76

77 78
  /*< public >*/

79 80
  /* If the following flag is true, then we should always
   * hide the menu when the MenuItem is activated. Otherwise,
81 82 83 84 85
   * it is up to the caller. For instance, when navigating
   * a menu with the keyboard, <Space> doesn't hide, but
   * <Return> does.
   */
  guint hide_on_activate : 1;
86

87 88 89
  void (* activate)             (GtkMenuItem *menu_item);
  void (* activate_item)        (GtkMenuItem *menu_item);
  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

Matthias Clasen's avatar
Matthias Clasen committed
97 98 99
  void (* select)               (GtkMenuItem *menu_item);
  void (* deselect)             (GtkMenuItem *menu_item);

100 101
  /*< private >*/

102 103 104
  /* Padding for future expansion */
  void (*_gtk_reserved1) (void);
  void (*_gtk_reserved2) (void);
Matthias Clasen's avatar
Matthias Clasen committed
105 106
  void (*_gtk_reserved3) (void);
  void (*_gtk_reserved4) (void);
Elliot Lee's avatar
Elliot Lee committed
107 108 109
};


110
GDK_AVAILABLE_IN_ALL
111 112
GType      gtk_menu_item_get_type             (void) G_GNUC_CONST;

113
GDK_AVAILABLE_IN_ALL
114
GtkWidget* gtk_menu_item_new                  (void);
115
GDK_AVAILABLE_IN_ALL
116
GtkWidget* gtk_menu_item_new_with_label       (const gchar         *label);
117
GDK_AVAILABLE_IN_ALL
118
GtkWidget* gtk_menu_item_new_with_mnemonic    (const gchar         *label);
119
GDK_AVAILABLE_IN_ALL
120
void       gtk_menu_item_set_submenu          (GtkMenuItem         *menu_item,
121
                                               GtkWidget           *submenu);
122
GDK_AVAILABLE_IN_ALL
123
GtkWidget* gtk_menu_item_get_submenu          (GtkMenuItem         *menu_item);
124
GDK_AVAILABLE_IN_ALL
125
void       gtk_menu_item_select               (GtkMenuItem         *menu_item);
126
GDK_AVAILABLE_IN_ALL
127
void       gtk_menu_item_deselect             (GtkMenuItem         *menu_item);
128
GDK_AVAILABLE_IN_ALL
129
void       gtk_menu_item_activate             (GtkMenuItem         *menu_item);
130
GDK_AVAILABLE_IN_ALL
131
void       gtk_menu_item_toggle_size_request  (GtkMenuItem         *menu_item,
132
                                               gint                *requisition);
133
GDK_AVAILABLE_IN_ALL
134
void       gtk_menu_item_toggle_size_allocate (GtkMenuItem         *menu_item,
135
                                               gint                 allocation);
136
GDK_DEPRECATED_IN_3_2
137
void       gtk_menu_item_set_right_justified  (GtkMenuItem         *menu_item,
138
                                               gboolean             right_justified);
139
GDK_DEPRECATED_IN_3_2
140
gboolean   gtk_menu_item_get_right_justified  (GtkMenuItem         *menu_item);
141
GDK_AVAILABLE_IN_ALL
142
void          gtk_menu_item_set_accel_path    (GtkMenuItem         *menu_item,
143
                                               const gchar         *accel_path);
144
GDK_AVAILABLE_IN_ALL
145
const gchar * gtk_menu_item_get_accel_path    (GtkMenuItem    *menu_item);
146

147
GDK_AVAILABLE_IN_ALL
148
void          gtk_menu_item_set_label         (GtkMenuItem         *menu_item,
149
                                               const gchar         *label);
150
GDK_AVAILABLE_IN_ALL
151
const gchar * gtk_menu_item_get_label         (GtkMenuItem         *menu_item);
152

153
GDK_AVAILABLE_IN_ALL
154
void       gtk_menu_item_set_use_underline    (GtkMenuItem         *menu_item,
155
                                               gboolean             setting);
156
GDK_AVAILABLE_IN_ALL
157 158
gboolean   gtk_menu_item_get_use_underline    (GtkMenuItem         *menu_item);

159
GDK_AVAILABLE_IN_ALL
160 161
void       gtk_menu_item_set_reserve_indicator (GtkMenuItem        *menu_item,
                                                gboolean            reserve);
162
GDK_AVAILABLE_IN_ALL
163
gboolean   gtk_menu_item_get_reserve_indicator (GtkMenuItem        *menu_item);
164

165
G_END_DECLS
Elliot Lee's avatar
Elliot Lee committed
166 167

#endif /* __GTK_MENU_ITEM_H__ */