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