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 = GActionMap.html 27 * outPack = gio 28 * outFile = ActionMapT 29 * strct = GActionMap 30 * realStrct= 31 * ctorStrct= 32 * clss = ActionMapT 33 * interf = ActionMapIF 34 * class Code: No 35 * interface Code: No 36 * template for: 37 * - TStruct 38 * extend = 39 * implements: 40 * prefixes: 41 * - g_action_map_ 42 * omit structs: 43 * omit prefixes: 44 * omit code: 45 * omit signals: 46 * imports: 47 * - glib.Str 48 * - gio.Action 49 * - gio.ActionIF 50 * structWrap: 51 * - GAction* -> ActionIF 52 * module aliases: 53 * local aliases: 54 * overrides: 55 */ 56 57 module gio.ActionMapT; 58 59 public import gtkc.giotypes; 60 61 public import gtkc.gio; 62 public import glib.ConstructionException; 63 public import gobject.ObjectG; 64 65 66 public import glib.Str; 67 public import gio.Action; 68 public import gio.ActionIF; 69 70 71 72 73 /** 74 * The GActionMap interface is implemented by GActionGroup 75 * implementations that operate by containing a number of 76 * named GAction instances, such as GSimpleActionGroup. 77 * 78 * One useful application of this interface is to map the 79 * names of actions from various action groups to unique, 80 * prefixed names (e.g. by prepending "app." or "win."). 81 * This is the motivation for the 'Map' part of the interface 82 * name. 83 */ 84 public template ActionMapT(TStruct) 85 { 86 87 /** the main Gtk struct */ 88 protected GActionMap* gActionMap; 89 90 91 public GActionMap* getActionMapTStruct() 92 { 93 return cast(GActionMap*)getStruct(); 94 } 95 96 97 /** 98 */ 99 100 /** 101 * Looks up the action with the name action_name in action_map. 102 * If no such action exists, returns NULL. 103 * Since 2.32 104 * Params: 105 * actionName = the name of an action 106 * Returns: a GAction, or NULL. [transfer none] 107 */ 108 public ActionIF lookupAction(string actionName) 109 { 110 // GAction * g_action_map_lookup_action (GActionMap *action_map, const gchar *action_name); 111 auto p = g_action_map_lookup_action(getActionMapTStruct(), Str.toStringz(actionName)); 112 113 if(p is null) 114 { 115 return null; 116 } 117 118 return ObjectG.getDObject!(Action, ActionIF)(cast(GAction*) p); 119 } 120 121 /** 122 * A convenience function for creating multiple GSimpleAction instances 123 * and adding them to a GActionMap. 124 * Each action is constructed as per one GActionEntry. 125 * $(DDOC_COMMENT example) 126 * Since 2.32 127 * Params: 128 * entries = a pointer to 129 * the first item in an array of GActionEntry structs. [array length=n_entries][element-type GActionEntry] 130 * nEntries = the length of entries, or -1 if entries is NULL-terminated 131 * userData = the user data for signal connections 132 */ 133 public void addActionEntries(GActionEntry[] entries, void* userData) 134 { 135 // void g_action_map_add_action_entries (GActionMap *action_map, const GActionEntry *entries, gint n_entries, gpointer user_data); 136 g_action_map_add_action_entries(getActionMapTStruct(), entries.ptr, cast(int) entries.length, userData); 137 } 138 139 /** 140 * Adds an action to the action_map. 141 * If the action map already contains an action with the same name 142 * as action then the old action is dropped from the action map. 143 * The action map takes its own reference on action. 144 * Since 2.32 145 * Params: 146 * action = a GAction 147 */ 148 public void addAction(ActionIF action) 149 { 150 // void g_action_map_add_action (GActionMap *action_map, GAction *action); 151 g_action_map_add_action(getActionMapTStruct(), (action is null) ? null : action.getActionTStruct()); 152 } 153 154 /** 155 * Removes the named action from the action map. 156 * If no action of this name is in the map then nothing happens. 157 * Since 2.32 158 * Params: 159 * actionName = the name of the action 160 */ 161 public void removeAction(string actionName) 162 { 163 // void g_action_map_remove_action (GActionMap *action_map, const gchar *action_name); 164 g_action_map_remove_action(getActionMapTStruct(), Str.toStringz(actionName)); 165 } 166 }