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  = GAction.html
27  * outPack = gio
28  * outFile = ActionIF
29  * strct   = GAction
30  * realStrct=
31  * ctorStrct=
32  * clss    = ActionT
33  * interf  = ActionIF
34  * class Code: No
35  * interface Code: No
36  * template for:
37  * extend  = 
38  * implements:
39  * prefixes:
40  * 	- g_action_
41  * omit structs:
42  * omit prefixes:
43  * omit code:
44  * omit signals:
45  * imports:
46  * 	- glib.Str
47  * 	- glib.ErrorG
48  * 	- glib.GException
49  * 	- glib.Variant
50  * 	- glib.VariantType
51  * structWrap:
52  * 	- GVariant* -> Variant
53  * 	- GVariantType* -> VariantType
54  * module aliases:
55  * local aliases:
56  * overrides:
57  */
58 
59 module gio.ActionIF;
60 
61 public  import gtkc.giotypes;
62 
63 private import gtkc.gio;
64 private import glib.ConstructionException;
65 private import gobject.ObjectG;
66 
67 
68 private import glib.Str;
69 private import glib.ErrorG;
70 private import glib.GException;
71 private import glib.Variant;
72 private import glib.VariantType;
73 
74 
75 
76 
77 /**
78  * GAction represents a single named action.
79  *
80  * The main interface to an action is that it can be activated with
81  * g_action_activate(). This results in the 'activate' signal being
82  * emitted. An activation has a GVariant parameter (which may be
83  * NULL). The correct type for the parameter is determined by a static
84  * parameter type (which is given at construction time).
85  *
86  * An action may optionally have a state, in which case the state may be
87  * set with g_action_change_state(). This call takes a GVariant. The
88  * correct type for the state is determined by a static state type
89  * (which is given at construction time).
90  *
91  * The state may have a hint associated with it, specifying its valid
92  * range.
93  *
94  * GAction is merely the interface to the concept of an action, as
95  * described above. Various implementations of actions exist, including
96  * GSimpleAction and GtkAction.
97  *
98  * In all cases, the implementing class is responsible for storing the
99  * name of the action, the parameter type, the enabled state, the
100  * optional state type and the state and emitting the appropriate
101  * signals when these change. The implementor responsible for filtering
102  * calls to g_action_activate() and g_action_change_state() for type
103  * safety and for the state being enabled.
104  *
105  * Probably the only useful thing to do with a GAction is to put it
106  * inside of a GSimpleActionGroup.
107  */
108 public interface ActionIF
109 {
110 	
111 	
112 	public GAction* getActionTStruct();
113 	
114 	/** the main Gtk struct as a void* */
115 	protected void* getStruct();
116 	
117 	
118 	/**
119 	 */
120 	
121 	/**
122 	 * Checks if action_name is valid.
123 	 * action_name is valid if it consists only of alphanumeric characters,
124 	 * plus '-' and '.'. The empty string is not a valid action name.
125 	 * It is an error to call this function with a non-utf8 action_name.
126 	 * action_name must not be NULL.
127 	 * Since 2.38
128 	 * Params:
129 	 * actionName = an potential action name
130 	 * Returns: TRUE if action_name is valid
131 	 */
132 	public static int nameIsValid(string actionName);
133 	
134 	/**
135 	 * Queries the name of action.
136 	 * Since 2.28
137 	 * Returns: the name of the action
138 	 */
139 	public string getName();
140 	
141 	/**
142 	 * Queries the type of the parameter that must be given when activating
143 	 * action.
144 	 * When activating the action using g_action_activate(), the GVariant
145 	 * given to that function must be of the type returned by this function.
146 	 * In the case that this function returns NULL, you must not give any
147 	 * GVariant, but NULL instead.
148 	 * Since 2.28
149 	 * Returns: the parameter type. [allow-none]
150 	 */
151 	public VariantType getParameterType();
152 	
153 	/**
154 	 * Queries the type of the state of action.
155 	 * If the action is stateful (e.g. created with
156 	 * g_simple_action_new_stateful()) then this function returns the
157 	 * GVariantType of the state. This is the type of the initial value
158 	 * given as the state. All calls to g_action_change_state() must give a
159 	 * GVariant of this type and g_action_get_state() will return a
160 	 * GVariant of the same type.
161 	 * If the action is not stateful (e.g. created with g_simple_action_new())
162 	 * then this function will return NULL. In that case, g_action_get_state()
163 	 * will return NULL and you must not call g_action_change_state().
164 	 * Since 2.28
165 	 * Returns: the state type, if the action is stateful. [allow-none]
166 	 */
167 	public VariantType getStateType();
168 	
169 	/**
170 	 * Requests a hint about the valid range of values for the state of
171 	 * action.
172 	 * If NULL is returned it either means that the action is not stateful
173 	 * or that there is no hint about the valid range of values for the
174 	 * state of the action.
175 	 * If a GVariant array is returned then each item in the array is a
176 	 * possible value for the state. If a GVariant pair (ie: two-tuple) is
177 	 * returned then the tuple specifies the inclusive lower and upper bound
178 	 * of valid values for the state.
179 	 * In any case, the information is merely a hint. It may be possible to
180 	 * have a state value outside of the hinted range and setting a value
181 	 * within the range may fail.
182 	 * The return value (if non-NULL) should be freed with
183 	 * g_variant_unref() when it is no longer required.
184 	 * Since 2.28
185 	 * Returns: the state range hint. [transfer full]
186 	 */
187 	public Variant getStateHint();
188 	
189 	/**
190 	 * Checks if action is currently enabled.
191 	 * An action must be enabled in order to be activated or in order to
192 	 * have its state changed from outside callers.
193 	 * Since 2.28
194 	 * Returns: whether the action is enabled
195 	 */
196 	public int getEnabled();
197 	
198 	/**
199 	 * Queries the current state of action.
200 	 * If the action is not stateful then NULL will be returned. If the
201 	 * action is stateful then the type of the return value is the type
202 	 * given by g_action_get_state_type().
203 	 * The return value (if non-NULL) should be freed with
204 	 * g_variant_unref() when it is no longer required.
205 	 * Since 2.28
206 	 * Returns: the current state of the action. [transfer full]
207 	 */
208 	public Variant getState();
209 	
210 	/**
211 	 * Request for the state of action to be changed to value.
212 	 * The action must be stateful and value must be of the correct type.
213 	 * See g_action_get_state_type().
214 	 * This call merely requests a change. The action may refuse to change
215 	 * its state or may change its state to something other than value.
216 	 * See g_action_get_state_hint().
217 	 * If the value GVariant is floating, it is consumed.
218 	 * Since 2.30
219 	 * Params:
220 	 * value = the new state
221 	 */
222 	public void changeState(Variant value);
223 	
224 	/**
225 	 * Activates the action.
226 	 * Since 2.28
227 	 * Params:
228 	 * parameter = the parameter to the activation. [allow-none]
229 	 */
230 	public void activate(Variant parameter);
231 	
232 	/**
233 	 * Parses a detailed action name into its separate name and target
234 	 * components.
235 	 * Detailed action names can have three formats.
236 	 * The first format is used to represent an action name with no target
237 	 * value and consists of just an action name containing no whitespace
238 	 * nor the characters ':', '(' or ')'. For example: "app.action".
239 	 * The second format is used to represent an action with a target value
240 	 * that is a non-empty string consisting only of alphanumerics, plus '-'
241 	 * and '.'. In that case, the action name and target value are
242 	 * separated by a double colon ("::"). For example:
243 	 * "app.action::target".
244 	 * The third format is used to represent an action with any type of
245 	 * target value, including strings. The target value follows the action
246 	 * name, surrounded in parens. For example: "app.action(42)". The
247 	 * target value is parsed using g_variant_parse(). If a tuple-typed
248 	 * value is desired, it must be specified in the same way, resulting in
249 	 * two sets of parens, for example: "app.action((1,2,3))". A string
250 	 * target can be specified this way as well: "app.action('target')".
251 	 * For strings, this third format must be used if * target value is
252 	 * empty or contains characters other than alphanumerics, '-' and '.'.
253 	 * Since 2.38
254 	 * Params:
255 	 * detailedName = a detailed action name
256 	 * actionName = the action name. [out]
257 	 * targetValue = the target value, or NULL for no target. [out]
258 	 * Returns: TRUE if successful, else FALSE with error set
259 	 * Throws: GException on failure.
260 	 */
261 	public static int parseDetailedName(string detailedName, out string actionName, out Variant targetValue);
262 	
263 	/**
264 	 * Formats a detailed action name from action_name and target_value.
265 	 * It is an error to call this function with an invalid action name.
266 	 * This function is the opposite of
267 	 * g_action_parse_detailed_action_name(). It will produce a string that
268 	 * can be parsed back to the action_name and target_value by that
269 	 * function.
270 	 * See that function for the types of strings that will be printed by
271 	 * this function.
272 	 * Since 2.38
273 	 * Params:
274 	 * actionName = a valid action name
275 	 * Returns: a detailed format string
276 	 */
277 	public static string printDetailedName(string actionName, Variant parameter);
278 }