2 * This file is part of gtkD.
4 * gtkD is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License as published by
6 * the Free Software Foundation; either version 2.1 of the License, or
7 * (at your option) any later version.
9 * gtkD is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public License
15 * along with gtkD; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 // generated automatically - do not change
20 // find conversion definition on APILookup.txt
21 // implement new conversion functionalities on the wrap.utils pakage
24 * Conversion parameters:
25 * inFile = AtkComponent.html
28 * strct = AtkComponent
55 import tango
.io
.Stdout
; // use the tango loging?
59 private import gtkc
.atktypes
;
61 private import gtkc
.atk
;
70 * AtkComponent should be implemented by most if not all UI elements with
71 * an actual on-screen presence, i.e. components which can be said to have
72 * a screen-coordinate bounding box. Virtually all widgets will need to
73 * have AtkComponent implementations provided for their corresponding
74 * AtkObject class. In short, only UI elements which are *not* GUI
75 * elements will omit this ATK interface.
76 * A possible exception might be textual information with a transparent
77 * background, in which case text glyph bounding box information is
78 * provided by AtkText.
80 public class Component
83 /** the main Gtk struct */
84 protected AtkComponent
* atkComponent
;
87 public AtkComponent
* getComponentStruct()
93 /** the main Gtk struct as a void* */
94 protected void* getStruct()
96 return cast(void*)atkComponent
;
100 * Sets our main struct and passes it to the parent class
102 public this (AtkComponent
* atkComponent
)
106 if ( atkComponent
is null )
111 Stdout("struct atkComponent is null on constructor").newline
;
115 printf("struct atkComponent is null on constructor");
122 assert(atkComponent
!is null, "struct atkComponent is null on constructor");
124 this.atkComponent
= atkComponent
;
130 // imports for the signal processing
131 private import gobject
.Signals
;
132 private import gtkc
.gdktypes
;
133 int[char[]] connectedSignals
;
135 void delegate(AtkRectangle
*, Component
)[] onBoundsChangedListeners
;
136 void addOnBoundsChanged(void delegate(AtkRectangle
*, Component
) dlg
, ConnectFlags connectFlags
=cast(ConnectFlags
)0)
138 if ( !("bounds-changed" in connectedSignals
) )
143 cast(GCallback
)&callBackBoundsChanged
,
147 connectedSignals
["bounds-changed"] = 1;
149 onBoundsChangedListeners
~= dlg
;
151 extern(C
) static void callBackBoundsChanged(AtkComponent
* atkcomponentStruct
, AtkRectangle
* arg1
, Component component
)
153 bool consumed
= false;
155 foreach ( void delegate(AtkRectangle
*, Component
) dlg
; component
.onBoundsChangedListeners
)
157 dlg(arg1
, component
);
166 * Add the specified handler to the set of functions to be called
167 * when this object receives focus events (in or out). If the handler is
168 * already added it is not added again
170 * The AtkComponent to attach the handler to
172 * The AtkFocusHandler to be attached to component
174 * a handler id which can be used in atk_component_remove_focus_handler
175 * or zero if the handler was already added.
177 public uint addFocusHandler(AtkFocusHandler handler
)
179 // guint atk_component_add_focus_handler (AtkComponent *component, AtkFocusHandler handler);
180 return atk_component_add_focus_handler(atkComponent
, handler
);
184 * Checks whether the specified point is within the extent of the component.
192 * specifies whether the coordinates are relative to the screen
193 * or to the components top level window
195 * TRUE or FALSE indicating whether the specified point is within
196 * the extent of the component or not
198 public int contains(int x
, int y
, AtkCoordType coordType
)
200 // gboolean atk_component_contains (AtkComponent *component, gint x, gint y, AtkCoordType coord_type);
201 return atk_component_contains(atkComponent
, x
, y
, coordType
);
205 * Gets the rectangle which gives the extent of the component.
209 * address of gint to put x coordinate
211 * address of gint to put y coordinate
213 * address of gint to put width
215 * address of gint to put height
217 * specifies whether the coordinates are relative to the screen
218 * or to the components top level window
220 public void getExtents(int* x
, int* y
, int* width
, int* height
, AtkCoordType coordType
)
222 // void atk_component_get_extents (AtkComponent *component, gint *x, gint *y, gint *width, gint *height, AtkCoordType coord_type);
223 atk_component_get_extents(atkComponent
, x
, y
, width
, height
, coordType
);
227 * Gets the layer of the component.
231 * an AtkLayer which is the layer of the component
233 public AtkLayer
getLayer()
235 // AtkLayer atk_component_get_layer (AtkComponent *component);
236 return atk_component_get_layer(atkComponent
);
240 * Gets the zorder of the component. The value G_MININT will be returned
241 * if the layer of the component is not ATK_LAYER_MDI or ATK_LAYER_WINDOW.
245 * a gint which is the zorder of the component, i.e. the depth at
246 * which the component is shown in relation to other components in the same
249 public int getMdiZorder()
251 // gint atk_component_get_mdi_zorder (AtkComponent *component);
252 return atk_component_get_mdi_zorder(atkComponent
);
256 * Gets the position of component in the form of
257 * a point specifying component's top-left corner.
261 * address of gint to put x coordinate position
263 * address of gint to put y coordinate position
265 * specifies whether the coordinates are relative to the screen
266 * or to the components top level window
268 public void getPosition(int* x
, int* y
, AtkCoordType coordType
)
270 // void atk_component_get_position (AtkComponent *component, gint *x, gint *y, AtkCoordType coord_type);
271 atk_component_get_position(atkComponent
, x
, y
, coordType
);
275 * Gets the size of the component in terms of width and height.
279 * address of gint to put width of component
281 * address of gint to put height of component
283 public void getSize(int* width
, int* height
)
285 // void atk_component_get_size (AtkComponent *component, gint *width, gint *height);
286 atk_component_get_size(atkComponent
, width
, height
);
290 * Grabs focus for this component.
294 * TRUE if successful, FALSE otherwise.
296 public int grabFocus()
298 // gboolean atk_component_grab_focus (AtkComponent *component);
299 return atk_component_grab_focus(atkComponent
);
303 * Gets a reference to the accessible child, if one exists, at the
304 * coordinate point specified by x and y.
312 * specifies whether the coordinates are relative to the screen
313 * or to the components top level window
315 * a reference to the accessible child, if one exists
317 public AtkObject
* refAccessibleAtPoint(int x
, int y
, AtkCoordType coordType
)
319 // AtkObject* atk_component_ref_accessible_at_point (AtkComponent *component, gint x, gint y, AtkCoordType coord_type);
320 return atk_component_ref_accessible_at_point(atkComponent
, x
, y
, coordType
);
324 * Remove the handler specified by handler_id from the list of
325 * functions to be executed when this object receives focus events
328 * the AtkComponent to remove the focus handler from
330 * the handler id of the focus handler to be removed
333 public void removeFocusHandler(uint handlerId
)
335 // void atk_component_remove_focus_handler (AtkComponent *component, guint handler_id);
336 atk_component_remove_focus_handler(atkComponent
, handlerId
);
340 * Sets the extents of component.
348 * width to set for component
350 * height to set for component
352 * specifies whether the coordinates are relative to the screen
353 * or to the components top level window
355 * TRUE or FALSE whether the extents were set or not
357 public int setExtents(int x
, int y
, int width
, int height
, AtkCoordType coordType
)
359 // gboolean atk_component_set_extents (AtkComponent *component, gint x, gint y, gint width, gint height, AtkCoordType coord_type);
360 return atk_component_set_extents(atkComponent
, x
, y
, width
, height
, coordType
);
364 * Sets the postition of component.
372 * specifies whether the coordinates are relative to the screen
373 * or to the components top level window
375 * TRUE or FALSE whether or not the position was set or not
377 public int setPosition(int x
, int y
, AtkCoordType coordType
)
379 // gboolean atk_component_set_position (AtkComponent *component, gint x, gint y, AtkCoordType coord_type);
380 return atk_component_set_position(atkComponent
, x
, y
, coordType
);
384 * Set the size of the component in terms of width and height.
388 * width to set for component
390 * height to set for component
392 * TRUE or FALSE whether the size was set or not
394 public int setSize(int width
, int height
)
396 // gboolean atk_component_set_size (AtkComponent *component, gint width, gint height);
397 return atk_component_set_size(atkComponent
, width
, height
);
401 * Returns the alpha value (i.e. the opacity) for this
402 * component, on a scale from 0 (fully transparent) to 1.0
407 * An alpha value from 0 to 1.0, inclusive.
410 * The "bounds-changed" signal
411 * void user_function (AtkComponent *atkcomponent,
412 * AtkRectangle *arg1,
413 * gpointer user_data) : Run Last
414 * The 'bounds-changed" signal is emitted when the bposition or size of the
415 * a component changes.
417 * the object which received the signal.
419 * The AtkRectangle giving the new position and size.
421 * user data set when the signal handler was connected.
423 public double getAlpha()
425 // gdouble atk_component_get_alpha (AtkComponent *component);
426 return atk_component_get_alpha(atkComponent
);