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 * Description 72 * AtkComponent should be implemented by most if not all UI elements with 73 * an actual on-screen presence, i.e. components which can be said to have 74 * a screen-coordinate bounding box. Virtually all widgets will need to 75 * have AtkComponent implementations provided for their corresponding 76 * AtkObject class. In short, only UI elements which are *not* GUI 77 * elements will omit this ATK interface. 78 * A possible exception might be textual information with a transparent 79 * background, in which case text glyph bounding box information is 80 * 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 size of the 116 * a 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 * Add the specified handler to the set of functions to be called 144 * when this object receives focus events (in or out). If the handler is 145 * already added it is not added again 146 * Params: 147 * handler = The AtkFocusHandler to be attached to component 148 * Returns: a handler id which can be used in atk_component_remove_focus_handler or zero if the handler was already added. 149 */ 150 public uint addFocusHandler(AtkFocusHandler handler) 151 { 152 // guint atk_component_add_focus_handler (AtkComponent *component, AtkFocusHandler handler); 153 return atk_component_add_focus_handler(atkComponent, handler); 154 } 155 156 /** 157 * Checks whether the specified point is within the extent of the component. 158 * Params: 159 * x = x coordinate 160 * y = y coordinate 161 * coordType = specifies whether the coordinates are relative to the screen 162 * or to the components top level window 163 * Returns: TRUE or FALSE indicating whether the specified point is within the extent of the component or not 164 */ 165 public int contains(int x, int y, AtkCoordType coordType) 166 { 167 // gboolean atk_component_contains (AtkComponent *component, gint x, gint y, AtkCoordType coord_type); 168 return atk_component_contains(atkComponent, x, y, coordType); 169 } 170 171 /** 172 * Gets the rectangle which gives the extent of the component. 173 * Params: 174 * x = address of gint to put x coordinate 175 * y = address of gint to put y coordinate 176 * width = address of gint to put width 177 * height = address of gint to put height 178 * coordType = specifies whether the coordinates are relative to the screen 179 * or to the components top level window 180 */ 181 public void getExtents(out int x, out int y, out int width, out int height, AtkCoordType coordType) 182 { 183 // void atk_component_get_extents (AtkComponent *component, gint *x, gint *y, gint *width, gint *height, AtkCoordType coord_type); 184 atk_component_get_extents(atkComponent, &x, &y, &width, &height, coordType); 185 } 186 187 /** 188 * Gets the layer of the component. 189 * Returns: an AtkLayer which is the layer of the component 190 */ 191 public AtkLayer getLayer() 192 { 193 // AtkLayer atk_component_get_layer (AtkComponent *component); 194 return atk_component_get_layer(atkComponent); 195 } 196 197 /** 198 * Gets the zorder of the component. The value G_MININT will be returned 199 * if the layer of the component is not ATK_LAYER_MDI or ATK_LAYER_WINDOW. 200 * 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. 201 */ 202 public int getMdiZorder() 203 { 204 // gint atk_component_get_mdi_zorder (AtkComponent *component); 205 return atk_component_get_mdi_zorder(atkComponent); 206 } 207 208 /** 209 * Gets the position of component in the form of 210 * a point specifying component's top-left corner. 211 * Params: 212 * x = address of gint to put x coordinate position 213 * y = address of gint to put y coordinate position 214 * coordType = specifies whether the coordinates are relative to the screen 215 * or to the components top level window 216 */ 217 public void getPosition(out int x, out int y, AtkCoordType coordType) 218 { 219 // void atk_component_get_position (AtkComponent *component, gint *x, gint *y, AtkCoordType coord_type); 220 atk_component_get_position(atkComponent, &x, &y, coordType); 221 } 222 223 /** 224 * Gets the size of the component in terms of width and height. 225 * Params: 226 * width = address of gint to put width of component 227 * height = address of gint to put height of component 228 */ 229 public void getSize(out int width, out int height) 230 { 231 // void atk_component_get_size (AtkComponent *component, gint *width, gint *height); 232 atk_component_get_size(atkComponent, &width, &height); 233 } 234 235 /** 236 * Grabs focus for this component. 237 * Returns: TRUE if successful, FALSE otherwise. 238 */ 239 public int grabFocus() 240 { 241 // gboolean atk_component_grab_focus (AtkComponent *component); 242 return atk_component_grab_focus(atkComponent); 243 } 244 245 /** 246 * Gets a reference to the accessible child, if one exists, at the 247 * coordinate point specified by x and y. 248 * Params: 249 * x = x coordinate 250 * y = y coordinate 251 * coordType = specifies whether the coordinates are relative to the screen 252 * or to the components top level window 253 * Returns: a reference to the accessible child, if one exists. [transfer full] 254 */ 255 public ObjectAtk refAccessibleAtPoint(int x, int y, AtkCoordType coordType) 256 { 257 // AtkObject * atk_component_ref_accessible_at_point (AtkComponent *component, gint x, gint y, AtkCoordType coord_type); 258 auto p = atk_component_ref_accessible_at_point(atkComponent, x, y, coordType); 259 260 if(p is null) 261 { 262 return null; 263 } 264 265 return ObjectG.getDObject!(ObjectAtk)(cast(AtkObject*) p); 266 } 267 268 /** 269 * Remove the handler specified by handler_id from the list of 270 * functions to be executed when this object receives focus events 271 * (in or out). 272 * Params: 273 * handlerId = the handler id of the focus handler to be removed 274 * from component 275 */ 276 public void removeFocusHandler(uint handlerId) 277 { 278 // void atk_component_remove_focus_handler (AtkComponent *component, guint handler_id); 279 atk_component_remove_focus_handler(atkComponent, handlerId); 280 } 281 282 /** 283 * Sets the extents of component. 284 * Params: 285 * x = x coordinate 286 * y = y coordinate 287 * width = width to set for component 288 * height = height to set for component 289 * coordType = specifies whether the coordinates are relative to the screen 290 * or to the components top level window 291 * Returns: TRUE or FALSE whether the extents were set or not 292 */ 293 public int setExtents(int x, int y, int width, int height, AtkCoordType coordType) 294 { 295 // gboolean atk_component_set_extents (AtkComponent *component, gint x, gint y, gint width, gint height, AtkCoordType coord_type); 296 return atk_component_set_extents(atkComponent, x, y, width, height, coordType); 297 } 298 299 /** 300 * Sets the postition of component. 301 * Params: 302 * x = x coordinate 303 * y = y coordinate 304 * coordType = specifies whether the coordinates are relative to the screen 305 * or to the components top level window 306 * Returns: TRUE or FALSE whether or not the position was set or not 307 */ 308 public int setPosition(int x, int y, AtkCoordType coordType) 309 { 310 // gboolean atk_component_set_position (AtkComponent *component, gint x, gint y, AtkCoordType coord_type); 311 return atk_component_set_position(atkComponent, x, y, coordType); 312 } 313 314 /** 315 * Set the size of the component in terms of width and height. 316 * Params: 317 * width = width to set for component 318 * height = height to set for component 319 * Returns: TRUE or FALSE whether the size was set or not 320 */ 321 public int setSize(int width, int height) 322 { 323 // gboolean atk_component_set_size (AtkComponent *component, gint width, gint height); 324 return atk_component_set_size(atkComponent, width, height); 325 } 326 327 /** 328 * Returns the alpha value (i.e. the opacity) for this 329 * component, on a scale from 0 (fully transparent) to 1.0 330 * (fully opaque). 331 * Since 1.12 332 * Signal Details 333 * The "bounds-changed" signal 334 * void user_function (AtkComponent *atkcomponent, 335 * AtkRectangle *arg1, 336 * gpointer user_data) : Run Last 337 * The 'bounds-changed" signal is emitted when the bposition or size of the 338 * a component changes. 339 * Returns: An alpha value from 0 to 1.0, inclusive. 340 */ 341 public double getAlpha() 342 { 343 // gdouble atk_component_get_alpha (AtkComponent *component); 344 return atk_component_get_alpha(atkComponent); 345 } 346 }