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