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  = GActionGroup.html
27  * outPack = gio
28  * outFile = ActionGroupIF
29  * strct   = GActionGroup
30  * realStrct=
31  * ctorStrct=
32  * clss    = ActionGroupT
33  * interf  = ActionGroupIF
34  * class Code: No
35  * interface Code: No
36  * template for:
37  * extend  = 
38  * implements:
39  * prefixes:
40  * 	- g_action_group_
41  * omit structs:
42  * omit prefixes:
43  * omit code:
44  * omit signals:
45  * imports:
46  * 	- glib.Str
47  * 	- glib.Variant
48  * 	- glib.VariantType
49  * structWrap:
50  * 	- GVariant* -> Variant
51  * 	- GVariantType* -> VariantType
52  * module aliases:
53  * local aliases:
54  * overrides:
55  */
56 
57 module gio.ActionGroupIF;
58 
59 public  import gtkc.giotypes;
60 
61 private import gtkc.gio;
62 private import glib.ConstructionException;
63 private import gobject.ObjectG;
64 
65 private import gobject.Signals;
66 public  import gtkc.gdktypes;
67 private import glib.Str;
68 private import glib.Variant;
69 private import glib.VariantType;
70 
71 
72 
73 /**
74  * GActionGroup represents a group of actions. Actions can be used to
75  * expose functionality in a structured way, either from one part of a
76  * program to another, or to the outside world. Action groups are often
77  * used together with a GMenuModel that provides additional
78  * representation data for displaying the actions to the user, e.g. in
79  * a menu.
80  *
81  * The main way to interact with the actions in a GActionGroup is to
82  * activate them with g_action_group_activate_action(). Activating an
83  * action may require a GVariant parameter. The required type of the
84  * parameter can be inquired with g_action_group_get_action_parameter_type().
85  * Actions may be disabled, see g_action_group_get_action_enabled().
86  * Activating a disabled action has no effect.
87  *
88  * Actions may optionally have a state in the form of a GVariant. The
89  * current state of an action can be inquired with
90  * g_action_group_get_action_state(). Activating a stateful action may
91  * change its state, but it is also possible to set the state by calling
92  * g_action_group_change_action_state().
93  *
94  * As typical example, consider a text editing application which has an
95  * option to change the current font to 'bold'. A good way to represent
96  * this would be a stateful action, with a boolean state. Activating the
97  * action would toggle the state.
98  *
99  * Each action in the group has a unique name (which is a string). All
100  * method calls, except g_action_group_list_actions() take the name of
101  * an action as an argument.
102  *
103  * The GActionGroup API is meant to be the 'public' API to the action
104  * group. The calls here are exactly the interaction that 'external
105  * forces' (eg: UI, incoming D-Bus messages, etc.) are supposed to have
106  * with actions. 'Internal' APIs (ie: ones meant only to be accessed by
107  * the action group implementation) are found on subclasses. This is
108  * why you will find - for example - g_action_group_get_action_enabled()
109  * but not an equivalent set() call.
110  *
111  * Signals are emitted on the action group in response to state changes
112  * on individual actions.
113  *
114  * Implementations of GActionGroup should provide implementations for
115  * the virtual functions g_action_group_list_actions() and
116  * g_action_group_query_action(). The other virtual functions should
117  * not be implemented - their "wrappers" are actually implemented with
118  * calls to g_action_group_query_action().
119  */
120 public interface ActionGroupIF
121 {
122 	
123 	
124 	/** Get the main Gtk struct */
125 	public GActionGroup* getActionGroupTStruct();
126 	
127 	/** the main Gtk struct as a void* */
128 	protected void* getStruct();
129 	
130 	
131 	/**
132 	 */
133 	
134 	@property void delegate(string, ActionGroupIF)[] onActionAddedListeners();
135 	/**
136 	 * Signals that a new action was just added to the group.
137 	 * This signal is emitted after the action has been added
138 	 * and is now visible.
139 	 * Since 2.28
140 	 */
141 	void addOnActionAdded(void delegate(string, ActionGroupIF) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0);
142 	@property void delegate(string, gboolean, ActionGroupIF)[] onActionEnabledChangedListeners();
143 	/**
144 	 * Signals that the enabled status of the named action has changed.
145 	 * Since 2.28
146 	 */
147 	void addOnActionEnabledChanged(void delegate(string, gboolean, ActionGroupIF) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0);
148 	@property void delegate(string, ActionGroupIF)[] onActionRemovedListeners();
149 	/**
150 	 * Signals that an action is just about to be removed from the group.
151 	 * This signal is emitted before the action is removed, so the action
152 	 * is still visible and can be queried from the signal handler.
153 	 * Since 2.28
154 	 */
155 	void addOnActionRemoved(void delegate(string, ActionGroupIF) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0);
156 	@property void delegate(string, Variant, ActionGroupIF)[] onActionStateChangedListeners();
157 	/**
158 	 * Signals that the state of the named action has changed.
159 	 * Since 2.28
160 	 * See Also
161 	 * GAction
162 	 */
163 	void addOnActionStateChanged(void delegate(string, Variant, ActionGroupIF) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0);
164 	
165 	/**
166 	 * Lists the actions contained within action_group.
167 	 * The caller is responsible for freeing the list with g_strfreev() when
168 	 * it is no longer required.
169 	 * Since 2.28
170 	 * Returns: a NULL-terminated array of the names of the actions in the groupb. [transfer full]
171 	 */
172 	public string[] listActions();
173 	
174 	/**
175 	 * Queries all aspects of the named action within an action_group.
176 	 * This function acquires the information available from
177 	 * g_action_group_has_action(), g_action_group_get_action_enabled(),
178 	 * g_action_group_get_action_parameter_type(),
179 	 * g_action_group_get_action_state_type(),
180 	 * g_action_group_get_action_state_hint() and
181 	 * g_action_group_get_action_state() with a single function call.
182 	 * This provides two main benefits.
183 	 * The first is the improvement in efficiency that comes with not having
184 	 * to perform repeated lookups of the action in order to discover
185 	 * different things about it. The second is that implementing
186 	 * GActionGroup can now be done by only overriding this one virtual
187 	 * function.
188 	 * The interface provides a default implementation of this function that
189 	 * calls the individual functions, as required, to fetch the
190 	 * information. The interface also provides default implementations of
191 	 * those functions that call this function. All implementations,
192 	 * therefore, must override either this function or all of the others.
193 	 * If the action exists, TRUE is returned and any of the requested
194 	 * fields (as indicated by having a non-NULL reference passed in) are
195 	 * filled. If the action doesn't exist, FALSE is returned and the
196 	 * fields may or may not have been modified.
197 	 * Since 2.32
198 	 * Params:
199 	 * actionName = the name of an action in the group
200 	 * enabled = if the action is presently enabled. [out]
201 	 * parameterType = the parameter type, or NULL if none needed. [out][allow-none]
202 	 * stateType = the state type, or NULL if stateless. [out][allow-none]
203 	 * stateHint = the state hint, or NULL if none. [out][allow-none]
204 	 * state = the current state, or NULL if stateless. [out][allow-none]
205 	 * Returns: TRUE if the action exists, else FALSE
206 	 */
207 	public int queryAction(string actionName, out int enabled, out VariantType parameterType, out VariantType stateType, out Variant stateHint, out Variant state);
208 	
209 	/**
210 	 * Checks if the named action exists within action_group.
211 	 * Since 2.28
212 	 * Params:
213 	 * actionName = the name of the action to check for
214 	 * Returns: whether the named action exists
215 	 */
216 	public int hasAction(string actionName);
217 	
218 	/**
219 	 * Checks if the named action within action_group is currently enabled.
220 	 * An action must be enabled in order to be activated or in order to
221 	 * have its state changed from outside callers.
222 	 * Since 2.28
223 	 * Params:
224 	 * actionName = the name of the action to query
225 	 * Returns: whether or not the action is currently enabled
226 	 */
227 	public int getActionEnabled(string actionName);
228 	
229 	/**
230 	 * Queries the type of the parameter that must be given when activating
231 	 * the named action within action_group.
232 	 * When activating the action using g_action_group_activate_action(),
233 	 * the GVariant given to that function must be of the type returned
234 	 * by this function.
235 	 * In the case that this function returns NULL, you must not give any
236 	 * GVariant, but NULL instead.
237 	 * The parameter type of a particular action will never change but it is
238 	 * possible for an action to be removed and for a new action to be added
239 	 * with the same name but a different parameter type.
240 	 * Since 2.28
241 	 * Params:
242 	 * actionName = the name of the action to query
243 	 * Returns: the parameter type
244 	 */
245 	public VariantType getActionParameterType(string actionName);
246 	
247 	/**
248 	 * Queries the type of the state of the named action within
249 	 * action_group.
250 	 * If the action is stateful then this function returns the
251 	 * GVariantType of the state. All calls to
252 	 * g_action_group_change_action_state() must give a GVariant of this
253 	 * type and g_action_group_get_action_state() will return a GVariant
254 	 * of the same type.
255 	 * If the action is not stateful then this function will return NULL.
256 	 * In that case, g_action_group_get_action_state() will return NULL
257 	 * and you must not call g_action_group_change_action_state().
258 	 * The state type of a particular action will never change but it is
259 	 * possible for an action to be removed and for a new action to be added
260 	 * with the same name but a different state type.
261 	 * Since 2.28
262 	 * Params:
263 	 * actionName = the name of the action to query
264 	 * Returns: the state type, if the action is stateful. [transfer full]
265 	 */
266 	public VariantType getActionStateType(string actionName);
267 	
268 	/**
269 	 * Requests a hint about the valid range of values for the state of the
270 	 * named action within action_group.
271 	 * If NULL is returned it either means that the action is not stateful
272 	 * or that there is no hint about the valid range of values for the
273 	 * state of the action.
274 	 * If a GVariant array is returned then each item in the array is a
275 	 * possible value for the state. If a GVariant pair (ie: two-tuple) is
276 	 * returned then the tuple specifies the inclusive lower and upper bound
277 	 * of valid values for the state.
278 	 * In any case, the information is merely a hint. It may be possible to
279 	 * have a state value outside of the hinted range and setting a value
280 	 * within the range may fail.
281 	 * The return value (if non-NULL) should be freed with
282 	 * g_variant_unref() when it is no longer required.
283 	 * Since 2.28
284 	 * Params:
285 	 * actionName = the name of the action to query
286 	 * Returns: the state range hint. [transfer full]
287 	 */
288 	public Variant getActionStateHint(string actionName);
289 	
290 	/**
291 	 * Queries the current state of the named action within action_group.
292 	 * If the action is not stateful then NULL will be returned. If the
293 	 * action is stateful then the type of the return value is the type
294 	 * given by g_action_group_get_action_state_type().
295 	 * The return value (if non-NULL) should be freed with
296 	 * g_variant_unref() when it is no longer required.
297 	 * Since 2.28
298 	 * Params:
299 	 * actionName = the name of the action to query
300 	 * Returns: the current state of the action. [allow-none]
301 	 */
302 	public Variant getActionState(string actionName);
303 	
304 	/**
305 	 * Request for the state of the named action within action_group to be
306 	 * changed to value.
307 	 * The action must be stateful and value must be of the correct type.
308 	 * See g_action_group_get_action_state_type().
309 	 * This call merely requests a change. The action may refuse to change
310 	 * its state or may change its state to something other than value.
311 	 * See g_action_group_get_action_state_hint().
312 	 * If the value GVariant is floating, it is consumed.
313 	 * Since 2.28
314 	 * Params:
315 	 * actionName = the name of the action to request the change on
316 	 * value = the new state
317 	 */
318 	public void changeActionState(string actionName, Variant value);
319 	
320 	/**
321 	 * Activate the named action within action_group.
322 	 * If the action is expecting a parameter, then the correct type of
323 	 * parameter must be given as parameter. If the action is expecting no
324 	 * parameters then parameter must be NULL. See
325 	 * g_action_group_get_action_parameter_type().
326 	 * Since 2.28
327 	 * Params:
328 	 * actionName = the name of the action to activate
329 	 * parameter = parameters to the activation. [allow-none]
330 	 */
331 	public void activateAction(string actionName, Variant parameter);
332 	
333 	/**
334 	 * Emits the "action-added" signal on action_group.
335 	 * This function should only be called by GActionGroup implementations.
336 	 * Since 2.28
337 	 * Params:
338 	 * actionName = the name of an action in the group
339 	 */
340 	public void actionAdded(string actionName);
341 	
342 	/**
343 	 * Emits the "action-removed" signal on action_group.
344 	 * This function should only be called by GActionGroup implementations.
345 	 * Since 2.28
346 	 * Params:
347 	 * actionName = the name of an action in the group
348 	 */
349 	public void actionRemoved(string actionName);
350 	
351 	/**
352 	 * Emits the "action-enabled-changed" signal on action_group.
353 	 * This function should only be called by GActionGroup implementations.
354 	 * Since 2.28
355 	 * Params:
356 	 * actionName = the name of an action in the group
357 	 * enabled = whether or not the action is now enabled
358 	 */
359 	public void actionEnabledChanged(string actionName, int enabled);
360 	
361 	/**
362 	 * Emits the "action-state-changed" signal on action_group.
363 	 * This function should only be called by GActionGroup implementations.
364 	 * Since 2.28
365 	 * Signal Details
366 	 * The "action-added" signal
367 	 * void user_function (GActionGroup *action_group,
368 	 *  gchar *action_name,
369 	 *  gpointer user_data) : Has Details
370 	 * Signals that a new action was just added to the group.
371 	 * This signal is emitted after the action has been added
372 	 * and is now visible.
373 	 * Since 2.28
374 	 * Params:
375 	 * actionName = the name of an action in the group
376 	 * state = the new state of the named action
377 	 * actionName = the name of the action in action_group
378 	 */
379 	public void actionStateChanged(string actionName, Variant state);
380 }