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 glib.Str;
28 private import glib.Variant;
29 private import glib.VariantType;
30 private import gobject.Signals;
31 public  import gtkc.gdktypes;
32 private import gtkc.gio;
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();
87 
88 	/** the main Gtk struct as a void* */
89 	protected void* getStruct();
90 
91 
92 	/**
93 	 * Emits the #GActionGroup::action-added signal on @action_group.
94 	 *
95 	 * This function should only be called by #GActionGroup implementations.
96 	 *
97 	 * Params:
98 	 *     actionName = the name of an action in the group
99 	 *
100 	 * Since: 2.28
101 	 */
102 	public void actionAdded(string actionName);
103 
104 	/**
105 	 * Emits the #GActionGroup::action-enabled-changed signal on @action_group.
106 	 *
107 	 * This function should only be called by #GActionGroup implementations.
108 	 *
109 	 * Params:
110 	 *     actionName = the name of an action in the group
111 	 *     enabled = whether or not the action is now enabled
112 	 *
113 	 * Since: 2.28
114 	 */
115 	public void actionEnabledChanged(string actionName, bool enabled);
116 
117 	/**
118 	 * Emits the #GActionGroup::action-removed signal on @action_group.
119 	 *
120 	 * This function should only be called by #GActionGroup implementations.
121 	 *
122 	 * Params:
123 	 *     actionName = the name of an action in the group
124 	 *
125 	 * Since: 2.28
126 	 */
127 	public void actionRemoved(string actionName);
128 
129 	/**
130 	 * Emits the #GActionGroup::action-state-changed signal on @action_group.
131 	 *
132 	 * This function should only be called by #GActionGroup implementations.
133 	 *
134 	 * Params:
135 	 *     actionName = the name of an action in the group
136 	 *     state = the new state of the named action
137 	 *
138 	 * Since: 2.28
139 	 */
140 	public void actionStateChanged(string actionName, Variant state);
141 
142 	/**
143 	 * Activate the named action within @action_group.
144 	 *
145 	 * If the action is expecting a parameter, then the correct type of
146 	 * parameter must be given as @parameter.  If the action is expecting no
147 	 * parameters then @parameter must be %NULL.  See
148 	 * g_action_group_get_action_parameter_type().
149 	 *
150 	 * Params:
151 	 *     actionName = the name of the action to activate
152 	 *     parameter = parameters to the activation
153 	 *
154 	 * Since: 2.28
155 	 */
156 	public void activateAction(string actionName, Variant parameter);
157 
158 	/**
159 	 * Request for the state of the named action within @action_group to be
160 	 * changed to @value.
161 	 *
162 	 * The action must be stateful and @value must be of the correct type.
163 	 * See g_action_group_get_action_state_type().
164 	 *
165 	 * This call merely requests a change.  The action may refuse to change
166 	 * its state or may change its state to something other than @value.
167 	 * See g_action_group_get_action_state_hint().
168 	 *
169 	 * If the @value GVariant is floating, it is consumed.
170 	 *
171 	 * Params:
172 	 *     actionName = the name of the action to request the change on
173 	 *     value = the new state
174 	 *
175 	 * Since: 2.28
176 	 */
177 	public void changeActionState(string actionName, Variant value);
178 
179 	/**
180 	 * Checks if the named action within @action_group is currently enabled.
181 	 *
182 	 * An action must be enabled in order to be activated or in order to
183 	 * have its state changed from outside callers.
184 	 *
185 	 * Params:
186 	 *     actionName = the name of the action to query
187 	 *
188 	 * Return: whether or not the action is currently enabled
189 	 *
190 	 * Since: 2.28
191 	 */
192 	public bool getActionEnabled(string actionName);
193 
194 	/**
195 	 * Queries the type of the parameter that must be given when activating
196 	 * the named action within @action_group.
197 	 *
198 	 * When activating the action using g_action_group_activate_action(),
199 	 * the #GVariant given to that function must be of the type returned
200 	 * by this function.
201 	 *
202 	 * In the case that this function returns %NULL, you must not give any
203 	 * #GVariant, but %NULL instead.
204 	 *
205 	 * The parameter type of a particular action will never change but it is
206 	 * possible for an action to be removed and for a new action to be added
207 	 * with the same name but a different parameter type.
208 	 *
209 	 * Params:
210 	 *     actionName = the name of the action to query
211 	 *
212 	 * Return: the parameter type
213 	 *
214 	 * Since: 2.28
215 	 */
216 	public VariantType getActionParameterType(string actionName);
217 
218 	/**
219 	 * Queries the current state of the named action within @action_group.
220 	 *
221 	 * If the action is not stateful then %NULL will be returned.  If the
222 	 * action is stateful then the type of the return value is the type
223 	 * given by g_action_group_get_action_state_type().
224 	 *
225 	 * The return value (if non-%NULL) should be freed with
226 	 * g_variant_unref() when it is no longer required.
227 	 *
228 	 * Params:
229 	 *     actionName = the name of the action to query
230 	 *
231 	 * Return: the current state of the action
232 	 *
233 	 * Since: 2.28
234 	 */
235 	public Variant getActionState(string actionName);
236 
237 	/**
238 	 * Requests a hint about the valid range of values for the state of the
239 	 * named action within @action_group.
240 	 *
241 	 * If %NULL is returned it either means that the action is not stateful
242 	 * or that there is no hint about the valid range of values for the
243 	 * state of the action.
244 	 *
245 	 * If a #GVariant array is returned then each item in the array is a
246 	 * possible value for the state.  If a #GVariant pair (ie: two-tuple) is
247 	 * returned then the tuple specifies the inclusive lower and upper bound
248 	 * of valid values for the state.
249 	 *
250 	 * In any case, the information is merely a hint.  It may be possible to
251 	 * have a state value outside of the hinted range and setting a value
252 	 * within the range may fail.
253 	 *
254 	 * The return value (if non-%NULL) should be freed with
255 	 * g_variant_unref() when it is no longer required.
256 	 *
257 	 * Params:
258 	 *     actionName = the name of the action to query
259 	 *
260 	 * Return: the state range hint
261 	 *
262 	 * Since: 2.28
263 	 */
264 	public Variant getActionStateHint(string actionName);
265 
266 	/**
267 	 * Queries the type of the state of the named action within
268 	 * @action_group.
269 	 *
270 	 * If the action is stateful then this function returns the
271 	 * #GVariantType of the state.  All calls to
272 	 * g_action_group_change_action_state() must give a #GVariant of this
273 	 * type and g_action_group_get_action_state() will return a #GVariant
274 	 * of the same type.
275 	 *
276 	 * If the action is not stateful then this function will return %NULL.
277 	 * In that case, g_action_group_get_action_state() will return %NULL
278 	 * and you must not call g_action_group_change_action_state().
279 	 *
280 	 * The state type of a particular action will never change but it is
281 	 * possible for an action to be removed and for a new action to be added
282 	 * with the same name but a different state type.
283 	 *
284 	 * Params:
285 	 *     actionName = the name of the action to query
286 	 *
287 	 * Return: the state type, if the action is stateful
288 	 *
289 	 * Since: 2.28
290 	 */
291 	public VariantType getActionStateType(string actionName);
292 
293 	/**
294 	 * Checks if the named action exists within @action_group.
295 	 *
296 	 * Params:
297 	 *     actionName = the name of the action to check for
298 	 *
299 	 * Return: whether the named action exists
300 	 *
301 	 * Since: 2.28
302 	 */
303 	public bool hasAction(string actionName);
304 
305 	/**
306 	 * Lists the actions contained within @action_group.
307 	 *
308 	 * The caller is responsible for freeing the list with g_strfreev() when
309 	 * it is no longer required.
310 	 *
311 	 * Return: a %NULL-terminated array of the names of the
312 	 *     actions in the group
313 	 *
314 	 * Since: 2.28
315 	 */
316 	public string[] listActions();
317 
318 	/**
319 	 * Queries all aspects of the named action within an @action_group.
320 	 *
321 	 * This function acquires the information available from
322 	 * g_action_group_has_action(), g_action_group_get_action_enabled(),
323 	 * g_action_group_get_action_parameter_type(),
324 	 * g_action_group_get_action_state_type(),
325 	 * g_action_group_get_action_state_hint() and
326 	 * g_action_group_get_action_state() with a single function call.
327 	 *
328 	 * This provides two main benefits.
329 	 *
330 	 * The first is the improvement in efficiency that comes with not having
331 	 * to perform repeated lookups of the action in order to discover
332 	 * different things about it.  The second is that implementing
333 	 * #GActionGroup can now be done by only overriding this one virtual
334 	 * function.
335 	 *
336 	 * The interface provides a default implementation of this function that
337 	 * calls the individual functions, as required, to fetch the
338 	 * information.  The interface also provides default implementations of
339 	 * those functions that call this function.  All implementations,
340 	 * therefore, must override either this function or all of the others.
341 	 *
342 	 * If the action exists, %TRUE is returned and any of the requested
343 	 * fields (as indicated by having a non-%NULL reference passed in) are
344 	 * filled.  If the action doesn't exist, %FALSE is returned and the
345 	 * fields may or may not have been modified.
346 	 *
347 	 * Params:
348 	 *     actionName = the name of an action in the group
349 	 *     enabled = if the action is presently enabled
350 	 *     parameterType = the parameter type, or %NULL if none needed
351 	 *     stateType = the state type, or %NULL if stateless
352 	 *     stateHint = the state hint, or %NULL if none
353 	 *     state = the current state, or %NULL if stateless
354 	 *
355 	 * Return: %TRUE if the action exists, else %FALSE
356 	 *
357 	 * Since: 2.32
358 	 */
359 	public bool queryAction(string actionName, out bool enabled, out VariantType parameterType, out VariantType stateType, out Variant stateHint, out Variant state);
360 	/**
361 	 * Signals that a new action was just added to the group.
362 	 * This signal is emitted after the action has been added
363 	 * and is now visible.
364 	 *
365 	 * Params:
366 	 *     actionName = the name of the action in @action_group
367 	 *
368 	 * Since: 2.28
369 	 */
370 	gulong addOnActionAdded(void delegate(string, ActionGroupIF) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
371 	;
372 
373 	/**
374 	 * Signals that the enabled status of the named action has changed.
375 	 *
376 	 * Params:
377 	 *     actionName = the name of the action in @action_group
378 	 *     enabled = whether the action is enabled or not
379 	 *
380 	 * Since: 2.28
381 	 */
382 	gulong addOnActionEnabledChanged(void delegate(string, bool, ActionGroupIF) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
383 	;
384 
385 	/**
386 	 * Signals that an action is just about to be removed from the group.
387 	 * This signal is emitted before the action is removed, so the action
388 	 * is still visible and can be queried from the signal handler.
389 	 *
390 	 * Params:
391 	 *     actionName = the name of the action in @action_group
392 	 *
393 	 * Since: 2.28
394 	 */
395 	gulong addOnActionRemoved(void delegate(string, ActionGroupIF) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
396 	;
397 
398 	/**
399 	 * Signals that the state of the named action has changed.
400 	 *
401 	 * Params:
402 	 *     actionName = the name of the action in @action_group
403 	 *     value = the new value of the state
404 	 *
405 	 * Since: 2.28
406 	 */
407 	gulong addOnActionStateChanged(void delegate(string, Variant, ActionGroupIF) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
408 	;
409 
410 }