2 * This file is part of duit.
4 * duit is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License as published by
6 * the Free Software Foundation; either version 2.1 of the License, or
7 * (at your option) any later version.
9 * duit 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
12 * GNU Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public License
15 * along with duit; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 // generated automatically - do not change
20 // find conversion definition on APILookup.txt
21 // implement new conversion functionalities on the wrap.utils pakage
24 * Conversion parameters:
25 * inFile = GtkMenuShell.html
28 * strct = GtkMenuShell
47 * - GtkWidget* -> Widget
53 private import gtk
.gtktypes
;
55 private import lib
.gtk
;
57 private import gtk
.Widget
;
61 * A GtkMenuShell is the abstract base class used to derive the
62 * GtkMenu and GtkMenuBar subclasses.
63 * A GtkMenuShell is a container of GtkMenuItem objects arranged in a
64 * list which can be navigated, selected, and activated by the user to perform
65 * application functions. A GtkMenuItem can have a submenu associated with it,
66 * allowing for nested hierarchical menus.
68 private import gtk
.Container
;
69 public class MenuShell
: Container
72 /** the main Gtk struct */
73 protected GtkMenuShell
* gtkMenuShell
;
76 public GtkMenuShell
* getMenuShellStruct()
82 /** the main Gtk struct as a void* */
83 protected void* getStruct()
85 return cast(void*)gtkMenuShell
;
89 * Sets our main struct and passes it to the parent class
91 public this (GtkMenuShell
* gtkMenuShell
)
93 super(cast(GtkContainer
*)gtkMenuShell
);
94 this.gtkMenuShell
= gtkMenuShell
;
100 // imports for the signal processing
101 private import gobject
.Signals
;
102 private import gdk
.gdktypes
;
103 int[char[]] connectedSignals
;
105 void delegate(gboolean
, MenuShell
)[] onActivateCurrentListeners
;
106 void addOnActivateCurrent(void delegate(gboolean
, MenuShell
) dlg
)
108 if ( !("activate-current" in connectedSignals
) )
113 cast(GCallback
)&callBackActivateCurrent
,
116 cast(ConnectFlags
)0);
117 connectedSignals
["activate-current"] = 1;
119 onActivateCurrentListeners
~= dlg
;
121 extern(C
) static void callBackActivateCurrent(GtkMenuShell
* menushellStruct
, gboolean forceHide
, MenuShell menuShell
)
123 bit consumed
= false;
125 foreach ( void delegate(gboolean
, MenuShell
) dlg
; menuShell
.onActivateCurrentListeners
)
127 dlg(forceHide
, menuShell
);
133 void delegate(MenuShell
)[] onCancelListeners
;
134 void addOnCancel(void delegate(MenuShell
) dlg
)
136 if ( !("cancel" in connectedSignals
) )
141 cast(GCallback
)&callBackCancel
,
144 cast(ConnectFlags
)0);
145 connectedSignals
["cancel"] = 1;
147 onCancelListeners
~= dlg
;
149 extern(C
) static void callBackCancel(GtkMenuShell
* menushellStruct
, MenuShell menuShell
)
151 bit consumed
= false;
153 foreach ( void delegate(MenuShell
) dlg
; menuShell
.onCancelListeners
)
161 void delegate(GtkDirectionType
, MenuShell
)[] onCycleFocusListeners
;
162 void addOnCycleFocus(void delegate(GtkDirectionType
, MenuShell
) dlg
)
164 if ( !("cycle-focus" in connectedSignals
) )
169 cast(GCallback
)&callBackCycleFocus
,
172 cast(ConnectFlags
)0);
173 connectedSignals
["cycle-focus"] = 1;
175 onCycleFocusListeners
~= dlg
;
177 extern(C
) static void callBackCycleFocus(GtkMenuShell
* menushellStruct
, GtkDirectionType arg1
, MenuShell menuShell
)
179 bit consumed
= false;
181 foreach ( void delegate(GtkDirectionType
, MenuShell
) dlg
; menuShell
.onCycleFocusListeners
)
183 dlg(arg1
, menuShell
);
189 void delegate(MenuShell
)[] onDeactivateListeners
;
190 void addOnDeactivate(void delegate(MenuShell
) dlg
)
192 if ( !("deactivate" in connectedSignals
) )
197 cast(GCallback
)&callBackDeactivate
,
200 cast(ConnectFlags
)0);
201 connectedSignals
["deactivate"] = 1;
203 onDeactivateListeners
~= dlg
;
205 extern(C
) static void callBackDeactivate(GtkMenuShell
* menushellStruct
, MenuShell menuShell
)
207 bit consumed
= false;
209 foreach ( void delegate(MenuShell
) dlg
; menuShell
.onDeactivateListeners
)
217 void delegate(GtkMenuDirectionType
, MenuShell
)[] onMoveCurrentListeners
;
218 void addOnMoveCurrent(void delegate(GtkMenuDirectionType
, MenuShell
) dlg
)
220 if ( !("move-current" in connectedSignals
) )
225 cast(GCallback
)&callBackMoveCurrent
,
228 cast(ConnectFlags
)0);
229 connectedSignals
["move-current"] = 1;
231 onMoveCurrentListeners
~= dlg
;
233 extern(C
) static void callBackMoveCurrent(GtkMenuShell
* menushellStruct
, GtkMenuDirectionType direction
, MenuShell menuShell
)
235 bit consumed
= false;
237 foreach ( void delegate(GtkMenuDirectionType
, MenuShell
) dlg
; menuShell
.onMoveCurrentListeners
)
239 dlg(direction
, menuShell
);
245 void delegate(MenuShell
)[] onSelectionDoneListeners
;
246 void addOnSelectionDone(void delegate(MenuShell
) dlg
)
248 if ( !("selection-done" in connectedSignals
) )
253 cast(GCallback
)&callBackSelectionDone
,
256 cast(ConnectFlags
)0);
257 connectedSignals
["selection-done"] = 1;
259 onSelectionDoneListeners
~= dlg
;
261 extern(C
) static void callBackSelectionDone(GtkMenuShell
* menushellStruct
, MenuShell menuShell
)
263 bit consumed
= false;
265 foreach ( void delegate(MenuShell
) dlg
; menuShell
.onSelectionDoneListeners
)
276 * Adds a new GtkMenuItem to the end of the menu shell's item list.
280 * The GtkMenuItem to add.
282 public void append(Widget child
)
284 // void gtk_menu_shell_append (GtkMenuShell *menu_shell, GtkWidget *child);
285 gtk_menu_shell_append(gtkMenuShell
, (child
is null) ?
null : child
.getWidgetStruct());
289 * Adds a new GtkMenuItem to the beginning of the menu shell's item list.
293 * The GtkMenuItem to add.
295 public void prepend(Widget child
)
297 // void gtk_menu_shell_prepend (GtkMenuShell *menu_shell, GtkWidget *child);
298 gtk_menu_shell_prepend(gtkMenuShell
, (child
is null) ?
null : child
.getWidgetStruct());
302 * Adds a new GtkMenuItem to the menu shell's item list at the position
303 * indicated by position.
307 * The GtkMenuItem to add.
309 * The position in the item list where child is added.
310 * Positions are numbered from 0 to n-1.
312 public void insert(Widget child
, int position
)
314 // void gtk_menu_shell_insert (GtkMenuShell *menu_shell, GtkWidget *child, gint position);
315 gtk_menu_shell_insert(gtkMenuShell
, (child
is null) ?
null : child
.getWidgetStruct(), position
);
319 * Deactivates the menu shell. Typically this results in the menu shell
320 * being erased from the screen.
324 public void deactivate()
326 // void gtk_menu_shell_deactivate (GtkMenuShell *menu_shell);
327 gtk_menu_shell_deactivate(gtkMenuShell
);
331 * Selects the menu item from the menu shell.
335 * The GtkMenuItem to select.
337 public void selectItem(Widget menuItem
)
339 // void gtk_menu_shell_select_item (GtkMenuShell *menu_shell, GtkWidget *menu_item);
340 gtk_menu_shell_select_item(gtkMenuShell
, (menuItem
is null) ?
null : menuItem
.getWidgetStruct());
344 * Select the first visible or selectable child of the menu shell;
345 * don't select tearoff items unless the only item is a tearoff
350 * if TRUE, search for the first selectable
351 * menu item, otherwise select nothing if
352 * the first item isn't sensitive. This
353 * should be FALSE if the menu is being
354 * popped up initially.
357 public void selectFirst(int searchSensitive
)
359 // void gtk_menu_shell_select_first (GtkMenuShell *menu_shell, gboolean search_sensitive);
360 gtk_menu_shell_select_first(gtkMenuShell
, searchSensitive
);
364 * Deselects the currently selected item from the menu shell, if any.
368 public void deselect()
370 // void gtk_menu_shell_deselect (GtkMenuShell *menu_shell);
371 gtk_menu_shell_deselect(gtkMenuShell
);
375 * Activates the menu item within the menu shell.
379 * The GtkMenuItem to activate.
381 * If TRUE, force the deactivation of the menu shell
382 * after the menu item is activated.
384 public void activateItem(Widget menuItem
, int forceDeactivate
)
386 // void gtk_menu_shell_activate_item (GtkMenuShell *menu_shell, GtkWidget *menu_item, gboolean force_deactivate);
387 gtk_menu_shell_activate_item(gtkMenuShell
, (menuItem
is null) ?
null : menuItem
.getWidgetStruct(), forceDeactivate
);
391 * Cancels the selection within the menu shell.
398 // void gtk_menu_shell_cancel (GtkMenuShell *menu_shell);
399 gtk_menu_shell_cancel(gtkMenuShell
);
403 * If take_focus is TRUE (the default) the menu shell will take the keyboard
404 * focus so that it will receive all keyboard events which is needed to enable
405 * keyboard navigation in menus.
406 * Setting take_focus to FALSE is useful only for special applications
407 * like virtual keyboard implementations which should not take keyboard
409 * The take_focus state of a menu or menu bar is automatically propagated
410 * to submenus whenever a submenu is popped up, so you don't have to worry
411 * about recursively setting it for your entire menu hierarchy. Only when
412 * programmatically picking a submenu and popping it up manually, the
413 * take_focus property of the submenu needs to be set explicitely.
414 * Note that setting it to FALSE has side-effects:
415 * If the focus is in some other app, it keeps the focus and keynav in
416 * the menu doesn't work. Consequently, keynav on the menu will only
417 * work if the focus is on some toplevel owned by the onscreen keyboard.
418 * To avoid confusing the user, menus with take_focus set to FALSE
419 * should not display mnemonics or accelerators, since it cannot be
420 * guaranteed that they will work.
421 * See also gdk_keyboard_grab()
425 * TRUE if the menu shell should take the keyboard focus on popup.
428 public void setTakeFocus(int takeFocus
)
430 // void gtk_menu_shell_set_take_focus (GtkMenuShell *menu_shell, gboolean take_focus);
431 gtk_menu_shell_set_take_focus(gtkMenuShell
, takeFocus
);
435 * Returns TRUE if the menu shell will take the keyboard focus on popup.
439 * TRUE if the menu shell will take the keyboard focus on popup.
442 public int getTakeFocus()
444 // gboolean gtk_menu_shell_get_take_focus (GtkMenuShell *menu_shell);
445 return gtk_menu_shell_get_take_focus(gtkMenuShell
);