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  * AtkAction should be implemented by instances of AtkObject classes
69  * with which the user can interact directly, i.e. buttons,
70  * checkboxes, scrollbars, e.g. components which are not "passive"
71  * providers of UI information.
72  *
73  * Exceptions: when the user interaction is already covered by another
74  * appropriate interface such as AtkEditableText (insert/delete text,
75  * etc.) or AtkValue (set value) then these actions should not be
76  * exposed by AtkAction as well.
77  *
78  * Though most UI interactions on components should be invocable via
79  * keyboard as well as mouse, there will generally be a close mapping
80  * between "mouse actions" that are possible on a component and the
81  * AtkActions. Where mouse and keyboard actions are redundant in
82  * effect, AtkAction should expose only one action rather than
83  * exposing redundant actions if possible. By convention we have been
84  * using "mouse centric" terminology for AtkAction names.
85  */
86 public class Action
87 {
88 	
89 	/** the main Gtk struct */
90 	protected AtkAction* atkAction;
91 	
92 	
93 	public AtkAction* getActionStruct()
94 	{
95 		return atkAction;
96 	}
97 	
98 	
99 	/** the main Gtk struct as a void* */
100 	protected void* getStruct()
101 	{
102 		return cast(void*)atkAction;
103 	}
104 	
105 	/**
106 	 * Sets our main struct and passes it to the parent class
107 	 */
108 	public this (AtkAction* atkAction)
109 	{
110 		this.atkAction = atkAction;
111 	}
112 	
113 	/**
114 	 */
115 	
116 	/**
117 	 * Perform the specified action on the object.
118 	 * Params:
119 	 * i = the action index corresponding to the action to be performed
120 	 * Returns: TRUE if success, FALSE otherwise
121 	 */
122 	public int doAction(int i)
123 	{
124 		// gboolean atk_action_do_action (AtkAction *action,  gint i);
125 		return atk_action_do_action(atkAction, i);
126 	}
127 	
128 	/**
129 	 * Gets the number of accessible actions available on the object.
130 	 * If there are more than one, the first one is considered the
131 	 * "default" action of the object.
132 	 * Returns: a the number of actions, or 0 if action does not implement this interface.
133 	 */
134 	public int getNActions()
135 	{
136 		// gint atk_action_get_n_actions (AtkAction *action);
137 		return atk_action_get_n_actions(atkAction);
138 	}
139 	
140 	/**
141 	 * Returns a description of the specified action of the object.
142 	 * Params:
143 	 * i = the action index corresponding to the action to be performed
144 	 * Returns: a description string, or NULL if action does not implement this interface.
145 	 */
146 	public string getDescription(int i)
147 	{
148 		// const gchar * atk_action_get_description (AtkAction *action,  gint i);
149 		return Str.toString(atk_action_get_description(atkAction, i));
150 	}
151 	
152 	/**
153 	 * Returns a non-localized string naming the specified action of the
154 	 * object. This name is generally not descriptive of the end result
155 	 * of the action, but instead names the 'interaction type' which the
156 	 * object supports. By convention, the above strings should be used to
157 	 * represent the actions which correspond to the common point-and-click
158 	 * interaction techniques of the same name: i.e.
159 	 * "click", "press", "release", "drag", "drop", "popup", etc.
160 	 * The "popup" action should be used to pop up a context menu for the
161 	 * object, if one exists.
162 	 * For technical reasons, some toolkits cannot guarantee that the
163 	 * reported action is actually 'bound' to a nontrivial user event;
164 	 * i.e. the result of some actions via atk_action_do_action() may be
165 	 * NIL.
166 	 * Params:
167 	 * i = the action index corresponding to the action to be performed
168 	 * Returns: a name string, or NULL if action does not implement this interface.
169 	 */
170 	public string getName(int i)
171 	{
172 		// const gchar * atk_action_get_name (AtkAction *action,  gint i);
173 		return Str.toString(atk_action_get_name(atkAction, i));
174 	}
175 	
176 	/**
177 	 * Returns the localized name of the specified action of the object.
178 	 * Params:
179 	 * i = the action index corresponding to the action to be performed
180 	 * Returns: a name string, or NULL if action does not implement this interface.
181 	 */
182 	public string getLocalizedName(int i)
183 	{
184 		// const gchar * atk_action_get_localized_name (AtkAction *action,  gint i);
185 		return Str.toString(atk_action_get_localized_name(atkAction, i));
186 	}
187 	
188 	/**
189 	 * Gets the keybinding which can be used to activate this action, if one
190 	 * exists. The string returned should contain localized, human-readable,
191 	 * key sequences as they would appear when displayed on screen. It must
192 	 * be in the format "mnemonic;sequence;shortcut".
193 	 * The mnemonic key activates the object if it is presently enabled onscreen.
194 	 *  This typically corresponds to the underlined letter within the widget.
195 	 *  Example: "n" in a traditional "New..." menu item or the "a" in "Apply" for
196 	 *  a button.
197 	 * The sequence is the full list of keys which invoke the action even if the
198 	 *  relevant element is not currently shown on screen. For instance, for a menu
199 	 *  item the sequence is the keybindings used to open the parent menus before
200 	 *  invoking. The sequence string is colon-delimited. Example: "Alt+F:N" in a
201 	 *  traditional "New..." menu item.
202 	 * The shortcut, if it exists, will invoke the same action without showing
203 	 *  the component or its enclosing menus or dialogs. Example: "Ctrl+N" in a
204 	 *  traditional "New..." menu item.
205 	 * Example: For a traditional "New..." menu item, the expected return value
206 	 * would be: "N;Alt+F:N;Ctrl+N" for the English locale and "N;Alt+D:N;Strg+N"
207 	 * for the German locale. If, hypothetically, this menu item lacked a mnemonic,
208 	 * it would be represented by ";;Ctrl+N" and ";;Strg+N" respectively.
209 	 * Params:
210 	 * i = the action index corresponding to the action to be performed
211 	 * Returns: the keybinding which can be used to activate this action, or NULL if there is no keybinding for this action.
212 	 */
213 	public string getKeybinding(int i)
214 	{
215 		// const gchar * atk_action_get_keybinding (AtkAction *action,  gint i);
216 		return Str.toString(atk_action_get_keybinding(atkAction, i));
217 	}
218 	
219 	/**
220 	 * Sets a description of the specified action of the object.
221 	 * Params:
222 	 * i = the action index corresponding to the action to be performed
223 	 * desc = the description to be assigned to this action
224 	 * Returns: a gboolean representing if the description was successfully set;
225 	 */
226 	public int setDescription(int i, string desc)
227 	{
228 		// gboolean atk_action_set_description (AtkAction *action,  gint i,  const gchar *desc);
229 		return atk_action_set_description(atkAction, i, Str.toStringz(desc));
230 	}
231 }