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 * prefixes: 41 * - g_simple_action_group_ 42 * omit structs: 43 * omit prefixes: 44 * omit code: 45 * omit signals: 46 * imports: 47 * - glib.Str 48 * - gio.Action 49 * - gio.ActionIF 50 * - gio.ActionGroupIF 51 * - gio.ActionGroupT 52 * structWrap: 53 * - GAction* -> ActionIF 54 * module aliases: 55 * local aliases: 56 * overrides: 57 */ 58 59 module gio.SimpleActionGroup; 60 61 public import gtkc.giotypes; 62 63 private import gtkc.gio; 64 private import glib.ConstructionException; 65 private import gobject.ObjectG; 66 67 68 private import glib.Str; 69 private import gio.Action; 70 private import gio.ActionIF; 71 private import gio.ActionGroupIF; 72 private import gio.ActionGroupT; 73 74 75 76 private import gobject.ObjectG; 77 78 /** 79 * Description 80 * GSimpleActionGroup is a hash table filled with GAction objects, 81 * implementing the GActionGroup interface. 82 */ 83 public class SimpleActionGroup : ObjectG, ActionGroupIF 84 { 85 86 /** the main Gtk struct */ 87 protected GSimpleActionGroup* gSimpleActionGroup; 88 89 90 public GSimpleActionGroup* getSimpleActionGroupStruct() 91 { 92 return gSimpleActionGroup; 93 } 94 95 96 /** the main Gtk struct as a void* */ 97 protected override void* getStruct() 98 { 99 return cast(void*)gSimpleActionGroup; 100 } 101 102 /** 103 * Sets our main struct and passes it to the parent class 104 */ 105 public this (GSimpleActionGroup* gSimpleActionGroup) 106 { 107 super(cast(GObject*)gSimpleActionGroup); 108 this.gSimpleActionGroup = gSimpleActionGroup; 109 } 110 111 protected override void setStruct(GObject* obj) 112 { 113 super.setStruct(obj); 114 gSimpleActionGroup = cast(GSimpleActionGroup*)obj; 115 } 116 117 // add the ActionGroup capabilities 118 mixin ActionGroupT!(GSimpleActionGroup); 119 120 /** 121 */ 122 123 /** 124 * Creates a new, empty, GSimpleActionGroup. 125 * Since 2.28 126 * Throws: ConstructionException GTK+ fails to create the object. 127 */ 128 public this () 129 { 130 // GSimpleActionGroup * g_simple_action_group_new (void); 131 auto p = g_simple_action_group_new(); 132 if(p is null) 133 { 134 throw new ConstructionException("null returned by g_simple_action_group_new()"); 135 } 136 this(cast(GSimpleActionGroup*) p); 137 } 138 139 /** 140 * Looks up the action with the name action_name in the group. 141 * If no such action exists, returns NULL. 142 * Since 2.28 143 * Params: 144 * actionName = the name of an action 145 * Returns: a GAction, or NULL. [transfer none] 146 */ 147 public ActionIF lookup(string actionName) 148 { 149 // GAction * g_simple_action_group_lookup (GSimpleActionGroup *simple, const gchar *action_name); 150 auto p = g_simple_action_group_lookup(gSimpleActionGroup, Str.toStringz(actionName)); 151 152 if(p is null) 153 { 154 return null; 155 } 156 157 return ObjectG.getDObject!(Action, ActionIF)(cast(GAction*) p); 158 } 159 160 /** 161 * Adds an action to the action group. 162 * If the action group already contains an action with the same name as 163 * action then the old action is dropped from the group. 164 * The action group takes its own reference on action. 165 * Since 2.28 166 * Params: 167 * action = a GAction 168 */ 169 public void insert(ActionIF action) 170 { 171 // void g_simple_action_group_insert (GSimpleActionGroup *simple, GAction *action); 172 g_simple_action_group_insert(gSimpleActionGroup, (action is null) ? null : action.getActionTStruct()); 173 } 174 175 /** 176 * Removes the named action from the action group. 177 * If no action of this name is in the group then nothing happens. 178 * Since 2.28 179 * Params: 180 * actionName = the name of the action 181 */ 182 public void remove(string actionName) 183 { 184 // void g_simple_action_group_remove (GSimpleActionGroup *simple, const gchar *action_name); 185 g_simple_action_group_remove(gSimpleActionGroup, Str.toStringz(actionName)); 186 } 187 }