1
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
4
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
6
<meta name="generator" content="DocBook XSL Stylesheets V1.72.0">
7
<link rel="start" href="index.html" title="GTK+ Reference Manual">
8
<link rel="up" href="MenusAndCombos.html" title="Menus, Combo Box, Toolbar">
9
<link rel="prev" href="GtkComboBoxEntry.html" title="GtkComboBoxEntry">
10
<link rel="next" href="GtkMenuBar.html" title="GtkMenuBar">
11
<meta name="generator" content="GTK-Doc V1.7 (XML mode)">
12
<link rel="stylesheet" href="style.css" type="text/css">
13
<link rel="part" href="gtk.html" title="Part I. GTK+ Overview">
14
<link rel="part" href="gtkbase.html" title="Part II. GTK+ Core Reference">
15
<link rel="part" href="gtkobjects.html" title="Part III. GTK+ Widgets and Objects">
16
<link rel="chapter" href="ch01.html" title="Object Hierarchy">
17
<link rel="chapter" href="ch02.html" title="Widget Gallery">
18
<link rel="chapter" href="WindowWidgets.html" title="Windows">
19
<link rel="chapter" href="DisplayWidgets.html" title="Display Widgets">
20
<link rel="chapter" href="ButtonWidgets.html" title="Buttons and Toggles">
21
<link rel="chapter" href="NumericEntry.html" title="Numeric/Text Data Entry">
22
<link rel="chapter" href="TextWidgetObjects.html" title="Multiline Text Editor">
23
<link rel="chapter" href="TreeWidgetObjects.html" title="Tree, List and Icon Grid Widgets">
24
<link rel="chapter" href="MenusAndCombos.html" title="Menus, Combo Box, Toolbar">
25
<link rel="chapter" href="Actions.html" title="Action-based menus and toolbars">
26
<link rel="chapter" href="SelectorWidgets.html" title="Selectors (File/Font/Color/Input Devices)">
27
<link rel="chapter" href="LayoutContainers.html" title="Layout Containers">
28
<link rel="chapter" href="Ornaments.html" title="Ornaments">
29
<link rel="chapter" href="ScrollingWidgets.html" title="Scrolling">
30
<link rel="chapter" href="Printing.html" title="Printing">
31
<link rel="chapter" href="MiscObjects.html" title="Miscellaneous">
32
<link rel="chapter" href="AbstractObjects.html" title="Abstract Base Classes">
33
<link rel="chapter" href="PlugSocket.html" title="Cross-process Embedding">
34
<link rel="chapter" href="SpecialObjects.html" title="Special-purpose features">
35
<link rel="chapter" href="RecentDocuments.html" title="Recently Used Documents">
36
<link rel="chapter" href="DeprecatedObjects.html" title="Deprecated">
37
<link rel="part" href="migrating.html" title="Part IV. Migrating from Previous Versions of GTK+">
38
<link rel="chapter" href="gtk-migrating-checklist.html" title="Migration Checklist">
39
<link rel="chapter" href="gtk-migrating-GtkFileChooser.html" title="Migrating from GtkFileSelection to GtkFileChooser">
40
<link rel="chapter" href="gtk-migrating-GtkAction.html" title="Migrating from old menu and toolbar systems to GtkAction">
41
<link rel="chapter" href="gtk-migrating-GtkComboBox.html" title="Migrating from GtkOptionMenu and GtkCombo to GtkComboBox and GtkComboBoxEntry">
42
<link rel="chapter" href="gtk-migrating-GtkIconView.html" title="Migrating from GnomeIconList to GtkIconView">
43
<link rel="chapter" href="gtk-migrating-GtkAboutDialog.html" title="Migrating from GnomeAbout to GtkAboutDialog">
44
<link rel="chapter" href="gtk-migrating-GtkColorButton.html" title="Migrating from GnomeColorPicker to GtkColorButton">
45
<link rel="chapter" href="gtk-migrating-GtkAssistant.html" title="Migrating from GnomeDruid to GtkAssistant">
46
<link rel="chapter" href="gtk-migrating-GtkRecentChooser.html" title="Migrating from EggRecent to GtkRecentChooser">
47
<link rel="chapter" href="gtk-migrating-GtkLinkButton.html" title="Migrating from GnomeHRef to GtkLinkButton">
48
<link rel="part" href="pt05.html" title="Part V. GTK+ Tools">
49
<link rel="glossary" href="glossary.html" title="Glossary">
50
<link rel="index" href="ix01.html" title="Index">
51
<link rel="index" href="ix02.html" title="Index of deprecated symbols">
52
<link rel="index" href="ix03.html" title="Index of new symbols in 2.2">
53
<link rel="index" href="ix04.html" title="Index of new symbols in 2.4">
54
<link rel="index" href="ix05.html" title="Index of new symbols in 2.6">
55
<link rel="index" href="ix06.html" title="Index of new symbols in 2.8">
56
<link rel="index" href="ix07.html" title="Index of new symbols in 2.10">
58
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
59
<table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2">
61
<td><a accesskey="p" href="GtkComboBoxEntry.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></a></td>
62
<td><a accesskey="u" href="MenusAndCombos.html"><img src="up.png" width="24" height="24" border="0" alt="Up"></a></td>
63
<td><a accesskey="h" href="index.html"><img src="home.png" width="24" height="24" border="0" alt="Home"></a></td>
64
<th width="100%" align="center">GTK+ Reference Manual</th>
65
<td><a accesskey="n" href="GtkMenuBar.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td>
67
<tr><td colspan="5" class="shortcuts"><nobr><a href="#id3335533" class="shortcut">Top</a>
69
<a href="#id3336669" class="shortcut">Description</a>
71
<a href="#id3336315" class="shortcut">Object Hierarchy</a>
73
<a href="#id3336385" class="shortcut">Implemented Interfaces</a>
75
<a href="#id3336407" class="shortcut">Properties</a>
77
<a href="#id3336458" class="shortcut">Child Properties</a>
79
<a href="#id3336542" class="shortcut">Style Properties</a>
81
<a href="#id3336641" class="shortcut">Signals</a></nobr></td></tr>
83
<div class="refentry" lang="en">
84
<a name="GtkMenu"></a><div class="titlepage"></div>
85
<div class="refnamediv"><table width="100%"><tr>
88
<a name="id3335533"></a><span class="refentrytitle">GtkMenu</span>
90
<p>GtkMenu — A menu widget</p>
92
<td valign="top" align="right"></td>
94
<div class="refsynopsisdiv">
96
<pre class="synopsis">
98
#include <gtk/gtk.h>
101
<a href="GtkMenu.html#GtkMenu-struct">GtkMenu</a>;
102
<a href="GtkWidget.html" title="GtkWidget">GtkWidget</a>* <a href="GtkMenu.html#gtk-menu-new">gtk_menu_new</a> (void);
103
void <a href="GtkMenu.html#gtk-menu-set-screen">gtk_menu_set_screen</a> (<a href="GtkMenu.html" title="GtkMenu">GtkMenu</a> *menu,
105
href="../gdk/GdkScreen.html"
106
>GdkScreen</a> *screen);
107
#define <a href="GtkMenu.html#gtk-menu-append">gtk_menu_append</a> (menu,child)
108
#define <a href="GtkMenu.html#gtk-menu-prepend">gtk_menu_prepend</a> (menu,child)
109
#define <a href="GtkMenu.html#gtk-menu-insert">gtk_menu_insert</a> (menu,child,pos)
110
void <a href="GtkMenu.html#gtk-menu-reorder-child">gtk_menu_reorder_child</a> (<a href="GtkMenu.html" title="GtkMenu">GtkMenu</a> *menu,
111
<a href="GtkWidget.html" title="GtkWidget">GtkWidget</a> *child,
113
void <a href="GtkMenu.html#gtk-menu-attach">gtk_menu_attach</a> (<a href="GtkMenu.html" title="GtkMenu">GtkMenu</a> *menu,
114
<a href="GtkWidget.html" title="GtkWidget">GtkWidget</a> *child,
118
guint bottom_attach);
119
void <a href="GtkMenu.html#gtk-menu-popup">gtk_menu_popup</a> (<a href="GtkMenu.html" title="GtkMenu">GtkMenu</a> *menu,
120
<a href="GtkWidget.html" title="GtkWidget">GtkWidget</a> *parent_menu_shell,
121
<a href="GtkWidget.html" title="GtkWidget">GtkWidget</a> *parent_menu_item,
122
<a href="GtkMenu.html#GtkMenuPositionFunc">GtkMenuPositionFunc</a> func,
125
guint32 activate_time);
126
void <a href="GtkMenu.html#gtk-menu-set-accel-group">gtk_menu_set_accel_group</a> (<a href="GtkMenu.html" title="GtkMenu">GtkMenu</a> *menu,
127
<a href="gtk-Keyboard-Accelerators.html#GtkAccelGroup">GtkAccelGroup</a> *accel_group);
128
<a href="gtk-Keyboard-Accelerators.html#GtkAccelGroup">GtkAccelGroup</a>* <a href="GtkMenu.html#gtk-menu-get-accel-group">gtk_menu_get_accel_group</a> (<a href="GtkMenu.html" title="GtkMenu">GtkMenu</a> *menu);
129
void <a href="GtkMenu.html#gtk-menu-set-accel-path">gtk_menu_set_accel_path</a> (<a href="GtkMenu.html" title="GtkMenu">GtkMenu</a> *menu,
130
const gchar *accel_path);
131
void <a href="GtkMenu.html#gtk-menu-set-title">gtk_menu_set_title</a> (<a href="GtkMenu.html" title="GtkMenu">GtkMenu</a> *menu,
133
gboolean <a href="GtkMenu.html#gtk-menu-get-tearoff-state">gtk_menu_get_tearoff_state</a> (<a href="GtkMenu.html" title="GtkMenu">GtkMenu</a> *menu);
134
const gchar* <a href="GtkMenu.html#gtk-menu-get-title">gtk_menu_get_title</a> (<a href="GtkMenu.html" title="GtkMenu">GtkMenu</a> *menu);
136
void <a href="GtkMenu.html#gtk-menu-popdown">gtk_menu_popdown</a> (<a href="GtkMenu.html" title="GtkMenu">GtkMenu</a> *menu);
137
void <a href="GtkMenu.html#gtk-menu-reposition">gtk_menu_reposition</a> (<a href="GtkMenu.html" title="GtkMenu">GtkMenu</a> *menu);
138
<a href="GtkWidget.html" title="GtkWidget">GtkWidget</a>* <a href="GtkMenu.html#gtk-menu-get-active">gtk_menu_get_active</a> (<a href="GtkMenu.html" title="GtkMenu">GtkMenu</a> *menu);
139
void <a href="GtkMenu.html#gtk-menu-set-active">gtk_menu_set_active</a> (<a href="GtkMenu.html" title="GtkMenu">GtkMenu</a> *menu,
141
void <a href="GtkMenu.html#gtk-menu-set-tearoff-state">gtk_menu_set_tearoff_state</a> (<a href="GtkMenu.html" title="GtkMenu">GtkMenu</a> *menu,
143
void <a href="GtkMenu.html#gtk-menu-attach-to-widget">gtk_menu_attach_to_widget</a> (<a href="GtkMenu.html" title="GtkMenu">GtkMenu</a> *menu,
144
<a href="GtkWidget.html" title="GtkWidget">GtkWidget</a> *attach_widget,
145
<a href="GtkMenu.html#GtkMenuDetachFunc">GtkMenuDetachFunc</a> detacher);
146
void <a href="GtkMenu.html#gtk-menu-detach">gtk_menu_detach</a> (<a href="GtkMenu.html" title="GtkMenu">GtkMenu</a> *menu);
147
<a href="GtkWidget.html" title="GtkWidget">GtkWidget</a>* <a href="GtkMenu.html#gtk-menu-get-attach-widget">gtk_menu_get_attach_widget</a> (<a href="GtkMenu.html" title="GtkMenu">GtkMenu</a> *menu);
148
GList* <a href="GtkMenu.html#gtk-menu-get-for-attach-widget">gtk_menu_get_for_attach_widget</a> (<a href="GtkWidget.html" title="GtkWidget">GtkWidget</a> *widget);
149
void (<a href="GtkMenu.html#GtkMenuPositionFunc">*GtkMenuPositionFunc</a>) (<a href="GtkMenu.html" title="GtkMenu">GtkMenu</a> *menu,
154
void (<a href="GtkMenu.html#GtkMenuDetachFunc">*GtkMenuDetachFunc</a>) (<a href="GtkWidget.html" title="GtkWidget">GtkWidget</a> *attach_widget,
155
<a href="GtkMenu.html" title="GtkMenu">GtkMenu</a> *menu);
156
void <a href="GtkMenu.html#gtk-menu-set-monitor">gtk_menu_set_monitor</a> (<a href="GtkMenu.html" title="GtkMenu">GtkMenu</a> *menu,
162
<div class="refsect1" lang="en">
163
<a name="id3336315"></a><h2>Object Hierarchy</h2>
164
<pre class="synopsis">
167
+----GInitiallyUnowned
168
+----<a href="GtkObject.html" title="GtkObject">GtkObject</a>
169
+----<a href="GtkWidget.html" title="GtkWidget">GtkWidget</a>
170
+----<a href="GtkContainer.html" title="GtkContainer">GtkContainer</a>
171
+----<a href="GtkMenuShell.html" title="GtkMenuShell">GtkMenuShell</a>
173
+----<a href="GtkRecentChooserMenu.html" title="GtkRecentChooserMenu">GtkRecentChooserMenu</a>
176
<div class="refsect1" lang="en">
177
<a name="id3336385"></a><h2>Implemented Interfaces</h2>
180
AtkImplementorIface.</p>
182
<div class="refsect1" lang="en">
183
<a name="id3336407"></a><h2>Properties</h2>
184
<pre class="synopsis">
186
"<a href="GtkMenu.html#GtkMenu--tearoff-state">tearoff-state</a>" gboolean : Read / Write
187
"<a href="GtkMenu.html#GtkMenu--tearoff-title">tearoff-title</a>" gchararray : Read / Write
190
<div class="refsect1" lang="en">
191
<a name="id3336458"></a><h2>Child Properties</h2>
192
<pre class="synopsis">
194
"<a href="GtkMenu.html#GtkMenu--bottom-attach">bottom-attach</a>" gint : Read / Write
195
"<a href="GtkMenu.html#GtkMenu--left-attach">left-attach</a>" gint : Read / Write
196
"<a href="GtkMenu.html#GtkMenu--right-attach">right-attach</a>" gint : Read / Write
197
"<a href="GtkMenu.html#GtkMenu--top-attach">top-attach</a>" gint : Read / Write
200
<div class="refsect1" lang="en">
201
<a name="id3336542"></a><h2>Style Properties</h2>
202
<pre class="synopsis">
204
"<a href="GtkMenu.html#GtkMenu--double-arrows">double-arrows</a>" gboolean : Read
205
"<a href="GtkMenu.html#GtkMenu--horizontal-offset">horizontal-offset</a>" gint : Read
206
"<a href="GtkMenu.html#GtkMenu--horizontal-padding">horizontal-padding</a>" gint : Read
207
"<a href="GtkMenu.html#GtkMenu--vertical-offset">vertical-offset</a>" gint : Read
208
"<a href="GtkMenu.html#GtkMenu--vertical-padding">vertical-padding</a>" gint : Read
211
<div class="refsect1" lang="en">
212
<a name="id3336641"></a><h2>Signals</h2>
213
<pre class="synopsis">
215
"<a href="GtkMenu.html#GtkMenu-move-scroll">move-scroll</a>" : Run Last / Action
218
<div class="refsect1" lang="en">
219
<a name="id3336669"></a><h2>Description</h2>
221
A <a href="GtkMenu.html" title="GtkMenu"><span class="type">GtkMenu</span></a> is a <a href="GtkMenuShell.html" title="GtkMenuShell"><span class="type">GtkMenuShell</span></a> that implements a drop down menu consisting of
222
a list of <a href="GtkMenuItem.html" title="GtkMenuItem"><span class="type">GtkMenuItem</span></a> objects which can be navigated and activated by the
223
user to perform application functions.
226
A <a href="GtkMenu.html" title="GtkMenu"><span class="type">GtkMenu</span></a> is most commonly dropped down by activating a <a href="GtkMenuItem.html" title="GtkMenuItem"><span class="type">GtkMenuItem</span></a> in a
227
<a href="GtkMenuBar.html" title="GtkMenuBar"><span class="type">GtkMenuBar</span></a> or popped up by activating a <a href="GtkMenuItem.html" title="GtkMenuItem"><span class="type">GtkMenuItem</span></a> in another <a href="GtkMenu.html" title="GtkMenu"><span class="type">GtkMenu</span></a>.
230
A <a href="GtkMenu.html" title="GtkMenu"><span class="type">GtkMenu</span></a> can also be popped up by activating a <a href="GtkOptionMenu.html" title="GtkOptionMenu"><span class="type">GtkOptionMenu</span></a>.
231
Other composite widgets such as the <a href="GtkNotebook.html" title="GtkNotebook"><span class="type">GtkNotebook</span></a> can pop up a <a href="GtkMenu.html" title="GtkMenu"><span class="type">GtkMenu</span></a>
235
Applications can display a <a href="GtkMenu.html" title="GtkMenu"><span class="type">GtkMenu</span></a> as a popup menu by calling the
236
<a href="GtkMenu.html#gtk-menu-popup"><code class="function">gtk_menu_popup()</code></a> function. The example below shows how an application
237
can pop up a menu when the 3rd mouse button is pressed.
239
<div class="example">
240
<a name="id3336815"></a><p class="title"><b>Example 19. Connecting the popup signal handler.</b></p>
241
<div class="example-contents"><pre class="programlisting">
242
/* connect our handler which will popup the menu */
243
g_signal_connect_swapped (window, "button_press_event",
244
G_CALLBACK (my_popup_handler), menu);
247
<br class="example-break"><div class="example">
248
<a name="id3336830"></a><p class="title"><b>Example 20. Signal handler which displays a popup menu.</b></p>
249
<div class="example-contents"><pre class="programlisting">
251
my_popup_handler (GtkWidget *widget, GdkEvent *event)
254
GdkEventButton *event_button;
256
g_return_val_if_fail (widget != NULL, FALSE);
257
g_return_val_if_fail (GTK_IS_MENU (widget), FALSE);
258
g_return_val_if_fail (event != NULL, FALSE);
260
/* The "widget" is the menu that was supplied when
261
* g_signal_connect_swapped() was called.
263
menu = GTK_MENU (widget);
265
if (event->type == GDK_BUTTON_PRESS)
267
event_button = (GdkEventButton *) event;
268
if (event_button->button == 3)
270
gtk_menu_popup (menu, NULL, NULL, NULL, NULL,
271
event_button->button, event_button->time);
280
<br class="example-break">
282
<div class="refsect1" lang="en">
283
<a name="id3336856"></a><h2>Details</h2>
284
<div class="refsect2" lang="en">
285
<a name="id3336866"></a><h3>
286
<a name="GtkMenu-struct"></a>GtkMenu</h3>
287
<a class="indexterm" name="id3336879"></a><pre class="programlisting">typedef struct _GtkMenu GtkMenu;</pre>
289
The <a href="GtkMenu.html" title="GtkMenu"><span class="type">GtkMenu</span></a> struct contains private data only, and
290
should be accessed using the functions below.
294
<div class="refsect2" lang="en">
295
<a name="id3336904"></a><h3>
296
<a name="gtk-menu-new"></a>gtk_menu_new ()</h3>
297
<a class="indexterm" name="id3336917"></a><pre class="programlisting"><a href="GtkWidget.html" title="GtkWidget">GtkWidget</a>* gtk_menu_new (void);</pre>
299
Creates a new <a href="GtkMenu.html" title="GtkMenu"><span class="type">GtkMenu</span></a>.
301
<div class="variablelist"><table border="0">
302
<col align="left" valign="top">
304
<td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
305
<td>a new <a href="GtkMenu.html" title="GtkMenu"><span class="type">GtkMenu</span></a>.
313
<div class="refsect2" lang="en">
314
<a name="id3336969"></a><h3>
315
<a name="gtk-menu-set-screen"></a>gtk_menu_set_screen ()</h3>
316
<a class="indexterm" name="id3336985"></a><pre class="programlisting">void gtk_menu_set_screen (<a href="GtkMenu.html" title="GtkMenu">GtkMenu</a> *menu,
318
href="../gdk/GdkScreen.html"
319
>GdkScreen</a> *screen);</pre>
322
href="../gdk/GdkScreen.html"
323
><span class="type">GdkScreen</span></a> on which the menu will be displayed.</p>
327
<div class="variablelist"><table border="0">
328
<col align="left" valign="top">
331
<td><span class="term"><em class="parameter"><code>menu</code></em> :</span></td>
332
<td> a <a href="GtkMenu.html" title="GtkMenu"><span class="type">GtkMenu</span></a>.
336
<td><span class="term"><em class="parameter"><code>screen</code></em> :</span></td>
338
href="../gdk/GdkScreen.html"
339
><span class="type">GdkScreen</span></a>, or <a
340
href="../liboil/liboil-liboiljunk.html#NULL:CAPS"
341
><code class="literal">NULL</code></a> if the screen should be
342
determined by the widget the menu is attached to.
347
<p class="since">Since 2.2
351
<div class="refsect2" lang="en">
352
<a name="id3337098"></a><h3>
353
<a name="gtk-menu-append"></a>gtk_menu_append()</h3>
354
<a class="indexterm" name="id3337113"></a><pre class="programlisting">#define gtk_menu_append(menu,child) gtk_menu_shell_append ((GtkMenuShell *)(menu),(child))
356
<div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;">
357
<h3 class="title">Warning</h3>
358
<p><code class="literal">gtk_menu_append</code> is deprecated and should not be used in newly-written code. Use <a href="GtkMenuShell.html#gtk-menu-shell-append"><code class="function">gtk_menu_shell_append()</code></a> instead.</p>
361
Adds a new <a href="GtkMenuItem.html" title="GtkMenuItem"><span class="type">GtkMenuItem</span></a> to the end of the menu's item list.
363
<div class="variablelist"><table border="0">
364
<col align="left" valign="top">
367
<td><span class="term"><em class="parameter"><code>menu</code></em> :</span></td>
368
<td>a <a href="GtkMenu.html" title="GtkMenu"><span class="type">GtkMenu</span></a>.
372
<td><span class="term"><em class="parameter"><code>child</code></em> :</span></td>
373
<td>The <a href="GtkMenuItem.html" title="GtkMenuItem"><span class="type">GtkMenuItem</span></a> to add.
380
<div class="refsect2" lang="en">
381
<a name="id3337210"></a><h3>
382
<a name="gtk-menu-prepend"></a>gtk_menu_prepend()</h3>
383
<a class="indexterm" name="id3337226"></a><pre class="programlisting">#define gtk_menu_prepend(menu,child) gtk_menu_shell_prepend ((GtkMenuShell *)(menu),(child))
385
<div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;">
386
<h3 class="title">Warning</h3>
387
<p><code class="literal">gtk_menu_prepend</code> is deprecated and should not be used in newly-written code. Use <a href="GtkMenuShell.html#gtk-menu-shell-prepend"><code class="function">gtk_menu_shell_prepend()</code></a> instead.</p>
390
Adds a new <a href="GtkMenuItem.html" title="GtkMenuItem"><span class="type">GtkMenuItem</span></a> to the beginning of the menu's item list.
392
<div class="variablelist"><table border="0">
393
<col align="left" valign="top">
396
<td><span class="term"><em class="parameter"><code>menu</code></em> :</span></td>
397
<td>a <a href="GtkMenu.html" title="GtkMenu"><span class="type">GtkMenu</span></a>.
401
<td><span class="term"><em class="parameter"><code>child</code></em> :</span></td>
402
<td>The <a href="GtkMenuItem.html" title="GtkMenuItem"><span class="type">GtkMenuItem</span></a> to add.
409
<div class="refsect2" lang="en">
410
<a name="id3337324"></a><h3>
411
<a name="gtk-menu-insert"></a>gtk_menu_insert()</h3>
412
<a class="indexterm" name="id3337340"></a><pre class="programlisting">#define gtk_menu_insert(menu,child,pos) gtk_menu_shell_insert ((GtkMenuShell *)(menu),(child),(pos))
414
<div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;">
415
<h3 class="title">Warning</h3>
416
<p><code class="literal">gtk_menu_insert</code> is deprecated and should not be used in newly-written code. Use <a href="GtkMenuShell.html#gtk-menu-shell-insert"><code class="function">gtk_menu_shell_insert()</code></a> instead.</p>
419
Adds a new <a href="GtkMenuItem.html" title="GtkMenuItem"><span class="type">GtkMenuItem</span></a> to the menu's item list at the position
420
indicated by <em class="parameter"><code>position</code></em>.
422
<div class="variablelist"><table border="0">
423
<col align="left" valign="top">
426
<td><span class="term"><em class="parameter"><code>menu</code></em> :</span></td>
427
<td>a <a href="GtkMenu.html" title="GtkMenu"><span class="type">GtkMenu</span></a>.
431
<td><span class="term"><em class="parameter"><code>child</code></em> :</span></td>
432
<td>The <a href="GtkMenuItem.html" title="GtkMenuItem"><span class="type">GtkMenuItem</span></a> to add.
436
<td><span class="term"><em class="parameter"><code>pos</code></em> :</span></td>
437
<td>The position in the item list where <em class="parameter"><code>child</code></em> is added.
438
Positions are numbered from 0 to n-1.
445
<div class="refsect2" lang="en">
446
<a name="id3337464"></a><h3>
447
<a name="gtk-menu-reorder-child"></a>gtk_menu_reorder_child ()</h3>
448
<a class="indexterm" name="id3337477"></a><pre class="programlisting">void gtk_menu_reorder_child (<a href="GtkMenu.html" title="GtkMenu">GtkMenu</a> *menu,
449
<a href="GtkWidget.html" title="GtkWidget">GtkWidget</a> *child,
450
gint position);</pre>
452
Moves a <a href="GtkMenuItem.html" title="GtkMenuItem"><span class="type">GtkMenuItem</span></a> to a new position within the <a href="GtkMenu.html" title="GtkMenu"><span class="type">GtkMenu</span></a>.
454
<div class="variablelist"><table border="0">
455
<col align="left" valign="top">
458
<td><span class="term"><em class="parameter"><code>menu</code></em> :</span></td>
459
<td>a <a href="GtkMenu.html" title="GtkMenu"><span class="type">GtkMenu</span></a>.
463
<td><span class="term"><em class="parameter"><code>child</code></em> :</span></td>
464
<td>the <a href="GtkMenuItem.html" title="GtkMenuItem"><span class="type">GtkMenuItem</span></a> to move.
468
<td><span class="term"><em class="parameter"><code>position</code></em> :</span></td>
469
<td>the new position to place <em class="parameter"><code>child</code></em>. Positions are numbered from
479
<div class="refsect2" lang="en">
480
<a name="id3337606"></a><h3>
481
<a name="gtk-menu-attach"></a>gtk_menu_attach ()</h3>
482
<a class="indexterm" name="id3337620"></a><pre class="programlisting">void gtk_menu_attach (<a href="GtkMenu.html" title="GtkMenu">GtkMenu</a> *menu,
483
<a href="GtkWidget.html" title="GtkWidget">GtkWidget</a> *child,
487
guint bottom_attach);</pre>
489
Adds a new <a href="GtkMenuItem.html" title="GtkMenuItem"><span class="type">GtkMenuItem</span></a> to a (table) menu. The number of 'cells' that
490
an item will occupy is specified by <em class="parameter"><code>left_attach</code></em>, <em class="parameter"><code>right_attach</code></em>,
491
<em class="parameter"><code>top_attach</code></em> and <em class="parameter"><code>bottom_attach</code></em>. These each represent the leftmost,
492
rightmost, uppermost and lower column and row numbers of the table.
493
(Columns and rows are indexed from zero).
496
Note that this function is not related to <a href="GtkMenu.html#gtk-menu-detach"><code class="function">gtk_menu_detach()</code></a>.</p>
500
<div class="variablelist"><table border="0">
501
<col align="left" valign="top">
504
<td><span class="term"><em class="parameter"><code>menu</code></em> :</span></td>
505
<td> a <a href="GtkMenu.html" title="GtkMenu"><span class="type">GtkMenu</span></a>.
509
<td><span class="term"><em class="parameter"><code>child</code></em> :</span></td>
510
<td> a <a href="GtkMenuItem.html" title="GtkMenuItem"><span class="type">GtkMenuItem</span></a>.
514
<td><span class="term"><em class="parameter"><code>left_attach</code></em> :</span></td>
515
<td> The column number to attach the left side of the item to.
519
<td><span class="term"><em class="parameter"><code>right_attach</code></em> :</span></td>
520
<td> The column number to attach the right side of the item to.
524
<td><span class="term"><em class="parameter"><code>top_attach</code></em> :</span></td>
525
<td> The row number to attach the top of the item to.
529
<td><span class="term"><em class="parameter"><code>bottom_attach</code></em> :</span></td>
530
<td> The row number to attach the bottom of the item to.
535
<p class="since">Since 2.4
539
<div class="refsect2" lang="en">
540
<a name="id3337854"></a><h3>
541
<a name="gtk-menu-popup"></a>gtk_menu_popup ()</h3>
542
<a class="indexterm" name="id3337866"></a><pre class="programlisting">void gtk_menu_popup (<a href="GtkMenu.html" title="GtkMenu">GtkMenu</a> *menu,
543
<a href="GtkWidget.html" title="GtkWidget">GtkWidget</a> *parent_menu_shell,
544
<a href="GtkWidget.html" title="GtkWidget">GtkWidget</a> *parent_menu_item,
545
<a href="GtkMenu.html#GtkMenuPositionFunc">GtkMenuPositionFunc</a> func,
548
guint32 activate_time);</pre>
550
Displays a menu and makes it available for selection. Applications can use
551
this function to display context-sensitive menus, and will typically supply
553
href="../liboil/liboil-liboiljunk.html#NULL:CAPS"
554
><code class="literal">NULL</code></a> for the <em class="parameter"><code>parent_menu_shell</code></em>, <em class="parameter"><code>parent_menu_item</code></em>, <em class="parameter"><code>func</code></em> and <em class="parameter"><code>data</code></em>
555
parameters. The default menu positioning function will position the menu
556
at the current mouse cursor position.
559
The <em class="parameter"><code>button</code></em> parameter should be the mouse button pressed to initiate
560
the menu popup. If the menu popup was initiated by something other than
561
a mouse button press, such as a mouse button release or a keypress,
562
<em class="parameter"><code>button</code></em> should be 0.
565
The <em class="parameter"><code>activate_time</code></em> parameter should be the time stamp of the event that
566
initiated the popup. If such an event is not available, use
567
<a href="gtk-General.html#gtk-get-current-event-time"><code class="function">gtk_get_current_event_time()</code></a> instead.</p>
568
<div class="variablelist"><table border="0">
569
<col align="left" valign="top">
572
<td><span class="term"><em class="parameter"><code>menu</code></em> :</span></td>
573
<td> a <a href="GtkMenu.html" title="GtkMenu"><span class="type">GtkMenu</span></a>.
577
<td><span class="term"><em class="parameter"><code>parent_menu_shell</code></em> :</span></td>
578
<td> the menu shell containing the triggering menu item, or <a
579
href="../liboil/liboil-liboiljunk.html#NULL:CAPS"
580
><code class="literal">NULL</code></a>
584
<td><span class="term"><em class="parameter"><code>parent_menu_item</code></em> :</span></td>
585
<td> the menu item whose activation triggered the popup, or <a
586
href="../liboil/liboil-liboiljunk.html#NULL:CAPS"
587
><code class="literal">NULL</code></a>
591
<td><span class="term"><em class="parameter"><code>func</code></em> :</span></td>
592
<td> a user supplied function used to position the menu, or <a
593
href="../liboil/liboil-liboiljunk.html#NULL:CAPS"
594
><code class="literal">NULL</code></a>
598
<td><span class="term"><em class="parameter"><code>data</code></em> :</span></td>
599
<td> user supplied data to be passed to <em class="parameter"><code>func</code></em>.
603
<td><span class="term"><em class="parameter"><code>button</code></em> :</span></td>
604
<td> the mouse button which was pressed to initiate the event.
608
<td><span class="term"><em class="parameter"><code>activate_time</code></em> :</span></td>
609
<td> the time at which the activation event occurred.
616
<div class="refsect2" lang="en">
617
<a name="id3338173"></a><h3>
618
<a name="gtk-menu-set-accel-group"></a>gtk_menu_set_accel_group ()</h3>
619
<a class="indexterm" name="id3338186"></a><pre class="programlisting">void gtk_menu_set_accel_group (<a href="GtkMenu.html" title="GtkMenu">GtkMenu</a> *menu,
620
<a href="gtk-Keyboard-Accelerators.html#GtkAccelGroup">GtkAccelGroup</a> *accel_group);</pre>
622
Set the <a href="gtk-Keyboard-Accelerators.html#GtkAccelGroup"><span class="type">GtkAccelGroup</span></a> which holds global accelerators for the menu.
623
This accelerator group needs to also be added to all windows that
624
this menu is being used in with <a href="GtkWindow.html#gtk-window-add-accel-group"><code class="function">gtk_window_add_accel_group()</code></a>, in order
625
for those windows to support all the accelerators contained in this group.
627
<div class="variablelist"><table border="0">
628
<col align="left" valign="top">
631
<td><span class="term"><em class="parameter"><code>menu</code></em> :</span></td>
632
<td>a <a href="GtkMenu.html" title="GtkMenu"><span class="type">GtkMenu</span></a>.
636
<td><span class="term"><em class="parameter"><code>accel_group</code></em> :</span></td>
637
<td>the <a href="gtk-Keyboard-Accelerators.html#GtkAccelGroup"><span class="type">GtkAccelGroup</span></a> to be associated with the menu.
646
<div class="refsect2" lang="en">
647
<a name="id3338295"></a><h3>
648
<a name="gtk-menu-get-accel-group"></a>gtk_menu_get_accel_group ()</h3>
649
<a class="indexterm" name="id3338307"></a><pre class="programlisting"><a href="gtk-Keyboard-Accelerators.html#GtkAccelGroup">GtkAccelGroup</a>* gtk_menu_get_accel_group (<a href="GtkMenu.html" title="GtkMenu">GtkMenu</a> *menu);</pre>
651
Gets the <a href="gtk-Keyboard-Accelerators.html#GtkAccelGroup"><span class="type">GtkAccelGroup</span></a> which holds global accelerators for the menu.
652
See <a href="GtkMenu.html#gtk-menu-set-accel-group"><code class="function">gtk_menu_set_accel_group()</code></a>.
654
<div class="variablelist"><table border="0">
655
<col align="left" valign="top">
658
<td><span class="term"><em class="parameter"><code>menu</code></em> :</span></td>
659
<td>a <a href="GtkMenu.html" title="GtkMenu"><span class="type">GtkMenu</span></a>.
663
<td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
664
<td>the <a href="gtk-Keyboard-Accelerators.html#GtkAccelGroup"><span class="type">GtkAccelGroup</span></a> associated with the menu.
673
<div class="refsect2" lang="en">
674
<a name="id3338401"></a><h3>
675
<a name="gtk-menu-set-accel-path"></a>gtk_menu_set_accel_path ()</h3>
676
<a class="indexterm" name="id3338414"></a><pre class="programlisting">void gtk_menu_set_accel_path (<a href="GtkMenu.html" title="GtkMenu">GtkMenu</a> *menu,
677
const gchar *accel_path);</pre>
679
Sets an accelerator path for this menu from which accelerator paths
680
for its immediate children, its menu items, can be constructed.
681
The main purpose of this function is to spare the programmer the
682
inconvenience of having to call <a href="GtkMenuItem.html#gtk-menu-item-set-accel-path"><code class="function">gtk_menu_item_set_accel_path()</code></a> on
683
each menu item that should support runtime user changable accelerators.
684
Instead, by just calling <a href="GtkMenu.html#gtk-menu-set-accel-path"><code class="function">gtk_menu_set_accel_path()</code></a> on their parent,
685
each menu item of this menu, that contains a label describing its purpose,
686
automatically gets an accel path assigned. For example, a menu containing
687
menu items "New" and "Exit", will, after
688
<code class="literal">gtk_menu_set_accel_path (menu, "<Gnumeric-Sheet>/File");</code>
689
has been called, assign its items the accel paths:
690
<code class="literal">"<Gnumeric-Sheet>/File/New"</code> and <code class="literal">"<Gnumeric-Sheet>/File/Exit"</code>.
691
Assigning accel paths to menu items then enables the user to change
692
their accelerators at runtime. More details about accelerator paths
693
and their default setups can be found at <a href="gtk-Accelerator-Maps.html#gtk-accel-map-add-entry"><code class="function">gtk_accel_map_add_entry()</code></a>.</p>
697
<div class="variablelist"><table border="0">
698
<col align="left" valign="top">
701
<td><span class="term"><em class="parameter"><code>menu</code></em> :</span></td>
702
<td> a valid <a href="GtkMenu.html" title="GtkMenu"><span class="type">GtkMenu</span></a>
706
<td><span class="term"><em class="parameter"><code>accel_path</code></em> :</span></td>
707
<td> a valid accelerator path
714
<div class="refsect2" lang="en">
715
<a name="id3338561"></a><h3>
716
<a name="gtk-menu-set-title"></a>gtk_menu_set_title ()</h3>
717
<a class="indexterm" name="id3338574"></a><pre class="programlisting">void gtk_menu_set_title (<a href="GtkMenu.html" title="GtkMenu">GtkMenu</a> *menu,
718
const gchar *title);</pre>
720
Sets the title string for the menu. The title is displayed when the menu
721
is shown as a tearoff menu. If <em class="parameter"><code>title</code></em> is <a
722
href="../liboil/liboil-liboiljunk.html#NULL:CAPS"
723
><code class="literal">NULL</code></a>, the menu will see if it is
724
attached to a parent menu item, and if so it will try to use the same text as
725
that menu item's label.</p>
728
<div class="variablelist"><table border="0">
729
<col align="left" valign="top">
732
<td><span class="term"><em class="parameter"><code>menu</code></em> :</span></td>
733
<td> a <a href="GtkMenu.html" title="GtkMenu"><span class="type">GtkMenu</span></a>
737
<td><span class="term"><em class="parameter"><code>title</code></em> :</span></td>
738
<td> a string containing the title for the menu.
745
<div class="refsect2" lang="en">
746
<a name="id3338674"></a><h3>
747
<a name="gtk-menu-get-tearoff-state"></a>gtk_menu_get_tearoff_state ()</h3>
748
<a class="indexterm" name="id3338688"></a><pre class="programlisting">gboolean gtk_menu_get_tearoff_state (<a href="GtkMenu.html" title="GtkMenu">GtkMenu</a> *menu);</pre>
750
Returns whether the menu is torn off. See
751
<a href="GtkMenu.html#gtk-menu-set-tearoff-state"><code class="function">gtk_menu_set_tearoff_state()</code></a>.</p>
755
<div class="variablelist"><table border="0">
756
<col align="left" valign="top">
759
<td><span class="term"><em class="parameter"><code>menu</code></em> :</span></td>
760
<td> a <a href="GtkMenu.html" title="GtkMenu"><span class="type">GtkMenu</span></a>
764
<td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
765
<td> <code class="literal">TRUE</code> if the menu is currently torn off.
772
<div class="refsect2" lang="en">
773
<a name="id3338777"></a><h3>
774
<a name="gtk-menu-get-title"></a>gtk_menu_get_title ()</h3>
775
<a class="indexterm" name="id3338790"></a><pre class="programlisting">const gchar* gtk_menu_get_title (<a href="GtkMenu.html" title="GtkMenu">GtkMenu</a> *menu);</pre>
777
Returns the title of the menu. See <a href="GtkMenu.html#gtk-menu-set-title"><code class="function">gtk_menu_set_title()</code></a>.</p>
781
<div class="variablelist"><table border="0">
782
<col align="left" valign="top">
785
<td><span class="term"><em class="parameter"><code>menu</code></em> :</span></td>
786
<td> a <a href="GtkMenu.html" title="GtkMenu"><span class="type">GtkMenu</span></a>
790
<td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
791
<td> the title of the menu, or <a
792
href="../liboil/liboil-liboiljunk.html#NULL:CAPS"
793
><code class="literal">NULL</code></a> if the menu has no
794
title set on it. This string is owned by the widget and should
795
not be modified or freed.
802
<div class="refsect2" lang="en">
803
<a name="id3338882"></a><h3>
804
<a name="gtk-menu-popdown"></a>gtk_menu_popdown ()</h3>
805
<a class="indexterm" name="id3338895"></a><pre class="programlisting">void gtk_menu_popdown (<a href="GtkMenu.html" title="GtkMenu">GtkMenu</a> *menu);</pre>
807
Removes the menu from the screen.
809
<div class="variablelist"><table border="0">
810
<col align="left" valign="top">
812
<td><span class="term"><em class="parameter"><code>menu</code></em> :</span></td>
813
<td>a <a href="GtkMenu.html" title="GtkMenu"><span class="type">GtkMenu</span></a>.
821
<div class="refsect2" lang="en">
822
<a name="id3338950"></a><h3>
823
<a name="gtk-menu-reposition"></a>gtk_menu_reposition ()</h3>
824
<a class="indexterm" name="id3338963"></a><pre class="programlisting">void gtk_menu_reposition (<a href="GtkMenu.html" title="GtkMenu">GtkMenu</a> *menu);</pre>
826
Repositions the menu according to its position function.
828
<div class="variablelist"><table border="0">
829
<col align="left" valign="top">
831
<td><span class="term"><em class="parameter"><code>menu</code></em> :</span></td>
832
<td>a <a href="GtkMenu.html" title="GtkMenu"><span class="type">GtkMenu</span></a>.
840
<div class="refsect2" lang="en">
841
<a name="id3339018"></a><h3>
842
<a name="gtk-menu-get-active"></a>gtk_menu_get_active ()</h3>
843
<a class="indexterm" name="id3339031"></a><pre class="programlisting"><a href="GtkWidget.html" title="GtkWidget">GtkWidget</a>* gtk_menu_get_active (<a href="GtkMenu.html" title="GtkMenu">GtkMenu</a> *menu);</pre>
845
Returns the selected menu item from the menu. This is used by the
846
<a href="GtkOptionMenu.html" title="GtkOptionMenu"><span class="type">GtkOptionMenu</span></a>.
848
<div class="variablelist"><table border="0">
849
<col align="left" valign="top">
852
<td><span class="term"><em class="parameter"><code>menu</code></em> :</span></td>
853
<td>a <a href="GtkMenu.html" title="GtkMenu"><span class="type">GtkMenu</span></a>.
857
<td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
858
<td>the <a href="GtkMenuItem.html" title="GtkMenuItem"><span class="type">GtkMenuItem</span></a> that was last selected in the menu. If a
859
selection has not yet been made, the first menu item is selected.
868
<div class="refsect2" lang="en">
869
<a name="id3339114"></a><h3>
870
<a name="gtk-menu-set-active"></a>gtk_menu_set_active ()</h3>
871
<a class="indexterm" name="id3339128"></a><pre class="programlisting">void gtk_menu_set_active (<a href="GtkMenu.html" title="GtkMenu">GtkMenu</a> *menu,
874
Selects the specified menu item within the menu. This is used by the
875
<a href="GtkOptionMenu.html" title="GtkOptionMenu"><span class="type">GtkOptionMenu</span></a> and should not be used by anyone else.
877
<div class="variablelist"><table border="0">
878
<col align="left" valign="top">
881
<td><span class="term"><em class="parameter"><code>menu</code></em> :</span></td>
882
<td>a <a href="GtkMenu.html" title="GtkMenu"><span class="type">GtkMenu</span></a>.
886
<td><span class="term"><em class="parameter"><code>index_</code></em> :</span></td>
887
<td>the index of the menu item to select. Index values are from
897
<div class="refsect2" lang="en">
898
<a name="id3339214"></a><h3>
899
<a name="gtk-menu-set-tearoff-state"></a>gtk_menu_set_tearoff_state ()</h3>
900
<a class="indexterm" name="id3339228"></a><pre class="programlisting">void gtk_menu_set_tearoff_state (<a href="GtkMenu.html" title="GtkMenu">GtkMenu</a> *menu,
901
gboolean torn_off);</pre>
903
Changes the tearoff state of the menu. A menu is normally displayed
904
as drop down menu which persists as long as the menu is active. It can
905
also be displayed as a tearoff menu which persists until it is closed
908
<div class="variablelist"><table border="0">
909
<col align="left" valign="top">
912
<td><span class="term"><em class="parameter"><code>menu</code></em> :</span></td>
913
<td>a <a href="GtkMenu.html" title="GtkMenu"><span class="type">GtkMenu</span></a>.
917
<td><span class="term"><em class="parameter"><code>torn_off</code></em> :</span></td>
918
<td>If <code class="literal">TRUE</code>, menu is displayed as a tearoff menu.
927
<div class="refsect2" lang="en">
928
<a name="id3339318"></a><h3>
929
<a name="gtk-menu-attach-to-widget"></a>gtk_menu_attach_to_widget ()</h3>
930
<a class="indexterm" name="id3339332"></a><pre class="programlisting">void gtk_menu_attach_to_widget (<a href="GtkMenu.html" title="GtkMenu">GtkMenu</a> *menu,
931
<a href="GtkWidget.html" title="GtkWidget">GtkWidget</a> *attach_widget,
932
<a href="GtkMenu.html#GtkMenuDetachFunc">GtkMenuDetachFunc</a> detacher);</pre>
934
Attaches the menu to the widget and provides a callback function that will
935
be invoked when the menu calls <a href="GtkMenu.html#gtk-menu-detach"><code class="function">gtk_menu_detach()</code></a> during its destruction.
937
<div class="variablelist"><table border="0">
938
<col align="left" valign="top">
941
<td><span class="term"><em class="parameter"><code>menu</code></em> :</span></td>
942
<td>a <a href="GtkMenu.html" title="GtkMenu"><span class="type">GtkMenu</span></a>.
946
<td><span class="term"><em class="parameter"><code>attach_widget</code></em> :</span></td>
947
<td>the <a href="GtkWidget.html" title="GtkWidget"><span class="type">GtkWidget</span></a> that the menu will be attached to.
951
<td><span class="term"><em class="parameter"><code>detacher</code></em> :</span></td>
952
<td>the user supplied callback function that will be called when
953
the menu calls <a href="GtkMenu.html#gtk-menu-detach"><code class="function">gtk_menu_detach()</code></a>.
962
<div class="refsect2" lang="en">
963
<a name="id3339462"></a><h3>
964
<a name="gtk-menu-detach"></a>gtk_menu_detach ()</h3>
965
<a class="indexterm" name="id3339474"></a><pre class="programlisting">void gtk_menu_detach (<a href="GtkMenu.html" title="GtkMenu">GtkMenu</a> *menu);</pre>
967
Detaches the menu from the widget to which it had been attached.
968
This function will call the callback function, <em class="parameter"><code>detacher</code></em>, provided
969
when the <a href="GtkMenu.html#gtk-menu-attach-to-widget"><code class="function">gtk_menu_attach_to_widget()</code></a> function was called.
971
<div class="variablelist"><table border="0">
972
<col align="left" valign="top">
974
<td><span class="term"><em class="parameter"><code>menu</code></em> :</span></td>
975
<td>a <a href="GtkMenu.html" title="GtkMenu"><span class="type">GtkMenu</span></a>.
983
<div class="refsect2" lang="en">
984
<a name="id3339548"></a><h3>
985
<a name="gtk-menu-get-attach-widget"></a>gtk_menu_get_attach_widget ()</h3>
986
<a class="indexterm" name="id3339562"></a><pre class="programlisting"><a href="GtkWidget.html" title="GtkWidget">GtkWidget</a>* gtk_menu_get_attach_widget (<a href="GtkMenu.html" title="GtkMenu">GtkMenu</a> *menu);</pre>
988
Returns the <a href="GtkWidget.html" title="GtkWidget"><span class="type">GtkWidget</span></a> that the menu is attached to.
990
<div class="variablelist"><table border="0">
991
<col align="left" valign="top">
994
<td><span class="term"><em class="parameter"><code>menu</code></em> :</span></td>
995
<td>a <a href="GtkMenu.html" title="GtkMenu"><span class="type">GtkMenu</span></a>.
999
<td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
1000
<td>the <a href="GtkWidget.html" title="GtkWidget"><span class="type">GtkWidget</span></a> that the menu is attached to.
1009
<div class="refsect2" lang="en">
1010
<a name="id3339643"></a><h3>
1011
<a name="gtk-menu-get-for-attach-widget"></a>gtk_menu_get_for_attach_widget ()</h3>
1012
<a class="indexterm" name="id3339659"></a><pre class="programlisting">GList* gtk_menu_get_for_attach_widget (<a href="GtkWidget.html" title="GtkWidget">GtkWidget</a> *widget);</pre>
1014
Returns a list of the menus which are attached to this widget.
1015
This list is owned by GTK+ and must not be modified.</p>
1019
<div class="variablelist"><table border="0">
1020
<col align="left" valign="top">
1023
<td><span class="term"><em class="parameter"><code>widget</code></em> :</span></td>
1024
<td> a <a href="GtkWidget.html" title="GtkWidget"><span class="type">GtkWidget</span></a>
1028
<td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
1029
<td> the list of menus attached to his widget.
1035
<p class="since">Since 2.6
1039
<div class="refsect2" lang="en">
1040
<a name="id3339736"></a><h3>
1041
<a name="GtkMenuPositionFunc"></a>GtkMenuPositionFunc ()</h3>
1042
<a class="indexterm" name="id3339750"></a><pre class="programlisting">void (*GtkMenuPositionFunc) (<a href="GtkMenu.html" title="GtkMenu">GtkMenu</a> *menu,
1046
gpointer user_data);</pre>
1048
A user function supplied when calling <a href="GtkMenu.html#gtk-menu-popup"><code class="function">gtk_menu_popup()</code></a> which controls the
1049
positioning of the menu when it is displayed. The function sets the <em class="parameter"><code>x</code></em>
1050
and <em class="parameter"><code>y</code></em> parameters to the coordinates where the menu is to be drawn.
1052
<div class="variablelist"><table border="0">
1053
<col align="left" valign="top">
1056
<td><span class="term"><em class="parameter"><code>menu</code></em> :</span></td>
1057
<td>a <a href="GtkMenu.html" title="GtkMenu"><span class="type">GtkMenu</span></a>.
1061
<td><span class="term"><em class="parameter"><code>x</code></em> :</span></td>
1062
<td>address of the <span class="type">gint</span> representing the horizontal position where the
1063
menu shall be drawn. This is an output parameter.
1067
<td><span class="term"><em class="parameter"><code>y</code></em> :</span></td>
1068
<td>address of the <span class="type">gint</span> representing the vertical position where the
1069
menu shall be drawn. This is an output parameter.
1073
<td><span class="term"><em class="parameter"><code>push_in</code></em> :</span></td>
1074
<td>whether the menu should be pushed in to be completely inside the
1075
screen instead of just clamped to the size to the screen.
1079
<td><span class="term"><em class="parameter"><code>user_data</code></em> :</span></td>
1080
<td>the data supplied by the user in the <a href="GtkMenu.html#gtk-menu-popup"><code class="function">gtk_menu_popup()</code></a> <em class="parameter"><code>data</code></em>
1090
<div class="refsect2" lang="en">
1091
<a name="id3339953"></a><h3>
1092
<a name="GtkMenuDetachFunc"></a>GtkMenuDetachFunc ()</h3>
1093
<a class="indexterm" name="id3339966"></a><pre class="programlisting">void (*GtkMenuDetachFunc) (<a href="GtkWidget.html" title="GtkWidget">GtkWidget</a> *attach_widget,
1094
<a href="GtkMenu.html" title="GtkMenu">GtkMenu</a> *menu);</pre>
1096
A user function supplied when calling <a href="GtkMenu.html#gtk-menu-attach-to-widget"><code class="function">gtk_menu_attach_to_widget()</code></a> which
1097
will be called when the menu is later detached from the widget.
1099
<div class="variablelist"><table border="0">
1100
<col align="left" valign="top">
1103
<td><span class="term"><em class="parameter"><code>attach_widget</code></em> :</span></td>
1104
<td>the <a href="GtkWidget.html" title="GtkWidget"><span class="type">GtkWidget</span></a> that the menu is being detached from.
1108
<td><span class="term"><em class="parameter"><code>menu</code></em> :</span></td>
1109
<td>the <a href="GtkMenu.html" title="GtkMenu"><span class="type">GtkMenu</span></a> being detached.
1118
<div class="refsect2" lang="en">
1119
<a name="id3340064"></a><h3>
1120
<a name="gtk-menu-set-monitor"></a>gtk_menu_set_monitor ()</h3>
1121
<a class="indexterm" name="id3340079"></a><pre class="programlisting">void gtk_menu_set_monitor (<a href="GtkMenu.html" title="GtkMenu">GtkMenu</a> *menu,
1122
gint monitor_num);</pre>
1124
Informs GTK+ on which monitor a menu should be popped up.
1126
href="../gdk/GdkScreen.html#gdk-screen-get-monitor-geometry"
1127
><code class="function">gdk_screen_get_monitor_geometry()</code></a>.
1130
This function should be called from a <a href="GtkMenu.html#GtkMenuPositionFunc"><span class="type">GtkMenuPositionFunc</span></a> if the
1131
menu should not appear on the same monitor as the pointer. This
1132
information can't be reliably inferred from the coordinates returned
1133
by a <a href="GtkMenu.html#GtkMenuPositionFunc"><span class="type">GtkMenuPositionFunc</span></a>, since, for very long menus, these coordinates
1134
may extend beyond the monitor boundaries or even the screen boundaries.</p>
1138
<div class="variablelist"><table border="0">
1139
<col align="left" valign="top">
1142
<td><span class="term"><em class="parameter"><code>menu</code></em> :</span></td>
1143
<td> a <a href="GtkMenu.html" title="GtkMenu"><span class="type">GtkMenu</span></a>
1147
<td><span class="term"><em class="parameter"><code>monitor_num</code></em> :</span></td>
1148
<td> the number of the monitor on which the menu should
1154
<p class="since">Since 2.4
1158
<div class="refsect1" lang="en">
1159
<a name="id3340206"></a><h2>Property Details</h2>
1160
<div class="refsect2" lang="en">
1161
<a name="id3340217"></a><h3>
1162
<a name="GtkMenu--tearoff-state"></a>The "<code class="literal">tearoff-state</code>" property</h3>
1163
<a class="indexterm" name="id3340233"></a><pre class="programlisting"> "tearoff-state" gboolean : Read / Write</pre>
1165
A boolean that indicates whether the menu is torn-off.</p>
1169
<p>Default value: FALSE</p>
1174
<div class="refsect2" lang="en">
1175
<a name="id3340269"></a><h3>
1176
<a name="GtkMenu--tearoff-title"></a>The "<code class="literal">tearoff-title</code>" property</h3>
1177
<a class="indexterm" name="id3340286"></a><pre class="programlisting"> "tearoff-title" gchararray : Read / Write</pre>
1178
<p>A title that may be displayed by the window manager when this menu is torn-off.</p>
1179
<p>Default value: ""</p>
1182
<div class="refsect1" lang="en">
1183
<a name="id3340314"></a><h2>Child Property Details</h2>
1184
<div class="refsect2" lang="en">
1185
<a name="id3340325"></a><h3>
1186
<a name="GtkMenu--bottom-attach"></a>The "<code class="literal">bottom-attach</code>" child property</h3>
1187
<a class="indexterm" name="id3340342"></a><pre class="programlisting"> "bottom-attach" gint : Read / Write</pre>
1188
<p>The row number to attach the bottom of the child to.</p>
1189
<p>Allowed values: >= -1</p>
1190
<p>Default value: -1</p>
1193
<div class="refsect2" lang="en">
1194
<a name="id3340373"></a><h3>
1195
<a name="GtkMenu--left-attach"></a>The "<code class="literal">left-attach</code>" child property</h3>
1196
<a class="indexterm" name="id3340389"></a><pre class="programlisting"> "left-attach" gint : Read / Write</pre>
1197
<p>The column number to attach the left side of the child to.</p>
1198
<p>Allowed values: >= -1</p>
1199
<p>Default value: -1</p>
1202
<div class="refsect2" lang="en">
1203
<a name="id3340420"></a><h3>
1204
<a name="GtkMenu--right-attach"></a>The "<code class="literal">right-attach</code>" child property</h3>
1205
<a class="indexterm" name="id3340436"></a><pre class="programlisting"> "right-attach" gint : Read / Write</pre>
1206
<p>The column number to attach the right side of the child to.</p>
1207
<p>Allowed values: >= -1</p>
1208
<p>Default value: -1</p>
1211
<div class="refsect2" lang="en">
1212
<a name="id3340467"></a><h3>
1213
<a name="GtkMenu--top-attach"></a>The "<code class="literal">top-attach</code>" child property</h3>
1214
<a class="indexterm" name="id3340483"></a><pre class="programlisting"> "top-attach" gint : Read / Write</pre>
1215
<p>The row number to attach the top of the child to.</p>
1216
<p>Allowed values: >= -1</p>
1217
<p>Default value: -1</p>
1220
<div class="refsect1" lang="en">
1221
<a name="id3340515"></a><h2>Style Property Details</h2>
1222
<div class="refsect2" lang="en">
1223
<a name="id3340526"></a><h3>
1224
<a name="GtkMenu--double-arrows"></a>The "<code class="literal">double-arrows</code>" style property</h3>
1225
<a class="indexterm" name="id3340542"></a><pre class="programlisting"> "double-arrows" gboolean : Read</pre>
1226
<p>When scrolling, always show both arrows.</p>
1227
<p>Default value: TRUE</p>
1230
<div class="refsect2" lang="en">
1231
<a name="id3340569"></a><h3>
1232
<a name="GtkMenu--horizontal-offset"></a>The "<code class="literal">horizontal-offset</code>" style property</h3>
1233
<a class="indexterm" name="id3340585"></a><pre class="programlisting"> "horizontal-offset" gint : Read</pre>
1234
<p>When the menu is a submenu, position it this number of pixels offset horizontally.</p>
1235
<p>Default value: -2</p>
1238
<div class="refsect2" lang="en">
1239
<a name="id3340613"></a><h3>
1240
<a name="GtkMenu--horizontal-padding"></a>The "<code class="literal">horizontal-padding</code>" style property</h3>
1241
<a class="indexterm" name="id3340630"></a><pre class="programlisting"> "horizontal-padding" gint : Read</pre>
1242
<p>Extra space at the left and right edges of the menu.</p>
1243
<p>Allowed values: >= 0</p>
1244
<p>Default value: 0</p>
1247
<div class="refsect2" lang="en">
1248
<a name="id3340661"></a><h3>
1249
<a name="GtkMenu--vertical-offset"></a>The "<code class="literal">vertical-offset</code>" style property</h3>
1250
<a class="indexterm" name="id3340677"></a><pre class="programlisting"> "vertical-offset" gint : Read</pre>
1251
<p>When the menu is a submenu, position it this number of pixels offset vertically.</p>
1252
<p>Default value: 0</p>
1255
<div class="refsect2" lang="en">
1256
<a name="id3340705"></a><h3>
1257
<a name="GtkMenu--vertical-padding"></a>The "<code class="literal">vertical-padding</code>" style property</h3>
1258
<a class="indexterm" name="id3340721"></a><pre class="programlisting"> "vertical-padding" gint : Read</pre>
1259
<p>Extra space at the top and bottom of the menu.</p>
1260
<p>Allowed values: >= 0</p>
1261
<p>Default value: 1</p>
1264
<div class="refsect1" lang="en">
1265
<a name="id3340753"></a><h2>Signal Details</h2>
1266
<div class="refsect2" lang="en">
1267
<a name="id3340763"></a><h3>
1268
<a name="GtkMenu-move-scroll"></a>The "move-scroll" signal</h3>
1269
<a class="indexterm" name="id3340774"></a><pre class="programlisting">void user_function (<a href="GtkMenu.html" title="GtkMenu">GtkMenu</a> *menu,
1270
<a href="gtk-Standard-Enumerations.html#GtkScrollType">GtkScrollType</a> arg1,
1271
gpointer user_data) : Run Last / Action</pre>
1275
<div class="variablelist"><table border="0">
1276
<col align="left" valign="top">
1279
<td><span class="term"><em class="parameter"><code>menu</code></em> :</span></td>
1280
<td>the object which received the signal.
1284
<td><span class="term"><em class="parameter"><code>arg1</code></em> :</span></td>
1290
<td><span class="term"><em class="parameter"><code>user_data</code></em> :</span></td>
1291
<td>user data set when the signal handler was connected.</td>