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