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.ActionGroupIF; 28 private import gio.ActionGroupT; 29 private import gio.ActionIF; 30 private import gio.ActionMapIF; 31 private import gio.ActionMapT; 32 private import gio.c.functions; 33 public import gio.c.types; 34 private import glib.ConstructionException; 35 private import glib.Str; 36 private import gobject.ObjectG; 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 * userData = the user data for signal connections 124 * 125 * Since: 2.30 126 */ 127 public void addEntries(GActionEntry[] entries, void* userData) 128 { 129 g_simple_action_group_add_entries(gSimpleActionGroup, entries.ptr, cast(int)entries.length, userData); 130 } 131 132 /** 133 * Adds an action to the action group. 134 * 135 * If the action group already contains an action with the same name as 136 * @action then the old action is dropped from the group. 137 * 138 * The action group takes its own reference on @action. 139 * 140 * Deprecated: Use g_action_map_add_action() 141 * 142 * Params: 143 * action = a #GAction 144 * 145 * Since: 2.28 146 */ 147 public void insert(ActionIF action) 148 { 149 g_simple_action_group_insert(gSimpleActionGroup, (action is null) ? null : action.getActionStruct()); 150 } 151 152 /** 153 * Looks up the action with the name @action_name in the group. 154 * 155 * If no such action exists, returns %NULL. 156 * 157 * Deprecated: Use g_action_map_lookup_action() 158 * 159 * Params: 160 * actionName = the name of an action 161 * 162 * Returns: a #GAction, or %NULL 163 * 164 * Since: 2.28 165 */ 166 public ActionIF lookup(string actionName) 167 { 168 auto p = g_simple_action_group_lookup(gSimpleActionGroup, Str.toStringz(actionName)); 169 170 if(p is null) 171 { 172 return null; 173 } 174 175 return ObjectG.getDObject!(ActionIF)(cast(GAction*) p); 176 } 177 178 /** 179 * Removes the named action from the action group. 180 * 181 * If no action of this name is in the group then nothing happens. 182 * 183 * Deprecated: Use g_action_map_remove_action() 184 * 185 * Params: 186 * actionName = the name of the action 187 * 188 * Since: 2.28 189 */ 190 public void remove(string actionName) 191 { 192 g_simple_action_group_remove(gSimpleActionGroup, Str.toStringz(actionName)); 193 } 194 }