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 = GtkActionGroup.html
27 * outFile = ActionGroup
28 * strct = GtkActionGroup
50 * - GtkAction* -> Action
54 module gtk
.ActionGroup
;
56 private import gtk
.gtktypes
;
58 private import lib
.gtk
;
60 private import glib
.Str
;
61 private import gtk
.Action
;
62 private import glib
.ListG
;
66 * Actions are organised into groups. An action group is essentially a
67 * map from names to GtkAction objects.
68 * All actions that would make sense to use in a particular context
69 * should be in a single group. Multiple action groups may be used for a
70 * particular user interface. In fact, it is expected that most nontrivial
71 * applications will make use of multiple groups. For example, in an application
72 * that can edit multiple documents, one group holding global actions
73 * (e.g. quit, about, new), and one group per document holding actions that
74 * act on that document (eg. save, cut/copy/paste, etc). Each window's menus
75 * would be constructed from a combination of two action groups.
76 * Accelerators are handled by the GTK+ accelerator map. All actions are assigned an
77 * accelerator path (which normally has the form
78 * <Actions>/group-name/action-name)
79 * and a shortcut is associated with this accelerator path. All menuitems and
80 * toolitems take on this accelerator path. The GTK+ accelerator map code makes
81 * sure that the correct shortcut is displayed next to the menu item.
83 private import gobject
.ObjectG
;
84 public class ActionGroup
: ObjectG
87 /** the main Gtk struct */
88 protected GtkActionGroup
* gtkActionGroup
;
91 public GtkActionGroup
* getActionGroupStruct()
93 return gtkActionGroup
;
97 /** the main Gtk struct as a void* */
98 protected void* getStruct()
100 return cast(void*)gtkActionGroup
;
104 * Sets our main struct and passes it to the parent class
106 public this (GtkActionGroup
* gtkActionGroup
)
108 super(cast(GObject
*)gtkActionGroup
);
109 this.gtkActionGroup
= gtkActionGroup
;
115 // imports for the signal processing
116 private import gobject
.Signals
;
117 private import gdk
.gdktypes
;
118 int[char[]] connectedSignals
;
120 void delegate(Action
, GtkWidget
*, ActionGroup
)[] onConnectProxyListeners
;
121 void addOnConnectProxy(void delegate(Action
, GtkWidget
*, ActionGroup
) dlg
)
123 if ( !("connect-proxy" in connectedSignals
) )
128 cast(GCallback
)&callBackConnectProxy
,
131 cast(ConnectFlags
)0);
132 connectedSignals
["connect-proxy"] = 1;
134 onConnectProxyListeners
~= dlg
;
136 extern(C
) static void callBackConnectProxy(GtkActionGroup
* actionGroupStruct
, GtkAction
* action
, GtkWidget
* proxy
, ActionGroup actionGroup
)
138 bit consumed
= false;
140 foreach ( void delegate(Action
, GtkWidget
*, ActionGroup
) dlg
; actionGroup
.onConnectProxyListeners
)
142 dlg(new Action(action
), proxy
, actionGroup
);
148 void delegate(Action
, GtkWidget
*, ActionGroup
)[] onDisconnectProxyListeners
;
149 void addOnDisconnectProxy(void delegate(Action
, GtkWidget
*, ActionGroup
) dlg
)
151 if ( !("disconnect-proxy" in connectedSignals
) )
156 cast(GCallback
)&callBackDisconnectProxy
,
159 cast(ConnectFlags
)0);
160 connectedSignals
["disconnect-proxy"] = 1;
162 onDisconnectProxyListeners
~= dlg
;
164 extern(C
) static void callBackDisconnectProxy(GtkActionGroup
* actionGroupStruct
, GtkAction
* action
, GtkWidget
* proxy
, ActionGroup actionGroup
)
166 bit consumed
= false;
168 foreach ( void delegate(Action
, GtkWidget
*, ActionGroup
) dlg
; actionGroup
.onDisconnectProxyListeners
)
170 dlg(new Action(action
), proxy
, actionGroup
);
176 void delegate(Action
, ActionGroup
)[] onPostActivateListeners
;
177 void addOnPostActivate(void delegate(Action
, ActionGroup
) dlg
)
179 if ( !("post-activate" in connectedSignals
) )
184 cast(GCallback
)&callBackPostActivate
,
187 cast(ConnectFlags
)0);
188 connectedSignals
["post-activate"] = 1;
190 onPostActivateListeners
~= dlg
;
192 extern(C
) static void callBackPostActivate(GtkActionGroup
* actionGroupStruct
, GtkAction
* action
, ActionGroup actionGroup
)
194 bit consumed
= false;
196 foreach ( void delegate(Action
, ActionGroup
) dlg
; actionGroup
.onPostActivateListeners
)
198 dlg(new Action(action
), actionGroup
);
204 void delegate(Action
, ActionGroup
)[] onPreActivateListeners
;
205 void addOnPreActivate(void delegate(Action
, ActionGroup
) dlg
)
207 if ( !("pre-activate" in connectedSignals
) )
212 cast(GCallback
)&callBackPreActivate
,
215 cast(ConnectFlags
)0);
216 connectedSignals
["pre-activate"] = 1;
218 onPreActivateListeners
~= dlg
;
220 extern(C
) static void callBackPreActivate(GtkActionGroup
* actionGroupStruct
, GtkAction
* action
, ActionGroup actionGroup
)
222 bit consumed
= false;
224 foreach ( void delegate(Action
, ActionGroup
) dlg
; actionGroup
.onPreActivateListeners
)
226 dlg(new Action(action
), actionGroup
);
235 * Creates a new GtkActionGroup object. The name of the action group
236 * is used when associating keybindings
239 * the name of the action group.
241 * the new GtkActionGroup
244 public this (char[] name
)
246 // GtkActionGroup* gtk_action_group_new (const gchar *name);
247 this(cast(GtkActionGroup
*)gtk_action_group_new(Str
.toStringz(name
)) );
251 * Gets the name of the action group.
255 * the name of the action group.
258 public char[] getName()
260 // const gchar* gtk_action_group_get_name (GtkActionGroup *action_group);
261 return Str
.toString(gtk_action_group_get_name(gtkActionGroup
) );
265 * Returns TRUE if the group is sensitive. The constituent actions
266 * can only be logically sensitive (see gtk_action_is_sensitive()) if
267 * they are sensitive (see gtk_action_get_sensitive()) and their group
272 * TRUE if the group is sensitive.
275 public int getSensitive()
277 // gboolean gtk_action_group_get_sensitive (GtkActionGroup *action_group);
278 return gtk_action_group_get_sensitive(gtkActionGroup
);
282 * Changes the sensitivity of action_group
289 public void setSensitive(int sensitive
)
291 // void gtk_action_group_set_sensitive (GtkActionGroup *action_group, gboolean sensitive);
292 gtk_action_group_set_sensitive(gtkActionGroup
, sensitive
);
296 * Returns TRUE if the group is visible. The constituent actions
297 * can only be logically visible (see gtk_action_is_visible()) if
298 * they are visible (see gtk_action_get_visible()) and their group
303 * TRUE if the group is visible.
306 public int getVisible()
308 // gboolean gtk_action_group_get_visible (GtkActionGroup *action_group);
309 return gtk_action_group_get_visible(gtkActionGroup
);
313 * Changes the visible of action_group.
320 public void setVisible(int visible
)
322 // void gtk_action_group_set_visible (GtkActionGroup *action_group, gboolean visible);
323 gtk_action_group_set_visible(gtkActionGroup
, visible
);
327 * Looks up an action in the action group by name.
331 * the name of the action
333 * the action, or NULL if no action by that name exists
336 public Action
getAction(char[] actionName
)
338 // GtkAction* gtk_action_group_get_action (GtkActionGroup *action_group, const gchar *action_name);
339 return new Action( gtk_action_group_get_action(gtkActionGroup
, Str
.toStringz(actionName
)) );
343 * Lists the actions in the action group.
347 * an allocated list of the action objects in the action group
350 public ListG
listActions()
352 // GList* gtk_action_group_list_actions (GtkActionGroup *action_group);
353 return new ListG( gtk_action_group_list_actions(gtkActionGroup
) );
357 * Adds an action object to the action group. Note that this function
358 * does not set up the accel path of the action, which can lead to problems
359 * if a user tries to modify the accelerator of a menuitem associated with
360 * the action. Therefore you must either set the accel path yourself with
361 * gtk_action_set_accel_path(), or use
362 * gtk_action_group_add_action_with_accel (..., NULL).
369 public void addAction(Action action
)
371 // void gtk_action_group_add_action (GtkActionGroup *action_group, GtkAction *action);
372 gtk_action_group_add_action(gtkActionGroup
, (action
is null) ?
null : action
.getActionStruct());
376 * Adds an action object to the action group and sets up the accelerator.
377 * If accelerator is NULL, attempts to use the accelerator associated
378 * with the stock_id of the action.
379 * Accel paths are set to
380 * <Actions>/group-name/action-name.
386 * the accelerator for the action, in
387 * the format understood by gtk_accelerator_parse(), or "" for no accelerator, or
388 * NULL to use the stock accelerator
391 public void addActionWithAccel(Action action
, char[] accelerator
)
393 // void gtk_action_group_add_action_with_accel (GtkActionGroup *action_group, GtkAction *action, const gchar *accelerator);
394 gtk_action_group_add_action_with_accel(gtkActionGroup
, (action
is null) ?
null : action
.getActionStruct(), Str
.toStringz(accelerator
));
398 * Removes an action object from the action group.
405 public void removeAction(Action action
)
407 // void gtk_action_group_remove_action (GtkActionGroup *action_group, GtkAction *action);
408 gtk_action_group_remove_action(gtkActionGroup
, (action
is null) ?
null : action
.getActionStruct());
413 * This is a convenience function to create a number of actions and add them
414 * to the action group.
415 * The "activate" signals of the actions are connected to the callbacks and
416 * their accel paths are set to
417 * <Actions>/group-name/action-name.
421 * an array of action descriptions
423 * the number of entries
425 * data to pass to the action callbacks
428 public void addActions(GtkActionEntry
* entries
, uint nEntries
, void* userData
)
430 // void gtk_action_group_add_actions (GtkActionGroup *action_group, const GtkActionEntry *entries, guint n_entries, gpointer user_data);
431 gtk_action_group_add_actions(gtkActionGroup
, entries
, nEntries
, userData
);
435 * This variant of gtk_action_group_add_actions() adds a GDestroyNotify
436 * callback for user_data.
440 * an array of action descriptions
442 * the number of entries
444 * data to pass to the action callbacks
446 * destroy notification callback for user_data
449 public void addActionsFull(GtkActionEntry
* entries
, uint nEntries
, void* userData
, GDestroyNotify destroy
)
451 // void gtk_action_group_add_actions_full (GtkActionGroup *action_group, const GtkActionEntry *entries, guint n_entries, gpointer user_data, GDestroyNotify destroy);
452 gtk_action_group_add_actions_full(gtkActionGroup
, entries
, nEntries
, userData
, destroy
);
457 * This is a convenience function to create a number of toggle actions and add them
458 * to the action group.
459 * The "activate" signals of the actions are connected to the callbacks and
460 * their accel paths are set to
461 * <Actions>/group-name/action-name.
465 * an array of toggle action descriptions
467 * the number of entries
469 * data to pass to the action callbacks
472 public void addToggleActions(GtkToggleActionEntry
* entries
, uint nEntries
, void* userData
)
474 // void gtk_action_group_add_toggle_actions (GtkActionGroup *action_group, const GtkToggleActionEntry *entries, guint n_entries, gpointer user_data);
475 gtk_action_group_add_toggle_actions(gtkActionGroup
, entries
, nEntries
, userData
);
479 * This variant of gtk_action_group_add_toggle_actions() adds a
480 * GDestroyNotify callback for user_data.
484 * an array of toggle action descriptions
486 * the number of entries
488 * data to pass to the action callbacks
490 * destroy notification callback for user_data
493 public void addToggleActionsFull(GtkToggleActionEntry
* entries
, uint nEntries
, void* userData
, GDestroyNotify destroy
)
495 // void gtk_action_group_add_toggle_actions_full (GtkActionGroup *action_group, const GtkToggleActionEntry *entries, guint n_entries, gpointer user_data, GDestroyNotify destroy);
496 gtk_action_group_add_toggle_actions_full(gtkActionGroup
, entries
, nEntries
, userData
, destroy
);
501 * This is a convenience routine to create a group of radio actions and
502 * add them to the action group.
503 * The "changed" signal of the first radio action is connected to the
504 * on_change callback and the accel paths of the actions are set to
505 * <Actions>/group-name/action-name.
509 * an array of radio action descriptions
511 * the number of entries
513 * the value of the action to activate initially, or -1 if
514 * no action should be activated
516 * the callback to connect to the changed signal
518 * data to pass to the action callbacks
521 public void addRadioActions(GtkRadioActionEntry
* entries
, uint nEntries
, int value
, GCallback onChange
, void* userData
)
523 // void gtk_action_group_add_radio_actions (GtkActionGroup *action_group, const GtkRadioActionEntry *entries, guint n_entries, gint value, GCallback on_change, gpointer user_data);
524 gtk_action_group_add_radio_actions(gtkActionGroup
, entries
, nEntries
, value
, onChange
, userData
);
528 * This variant of gtk_action_group_add_radio_actions() adds a
529 * GDestroyNotify callback for user_data.
533 * an array of radio action descriptions
535 * the number of entries
537 * the value of the action to activate initially, or -1 if
538 * no action should be activated
540 * the callback to connect to the changed signal
542 * data to pass to the action callbacks
544 * destroy notification callback for user_data
547 public void addRadioActionsFull(GtkRadioActionEntry
* entries
, uint nEntries
, int value
, GCallback onChange
, void* userData
, GDestroyNotify destroy
)
549 // void gtk_action_group_add_radio_actions_full (GtkActionGroup *action_group, const GtkRadioActionEntry *entries, guint n_entries, gint value, GCallback on_change, gpointer user_data, GDestroyNotify destroy);
550 gtk_action_group_add_radio_actions_full(gtkActionGroup
, entries
, nEntries
, value
, onChange
, userData
, destroy
);
554 * Sets a function to be used for translating the label and tooltip of
555 * GtkActionGroupEntrys added by gtk_action_group_add_actions().
556 * If you're using gettext(), it is enough to set the translation domain
557 * with gtk_action_group_set_translation_domain().
563 * data to be passed to func and notify
565 * a GtkDestroyNotify function to be called when action_group is
566 * destroyed and when the translation function is changed again
569 public void setTranslateFunc(GtkTranslateFunc func
, void* data
, GtkDestroyNotify notify
)
571 // void gtk_action_group_set_translate_func (GtkActionGroup *action_group, GtkTranslateFunc func, gpointer data, GtkDestroyNotify notify);
572 gtk_action_group_set_translate_func(gtkActionGroup
, func
, data
, notify
);
576 * Sets the translation domain and uses dgettext() for translating the
577 * label and tooltip of GtkActionEntrys added by
578 * gtk_action_group_add_actions().
579 * If you're not using gettext() for localization, see
580 * gtk_action_group_set_translate_func().
584 * the translation domain to use for dgettext() calls
587 public void setTranslationDomain(char[] domain
)
589 // void gtk_action_group_set_translation_domain (GtkActionGroup *action_group, const gchar *domain);
590 gtk_action_group_set_translation_domain(gtkActionGroup
, Str
.toStringz(domain
));
594 * Translates a string using the specified translate_func(). This
595 * is mainly intended for language bindings.
601 * the translation of string
604 * The "name" property
605 * "name" gchararray : Read / Write / Construct Only
606 * A name for the action group.
607 * Default value: NULL
609 public char[] translateString(char[] string
)
611 // const gchar* gtk_action_group_translate_string (GtkActionGroup *action_group, const gchar *string);
612 return Str
.toString(gtk_action_group_translate_string(gtkActionGroup
, Str
.toStringz(string
)) );