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