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 module atk.ComponentT; 26 27 public import atk.ObjectAtk; 28 public import atk.Rectangle; 29 public import atk.c.functions; 30 public import atk.c.types; 31 public import gobject.ObjectG; 32 public import gobject.Signals; 33 public import gtkc.atktypes; 34 public import std.algorithm; 35 36 37 /** 38 * #AtkComponent should be implemented by most if not all UI elements 39 * with an actual on-screen presence, i.e. components which can be 40 * said to have a screen-coordinate bounding box. Virtually all 41 * widgets will need to have #AtkComponent implementations provided 42 * for their corresponding #AtkObject class. In short, only UI 43 * elements which are *not* GUI elements will omit this ATK interface. 44 * 45 * A possible exception might be textual information with a 46 * transparent background, in which case text glyph bounding box 47 * information is provided by #AtkText. 48 */ 49 public template ComponentT(TStruct) 50 { 51 /** Get the main Gtk struct */ 52 public AtkComponent* getComponentStruct(bool transferOwnership = false) 53 { 54 if (transferOwnership) 55 ownedRef = false; 56 return cast(AtkComponent*)getStruct(); 57 } 58 59 60 /** 61 * Add the specified handler to the set of functions to be called 62 * when this object receives focus events (in or out). If the handler is 63 * already added it is not added again 64 * 65 * Deprecated: If you need to track when an object gains or 66 * lose the focus, use the #AtkObject::state-change "focused" notification instead. 67 * 68 * Params: 69 * handler = The #AtkFocusHandler to be attached to @component 70 * 71 * Returns: a handler id which can be used in atk_component_remove_focus_handler() 72 * or zero if the handler was already added. 73 */ 74 public uint addFocusHandler(AtkFocusHandler handler) 75 { 76 return atk_component_add_focus_handler(getComponentStruct(), handler); 77 } 78 79 /** 80 * Checks whether the specified point is within the extent of the @component. 81 * 82 * Toolkit implementor note: ATK provides a default implementation for 83 * this virtual method. In general there are little reason to 84 * re-implement it. 85 * 86 * Params: 87 * x = x coordinate 88 * y = y coordinate 89 * coordType = specifies whether the coordinates are relative to the screen 90 * or to the components top level window 91 * 92 * Returns: %TRUE or %FALSE indicating whether the specified point is within 93 * the extent of the @component or not 94 */ 95 public bool contains(int x, int y, AtkCoordType coordType) 96 { 97 return atk_component_contains(getComponentStruct(), x, y, coordType) != 0; 98 } 99 100 /** 101 * Returns the alpha value (i.e. the opacity) for this 102 * @component, on a scale from 0 (fully transparent) to 1.0 103 * (fully opaque). 104 * 105 * Returns: An alpha value from 0 to 1.0, inclusive. 106 * 107 * Since: 1.12 108 */ 109 public double getAlpha() 110 { 111 return atk_component_get_alpha(getComponentStruct()); 112 } 113 114 /** 115 * Gets the rectangle which gives the extent of the @component. 116 * 117 * Params: 118 * x = address of #gint to put x coordinate 119 * y = address of #gint to put y coordinate 120 * width = address of #gint to put width 121 * height = address of #gint to put height 122 * coordType = specifies whether the coordinates are relative to the screen 123 * or to the components top level window 124 */ 125 public void getExtents(out int x, out int y, out int width, out int height, AtkCoordType coordType) 126 { 127 atk_component_get_extents(getComponentStruct(), &x, &y, &width, &height, coordType); 128 } 129 130 /** 131 * Gets the layer of the component. 132 * 133 * Returns: an #AtkLayer which is the layer of the component 134 */ 135 public override AtkLayer getLayer() 136 { 137 return atk_component_get_layer(getComponentStruct()); 138 } 139 140 /** 141 * Gets the zorder of the component. The value G_MININT will be returned 142 * if the layer of the component is not ATK_LAYER_MDI or ATK_LAYER_WINDOW. 143 * 144 * Returns: a gint which is the zorder of the component, i.e. the depth at 145 * which the component is shown in relation to other components in the same 146 * container. 147 */ 148 public override int getMdiZorder() 149 { 150 return atk_component_get_mdi_zorder(getComponentStruct()); 151 } 152 153 /** 154 * Gets the position of @component in the form of 155 * a point specifying @component's top-left corner. 156 * 157 * Deprecated: Since 2.12. Use atk_component_get_extents() instead. 158 * 159 * Params: 160 * x = address of #gint to put x coordinate position 161 * y = address of #gint to put y coordinate position 162 * coordType = specifies whether the coordinates are relative to the screen 163 * or to the components top level window 164 */ 165 public void getPosition(out int x, out int y, AtkCoordType coordType) 166 { 167 atk_component_get_position(getComponentStruct(), &x, &y, coordType); 168 } 169 170 /** 171 * Gets the size of the @component in terms of width and height. 172 * 173 * Deprecated: Since 2.12. Use atk_component_get_extents() instead. 174 * 175 * Params: 176 * width = address of #gint to put width of @component 177 * height = address of #gint to put height of @component 178 */ 179 public void getSize(out int width, out int height) 180 { 181 atk_component_get_size(getComponentStruct(), &width, &height); 182 } 183 184 /** 185 * Grabs focus for this @component. 186 * 187 * Returns: %TRUE if successful, %FALSE otherwise. 188 */ 189 public bool grabFocus() 190 { 191 return atk_component_grab_focus(getComponentStruct()) != 0; 192 } 193 194 /** 195 * Gets a reference to the accessible child, if one exists, at the 196 * coordinate point specified by @x and @y. 197 * 198 * Params: 199 * x = x coordinate 200 * y = y coordinate 201 * coordType = specifies whether the coordinates are relative to the screen 202 * or to the components top level window 203 * 204 * Returns: a reference to the accessible 205 * child, if one exists 206 */ 207 public ObjectAtk refAccessibleAtPoint(int x, int y, AtkCoordType coordType) 208 { 209 auto __p = atk_component_ref_accessible_at_point(getComponentStruct(), x, y, coordType); 210 211 if(__p is null) 212 { 213 return null; 214 } 215 216 return ObjectG.getDObject!(ObjectAtk)(cast(AtkObject*) __p, true); 217 } 218 219 /** 220 * Remove the handler specified by @handler_id from the list of 221 * functions to be executed when this object receives focus events 222 * (in or out). 223 * 224 * Deprecated: If you need to track when an object gains or 225 * lose the focus, use the #AtkObject::state-change "focused" notification instead. 226 * 227 * Params: 228 * handlerId = the handler id of the focus handler to be removed 229 * from @component 230 */ 231 public void removeFocusHandler(uint handlerId) 232 { 233 atk_component_remove_focus_handler(getComponentStruct(), handlerId); 234 } 235 236 /** 237 * Makes @component visible on the screen by scrolling all necessary parents. 238 * 239 * Contrary to atk_component_set_position, this does not actually move 240 * @component in its parent, this only makes the parents scroll so that the 241 * object shows up on the screen, given its current position within the parents. 242 * 243 * Params: 244 * type = specify where the object should be made visible. 245 * 246 * Returns: whether scrolling was successful. 247 * 248 * Since: 2.30 249 */ 250 public bool scrollTo(AtkScrollType type) 251 { 252 return atk_component_scroll_to(getComponentStruct(), type) != 0; 253 } 254 255 /** 256 * Makes an object visible on the screen at a given position by scrolling all 257 * necessary parents. 258 * 259 * Params: 260 * coords = specify whether coordinates are relative to the screen or to the 261 * parent object. 262 * x = x-position where to scroll to 263 * y = y-position where to scroll to 264 * 265 * Returns: whether scrolling was successful. 266 * 267 * Since: 2.30 268 */ 269 public bool scrollToPoint(AtkCoordType coords, int x, int y) 270 { 271 return atk_component_scroll_to_point(getComponentStruct(), coords, x, y) != 0; 272 } 273 274 /** 275 * Sets the extents of @component. 276 * 277 * Params: 278 * x = x coordinate 279 * y = y coordinate 280 * width = width to set for @component 281 * height = height to set for @component 282 * coordType = specifies whether the coordinates are relative to the screen 283 * or to the components top level window 284 * 285 * Returns: %TRUE or %FALSE whether the extents were set or not 286 */ 287 public bool setExtents(int x, int y, int width, int height, AtkCoordType coordType) 288 { 289 return atk_component_set_extents(getComponentStruct(), x, y, width, height, coordType) != 0; 290 } 291 292 /** 293 * Sets the position of @component. 294 * 295 * Contrary to atk_component_scroll_to, this does not trigger any scrolling, 296 * this just moves @component in its parent. 297 * 298 * Params: 299 * x = x coordinate 300 * y = y coordinate 301 * coordType = specifies whether the coordinates are relative to the screen 302 * or to the component's top level window 303 * 304 * Returns: %TRUE or %FALSE whether or not the position was set or not 305 */ 306 public bool setPosition(int x, int y, AtkCoordType coordType) 307 { 308 return atk_component_set_position(getComponentStruct(), x, y, coordType) != 0; 309 } 310 311 /** 312 * Set the size of the @component in terms of width and height. 313 * 314 * Params: 315 * width = width to set for @component 316 * height = height to set for @component 317 * 318 * Returns: %TRUE or %FALSE whether the size was set or not 319 */ 320 public bool setSize(int width, int height) 321 { 322 return atk_component_set_size(getComponentStruct(), width, height) != 0; 323 } 324 325 /** 326 * The 'bounds-changed" signal is emitted when the bposition or 327 * size of the component changes. 328 * 329 * Params: 330 * arg1 = The AtkRectangle giving the new position and size. 331 */ 332 gulong addOnBoundsChanged(void delegate(Rectangle, ComponentIF) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 333 { 334 return Signals.connect(this, "bounds-changed", dlg, connectFlags ^ ConnectFlags.SWAPPED); 335 } 336 }