2 * This file is part of gtkD.
4 * gtkD 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 * gtkD 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 gtkD; 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
55 module gtk
.ActionGroup
;
61 import tango
.io
.Stdout
; // use the tango loging?
65 private import gtkc
.gtktypes
;
67 private import gtkc
.gtk
;
70 private import glib
.Str
;
71 private import gtk
.Action
;
72 private import glib
.ListG
;
79 * Actions are organised into groups. An action group is essentially a
80 * map from names to GtkAction objects.
81 * All actions that would make sense to use in a particular context
82 * should be in a single group. Multiple action groups may be used for a
83 * particular user interface. In fact, it is expected that most nontrivial
84 * applications will make use of multiple groups. For example, in an application
85 * that can edit multiple documents, one group holding global actions
86 * (e.g. quit, about, new), and one group per document holding actions that
87 * act on that document (eg. save, cut/copy/paste, etc). Each window's menus
88 * would be constructed from a combination of two action groups.
89 * Accelerators are handled by the GTK+ accelerator map. All actions are assigned an
90 * accelerator path (which normally has the form
91 * <Actions>/group-name/action-name)
92 * and a shortcut is associated with this accelerator path. All menuitems and
93 * toolitems take on this accelerator path. The GTK+ accelerator map code makes
94 * sure that the correct shortcut is displayed next to the menu item.
96 private import gobject
.ObjectG
;
97 public class ActionGroup
: ObjectG
100 /** the main Gtk struct */
101 protected GtkActionGroup
* gtkActionGroup
;
104 public GtkActionGroup
* getActionGroupStruct()
106 return gtkActionGroup
;
110 /** the main Gtk struct as a void* */
111 protected void* getStruct()
113 return cast(void*)gtkActionGroup
;
117 * Sets our main struct and passes it to the parent class
119 public this (GtkActionGroup
* gtkActionGroup
)
123 if ( gtkActionGroup
is null )
128 Stdout("struct gtkActionGroup is null on constructor").newline
;
132 printf("struct gtkActionGroup is null on constructor");
139 assert(gtkActionGroup
!is null, "struct gtkActionGroup is null on constructor");
141 super(cast(GObject
*)gtkActionGroup
);
142 this.gtkActionGroup
= gtkActionGroup
;
148 // imports for the signal processing
149 private import gobject
.Signals
;
150 private import gtkc
.gdktypes
;
151 int[char[]] connectedSignals
;
153 void delegate(Action
, GtkWidget
*, ActionGroup
)[] onConnectProxyListeners
;
154 void addOnConnectProxy(void delegate(Action
, GtkWidget
*, ActionGroup
) dlg
, ConnectFlags connectFlags
=cast(ConnectFlags
)0)
156 if ( !("connect-proxy" in connectedSignals
) )
161 cast(GCallback
)&callBackConnectProxy
,
165 connectedSignals
["connect-proxy"] = 1;
167 onConnectProxyListeners
~= dlg
;
169 extern(C
) static void callBackConnectProxy(GtkActionGroup
* actionGroupStruct
, GtkAction
* action
, GtkWidget
* proxy
, ActionGroup actionGroup
)
171 bool consumed
= false;
173 foreach ( void delegate(Action
, GtkWidget
*, ActionGroup
) dlg
; actionGroup
.onConnectProxyListeners
)
175 dlg(new Action(action
), proxy
, actionGroup
);
181 void delegate(Action
, GtkWidget
*, ActionGroup
)[] onDisconnectProxyListeners
;
182 void addOnDisconnectProxy(void delegate(Action
, GtkWidget
*, ActionGroup
) dlg
, ConnectFlags connectFlags
=cast(ConnectFlags
)0)
184 if ( !("disconnect-proxy" in connectedSignals
) )
189 cast(GCallback
)&callBackDisconnectProxy
,
193 connectedSignals
["disconnect-proxy"] = 1;
195 onDisconnectProxyListeners
~= dlg
;
197 extern(C
) static void callBackDisconnectProxy(GtkActionGroup
* actionGroupStruct
, GtkAction
* action
, GtkWidget
* proxy
, ActionGroup actionGroup
)
199 bool consumed
= false;
201 foreach ( void delegate(Action
, GtkWidget
*, ActionGroup
) dlg
; actionGroup
.onDisconnectProxyListeners
)
203 dlg(new Action(action
), proxy
, actionGroup
);
209 void delegate(Action
, ActionGroup
)[] onPostActivateListeners
;
210 void addOnPostActivate(void delegate(Action
, ActionGroup
) dlg
, ConnectFlags connectFlags
=cast(ConnectFlags
)0)
212 if ( !("post-activate" in connectedSignals
) )
217 cast(GCallback
)&callBackPostActivate
,
221 connectedSignals
["post-activate"] = 1;
223 onPostActivateListeners
~= dlg
;
225 extern(C
) static void callBackPostActivate(GtkActionGroup
* actionGroupStruct
, GtkAction
* action
, ActionGroup actionGroup
)
227 bool consumed
= false;
229 foreach ( void delegate(Action
, ActionGroup
) dlg
; actionGroup
.onPostActivateListeners
)
231 dlg(new Action(action
), actionGroup
);
237 void delegate(Action
, ActionGroup
)[] onPreActivateListeners
;
238 void addOnPreActivate(void delegate(Action
, ActionGroup
) dlg
, ConnectFlags connectFlags
=cast(ConnectFlags
)0)
240 if ( !("pre-activate" in connectedSignals
) )
245 cast(GCallback
)&callBackPreActivate
,
249 connectedSignals
["pre-activate"] = 1;
251 onPreActivateListeners
~= dlg
;
253 extern(C
) static void callBackPreActivate(GtkActionGroup
* actionGroupStruct
, GtkAction
* action
, ActionGroup actionGroup
)
255 bool consumed
= false;
257 foreach ( void delegate(Action
, ActionGroup
) dlg
; actionGroup
.onPreActivateListeners
)
259 dlg(new Action(action
), actionGroup
);
268 * Creates a new GtkActionGroup object. The name of the action group
269 * is used when associating keybindings
272 * the name of the action group.
274 * the new GtkActionGroup
277 public this (char[] name
)
279 // GtkActionGroup* gtk_action_group_new (const gchar *name);
280 this(cast(GtkActionGroup
*)gtk_action_group_new(Str
.toStringz(name
)) );
284 * Gets the name of the action group.
288 * the name of the action group.
291 public char[] getName()
293 // const gchar* gtk_action_group_get_name (GtkActionGroup *action_group);
294 return Str
.toString(gtk_action_group_get_name(gtkActionGroup
) );
298 * Returns TRUE if the group is sensitive. The constituent actions
299 * can only be logically sensitive (see gtk_action_is_sensitive()) if
300 * they are sensitive (see gtk_action_get_sensitive()) and their group
305 * TRUE if the group is sensitive.
308 public int getSensitive()
310 // gboolean gtk_action_group_get_sensitive (GtkActionGroup *action_group);
311 return gtk_action_group_get_sensitive(gtkActionGroup
);
315 * Changes the sensitivity of action_group
322 public void setSensitive(int sensitive
)
324 // void gtk_action_group_set_sensitive (GtkActionGroup *action_group, gboolean sensitive);
325 gtk_action_group_set_sensitive(gtkActionGroup
, sensitive
);
329 * Returns TRUE if the group is visible. The constituent actions
330 * can only be logically visible (see gtk_action_is_visible()) if
331 * they are visible (see gtk_action_get_visible()) and their group
336 * TRUE if the group is visible.
339 public int getVisible()
341 // gboolean gtk_action_group_get_visible (GtkActionGroup *action_group);
342 return gtk_action_group_get_visible(gtkActionGroup
);
346 * Changes the visible of action_group.
353 public void setVisible(int visible
)
355 // void gtk_action_group_set_visible (GtkActionGroup *action_group, gboolean visible);
356 gtk_action_group_set_visible(gtkActionGroup
, visible
);
360 * Looks up an action in the action group by name.
364 * the name of the action
366 * the action, or NULL if no action by that name exists
369 public Action
getAction(char[] actionName
)
371 // GtkAction* gtk_action_group_get_action (GtkActionGroup *action_group, const gchar *action_name);
372 return new Action( gtk_action_group_get_action(gtkActionGroup
, Str
.toStringz(actionName
)) );
376 * Lists the actions in the action group.
380 * an allocated list of the action objects in the action group
383 public ListG
listActions()
385 // GList* gtk_action_group_list_actions (GtkActionGroup *action_group);
386 return new ListG( gtk_action_group_list_actions(gtkActionGroup
) );
390 * Adds an action object to the action group. Note that this function
391 * does not set up the accel path of the action, which can lead to problems
392 * if a user tries to modify the accelerator of a menuitem associated with
393 * the action. Therefore you must either set the accel path yourself with
394 * gtk_action_set_accel_path(), or use
395 * gtk_action_group_add_action_with_accel (..., NULL).
402 public void addAction(Action action
)
404 // void gtk_action_group_add_action (GtkActionGroup *action_group, GtkAction *action);
405 gtk_action_group_add_action(gtkActionGroup
, (action
is null) ?
null : action
.getActionStruct());
409 * Adds an action object to the action group and sets up the accelerator.
410 * If accelerator is NULL, attempts to use the accelerator associated
411 * with the stock_id of the action.
412 * Accel paths are set to
413 * <Actions>/group-name/action-name.
419 * the accelerator for the action, in
420 * the format understood by gtk_accelerator_parse(), or "" for no accelerator, or
421 * NULL to use the stock accelerator
424 public void addActionWithAccel(Action action
, char[] accelerator
)
426 // void gtk_action_group_add_action_with_accel (GtkActionGroup *action_group, GtkAction *action, const gchar *accelerator);
427 gtk_action_group_add_action_with_accel(gtkActionGroup
, (action
is null) ?
null : action
.getActionStruct(), Str
.toStringz(accelerator
));
431 * Removes an action object from the action group.
438 public void removeAction(Action action
)
440 // void gtk_action_group_remove_action (GtkActionGroup *action_group, GtkAction *action);
441 gtk_action_group_remove_action(gtkActionGroup
, (action
is null) ?
null : action
.getActionStruct());
446 * This is a convenience function to create a number of actions and add them
447 * to the action group.
448 * The "activate" signals of the actions are connected to the callbacks and
449 * their accel paths are set to
450 * <Actions>/group-name/action-name.
454 * an array of action descriptions
456 * the number of entries
458 * data to pass to the action callbacks
461 public void addActions(GtkActionEntry
* entries
, uint nEntries
, void* userData
)
463 // void gtk_action_group_add_actions (GtkActionGroup *action_group, const GtkActionEntry *entries, guint n_entries, gpointer user_data);
464 gtk_action_group_add_actions(gtkActionGroup
, entries
, nEntries
, userData
);
468 * This variant of gtk_action_group_add_actions() adds a GDestroyNotify
469 * callback for user_data.
473 * an array of action descriptions
475 * the number of entries
477 * data to pass to the action callbacks
479 * destroy notification callback for user_data
482 public void addActionsFull(GtkActionEntry
* entries
, uint nEntries
, void* userData
, GDestroyNotify destroy
)
484 // void gtk_action_group_add_actions_full (GtkActionGroup *action_group, const GtkActionEntry *entries, guint n_entries, gpointer user_data, GDestroyNotify destroy);
485 gtk_action_group_add_actions_full(gtkActionGroup
, entries
, nEntries
, userData
, destroy
);
490 * This is a convenience function to create a number of toggle actions and add them
491 * to the action group.
492 * The "activate" signals of the actions are connected to the callbacks and
493 * their accel paths are set to
494 * <Actions>/group-name/action-name.
498 * an array of toggle action descriptions
500 * the number of entries
502 * data to pass to the action callbacks
505 public void addToggleActions(GtkToggleActionEntry
* entries
, uint nEntries
, void* userData
)
507 // void gtk_action_group_add_toggle_actions (GtkActionGroup *action_group, const GtkToggleActionEntry *entries, guint n_entries, gpointer user_data);
508 gtk_action_group_add_toggle_actions(gtkActionGroup
, entries
, nEntries
, userData
);
512 * This variant of gtk_action_group_add_toggle_actions() adds a
513 * GDestroyNotify callback for user_data.
517 * an array of toggle action descriptions
519 * the number of entries
521 * data to pass to the action callbacks
523 * destroy notification callback for user_data
526 public void addToggleActionsFull(GtkToggleActionEntry
* entries
, uint nEntries
, void* userData
, GDestroyNotify destroy
)
528 // void gtk_action_group_add_toggle_actions_full (GtkActionGroup *action_group, const GtkToggleActionEntry *entries, guint n_entries, gpointer user_data, GDestroyNotify destroy);
529 gtk_action_group_add_toggle_actions_full(gtkActionGroup
, entries
, nEntries
, userData
, destroy
);
534 * This is a convenience routine to create a group of radio actions and
535 * add them to the action group.
536 * The "changed" signal of the first radio action is connected to the
537 * on_change callback and the accel paths of the actions are set to
538 * <Actions>/group-name/action-name.
542 * an array of radio action descriptions
544 * the number of entries
546 * the value of the action to activate initially, or -1 if
547 * no action should be activated
549 * the callback to connect to the changed signal
551 * data to pass to the action callbacks
554 public void addRadioActions(GtkRadioActionEntry
* entries
, uint nEntries
, int value
, GCallback onChange
, void* userData
)
556 // void gtk_action_group_add_radio_actions (GtkActionGroup *action_group, const GtkRadioActionEntry *entries, guint n_entries, gint value, GCallback on_change, gpointer user_data);
557 gtk_action_group_add_radio_actions(gtkActionGroup
, entries
, nEntries
, value
, onChange
, userData
);
561 * This variant of gtk_action_group_add_radio_actions() adds a
562 * GDestroyNotify callback for user_data.
566 * an array of radio action descriptions
568 * the number of entries
570 * the value of the action to activate initially, or -1 if
571 * no action should be activated
573 * the callback to connect to the changed signal
575 * data to pass to the action callbacks
577 * destroy notification callback for user_data
580 public void addRadioActionsFull(GtkRadioActionEntry
* entries
, uint nEntries
, int value
, GCallback onChange
, void* userData
, GDestroyNotify destroy
)
582 // 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);
583 gtk_action_group_add_radio_actions_full(gtkActionGroup
, entries
, nEntries
, value
, onChange
, userData
, destroy
);
587 * Sets a function to be used for translating the label and tooltip of
588 * GtkActionGroupEntrys added by gtk_action_group_add_actions().
589 * If you're using gettext(), it is enough to set the translation domain
590 * with gtk_action_group_set_translation_domain().
596 * data to be passed to func and notify
598 * a GtkDestroyNotify function to be called when action_group is
599 * destroyed and when the translation function is changed again
602 public void setTranslateFunc(GtkTranslateFunc func
, void* data
, GtkDestroyNotify notify
)
604 // void gtk_action_group_set_translate_func (GtkActionGroup *action_group, GtkTranslateFunc func, gpointer data, GtkDestroyNotify notify);
605 gtk_action_group_set_translate_func(gtkActionGroup
, func
, data
, notify
);
609 * Sets the translation domain and uses dgettext() for translating the
610 * label and tooltip of GtkActionEntrys added by
611 * gtk_action_group_add_actions().
612 * If you're not using gettext() for localization, see
613 * gtk_action_group_set_translate_func().
617 * the translation domain to use for dgettext() calls
620 public void setTranslationDomain(char[] domain
)
622 // void gtk_action_group_set_translation_domain (GtkActionGroup *action_group, const gchar *domain);
623 gtk_action_group_set_translation_domain(gtkActionGroup
, Str
.toStringz(domain
));
627 * Translates a string using the specified translate_func(). This
628 * is mainly intended for language bindings.
634 * the translation of string
637 * The "name" property
638 * "name" gchararray : Read / Write / Construct Only
639 * A name for the action group.
640 * Default value: NULL
642 public char[] translateString(char[] string
)
644 // const gchar* gtk_action_group_translate_string (GtkActionGroup *action_group, const gchar *string);
645 return Str
.toString(gtk_action_group_translate_string(gtkActionGroup
, Str
.toStringz(string
)) );