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.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.ActionIF; 58 59 public import gtkc.giotypes; 60 61 private import gtkc.gio; 62 private import glib.ConstructionException; 63 private import gobject.ObjectG; 64 65 66 private import glib.Str; 67 private import glib.Variant; 68 private import glib.VariantType; 69 70 71 72 73 /** 74 * Description 75 * GAction represents a single named action. 76 * The main interface to an action is that it can be activated with 77 * g_action_activate(). This results in the 'activate' signal being 78 * emitted. An activation has a GVariant parameter (which may be 79 * NULL). The correct type for the parameter is determined by a static 80 * parameter type (which is given at construction time). 81 * An action may optionally have a state, in which case the state may be 82 * set with g_action_set_state(). This call takes a GVariant. The 83 * correct type for the state is determined by a static state type 84 * (which is given at construction time). 85 * The state may have a hint associated with it, specifying its valid 86 * range. 87 * GAction is merely the interface to the concept of an action, as 88 * described above. Various implementations of actions exist, including 89 * GSimpleAction and GtkAction. 90 * In all cases, the implementing class is responsible for storing the 91 * name of the action, the parameter type, the enabled state, the 92 * optional state type and the state and emitting the appropriate 93 * signals when these change. The implementor responsible for filtering 94 * calls to g_action_activate() and g_action_set_state() for type safety 95 * and for the state being enabled. 96 * Probably the only useful thing to do with a GAction is to put it 97 * inside of a GSimpleActionGroup. 98 */ 99 public interface ActionIF 100 { 101 102 103 public GAction* getActionTStruct(); 104 105 /** the main Gtk struct as a void* */ 106 protected void* getStruct(); 107 108 109 /** 110 */ 111 112 /** 113 * Queries the name of action. 114 * Since 2.28 115 * Returns: the name of the action 116 */ 117 public string getName(); 118 119 /** 120 * Queries the type of the parameter that must be given when activating 121 * action. 122 * When activating the action using g_action_activate(), the GVariant 123 * given to that function must be of the type returned by this function. 124 * In the case that this function returns NULL, you must not give any 125 * GVariant, but NULL instead. 126 * Since 2.28 127 * Returns: the parameter type. [allow-none] 128 */ 129 public VariantType getParameterType(); 130 131 /** 132 * Queries the type of the state of action. 133 * If the action is stateful (ie: was created with 134 * g_action_new_stateful()) then this function returns the GVariantType 135 * of the state. This is the type of the initial value given as the 136 * state. All calls to g_action_set_state() must give a GVariant of 137 * this type and g_action_get_state() will return a GVariant of the 138 * same type. 139 * If the action is not stateful (ie: created with g_action_new()) then 140 * this function will return NULL. In that case, g_action_get_state() 141 * will return NULL and you must not call g_action_set_state(). 142 * Since 2.28 143 * Returns: the state type, if the action is stateful. [allow-none] 144 */ 145 public VariantType getStateType(); 146 147 /** 148 * Requests a hint about the valid range of values for the state of 149 * action. 150 * If NULL is returned it either means that the action is not stateful 151 * or that there is no hint about the valid range of values for the 152 * state of the action. 153 * If a GVariant array is returned then each item in the array is a 154 * possible value for the state. If a GVariant pair (ie: two-tuple) is 155 * returned then the tuple specifies the inclusive lower and upper bound 156 * of valid values for the state. 157 * In any case, the information is merely a hint. It may be possible to 158 * have a state value outside of the hinted range and setting a value 159 * within the range may fail. 160 * The return value (if non-NULL) should be freed with 161 * g_variant_unref() when it is no longer required. 162 * Since 2.28 163 * Returns: the state range hint. [transfer full] 164 */ 165 public Variant getStateHint(); 166 167 /** 168 * Checks if action is currently enabled. 169 * An action must be enabled in order to be activated or in order to 170 * have its state changed from outside callers. 171 * Since 2.28 172 * Returns: whether the action is enabled 173 */ 174 public int getEnabled(); 175 176 /** 177 * Queries the current state of action. 178 * If the action is not stateful then NULL will be returned. If the 179 * action is stateful then the type of the return value is the type 180 * given by g_action_get_state_type(). 181 * The return value (if non-NULL) should be freed with 182 * g_variant_unref() when it is no longer required. 183 * Since 2.28 184 * Returns: the current state of the action. [transfer full] 185 */ 186 public Variant getState(); 187 188 /** 189 * Request for the state of action to be changed to value. 190 * The action must be stateful and value must be of the correct type. 191 * See g_action_get_state_type(). 192 * This call merely requests a change. The action may refuse to change 193 * its state or may change its state to something other than value. 194 * See g_action_get_state_hint(). 195 * If the value GVariant is floating, it is consumed. 196 * Since 2.28 197 * Params: 198 * value = the new state 199 */ 200 public void setState(Variant value); 201 202 /** 203 * Activates the action. 204 * Since 2.28 205 * Params: 206 * parameter = the parameter to the activation. [allow-none] 207 */ 208 public void activate(Variant parameter); 209 }