| 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_H__ |
| 28 | #define |
| 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/gtkaccelgroup.h> |
| 36 | #include <gtk/gtkmenushell.h> |
| 37 | |
| 38 | |
| 39 | G_BEGIN_DECLS |
| 40 | |
| 41 | #define (gtk_menu_get_type ()) |
| 42 | #define (obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_MENU, GtkMenu)) |
| 43 | #define (klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_MENU, GtkMenuClass)) |
| 44 | #define (obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_MENU)) |
| 45 | #define (klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_MENU)) |
| 46 | #define (obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_MENU, GtkMenuClass)) |
| 47 | |
| 48 | |
| 49 | typedef struct _GtkMenu ; |
| 50 | typedef struct _GtkMenuClass ; |
| 51 | |
| 52 | typedef void (*) (GtkMenu *, |
| 53 | gint *x, |
| 54 | gint *y, |
| 55 | gboolean *push_in, |
| 56 | gpointer user_data); |
| 57 | typedef void (*) (GtkWidget *attach_widget, |
| 58 | GtkMenu *); |
| 59 | |
| 60 | struct |
| 61 | { |
| 62 | GtkMenuShell GSEAL (); |
| 63 | |
| 64 | GtkWidget *GSEAL (); |
| 65 | GtkWidget *GSEAL (); |
| 66 | |
| 67 | GtkAccelGroup *GSEAL (); |
| 68 | gchar *GSEAL (); |
| 69 | GtkMenuPositionFunc GSEAL (); |
| 70 | gpointer GSEAL (); |
| 71 | |
| 72 | guint GSEAL (); |
| 73 | /* Do _not_ touch these widgets directly. We hide the reference |
| 74 | * count from the toplevel to the menu, so it must be restored |
| 75 | * before operating on these widgets |
| 76 | */ |
| 77 | GtkWidget *GSEAL (); |
| 78 | |
| 79 | GtkWidget *GSEAL (); |
| 80 | GtkWidget *GSEAL (); |
| 81 | GtkWidget *GSEAL (); |
| 82 | GtkAdjustment *GSEAL (); |
| 83 | |
| 84 | GdkWindow *GSEAL (); |
| 85 | GdkWindow *GSEAL (); |
| 86 | |
| 87 | gint GSEAL (); |
| 88 | gint GSEAL (); |
| 89 | gint GSEAL (); |
| 90 | guint GSEAL (); |
| 91 | |
| 92 | /* When a submenu of this menu is popped up, motion in this |
| 93 | * region is ignored |
| 94 | */ |
| 95 | GdkRegion *GSEAL (); /* unused */ |
| 96 | guint GSEAL (); |
| 97 | |
| 98 | guint GSEAL () : 1; |
| 99 | guint GSEAL () : 1; |
| 100 | /* The tearoff is active when it is torn off and the not-torn-off |
| 101 | * menu is not popped up. |
| 102 | */ |
| 103 | guint GSEAL () : 1; |
| 104 | |
| 105 | guint GSEAL () : 1; |
| 106 | |
| 107 | guint GSEAL () : 1; |
| 108 | guint GSEAL () : 1; |
| 109 | guint GSEAL () : 1; |
| 110 | guint GSEAL () : 1; |
| 111 | }; |
| 112 | |
| 113 | struct |
| 114 | { |
| 115 | GtkMenuShellClass ; |
| 116 | |
| 117 | /* Padding for future expansion */ |
| 118 | void (*) (void); |
| 119 | void (*) (void); |
| 120 | void (*) (void); |
| 121 | void (*) (void); |
| 122 | }; |
| 123 | |
| 124 | |
| 125 | GType (void) G_GNUC_CONST; |
| 126 | GtkWidget* (void); |
| 127 | |
| 128 | /* Display the menu onscreen */ |
| 129 | void (GtkMenu *, |
| 130 | GtkWidget *, |
| 131 | GtkWidget *, |
| 132 | GtkMenuPositionFunc func, |
| 133 | gpointer data, |
| 134 | guint button, |
| 135 | guint32 activate_time); |
| 136 | |
| 137 | /* Position the menu according to its position function. Called |
| 138 | * from gtkmenuitem.c when a menu-item changes its allocation |
| 139 | */ |
| 140 | void (GtkMenu *); |
| 141 | |
| 142 | void (GtkMenu *); |
| 143 | |
| 144 | /* Keep track of the last menu item selected. (For the purposes |
| 145 | * of the option menu |
| 146 | */ |
| 147 | GtkWidget* (GtkMenu *); |
| 148 | void (GtkMenu *, |
| 149 | guint index_); |
| 150 | |
| 151 | /* set/get the accelerator group that holds global accelerators (should |
| 152 | * be added to the corresponding toplevel with gtk_window_add_accel_group(). |
| 153 | */ |
| 154 | void (GtkMenu *, |
| 155 | GtkAccelGroup *accel_group); |
| 156 | GtkAccelGroup* (GtkMenu *); |
| 157 | void (GtkMenu *, |
| 158 | const gchar *accel_path); |
| 159 | const gchar* (GtkMenu *); |
| 160 | |
| 161 | /* A reference count is kept for a widget when it is attached to |
| 162 | * a particular widget. This is typically a menu item; it may also |
| 163 | * be a widget with a popup menu - for instance, the Notebook widget. |
| 164 | */ |
| 165 | void (GtkMenu *, |
| 166 | GtkWidget *attach_widget, |
| 167 | GtkMenuDetachFunc detacher); |
| 168 | void (GtkMenu *); |
| 169 | |
| 170 | /* This should be dumped in favor of data set when the menu is popped |
| 171 | * up - that is currently in the ItemFactory code, but should be |
| 172 | * in the Menu code. |
| 173 | */ |
| 174 | GtkWidget* (GtkMenu *); |
| 175 | |
| 176 | void (GtkMenu *, |
| 177 | gboolean torn_off); |
| 178 | gboolean (GtkMenu *); |
| 179 | |
| 180 | /* This sets the window manager title for the window that |
| 181 | * appears when a menu is torn off |
| 182 | */ |
| 183 | void (GtkMenu *, |
| 184 | const gchar *title); |
| 185 | const gchar * (GtkMenu *); |
| 186 | |
| 187 | void (GtkMenu *, |
| 188 | GtkWidget *child, |
| 189 | gint position); |
| 190 | |
| 191 | void (GtkMenu *, |
| 192 | GdkScreen *screen); |
| 193 | |
| 194 | void (GtkMenu *, |
| 195 | GtkWidget *child, |
| 196 | guint left_attach, |
| 197 | guint right_attach, |
| 198 | guint top_attach, |
| 199 | guint bottom_attach); |
| 200 | |
| 201 | void (GtkMenu *, |
| 202 | gint monitor_num); |
| 203 | gint (GtkMenu *); |
| 204 | GList* (GtkWidget *widget); |
| 205 | |
| 206 | #ifndef GTK_DISABLE_DEPRECATED |
| 207 | #define (menu,child) gtk_menu_shell_append ((GtkMenuShell *)(menu),(child)) |
| 208 | #define (menu,child) gtk_menu_shell_prepend ((GtkMenuShell *)(menu),(child)) |
| 209 | #define (menu,child,pos) gtk_menu_shell_insert ((GtkMenuShell *)(menu),(child),(pos)) |
| 210 | #endif /* GTK_DISABLE_DEPRECATED */ |
| 211 | |
| 212 | void (GtkMenu *, |
| 213 | gboolean reserve_toggle_size); |
| 214 | gboolean (GtkMenu *); |
| 215 | |
| 216 | |
| 217 | G_END_DECLS |
| 218 | |
| 219 | #endif /* __GTK_MENU_H__ */ |
| 220 | |