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