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 = AtkAction.html 27 * outPack = atk 28 * outFile = Action 29 * strct = AtkAction 30 * realStrct= 31 * ctorStrct= 32 * clss = Action 33 * interf = 34 * class Code: No 35 * interface Code: No 36 * template for: 37 * extend = 38 * implements: 39 * prefixes: 40 * - atk_action_ 41 * omit structs: 42 * omit prefixes: 43 * omit code: 44 * omit signals: 45 * imports: 46 * - glib.Str 47 * structWrap: 48 * module aliases: 49 * local aliases: 50 * overrides: 51 */ 52 53 module atk.Action; 54 55 public import gtkc.atktypes; 56 57 private import gtkc.atk; 58 private import glib.ConstructionException; 59 private import gobject.ObjectG; 60 61 62 private import glib.Str; 63 64 65 66 67 /** 68 * Description 69 * AtkAction should be implemented by instances of AtkObject classes with 70 * which the user can interact directly, i.e. buttons, checkboxes, 71 * scrollbars, e.g. components which are not "passive" 72 * providers of UI information. 73 * Exceptions: when the user interaction is already covered by 74 * another appropriate interface such as AtkEditableText (insert/delete 75 * test, etc.) or AtkValue (set value) then these actions should not be 76 * exposed by AtkAction as well. 77 * Also note that the AtkAction API is limited in that parameters may not 78 * be passed to the object being activated; thus the action must be 79 * self-contained and specifiable via only a single "verb". Concrete 80 * examples include "press", "release", "click" for buttons, "drag" 81 * (meaning initiate drag) and "drop" for drag sources and drop targets, 82 * etc. 83 * Though most UI interactions on components should be invocable via 84 * keyboard as well as mouse, there will generally be a close mapping 85 * between "mouse actions" that are possible on a component and the 86 * AtkActions. Where mouse and keyboard actions are redundant in effect, 87 * AtkAction should expose only one action rather than exposing redundant 88 * actions if possible. By convention we have been using "mouse centric" 89 * terminology for AtkAction names. 90 */ 91 public class Action 92 { 93 94 /** the main Gtk struct */ 95 protected AtkAction* atkAction; 96 97 98 public AtkAction* getActionStruct() 99 { 100 return atkAction; 101 } 102 103 104 /** the main Gtk struct as a void* */ 105 protected void* getStruct() 106 { 107 return cast(void*)atkAction; 108 } 109 110 /** 111 * Sets our main struct and passes it to the parent class 112 */ 113 public this (AtkAction* atkAction) 114 { 115 this.atkAction = atkAction; 116 } 117 118 /** 119 */ 120 121 /** 122 * Perform the specified action on the object. 123 * Params: 124 * i = the action index corresponding to the action to be performed 125 * Returns: TRUE if success, FALSE otherwise 126 */ 127 public int doAction(int i) 128 { 129 // gboolean atk_action_do_action (AtkAction *action, gint i); 130 return atk_action_do_action(atkAction, i); 131 } 132 133 /** 134 * Gets the number of accessible actions available on the object. 135 * If there are more than one, the first one is considered the 136 * "default" action of the object. 137 * Returns: a the number of actions, or 0 if action does not implement this interface. 138 */ 139 public int getNActions() 140 { 141 // gint atk_action_get_n_actions (AtkAction *action); 142 return atk_action_get_n_actions(atkAction); 143 } 144 145 /** 146 * Returns a description of the specified action of the object. 147 * Params: 148 * i = the action index corresponding to the action to be performed 149 * Returns: a description string, or NULL if action does not implement this interface. 150 */ 151 public string getDescription(int i) 152 { 153 // const gchar * atk_action_get_description (AtkAction *action, gint i); 154 return Str.toString(atk_action_get_description(atkAction, i)); 155 } 156 157 /** 158 * Returns a non-localized string naming the specified action of the 159 * object. This name is generally not descriptive of the end result 160 * of the action, but instead names the 'interaction type' which the 161 * object supports. By convention, the above strings should be used to 162 * represent the actions which correspond to the common point-and-click 163 * interaction techniques of the same name: i.e. 164 * "click", "press", "release", "drag", "drop", "popup", etc. 165 * The "popup" action should be used to pop up a context menu for the 166 * object, if one exists. 167 * For technical reasons, some toolkits cannot guarantee that the 168 * reported action is actually 'bound' to a nontrivial user event; 169 * i.e. the result of some actions via atk_action_do_action() may be 170 * NIL. 171 * Params: 172 * i = the action index corresponding to the action to be performed 173 * Returns: a name string, or NULL if action does not implement this interface. 174 */ 175 public string getName(int i) 176 { 177 // const gchar * atk_action_get_name (AtkAction *action, gint i); 178 return Str.toString(atk_action_get_name(atkAction, i)); 179 } 180 181 /** 182 * Returns the localized name of the specified action of the object. 183 * Params: 184 * i = the action index corresponding to the action to be performed 185 * Returns: a name string, or NULL if action does not implement this interface. 186 */ 187 public string getLocalizedName(int i) 188 { 189 // const gchar * atk_action_get_localized_name (AtkAction *action, gint i); 190 return Str.toString(atk_action_get_localized_name(atkAction, i)); 191 } 192 193 /** 194 * Returns a keybinding associated with this action, if one exists. 195 * The returned string is in the format "<a>;<b>;<c>" 196 * (i.e. semicolon-delimited), where <a> is the keybinding which 197 * activates the object if it is presently enabled onscreen, 198 * <b> corresponds to the keybinding or sequence of keys 199 * which invokes the action even if the relevant element is not 200 * currently posted on screen (for instance, for a menu item it 201 * posts the parent menus before invoking). The last token in the 202 * above string, if non-empty, represents a keyboard shortcut which 203 * invokes the same action without posting the component or its 204 * enclosing menus or dialogs. 205 * Params: 206 * i = the action index corresponding to the action to be performed 207 * Returns: a string representing the available keybindings, or NULL if there is no keybinding for this action. 208 */ 209 public string getKeybinding(int i) 210 { 211 // const gchar * atk_action_get_keybinding (AtkAction *action, gint i); 212 return Str.toString(atk_action_get_keybinding(atkAction, i)); 213 } 214 215 /** 216 * Sets a description of the specified action of the object. 217 * Params: 218 * i = the action index corresponding to the action to be performed 219 * desc = the description to be assigned to this action 220 * Returns: a gboolean representing if the description was successfully set; 221 */ 222 public int setDescription(int i, string desc) 223 { 224 // gboolean atk_action_set_description (AtkAction *action, gint i, const gchar *desc); 225 return atk_action_set_description(atkAction, i, Str.toStringz(desc)); 226 } 227 }