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 module gio.SimpleActionGroup; 26 27 private import gio.Action; 28 private import gio.ActionGroupIF; 29 private import gio.ActionGroupT; 30 private import gio.ActionIF; 31 private import gio.ActionMapIF; 32 private import gio.ActionMapT; 33 private import glib.ConstructionException; 34 private import glib.Str; 35 private import gobject.ObjectG; 36 private import gtkc.gio; 37 public import gtkc.giotypes; 38 39 40 /** 41 * #GSimpleActionGroup is a hash table filled with #GAction objects, 42 * implementing the #GActionGroup and #GActionMap interfaces. 43 * 44 * Since: 2.28 45 */ 46 public class SimpleActionGroup : ObjectG, ActionGroupIF, ActionMapIF 47 { 48 /** the main Gtk struct */ 49 protected GSimpleActionGroup* gSimpleActionGroup; 50 51 /** Get the main Gtk struct */ 52 public GSimpleActionGroup* getSimpleActionGroupStruct(bool transferOwnership = false) 53 { 54 if (transferOwnership) 55 ownedRef = false; 56 return gSimpleActionGroup; 57 } 58 59 /** the main Gtk struct as a void* */ 60 protected override void* getStruct() 61 { 62 return cast(void*)gSimpleActionGroup; 63 } 64 65 protected override void setStruct(GObject* obj) 66 { 67 gSimpleActionGroup = cast(GSimpleActionGroup*)obj; 68 super.setStruct(obj); 69 } 70 71 /** 72 * Sets our main struct and passes it to the parent class. 73 */ 74 public this (GSimpleActionGroup* gSimpleActionGroup, bool ownedRef = false) 75 { 76 this.gSimpleActionGroup = gSimpleActionGroup; 77 super(cast(GObject*)gSimpleActionGroup, ownedRef); 78 } 79 80 // add the ActionGroup capabilities 81 mixin ActionGroupT!(GSimpleActionGroup); 82 83 // add the ActionMap capabilities 84 mixin ActionMapT!(GSimpleActionGroup); 85 86 87 /** */ 88 public static GType getType() 89 { 90 return g_simple_action_group_get_type(); 91 } 92 93 /** 94 * Creates a new, empty, #GSimpleActionGroup. 95 * 96 * Returns: a new #GSimpleActionGroup 97 * 98 * Since: 2.28 99 * 100 * Throws: ConstructionException GTK+ fails to create the object. 101 */ 102 public this() 103 { 104 auto p = g_simple_action_group_new(); 105 106 if(p is null) 107 { 108 throw new ConstructionException("null returned by new"); 109 } 110 111 this(cast(GSimpleActionGroup*) p, true); 112 } 113 114 /** 115 * A convenience function for creating multiple #GSimpleAction instances 116 * and adding them to the action group. 117 * 118 * Deprecated: Use g_action_map_add_action_entries() 119 * 120 * Params: 121 * entries = a pointer to the first item in 122 * an array of #GActionEntry structs 123 * nEntries = the length of @entries, or -1 124 * userData = the user data for signal connections 125 * 126 * Since: 2.30 127 */ 128 public void addEntries(GActionEntry[] entries, void* userData) 129 { 130 g_simple_action_group_add_entries(gSimpleActionGroup, entries.ptr, cast(int)entries.length, userData); 131 } 132 133 /** 134 * Adds an action to the action group. 135 * 136 * If the action group already contains an action with the same name as 137 * @action then the old action is dropped from the group. 138 * 139 * The action group takes its own reference on @action. 140 * 141 * Deprecated: Use g_action_map_add_action() 142 * 143 * Params: 144 * action = a #GAction 145 * 146 * Since: 2.28 147 */ 148 public void insert(ActionIF action) 149 { 150 g_simple_action_group_insert(gSimpleActionGroup, (action is null) ? null : action.getActionStruct()); 151 } 152 153 /** 154 * Looks up the action with the name @action_name in the group. 155 * 156 * If no such action exists, returns %NULL. 157 * 158 * Deprecated: Use g_action_map_lookup_action() 159 * 160 * Params: 161 * actionName = the name of an action 162 * 163 * Returns: a #GAction, or %NULL 164 * 165 * Since: 2.28 166 */ 167 public ActionIF lookup(string actionName) 168 { 169 auto p = g_simple_action_group_lookup(gSimpleActionGroup, Str.toStringz(actionName)); 170 171 if(p is null) 172 { 173 return null; 174 } 175 176 return ObjectG.getDObject!(Action, ActionIF)(cast(GAction*) p); 177 } 178 179 /** 180 * Removes the named action from the action group. 181 * 182 * If no action of this name is in the group then nothing happens. 183 * 184 * Deprecated: Use g_action_map_remove_action() 185 * 186 * Params: 187 * actionName = the name of the action 188 * 189 * Since: 2.28 190 */ 191 public void remove(string actionName) 192 { 193 g_simple_action_group_remove(gSimpleActionGroup, Str.toStringz(actionName)); 194 } 195 }