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 71 private import glib.Str; 72 private import gio.Action; 73 private import gio.ActionIF; 74 private import gio.ActionGroupIF; 75 private import gio.ActionGroupT; 76 private import gio.ActionMapIF; 77 private import gio.ActionMapT; 78 79 80 81 private import gobject.ObjectG; 82 83 /** 84 * GSimpleActionGroup is a hash table filled with GAction objects, 85 * implementing the GActionGroup and GActionMap interfaces. 86 */ 87 public class SimpleActionGroup : ObjectG, ActionGroupIF, ActionMapIF 88 { 89 90 /** the main Gtk struct */ 91 protected GSimpleActionGroup* gSimpleActionGroup; 92 93 94 public GSimpleActionGroup* getSimpleActionGroupStruct() 95 { 96 return gSimpleActionGroup; 97 } 98 99 100 /** the main Gtk struct as a void* */ 101 protected override void* getStruct() 102 { 103 return cast(void*)gSimpleActionGroup; 104 } 105 106 /** 107 * Sets our main struct and passes it to the parent class 108 */ 109 public this (GSimpleActionGroup* gSimpleActionGroup) 110 { 111 super(cast(GObject*)gSimpleActionGroup); 112 this.gSimpleActionGroup = gSimpleActionGroup; 113 } 114 115 protected override void setStruct(GObject* obj) 116 { 117 super.setStruct(obj); 118 gSimpleActionGroup = cast(GSimpleActionGroup*)obj; 119 } 120 121 // add the ActionGroup capabilities 122 mixin ActionGroupT!(GSimpleActionGroup); 123 124 // add the ActionMap capabilities 125 mixin ActionMapT!(GSimpleActionGroup); 126 127 /** 128 */ 129 130 /** 131 * Creates a new, empty, GSimpleActionGroup. 132 * Since 2.28 133 * Throws: ConstructionException GTK+ fails to create the object. 134 */ 135 public this () 136 { 137 // GSimpleActionGroup * g_simple_action_group_new (void); 138 auto p = g_simple_action_group_new(); 139 if(p is null) 140 { 141 throw new ConstructionException("null returned by g_simple_action_group_new()"); 142 } 143 this(cast(GSimpleActionGroup*) p); 144 } 145 146 /** 147 * Warning 148 * 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() 149 * Looks up the action with the name action_name in the group. 150 * If no such action exists, returns NULL. 151 * Since 2.28 152 * Params: 153 * actionName = the name of an action 154 * Returns: a GAction, or NULL. [transfer none] 155 */ 156 public ActionIF lookup(string actionName) 157 { 158 // GAction * g_simple_action_group_lookup (GSimpleActionGroup *simple, const gchar *action_name); 159 auto p = g_simple_action_group_lookup(gSimpleActionGroup, Str.toStringz(actionName)); 160 161 if(p is null) 162 { 163 return null; 164 } 165 166 return ObjectG.getDObject!(Action, ActionIF)(cast(GAction*) p); 167 } 168 169 /** 170 * Warning 171 * 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() 172 * Adds an action to the action group. 173 * If the action group already contains an action with the same name as 174 * action then the old action is dropped from the group. 175 * The action group takes its own reference on action. 176 * Since 2.28 177 * Params: 178 * action = a GAction 179 */ 180 public void insert(ActionIF action) 181 { 182 // void g_simple_action_group_insert (GSimpleActionGroup *simple, GAction *action); 183 g_simple_action_group_insert(gSimpleActionGroup, (action is null) ? null : action.getActionTStruct()); 184 } 185 186 /** 187 * Warning 188 * 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() 189 * Removes the named action from the action group. 190 * If no action of this name is in the group then nothing happens. 191 * Since 2.28 192 * Params: 193 * actionName = the name of the action 194 */ 195 public void remove(string actionName) 196 { 197 // void g_simple_action_group_remove (GSimpleActionGroup *simple, const gchar *action_name); 198 g_simple_action_group_remove(gSimpleActionGroup, Str.toStringz(actionName)); 199 } 200 201 /** 202 * Warning 203 * 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() 204 * A convenience function for creating multiple GSimpleAction instances 205 * and adding them to the action group. 206 * Since 2.30 207 * Params: 208 * entries = a pointer to the first item in 209 * an array of GActionEntry structs. [array length=n_entries] 210 * userData = the user data for signal connections 211 */ 212 public void addEntries(GActionEntry[] entries, void* userData) 213 { 214 // void g_simple_action_group_add_entries (GSimpleActionGroup *simple, const GActionEntry *entries, gint n_entries, gpointer user_data); 215 g_simple_action_group_add_entries(gSimpleActionGroup, entries.ptr, cast(int) entries.length, userData); 216 } 217 }