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