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 * Sets the extents of @component. 238 * 239 * Params: 240 * x = x coordinate 241 * y = y coordinate 242 * width = width to set for @component 243 * height = height to set for @component 244 * coordType = specifies whether the coordinates are relative to the screen 245 * or to the components top level window 246 * 247 * Returns: %TRUE or %FALSE whether the extents were set or not 248 */ 249 public bool setExtents(int x, int y, int width, int height, AtkCoordType coordType) 250 { 251 return atk_component_set_extents(getComponentStruct(), x, y, width, height, coordType) != 0; 252 } 253 254 /** 255 * Sets the postition of @component. 256 * 257 * Params: 258 * x = x coordinate 259 * y = y coordinate 260 * coordType = specifies whether the coordinates are relative to the screen 261 * or to the components top level window 262 * 263 * Returns: %TRUE or %FALSE whether or not the position was set or not 264 */ 265 public bool setPosition(int x, int y, AtkCoordType coordType) 266 { 267 return atk_component_set_position(getComponentStruct(), x, y, coordType) != 0; 268 } 269 270 /** 271 * Set the size of the @component in terms of width and height. 272 * 273 * Params: 274 * width = width to set for @component 275 * height = height to set for @component 276 * 277 * Returns: %TRUE or %FALSE whether the size was set or not 278 */ 279 public bool setSize(int width, int height) 280 { 281 return atk_component_set_size(getComponentStruct(), width, height) != 0; 282 } 283 284 /** 285 * The 'bounds-changed" signal is emitted when the bposition or 286 * size of the component changes. 287 * 288 * Params: 289 * arg1 = The AtkRectangle giving the new position and size. 290 */ 291 gulong addOnBoundsChanged(void delegate(Rectangle, ComponentIF) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 292 { 293 return Signals.connect(this, "bounds-changed", dlg, connectFlags ^ ConnectFlags.SWAPPED); 294 } 295 }