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() 53 { 54 return gSimpleActionGroup; 55 } 56 57 /** the main Gtk struct as a void* */ 58 protected override void* getStruct() 59 { 60 return cast(void*)gSimpleActionGroup; 61 } 62 63 protected override void setStruct(GObject* obj) 64 { 65 gSimpleActionGroup = cast(GSimpleActionGroup*)obj; 66 super.setStruct(obj); 67 } 68 69 /** 70 * Sets our main struct and passes it to the parent class. 71 */ 72 public this (GSimpleActionGroup* gSimpleActionGroup, bool ownedRef = false) 73 { 74 this.gSimpleActionGroup = gSimpleActionGroup; 75 super(cast(GObject*)gSimpleActionGroup, ownedRef); 76 } 77 78 // add the ActionGroup capabilities 79 mixin ActionGroupT!(GSimpleActionGroup); 80 81 // add the ActionMap capabilities 82 mixin ActionMapT!(GSimpleActionGroup); 83 84 /** 85 */ 86 87 public static GType getType() 88 { 89 return g_simple_action_group_get_type(); 90 } 91 92 /** 93 * Creates a new, empty, #GSimpleActionGroup. 94 * 95 * Return: a new #GSimpleActionGroup 96 * 97 * Since: 2.28 98 * 99 * Throws: ConstructionException GTK+ fails to create the object. 100 */ 101 public this() 102 { 103 auto p = g_simple_action_group_new(); 104 105 if(p is null) 106 { 107 throw new ConstructionException("null returned by new"); 108 } 109 110 this(cast(GSimpleActionGroup*) p, true); 111 } 112 113 /** 114 * A convenience function for creating multiple #GSimpleAction instances 115 * and adding them to the action group. 116 * 117 * Deprecated: Use g_action_map_add_action_entries() 118 * 119 * Params: 120 * entries = a pointer to the first item in 121 * an array of #GActionEntry structs 122 * nEntries = the length of @entries, or -1 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 * Return: 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!(Action, 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 }