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  = AtkUtil.html
27  * outPack = atk
28  * outFile = Util
29  * strct   = 
30  * realStrct=
31  * ctorStrct=
32  * clss    = Util
33  * interf  = 
34  * class Code: No
35  * interface Code: No
36  * template for:
37  * extend  = 
38  * implements:
39  * prefixes:
40  * 	- atk_
41  * omit structs:
42  * omit prefixes:
43  * omit code:
44  * omit signals:
45  * imports:
46  * 	- atk.ObjectAtk
47  * 	- glib.Str
48  * structWrap:
49  * 	- AtkObject* -> ObjectAtk
50  * module aliases:
51  * local aliases:
52  * overrides:
53  */
54 
55 module atk.Util;
56 
57 public  import gtkc.atktypes;
58 
59 private import gtkc.atk;
60 private import glib.ConstructionException;
61 private import gobject.ObjectG;
62 
63 
64 private import atk.ObjectAtk;
65 private import glib.Str;
66 
67 
68 
69 
70 /**
71  * Description
72  * A set of ATK utility functions which are used to support event registration of
73  * various types, and obtaining the 'root' accessible of a process and
74  * information about the current ATK implementation and toolkit version.
75  */
76 public class Util
77 {
78 	
79 	/**
80 	 */
81 	
82 	/**
83 	 * Adds the specified function to the list of functions to be called
84 	 * when an object receives focus.
85 	 * Params:
86 	 * focusTracker = Function to be added to the list of functions to be called
87 	 * when an object receives focus.
88 	 * Returns: added focus tracker id, or 0 on failure.
89 	 */
90 	public static uint addFocusTracker(AtkEventListener focusTracker)
91 	{
92 		// guint atk_add_focus_tracker (AtkEventListener focus_tracker);
93 		return atk_add_focus_tracker(focusTracker);
94 	}
95 	
96 	/**
97 	 * Removes the specified focus tracker from the list of functions
98 	 * to be called when any object receives focus.
99 	 * Params:
100 	 * trackerId = the id of the focus tracker to remove
101 	 */
102 	public static void removeFocusTracker(uint trackerId)
103 	{
104 		// void atk_remove_focus_tracker (guint tracker_id);
105 		atk_remove_focus_tracker(trackerId);
106 	}
107 	
108 	/**
109 	 * Specifies the function to be called for focus tracker initialization.
110 	 * This function should be called by an implementation of the
111 	 * ATK interface if any specific work needs to be done to enable
112 	 * focus tracking.
113 	 * Params:
114 	 * init = Function to be called for focus tracker initialization
115 	 */
116 	public static void focusTrackerInit(AtkEventListenerInit init)
117 	{
118 		// void atk_focus_tracker_init (AtkEventListenerInit init);
119 		atk_focus_tracker_init(init);
120 	}
121 	
122 	/**
123 	 * Cause the focus tracker functions which have been specified to be
124 	 * executed for the object.
125 	 * Params:
126 	 * object = an AtkObject
127 	 */
128 	public static void focusTrackerNotify(ObjectAtk object)
129 	{
130 		// void atk_focus_tracker_notify (AtkObject *object);
131 		atk_focus_tracker_notify((object is null) ? null : object.getObjectAtkStruct());
132 	}
133 	
134 	/**
135 	 * Adds the specified function to the list of functions to be called
136 	 * when an event of type event_type occurs.
137 	 * Params:
138 	 * listener = the listener to notify
139 	 * eventType = the type of event for which notification is requested
140 	 * Returns: added event listener id, or 0 on failure.
141 	 */
142 	public static uint addGlobalEventListener(GSignalEmissionHook listener, string eventType)
143 	{
144 		// guint atk_add_global_event_listener (GSignalEmissionHook listener,  const gchar *event_type);
145 		return atk_add_global_event_listener(listener, Str.toStringz(eventType));
146 	}
147 	
148 	/**
149 	 * Removes the specified event listener
150 	 * Params:
151 	 * listenerId = the id of the event listener to remove
152 	 */
153 	public static void removeGlobalEventListener(uint listenerId)
154 	{
155 		// void atk_remove_global_event_listener (guint listener_id);
156 		atk_remove_global_event_listener(listenerId);
157 	}
158 	
159 	/**
160 	 * Adds the specified function to the list of functions to be called
161 	 *  when a key event occurs. The data element will be passed to the
162 	 *  AtkKeySnoopFunc (listener) as the func_data param, on notification.
163 	 * Params:
164 	 * listener = the listener to notify
165 	 * data = a gpointer that points to a block of data that should be sent to the registered listeners,
166 	 * along with the event notification, when it occurs.
167 	 * Returns: added event listener id, or 0 on failure.
168 	 */
169 	public static uint addKeyEventListener(AtkKeySnoopFunc listener, void* data)
170 	{
171 		// guint atk_add_key_event_listener (AtkKeySnoopFunc listener,  gpointer data);
172 		return atk_add_key_event_listener(listener, data);
173 	}
174 	
175 	/**
176 	 * Removes the specified event listener
177 	 * Params:
178 	 * listenerId = the id of the event listener to remove
179 	 */
180 	public static void removeKeyEventListener(uint listenerId)
181 	{
182 		// void atk_remove_key_event_listener (guint listener_id);
183 		atk_remove_key_event_listener(listenerId);
184 	}
185 	
186 	/**
187 	 * Gets the root accessible container for the current application.
188 	 * Returns: the root accessible container for the current application. [transfer none]
189 	 */
190 	public static ObjectAtk getRoot()
191 	{
192 		// AtkObject * atk_get_root (void);
193 		auto p = atk_get_root();
194 		
195 		if(p is null)
196 		{
197 			return null;
198 		}
199 		
200 		return ObjectG.getDObject!(ObjectAtk)(cast(AtkObject*) p);
201 	}
202 	
203 	/**
204 	 * Gets the currently focused object.
205 	 * Since 1.6
206 	 * Returns: the currently focused object for the current application. [transfer none]
207 	 */
208 	public static ObjectAtk getFocusObject()
209 	{
210 		// AtkObject * atk_get_focus_object (void);
211 		auto p = atk_get_focus_object();
212 		
213 		if(p is null)
214 		{
215 			return null;
216 		}
217 		
218 		return ObjectG.getDObject!(ObjectAtk)(cast(AtkObject*) p);
219 	}
220 	
221 	/**
222 	 * Gets name string for the GUI toolkit implementing ATK for this application.
223 	 * Returns: name string for the GUI toolkit implementing ATK for this application
224 	 */
225 	public static string getToolkitName()
226 	{
227 		// const gchar * atk_get_toolkit_name (void);
228 		return Str.toString(atk_get_toolkit_name());
229 	}
230 	
231 	/**
232 	 * Gets version string for the GUI toolkit implementing ATK for this application.
233 	 * Returns: version string for the GUI toolkit implementing ATK for this application
234 	 */
235 	public static string getToolkitVersion()
236 	{
237 		// const gchar * atk_get_toolkit_version (void);
238 		return Str.toString(atk_get_toolkit_version());
239 	}
240 	
241 	/**
242 	 * Gets the current version for ATK.
243 	 * Since 1.20
244 	 * Returns: version string for ATK
245 	 */
246 	public static string getVersion()
247 	{
248 		// const gchar * atk_get_version (void);
249 		return Str.toString(atk_get_version());
250 	}
251 }