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