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 private import atk.ObjectAtk; 64 private import glib.Str; 65 66 67 68 /** 69 * A set of ATK utility functions which are used to support event 70 * registration of various types, and obtaining the 'root' accessible 71 * of a process and information about the current ATK implementation 72 * and toolkit version. 73 */ 74 public class Util 75 { 76 77 /** 78 */ 79 80 /** 81 * Warning 82 * atk_add_focus_tracker is deprecated and should not be used in newly-written code. This method is deprecated since ATK version 83 * 2.9.4. Focus tracking has been dropped as a feature to be 84 * implemented by ATK itself. If you need focus tracking on your 85 * implementation, subscribe to the state-changed:focused signal. 86 * Adds the specified function to the list of functions to be called 87 * when an object receives focus. 88 * Params: 89 * focusTracker = Function to be added to the list of functions to be called 90 * when an object receives focus. 91 * Returns: added focus tracker id, or 0 on failure. 92 */ 93 public static uint addFocusTracker(AtkEventListener focusTracker) 94 { 95 // guint atk_add_focus_tracker (AtkEventListener focus_tracker); 96 return atk_add_focus_tracker(focusTracker); 97 } 98 99 /** 100 * Warning 101 * atk_remove_focus_tracker is deprecated and should not be used in newly-written code. This method is deprecated since ATK version 102 * 2.9.4. Focus tracking has been dropped as a feature to be 103 * implemented by ATK itself. If you need focus tracking on your 104 * implementation, subscribe to the state-changed:focused signal. 105 * Removes the specified focus tracker from the list of functions 106 * to be called when any object receives focus. 107 * Params: 108 * trackerId = the id of the focus tracker to remove 109 */ 110 public static void removeFocusTracker(uint trackerId) 111 { 112 // void atk_remove_focus_tracker (guint tracker_id); 113 atk_remove_focus_tracker(trackerId); 114 } 115 116 /** 117 * Warning 118 * atk_focus_tracker_init is deprecated and should not be used in newly-written code. This method is deprecated since ATK version 119 * 2.9.4. Focus tracking has been dropped as a feature to be 120 * implemented by ATK itself. 121 * Specifies the function to be called for focus tracker initialization. 122 * This function should be called by an implementation of the 123 * ATK interface if any specific work needs to be done to enable 124 * focus tracking. 125 * Params: 126 * init = Function to be called for focus tracker initialization 127 */ 128 public static void focusTrackerInit(AtkEventListenerInit init) 129 { 130 // void atk_focus_tracker_init (AtkEventListenerInit init); 131 atk_focus_tracker_init(init); 132 } 133 134 /** 135 * Warning 136 * atk_focus_tracker_notify is deprecated and should not be used in newly-written code. This method is deprecated since ATK version 137 * 2.9.4. Focus tracking has been dropped as a feature to be 138 * implemented by ATK itself. 139 * Cause the focus tracker functions which have been specified to be 140 * executed for the object. 141 * Params: 142 * object = an AtkObject 143 */ 144 public static void focusTrackerNotify(ObjectAtk object) 145 { 146 // void atk_focus_tracker_notify (AtkObject *object); 147 atk_focus_tracker_notify((object is null) ? null : object.getObjectAtkStruct()); 148 } 149 150 /** 151 * Adds the specified function to the list of functions to be called 152 * when an ATK event of type event_type occurs. 153 * Params: 154 * listener = the listener to notify 155 * eventType = the type of event for which notification is requested 156 * Returns: added event listener id, or 0 on failure. 157 */ 158 public static uint addGlobalEventListener(GSignalEmissionHook listener, string eventType) 159 { 160 // guint atk_add_global_event_listener (GSignalEmissionHook listener, const gchar *event_type); 161 return atk_add_global_event_listener(listener, Str.toStringz(eventType)); 162 } 163 164 /** 165 * listener_id is the value returned by atk_add_global_event_listener 166 * when you registered that event listener. 167 * Toolkit implementor note: Atk provides a default implementation for 168 * this virtual method, and that implementation should be enough for 169 * most of the cases. You should have a really good reason to 170 * reimplement this method. 171 * Removes the specified event listener 172 * Params: 173 * listenerId = the id of the event listener to remove 174 */ 175 public static void removeGlobalEventListener(uint listenerId) 176 { 177 // void atk_remove_global_event_listener (guint listener_id); 178 atk_remove_global_event_listener(listenerId); 179 } 180 181 /** 182 * Adds the specified function to the list of functions to be called 183 * when a key event occurs. The data element will be passed to the 184 * AtkKeySnoopFunc (listener) as the func_data param, on notification. 185 * Params: 186 * listener = the listener to notify 187 * data = a gpointer that points to a block of data that should be sent to the registered listeners, 188 * along with the event notification, when it occurs. 189 * Returns: added event listener id, or 0 on failure. 190 */ 191 public static uint addKeyEventListener(AtkKeySnoopFunc listener, void* data) 192 { 193 // guint atk_add_key_event_listener (AtkKeySnoopFunc listener, gpointer data); 194 return atk_add_key_event_listener(listener, data); 195 } 196 197 /** 198 * listener_id is the value returned by atk_add_key_event_listener 199 * when you registered that event listener. 200 * Removes the specified event listener. 201 * Params: 202 * listenerId = the id of the event listener to remove 203 */ 204 public static void removeKeyEventListener(uint listenerId) 205 { 206 // void atk_remove_key_event_listener (guint listener_id); 207 atk_remove_key_event_listener(listenerId); 208 } 209 210 /** 211 * Gets the root accessible container for the current application. 212 * Returns: the root accessible container for the current application. [transfer none] 213 */ 214 public static ObjectAtk getRoot() 215 { 216 // AtkObject * atk_get_root (void); 217 auto p = atk_get_root(); 218 219 if(p is null) 220 { 221 return null; 222 } 223 224 return ObjectG.getDObject!(ObjectAtk)(cast(AtkObject*) p); 225 } 226 227 /** 228 * Gets the currently focused object. 229 * Since 1.6 230 * Returns: the currently focused object for the current application. [transfer none] 231 */ 232 public static ObjectAtk getFocusObject() 233 { 234 // AtkObject * atk_get_focus_object (void); 235 auto p = atk_get_focus_object(); 236 237 if(p is null) 238 { 239 return null; 240 } 241 242 return ObjectG.getDObject!(ObjectAtk)(cast(AtkObject*) p); 243 } 244 245 /** 246 * Gets name string for the GUI toolkit implementing ATK for this application. 247 * Returns: name string for the GUI toolkit implementing ATK for this application 248 */ 249 public static string getToolkitName() 250 { 251 // const gchar * atk_get_toolkit_name (void); 252 return Str.toString(atk_get_toolkit_name()); 253 } 254 255 /** 256 * Gets version string for the GUI toolkit implementing ATK for this application. 257 * Returns: version string for the GUI toolkit implementing ATK for this application 258 */ 259 public static string getToolkitVersion() 260 { 261 // const gchar * atk_get_toolkit_version (void); 262 return Str.toString(atk_get_toolkit_version()); 263 } 264 265 /** 266 * Gets the current version for ATK. 267 * Since 1.20 268 * Returns: version string for ATK 269 */ 270 public static string getVersion() 271 { 272 // const gchar * atk_get_version (void); 273 return Str.toString(atk_get_version()); 274 } 275 }