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 = AtkComponent.html 27 * outPack = atk 28 * outFile = Component 29 * strct = AtkComponent 30 * realStrct= 31 * ctorStrct= 32 * clss = Component 33 * interf = 34 * class Code: No 35 * interface Code: No 36 * template for: 37 * extend = 38 * implements: 39 * prefixes: 40 * - atk_component_ 41 * omit structs: 42 * omit prefixes: 43 * omit code: 44 * omit signals: 45 * imports: 46 * - atk.ObjectAtk 47 * structWrap: 48 * - AtkObject* -> ObjectAtk 49 * module aliases: 50 * local aliases: 51 * overrides: 52 */ 53 54 module atk.Component; 55 56 public import gtkc.atktypes; 57 58 private import gtkc.atk; 59 private import glib.ConstructionException; 60 private import gobject.ObjectG; 61 62 private import gobject.Signals; 63 public import gtkc.gdktypes; 64 private import atk.ObjectAtk; 65 66 67 68 /** 69 * AtkComponent should be implemented by most if not all UI elements 70 * with an actual on-screen presence, i.e. components which can be 71 * said to have a screen-coordinate bounding box. Virtually all 72 * widgets will need to have AtkComponent implementations provided 73 * for their corresponding AtkObject class. In short, only UI 74 * elements which are *not* GUI elements will omit this ATK interface. 75 * 76 * A possible exception might be textual information with a 77 * transparent background, in which case text glyph bounding box 78 * information is provided by AtkText. 79 */ 80 public class Component 81 { 82 83 /** the main Gtk struct */ 84 protected AtkComponent* atkComponent; 85 86 87 /** Get the main Gtk struct */ 88 public AtkComponent* getComponentStruct() 89 { 90 return atkComponent; 91 } 92 93 94 /** the main Gtk struct as a void* */ 95 protected void* getStruct() 96 { 97 return cast(void*)atkComponent; 98 } 99 100 /** 101 * Sets our main struct and passes it to the parent class 102 */ 103 public this (AtkComponent* atkComponent) 104 { 105 this.atkComponent = atkComponent; 106 } 107 108 /** 109 */ 110 int[string] connectedSignals; 111 112 void delegate(AtkRectangle*, Component)[] onBoundsChangedListeners; 113 /** 114 * The 'bounds-changed" signal is emitted when the bposition or 115 * size of the component changes. 116 */ 117 void addOnBoundsChanged(void delegate(AtkRectangle*, Component) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 118 { 119 if ( !("bounds-changed" in connectedSignals) ) 120 { 121 Signals.connectData( 122 getStruct(), 123 "bounds-changed", 124 cast(GCallback)&callBackBoundsChanged, 125 cast(void*)this, 126 null, 127 connectFlags); 128 connectedSignals["bounds-changed"] = 1; 129 } 130 onBoundsChangedListeners ~= dlg; 131 } 132 extern(C) static void callBackBoundsChanged(AtkComponent* atkcomponentStruct, AtkRectangle* arg1, Component _component) 133 { 134 foreach ( void delegate(AtkRectangle*, Component) dlg ; _component.onBoundsChangedListeners ) 135 { 136 dlg(arg1, _component); 137 } 138 } 139 140 141 /** 142 * Warning 143 * atk_component_add_focus_handler is deprecated and should not be used in newly-written code. This method is deprecated since ATK version 2.9.4. If 144 * you need to track when an object gains or lose the focus, use 145 * state-changed:focused notification instead. 146 * Add the specified handler to the set of functions to be called 147 * when this object receives focus events (in or out). If the handler is 148 * already added it is not added again 149 * Params: 150 * handler = The AtkFocusHandler to be attached to component 151 * Returns: a handler id which can be used in atk_component_remove_focus_handler() or zero if the handler was already added. 152 */ 153 public uint addFocusHandler(AtkFocusHandler handler) 154 { 155 // guint atk_component_add_focus_handler (AtkComponent *component, AtkFocusHandler handler); 156 return atk_component_add_focus_handler(atkComponent, handler); 157 } 158 159 /** 160 * Checks whether the specified point is within the extent of the component. 161 * Params: 162 * x = x coordinate 163 * y = y coordinate 164 * coordType = specifies whether the coordinates are relative to the screen 165 * or to the components top level window 166 * Returns: TRUE or FALSE indicating whether the specified point is within the extent of the component or not 167 */ 168 public int contains(int x, int y, AtkCoordType coordType) 169 { 170 // gboolean atk_component_contains (AtkComponent *component, gint x, gint y, AtkCoordType coord_type); 171 return atk_component_contains(atkComponent, x, y, coordType); 172 } 173 174 /** 175 * Gets the rectangle which gives the extent of the component. 176 * Params: 177 * x = address of gint to put x coordinate 178 * y = address of gint to put y coordinate 179 * width = address of gint to put width 180 * height = address of gint to put height 181 * coordType = specifies whether the coordinates are relative to the screen 182 * or to the components top level window 183 */ 184 public void getExtents(out int x, out int y, out int width, out int height, AtkCoordType coordType) 185 { 186 // void atk_component_get_extents (AtkComponent *component, gint *x, gint *y, gint *width, gint *height, AtkCoordType coord_type); 187 atk_component_get_extents(atkComponent, &x, &y, &width, &height, coordType); 188 } 189 190 /** 191 * Gets the layer of the component. 192 * Returns: an AtkLayer which is the layer of the component 193 */ 194 public AtkLayer getLayer() 195 { 196 // AtkLayer atk_component_get_layer (AtkComponent *component); 197 return atk_component_get_layer(atkComponent); 198 } 199 200 /** 201 * Gets the zorder of the component. The value G_MININT will be returned 202 * if the layer of the component is not ATK_LAYER_MDI or ATK_LAYER_WINDOW. 203 * Returns: a gint which is the zorder of the component, i.e. the depth at which the component is shown in relation to other components in the same container. 204 */ 205 public int getMdiZorder() 206 { 207 // gint atk_component_get_mdi_zorder (AtkComponent *component); 208 return atk_component_get_mdi_zorder(atkComponent); 209 } 210 211 /** 212 * Gets the position of component in the form of 213 * a point specifying component's top-left corner. 214 * Params: 215 * x = address of gint to put x coordinate position 216 * y = address of gint to put y coordinate position 217 * coordType = specifies whether the coordinates are relative to the screen 218 * or to the components top level window 219 */ 220 public void getPosition(out int x, out int y, AtkCoordType coordType) 221 { 222 // void atk_component_get_position (AtkComponent *component, gint *x, gint *y, AtkCoordType coord_type); 223 atk_component_get_position(atkComponent, &x, &y, coordType); 224 } 225 226 /** 227 * Gets the size of the component in terms of width and height. 228 * Params: 229 * width = address of gint to put width of component 230 * height = address of gint to put height of component 231 */ 232 public void getSize(out int width, out int height) 233 { 234 // void atk_component_get_size (AtkComponent *component, gint *width, gint *height); 235 atk_component_get_size(atkComponent, &width, &height); 236 } 237 238 /** 239 * Grabs focus for this component. 240 * Returns: TRUE if successful, FALSE otherwise. 241 */ 242 public int grabFocus() 243 { 244 // gboolean atk_component_grab_focus (AtkComponent *component); 245 return atk_component_grab_focus(atkComponent); 246 } 247 248 /** 249 * Gets a reference to the accessible child, if one exists, at the 250 * coordinate point specified by x and y. 251 * Params: 252 * x = x coordinate 253 * y = y coordinate 254 * coordType = specifies whether the coordinates are relative to the screen 255 * or to the components top level window 256 * Returns: a reference to the accessible child, if one exists. [transfer full] 257 */ 258 public ObjectAtk refAccessibleAtPoint(int x, int y, AtkCoordType coordType) 259 { 260 // AtkObject * atk_component_ref_accessible_at_point (AtkComponent *component, gint x, gint y, AtkCoordType coord_type); 261 auto p = atk_component_ref_accessible_at_point(atkComponent, x, y, coordType); 262 263 if(p is null) 264 { 265 return null; 266 } 267 268 return ObjectG.getDObject!(ObjectAtk)(cast(AtkObject*) p); 269 } 270 271 /** 272 * Warning 273 * atk_component_remove_focus_handler is deprecated and should not be used in newly-written code. This method is deprecated since ATK version 2.9.4. If 274 * you need to track when an object gains or lose the focus, use 275 * state-changed:focused notification instead. 276 * Remove the handler specified by handler_id from the list of 277 * functions to be executed when this object receives focus events 278 * (in or out). 279 * Params: 280 * handlerId = the handler id of the focus handler to be removed 281 * from component 282 */ 283 public void removeFocusHandler(uint handlerId) 284 { 285 // void atk_component_remove_focus_handler (AtkComponent *component, guint handler_id); 286 atk_component_remove_focus_handler(atkComponent, handlerId); 287 } 288 289 /** 290 * Sets the extents of component. 291 * Params: 292 * x = x coordinate 293 * y = y coordinate 294 * width = width to set for component 295 * height = height to set for component 296 * coordType = specifies whether the coordinates are relative to the screen 297 * or to the components top level window 298 * Returns: TRUE or FALSE whether the extents were set or not 299 */ 300 public int setExtents(int x, int y, int width, int height, AtkCoordType coordType) 301 { 302 // gboolean atk_component_set_extents (AtkComponent *component, gint x, gint y, gint width, gint height, AtkCoordType coord_type); 303 return atk_component_set_extents(atkComponent, x, y, width, height, coordType); 304 } 305 306 /** 307 * Sets the postition of component. 308 * Params: 309 * x = x coordinate 310 * y = y coordinate 311 * coordType = specifies whether the coordinates are relative to the screen 312 * or to the components top level window 313 * Returns: TRUE or FALSE whether or not the position was set or not 314 */ 315 public int setPosition(int x, int y, AtkCoordType coordType) 316 { 317 // gboolean atk_component_set_position (AtkComponent *component, gint x, gint y, AtkCoordType coord_type); 318 return atk_component_set_position(atkComponent, x, y, coordType); 319 } 320 321 /** 322 * Set the size of the component in terms of width and height. 323 * Params: 324 * width = width to set for component 325 * height = height to set for component 326 * Returns: TRUE or FALSE whether the size was set or not 327 */ 328 public int setSize(int width, int height) 329 { 330 // gboolean atk_component_set_size (AtkComponent *component, gint width, gint height); 331 return atk_component_set_size(atkComponent, width, height); 332 } 333 334 /** 335 * Returns the alpha value (i.e. the opacity) for this 336 * component, on a scale from 0 (fully transparent) to 1.0 337 * (fully opaque). 338 * Since 1.12 339 * Signal Details 340 * The "bounds-changed" signal 341 * void user_function (AtkComponent *atkcomponent, 342 * AtkRectangle *arg1, 343 * gpointer user_data) : Run Last 344 * The 'bounds-changed" signal is emitted when the bposition or 345 * size of the component changes. 346 * Returns: An alpha value from 0 to 1.0, inclusive. 347 */ 348 public double getAlpha() 349 { 350 // gdouble atk_component_get_alpha (AtkComponent *component); 351 return atk_component_get_alpha(atkComponent); 352 } 353 }