Wrote the README_GIT file to be a proper tutorial on git, repo.or.cz and gtkD.
[gtkD.git] / gtkD / src / atk / Action.d
blobf322023fff98e293855bc603f0880e8ed455cc60
1 /*
2 * This file is part of gtkD.
4 * gtkD is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License as published by
6 * the Free Software Foundation; either version 2.1 of the License, or
7 * (at your option) any later version.
9 * gtkD is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public License
15 * along with gtkD; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 // generated automatically - do not change
20 // find conversion definition on APILookup.txt
21 // implement new conversion functionalities on the wrap.utils pakage
24 * Conversion parameters:
25 * inFile = AtkAction.html
26 * outPack = atk
27 * outFile = Action
28 * strct = AtkAction
29 * realStrct=
30 * ctorStrct=
31 * clss = Action
32 * interf =
33 * class Code: No
34 * interface Code: No
35 * template for:
36 * extend =
37 * implements:
38 * prefixes:
39 * - atk_action_
40 * omit structs:
41 * omit prefixes:
42 * omit code:
43 * imports:
44 * - glib.Str
45 * structWrap:
46 * module aliases:
47 * local aliases:
50 module atk.Action;
52 version(noAssert)
54 version(Tango)
56 import tango.io.Stdout; // use the tango loging?
60 private import gtkc.atktypes;
62 private import gtkc.atk;
65 private import glib.Str;
70 /**
71 * Description
72 * AtkAction should be implemented by instances of AtkObject classes with
73 * which the user can interact directly, i.e. buttons, checkboxes,
74 * scrollbars, e.g. components which are not "passive"
75 * providers of UI information.
76 * Exceptions: when the user interaction is already covered by
77 * another appropriate interface such as AtkEditableText (insert/delete
78 * test, etc.) or AtkValue (set value) then these actions should not be
79 * exposed by AtkAction as well.
80 * Also note that the AtkAction API is limited in that parameters may not
81 * be passed to the object being activated; thus the action must be
82 * self-contained and specifiable via only a single "verb". Concrete
83 * examples include "press", "release", "click" for buttons, "drag"
84 * (meaning initiate drag) and "drop" for drag sources and drop targets,
85 * etc.
86 * Though most UI interactions on components should be invocable via
87 * keyboard as well as mouse, there will generally be a close mapping
88 * between "mouse actions" that are possible on a component and the
89 * AtkActions. Where mouse and keyboard actions are redundant in effect,
90 * AtkAction should expose only one action rather than exposing redundant
91 * actions if possible. By convention we have been using "mouse centric"
92 * terminology for AtkAction names.
94 public class Action
97 /** the main Gtk struct */
98 protected AtkAction* atkAction;
101 public AtkAction* getActionStruct()
103 return atkAction;
107 /** the main Gtk struct as a void* */
108 protected void* getStruct()
110 return cast(void*)atkAction;
114 * Sets our main struct and passes it to the parent class
116 public this (AtkAction* atkAction)
118 version(noAssert)
120 if ( atkAction is null )
122 int zero = 0;
123 version(Tango)
125 Stdout("struct atkAction is null on constructor").newline;
127 else
129 printf("struct atkAction is null on constructor");
131 zero = zero / zero;
134 else
136 assert(atkAction !is null, "struct atkAction is null on constructor");
138 this.atkAction = atkAction;
146 * Perform the specified action on the object.
147 * action:
148 * a GObject instance that implements AtkActionIface
149 * i:
150 * the action index corresponding to the action to be performed
151 * Returns:
152 * TRUE if success, FALSE otherwise
154 public int doAction(int i)
156 // gboolean atk_action_do_action (AtkAction *action, gint i);
157 return atk_action_do_action(atkAction, i);
161 * Gets the number of accessible actions available on the object.
162 * If there are more than one, the first one is considered the
163 * "default" action of the object.
164 * action:
165 * a GObject instance that implements AtkActionIface
166 * Returns:
167 * a the number of actions, or 0 if action does not
168 * implement this interface.
170 public int getNActions()
172 // gint atk_action_get_n_actions (AtkAction *action);
173 return atk_action_get_n_actions(atkAction);
177 * Returns a description of the specified action of the object.
178 * action:
179 * a GObject instance that implements AtkActionIface
180 * i:
181 * the action index corresponding to the action to be performed
182 * Returns:
183 * a description string, or NULL
184 * if action does not implement this interface.
186 public char[] getDescription(int i)
188 // const gchar* atk_action_get_description (AtkAction *action, gint i);
189 return Str.toString(atk_action_get_description(atkAction, i) );
193 * Returns a non-localized string naming the specified action of the
194 * object. This name is generally not descriptive of the end result
195 * of the action, but instead names the 'interaction type' which the
196 * object supports. By convention, the above strings should be used to
197 * represent the actions which correspond to the common point-and-click
198 * interaction techniques of the same name: i.e.
199 * "click", "press", "release", "drag", "drop", "popup", etc.
200 * The "popup" action should be used to pop up a context menu for the
201 * object, if one exists.
202 * For technical reasons, some toolkits cannot guarantee that the
203 * reported action is actually 'bound' to a nontrivial user event;
204 * i.e. the result of some actions via atk_action_do_action() may be
205 * NIL.
206 * action:
207 * a GObject instance that implements AtkActionIface
208 * i:
209 * the action index corresponding to the action to be performed
210 * Returns:
211 * a name string, or NULL
212 * if action does not implement this interface.
214 public char[] getName(int i)
216 // const gchar* atk_action_get_name (AtkAction *action, gint i);
217 return Str.toString(atk_action_get_name(atkAction, i) );
221 * Returns the localized name of the specified action of the object.
222 * action:
223 * a GObject instance that implements AtkActionIface
224 * i:
225 * the action index corresponding to the action to be performed
226 * Returns:
227 * a name string, or NULL
228 * if action does not implement this interface.
230 public char[] getLocalizedName(int i)
232 // const gchar* atk_action_get_localized_name (AtkAction *action, gint i);
233 return Str.toString(atk_action_get_localized_name(atkAction, i) );
237 * Returns a keybinding associated with this action, if one exists.
238 * The returned string is in the format "<a>;<b>;<c>"
239 * (i.e. semicolon-delimited), where <a> is the keybinding which
240 * activates the object if it is presently enabled onscreen,
241 * <b> corresponds to the keybinding or sequence of keys
242 * which invokes the action even if the relevant element is not
243 * currently posted on screen (for instance, for a menu item it
244 * posts the parent menus before invoking). The last token in the
245 * above string, if non-empty, represents a keyboard shortcut which
246 * invokes the same action without posting the component or its
247 * enclosing menus or dialogs.
248 * action:
249 * a GObject instance that implements AtkActionIface
250 * i:
251 * the action index corresponding to the action to be performed
252 * Returns:
253 * a string representing the available keybindings, or NULL
254 * if there is no keybinding for this action.
256 public char[] getKeybinding(int i)
258 // const gchar* atk_action_get_keybinding (AtkAction *action, gint i);
259 return Str.toString(atk_action_get_keybinding(atkAction, i) );
263 * Sets a description of the specified action of the object.
264 * action:
265 * a GObject instance that implements AtkActionIface
266 * i:
267 * the action index corresponding to the action to be performed
268 * desc:
269 * the description to be assigned to this action
270 * Returns:
271 * a gboolean representing if the description was successfully set;
273 public int setDescription(int i, char[] desc)
275 // gboolean atk_action_set_description (AtkAction *action, gint i, const gchar *desc);
276 return atk_action_set_description(atkAction, i, Str.toStringz(desc));