1 /* 2 * This file is part of gtkD. 3 * 4 * gtkD is free software; you can redistribute it and/or modify 5 * it under the terms of the GNU Lesser General Public License 6 * as published by the Free Software Foundation; either version 3 7 * of the License, or (at your option) any later version, with 8 * some exceptions, please read the COPYING file. 9 * 10 * gtkD is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * GNU Lesser General Public License for more details. 14 * 15 * You should have received a copy of the GNU Lesser General Public License 16 * along with gtkD; if not, write to the Free Software 17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA 18 */ 19 20 // generated automatically - do not change 21 // find conversion definition on APILookup.txt 22 // implement new conversion functionalities on the wrap.utils pakage 23 24 /* 25 * Conversion parameters: 26 * inFile = GSimpleActionGroup.html 27 * outPack = gio 28 * outFile = SimpleActionGroup 29 * strct = GSimpleActionGroup 30 * realStrct= 31 * ctorStrct= 32 * clss = SimpleActionGroup 33 * interf = 34 * class Code: Yes 35 * interface Code: No 36 * template for: 37 * extend = 38 * implements: 39 * - ActionGroupIF 40 * - ActionMapIF 41 * prefixes: 42 * - g_simple_action_group_ 43 * omit structs: 44 * omit prefixes: 45 * omit code: 46 * omit signals: 47 * imports: 48 * - glib.Str 49 * - gio.Action 50 * - gio.ActionIF 51 * - gio.ActionGroupIF 52 * - gio.ActionGroupT 53 * - gio.ActionMapIF 54 * - gio.ActionMapT 55 * structWrap: 56 * - GAction* -> ActionIF 57 * module aliases: 58 * local aliases: 59 * overrides: 60 */ 61 62 module gio.SimpleActionGroup; 63 64 public import gtkc.giotypes; 65 66 private import gtkc.gio; 67 private import glib.ConstructionException; 68 private import gobject.ObjectG; 69 70 private import glib.Str; 71 private import gio.Action; 72 private import gio.ActionIF; 73 private import gio.ActionGroupIF; 74 private import gio.ActionGroupT; 75 private import gio.ActionMapIF; 76 private import gio.ActionMapT; 77 78 79 private import gobject.ObjectG; 80 81 /** 82 * GSimpleActionGroup is a hash table filled with GAction objects, 83 * implementing the GActionGroup and GActionMap interfaces. 84 */ 85 public class SimpleActionGroup : ObjectG, ActionGroupIF, ActionMapIF 86 { 87 88 /** the main Gtk struct */ 89 protected GSimpleActionGroup* gSimpleActionGroup; 90 91 92 /** Get the main Gtk struct */ 93 public GSimpleActionGroup* getSimpleActionGroupStruct() 94 { 95 return gSimpleActionGroup; 96 } 97 98 99 /** the main Gtk struct as a void* */ 100 protected override void* getStruct() 101 { 102 return cast(void*)gSimpleActionGroup; 103 } 104 105 /** 106 * Sets our main struct and passes it to the parent class 107 */ 108 public this (GSimpleActionGroup* gSimpleActionGroup) 109 { 110 super(cast(GObject*)gSimpleActionGroup); 111 this.gSimpleActionGroup = gSimpleActionGroup; 112 } 113 114 protected override void setStruct(GObject* obj) 115 { 116 super.setStruct(obj); 117 gSimpleActionGroup = cast(GSimpleActionGroup*)obj; 118 } 119 120 // add the ActionGroup capabilities 121 mixin ActionGroupT!(GSimpleActionGroup); 122 123 // add the ActionMap capabilities 124 mixin ActionMapT!(GSimpleActionGroup); 125 126 /** 127 */ 128 129 /** 130 * Creates a new, empty, GSimpleActionGroup. 131 * Since 2.28 132 * Throws: ConstructionException GTK+ fails to create the object. 133 */ 134 public this () 135 { 136 // GSimpleActionGroup * g_simple_action_group_new (void); 137 auto p = g_simple_action_group_new(); 138 if(p is null) 139 { 140 throw new ConstructionException("null returned by g_simple_action_group_new()"); 141 } 142 this(cast(GSimpleActionGroup*) p); 143 } 144 145 /** 146 * Warning 147 * g_simple_action_group_lookup has been deprecated since version 2.38 and should not be used in newly-written code. Use g_action_map_lookup_action() 148 * Looks up the action with the name action_name in the group. 149 * If no such action exists, returns NULL. 150 * Since 2.28 151 * Params: 152 * actionName = the name of an action 153 * Returns: a GAction, or NULL. [transfer none] 154 */ 155 public ActionIF lookup(string actionName) 156 { 157 // GAction * g_simple_action_group_lookup (GSimpleActionGroup *simple, const gchar *action_name); 158 auto p = g_simple_action_group_lookup(gSimpleActionGroup, Str.toStringz(actionName)); 159 160 if(p is null) 161 { 162 return null; 163 } 164 165 return ObjectG.getDObject!(Action, ActionIF)(cast(GAction*) p); 166 } 167 168 /** 169 * Warning 170 * g_simple_action_group_insert has been deprecated since version 2.38 and should not be used in newly-written code. Use g_action_map_add_action() 171 * Adds an action to the action group. 172 * If the action group already contains an action with the same name as 173 * action then the old action is dropped from the group. 174 * The action group takes its own reference on action. 175 * Since 2.28 176 * Params: 177 * action = a GAction 178 */ 179 public void insert(ActionIF action) 180 { 181 // void g_simple_action_group_insert (GSimpleActionGroup *simple, GAction *action); 182 g_simple_action_group_insert(gSimpleActionGroup, (action is null) ? null : action.getActionTStruct()); 183 } 184 185 /** 186 * Warning 187 * g_simple_action_group_remove has been deprecated since version 2.38 and should not be used in newly-written code. Use g_action_map_remove_action() 188 * Removes the named action from the action group. 189 * If no action of this name is in the group then nothing happens. 190 * Since 2.28 191 * Params: 192 * actionName = the name of the action 193 */ 194 public void remove(string actionName) 195 { 196 // void g_simple_action_group_remove (GSimpleActionGroup *simple, const gchar *action_name); 197 g_simple_action_group_remove(gSimpleActionGroup, Str.toStringz(actionName)); 198 } 199 200 /** 201 * Warning 202 * g_simple_action_group_add_entries has been deprecated since version 2.38 and should not be used in newly-written code. Use g_action_map_add_action_entries() 203 * A convenience function for creating multiple GSimpleAction instances 204 * and adding them to the action group. 205 * Since 2.30 206 * Params: 207 * entries = a pointer to the first item in 208 * an array of GActionEntry structs. [array length=n_entries] 209 * userData = the user data for signal connections 210 */ 211 public void addEntries(GActionEntry[] entries, void* userData) 212 { 213 // void g_simple_action_group_add_entries (GSimpleActionGroup *simple, const GActionEntry *entries, gint n_entries, gpointer user_data); 214 g_simple_action_group_add_entries(gSimpleActionGroup, entries.ptr, cast(int) entries.length, userData); 215 } 216 }