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 = AtkObject.html 27 * outPack = atk 28 * outFile = ObjectAtk 29 * strct = AtkObject 30 * realStrct= 31 * ctorStrct= 32 * clss = ObjectAtk 33 * interf = 34 * class Code: No 35 * interface Code: No 36 * template for: 37 * extend = 38 * implements: 39 * prefixes: 40 * - atk_object_ 41 * - atk_ 42 * omit structs: 43 * omit prefixes: 44 * omit code: 45 * omit signals: 46 * imports: 47 * - atk.ObjectAtk 48 * - atk.RelationSet 49 * - atk.StateSet 50 * - glib.Str 51 * structWrap: 52 * - AtkObject* -> ObjectAtk 53 * - AtkRelationSet* -> RelationSet 54 * - AtkStateSet* -> StateSet 55 * module aliases: 56 * local aliases: 57 * overrides: 58 */ 59 60 module atk.ObjectAtk; 61 62 public import gtkc.atktypes; 63 64 private import gtkc.atk; 65 private import glib.ConstructionException; 66 private import gobject.ObjectG; 67 68 private import gobject.Signals; 69 public import gtkc.gdktypes; 70 71 private import atk.ObjectAtk; 72 private import atk.RelationSet; 73 private import atk.StateSet; 74 private import glib.Str; 75 76 77 78 private import gobject.ObjectG; 79 80 /** 81 * Description 82 * This class is the primary class for accessibility support via 83 * the Accessibility ToolKit (ATK). Objects which are instances 84 * of AtkObject (or instances of AtkObject-derived types) are 85 * queried for properties which relate basic (and generic) properties of a 86 * UI component such as name and description. Instances of AtkObject 87 * may also be queried as to whether they implement other ATK interfaces 88 * (e.g. AtkAction, AtkComponent, etc.), as appropriate to the role 89 * which a given UI component plays in a user interface. 90 * All UI components in an application which provide useful 91 * information or services to the user must provide corresponding 92 * AtkObject instances on request (in GTK+, for instance, usually 93 * on a call to #gtk_widget_get_accessible()), either via ATK support 94 * built into the toolkit for the widget class or ancestor class, or in 95 * the case of custom widgets, if the inherited AtkObject implementation 96 * is insufficient, via instances of a new AtkObject subclass. 97 */ 98 public class ObjectAtk : ObjectG 99 { 100 101 /** the main Gtk struct */ 102 protected AtkObject* atkObject; 103 104 105 public AtkObject* getObjectAtkStruct() 106 { 107 return atkObject; 108 } 109 110 111 /** the main Gtk struct as a void* */ 112 protected override void* getStruct() 113 { 114 return cast(void*)atkObject; 115 } 116 117 /** 118 * Sets our main struct and passes it to the parent class 119 */ 120 public this (AtkObject* atkObject) 121 { 122 super(cast(GObject*)atkObject); 123 this.atkObject = atkObject; 124 } 125 126 protected override void setStruct(GObject* obj) 127 { 128 super.setStruct(obj); 129 atkObject = cast(AtkObject*)obj; 130 } 131 132 /** 133 */ 134 int[string] connectedSignals; 135 136 void delegate(void*, ObjectAtk)[] onActiveDescendantChangedListeners; 137 /** 138 * The "active-descendant-changed" signal is emitted by an object which has 139 * the state ATK_STATE_MANAGES_DESCENDANTS when the focus object in the 140 * object changes. For instance, a table will emit the signal when the cell 141 * in the table which has focus changes. 142 */ 143 void addOnActiveDescendantChanged(void delegate(void*, ObjectAtk) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 144 { 145 if ( !("active-descendant-changed" in connectedSignals) ) 146 { 147 Signals.connectData( 148 getStruct(), 149 "active-descendant-changed", 150 cast(GCallback)&callBackActiveDescendantChanged, 151 cast(void*)this, 152 null, 153 connectFlags); 154 connectedSignals["active-descendant-changed"] = 1; 155 } 156 onActiveDescendantChangedListeners ~= dlg; 157 } 158 extern(C) static void callBackActiveDescendantChanged(AtkObject* atkobjectStruct, void* arg1, ObjectAtk _objectAtk) 159 { 160 foreach ( void delegate(void*, ObjectAtk) dlg ; _objectAtk.onActiveDescendantChangedListeners ) 161 { 162 dlg(arg1, _objectAtk); 163 } 164 } 165 166 void delegate(guint, void*, ObjectAtk)[] onChildrenChangedListeners; 167 /** 168 * The signal "children-changed" is emitted when a child is added or 169 * removed form an object. It supports two details: "add" and "remove" 170 */ 171 void addOnChildrenChanged(void delegate(guint, void*, ObjectAtk) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 172 { 173 if ( !("children-changed" in connectedSignals) ) 174 { 175 Signals.connectData( 176 getStruct(), 177 "children-changed", 178 cast(GCallback)&callBackChildrenChanged, 179 cast(void*)this, 180 null, 181 connectFlags); 182 connectedSignals["children-changed"] = 1; 183 } 184 onChildrenChangedListeners ~= dlg; 185 } 186 extern(C) static void callBackChildrenChanged(AtkObject* atkobjectStruct, guint arg1, void* arg2, ObjectAtk _objectAtk) 187 { 188 foreach ( void delegate(guint, void*, ObjectAtk) dlg ; _objectAtk.onChildrenChangedListeners ) 189 { 190 dlg(arg1, arg2, _objectAtk); 191 } 192 } 193 194 void delegate(gboolean, ObjectAtk)[] onFocusListeners; 195 /** 196 * The signal "focus-event" is emitted when an object gains or loses focus. 197 */ 198 void addOnFocus(void delegate(gboolean, ObjectAtk) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 199 { 200 if ( !("focus-event" in connectedSignals) ) 201 { 202 Signals.connectData( 203 getStruct(), 204 "focus-event", 205 cast(GCallback)&callBackFocus, 206 cast(void*)this, 207 null, 208 connectFlags); 209 connectedSignals["focus-event"] = 1; 210 } 211 onFocusListeners ~= dlg; 212 } 213 extern(C) static void callBackFocus(AtkObject* atkobjectStruct, gboolean arg1, ObjectAtk _objectAtk) 214 { 215 foreach ( void delegate(gboolean, ObjectAtk) dlg ; _objectAtk.onFocusListeners ) 216 { 217 dlg(arg1, _objectAtk); 218 } 219 } 220 221 void delegate(void*, ObjectAtk)[] onPropertyChangeListeners; 222 /** 223 * The signal "property-change" is emitted when an object's property 224 * value changes. The detail identifies the name of the property whose 225 * value has changed. 226 */ 227 void addOnPropertyChange(void delegate(void*, ObjectAtk) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 228 { 229 if ( !("property-change" in connectedSignals) ) 230 { 231 Signals.connectData( 232 getStruct(), 233 "property-change", 234 cast(GCallback)&callBackPropertyChange, 235 cast(void*)this, 236 null, 237 connectFlags); 238 connectedSignals["property-change"] = 1; 239 } 240 onPropertyChangeListeners ~= dlg; 241 } 242 extern(C) static void callBackPropertyChange(AtkObject* atkobjectStruct, void* arg1, ObjectAtk _objectAtk) 243 { 244 foreach ( void delegate(void*, ObjectAtk) dlg ; _objectAtk.onPropertyChangeListeners ) 245 { 246 dlg(arg1, _objectAtk); 247 } 248 } 249 250 void delegate(string, gboolean, ObjectAtk)[] onStateChangeListeners; 251 /** 252 * The "state-change" signal is emitted when an object's state changes. 253 * The detail value identifies the state type which has changed. 254 */ 255 void addOnStateChange(void delegate(string, gboolean, ObjectAtk) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 256 { 257 if ( !("state-change" in connectedSignals) ) 258 { 259 Signals.connectData( 260 getStruct(), 261 "state-change", 262 cast(GCallback)&callBackStateChange, 263 cast(void*)this, 264 null, 265 connectFlags); 266 connectedSignals["state-change"] = 1; 267 } 268 onStateChangeListeners ~= dlg; 269 } 270 extern(C) static void callBackStateChange(AtkObject* atkobjectStruct, gchar* arg1, gboolean arg2, ObjectAtk _objectAtk) 271 { 272 foreach ( void delegate(string, gboolean, ObjectAtk) dlg ; _objectAtk.onStateChangeListeners ) 273 { 274 dlg(Str.toString(arg1), arg2, _objectAtk); 275 } 276 } 277 278 void delegate(ObjectAtk)[] onVisibleDataChangedListeners; 279 /** 280 * The "visible-data-changed" signal is emitted when the visual appearance of 281 * the object changed. 282 * See Also 283 * See also: AtkObjectFactory, AtkRegistry. 284 * ( GTK+ users see also GtkAccessible). 285 */ 286 void addOnVisibleDataChanged(void delegate(ObjectAtk) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 287 { 288 if ( !("visible-data-changed" in connectedSignals) ) 289 { 290 Signals.connectData( 291 getStruct(), 292 "visible-data-changed", 293 cast(GCallback)&callBackVisibleDataChanged, 294 cast(void*)this, 295 null, 296 connectFlags); 297 connectedSignals["visible-data-changed"] = 1; 298 } 299 onVisibleDataChangedListeners ~= dlg; 300 } 301 extern(C) static void callBackVisibleDataChanged(AtkObject* atkobjectStruct, ObjectAtk _objectAtk) 302 { 303 foreach ( void delegate(ObjectAtk) dlg ; _objectAtk.onVisibleDataChangedListeners ) 304 { 305 dlg(_objectAtk); 306 } 307 } 308 309 310 /** 311 * Registers the role specified by name. 312 * Params: 313 * name = a character string describing the new role. 314 * Returns: an AtkRole for the new role. 315 */ 316 public static AtkRole roleRegister(string name) 317 { 318 // AtkRole atk_role_register (const gchar *name); 319 return atk_role_register(Str.toStringz(name)); 320 } 321 322 /** 323 * Gets a reference to an object's AtkObject implementation, if 324 * the object implements AtkObjectIface 325 * Params: 326 * implementor = The GObject instance which should implement AtkImplementorIface 327 * if a non-null return value is required. 328 * Returns: a reference to an object's AtkObject implementation. [transfer full] 329 */ 330 public static ObjectAtk implementorRefAccessible(AtkImplementor* implementor) 331 { 332 // AtkObject * atk_implementor_ref_accessible (AtkImplementor *implementor); 333 auto p = atk_implementor_ref_accessible(implementor); 334 335 if(p is null) 336 { 337 return null; 338 } 339 340 return ObjectG.getDObject!(ObjectAtk)(cast(AtkObject*) p); 341 } 342 343 /** 344 * Gets the accessible name of the accessible. 345 * Returns: a character string representing the accessible name of the object. 346 */ 347 public string getName() 348 { 349 // const gchar * atk_object_get_name (AtkObject *accessible); 350 return Str.toString(atk_object_get_name(atkObject)); 351 } 352 353 /** 354 * Gets the accessible description of the accessible. 355 * Returns: a character string representing the accessible description of the accessible. 356 */ 357 public string getDescription() 358 { 359 // const gchar * atk_object_get_description (AtkObject *accessible); 360 return Str.toString(atk_object_get_description(atkObject)); 361 } 362 363 /** 364 * Gets the accessible parent of the accessible. 365 * Returns: a AtkObject representing the accessible parent of the accessible. [transfer none] 366 */ 367 public ObjectAtk getParent() 368 { 369 // AtkObject * atk_object_get_parent (AtkObject *accessible); 370 auto p = atk_object_get_parent(atkObject); 371 372 if(p is null) 373 { 374 return null; 375 } 376 377 return ObjectG.getDObject!(ObjectAtk)(cast(AtkObject*) p); 378 } 379 380 /** 381 * Gets the number of accessible children of the accessible. 382 * Returns: an integer representing the number of accessible children of the accessible. 383 */ 384 public int getNAccessibleChildren() 385 { 386 // gint atk_object_get_n_accessible_children (AtkObject *accessible); 387 return atk_object_get_n_accessible_children(atkObject); 388 } 389 390 /** 391 * Gets a reference to the specified accessible child of the object. 392 * The accessible children are 0-based so the first accessible child is 393 * at index 0, the second at index 1 and so on. 394 * Params: 395 * i = a gint representing the position of the child, starting from 0 396 * Returns: an AtkObject representing the specified accessible child of the accessible. [transfer full] 397 */ 398 public ObjectAtk refAccessibleChild(int i) 399 { 400 // AtkObject * atk_object_ref_accessible_child (AtkObject *accessible, gint i); 401 auto p = atk_object_ref_accessible_child(atkObject, i); 402 403 if(p is null) 404 { 405 return null; 406 } 407 408 return ObjectG.getDObject!(ObjectAtk)(cast(AtkObject*) p); 409 } 410 411 /** 412 * Gets the AtkRelationSet associated with the object. 413 * Returns: an AtkRelationSet representing the relation set of the object. [transfer full] 414 */ 415 public RelationSet refRelationSet() 416 { 417 // AtkRelationSet * atk_object_ref_relation_set (AtkObject *accessible); 418 auto p = atk_object_ref_relation_set(atkObject); 419 420 if(p is null) 421 { 422 return null; 423 } 424 425 return ObjectG.getDObject!(RelationSet)(cast(AtkRelationSet*) p); 426 } 427 428 /** 429 * Warning 430 * atk_object_get_layer is deprecated and should not be used in newly-written code. Use atk_component_get_layer instead. 431 * Gets the layer of the accessible. 432 * Returns: an AtkLayer which is the layer of the accessible 433 */ 434 public AtkLayer getLayer() 435 { 436 // AtkLayer atk_object_get_layer (AtkObject *accessible); 437 return atk_object_get_layer(atkObject); 438 } 439 440 /** 441 * Warning 442 * atk_object_get_mdi_zorder is deprecated and should not be used in newly-written code. Use atk_component_get_mdi_zorder instead. 443 * Gets the zorder of the accessible. The value G_MININT will be returned 444 * if the layer of the accessible is not ATK_LAYER_MDI. 445 * Returns: a gint which is the zorder of the accessible, i.e. the depth at which the component is shown in relation to other components in the same container. 446 */ 447 public int getMdiZorder() 448 { 449 // gint atk_object_get_mdi_zorder (AtkObject *accessible); 450 return atk_object_get_mdi_zorder(atkObject); 451 } 452 453 /** 454 * Gets the role of the accessible. 455 * Returns: an AtkRole which is the role of the accessible 456 */ 457 public AtkRole getRole() 458 { 459 // AtkRole atk_object_get_role (AtkObject *accessible); 460 return atk_object_get_role(atkObject); 461 } 462 463 /** 464 * Gets a reference to the state set of the accessible; the caller must 465 * unreference it when it is no longer needed. 466 * Returns: a reference to an AtkStateSet which is the state set of the accessible. [transfer full] 467 */ 468 public StateSet refStateSet() 469 { 470 // AtkStateSet * atk_object_ref_state_set (AtkObject *accessible); 471 auto p = atk_object_ref_state_set(atkObject); 472 473 if(p is null) 474 { 475 return null; 476 } 477 478 return ObjectG.getDObject!(StateSet)(cast(AtkStateSet*) p); 479 } 480 481 /** 482 * Gets the 0-based index of this accessible in its parent; returns -1 if the 483 * accessible does not have an accessible parent. 484 * Returns: an integer which is the index of the accessible in its parent 485 */ 486 public int getIndexInParent() 487 { 488 // gint atk_object_get_index_in_parent (AtkObject *accessible); 489 return atk_object_get_index_in_parent(atkObject); 490 } 491 492 /** 493 * Sets the accessible name of the accessible. 494 * Params: 495 * name = a character string to be set as the accessible name 496 */ 497 public void setName(string name) 498 { 499 // void atk_object_set_name (AtkObject *accessible, const gchar *name); 500 atk_object_set_name(atkObject, Str.toStringz(name)); 501 } 502 503 /** 504 * Sets the accessible description of the accessible. 505 * Params: 506 * description = a character string to be set as the accessible description 507 */ 508 public void setDescription(string description) 509 { 510 // void atk_object_set_description (AtkObject *accessible, const gchar *description); 511 atk_object_set_description(atkObject, Str.toStringz(description)); 512 } 513 514 /** 515 * Sets the accessible parent of the accessible. 516 * Params: 517 * parent = an AtkObject to be set as the accessible parent 518 */ 519 public void setParent(ObjectAtk parent) 520 { 521 // void atk_object_set_parent (AtkObject *accessible, AtkObject *parent); 522 atk_object_set_parent(atkObject, (parent is null) ? null : parent.getObjectAtkStruct()); 523 } 524 525 /** 526 * Sets the role of the accessible. 527 * Params: 528 * role = an AtkRole to be set as the role 529 */ 530 public void setRole(AtkRole role) 531 { 532 // void atk_object_set_role (AtkObject *accessible, AtkRole role); 533 atk_object_set_role(atkObject, role); 534 } 535 536 /** 537 * Specifies a function to be called when a property changes value. 538 * Params: 539 * handler = a function to be called when a property changes its value 540 * Returns: a guint which is the handler id used in atk_object_remove_property_change_handler() 541 */ 542 public uint connectPropertyChangeHandler(AtkPropertyChangeHandler* handler) 543 { 544 // guint atk_object_connect_property_change_handler (AtkObject *accessible, AtkPropertyChangeHandler *handler); 545 return atk_object_connect_property_change_handler(atkObject, handler); 546 } 547 548 /** 549 * Removes a property change handler. 550 * Params: 551 * handlerId = a guint which identifies the handler to be removed. 552 */ 553 public void removePropertyChangeHandler(uint handlerId) 554 { 555 // void atk_object_remove_property_change_handler (AtkObject *accessible, guint handler_id); 556 atk_object_remove_property_change_handler(atkObject, handlerId); 557 } 558 559 /** 560 * Emits a state-change signal for the specified state. 561 * Params: 562 * state = an AtkState whose state is changed 563 * value = a gboolean which indicates whether the state is being set on or off 564 */ 565 public void notifyStateChange(AtkState state, int value) 566 { 567 // void atk_object_notify_state_change (AtkObject *accessible, AtkState state, gboolean value); 568 atk_object_notify_state_change(atkObject, state, value); 569 } 570 571 /** 572 * This function is called when implementing subclasses of AtkObject. 573 * It does initialization required for the new object. It is intended 574 * that this function should called only in the ..._new() functions used 575 * to create an instance of a subclass of AtkObject 576 * Params: 577 * data = a gpointer which identifies the object for which the AtkObject was created. 578 */ 579 public void initialize(void* data) 580 { 581 // void atk_object_initialize (AtkObject *accessible, gpointer data); 582 atk_object_initialize(atkObject, data); 583 } 584 585 /** 586 * Adds a relationship of the specified type with the specified target. 587 * Params: 588 * relationship = The AtkRelationType of the relation 589 * target = The AtkObject which is to be the target of the relation. 590 * Returns: TRUE if the relationship is added. 591 */ 592 public int addRelationship(AtkRelationType relationship, ObjectAtk target) 593 { 594 // gboolean atk_object_add_relationship (AtkObject *object, AtkRelationType relationship, AtkObject *target); 595 return atk_object_add_relationship(atkObject, relationship, (target is null) ? null : target.getObjectAtkStruct()); 596 } 597 598 /** 599 * Removes a relationship of the specified type with the specified target. 600 * Params: 601 * relationship = The AtkRelationType of the relation 602 * target = The AtkObject which is the target of the relation to be removed. 603 * Returns: TRUE if the relationship is removed. 604 */ 605 public int removeRelationship(AtkRelationType relationship, ObjectAtk target) 606 { 607 // gboolean atk_object_remove_relationship (AtkObject *object, AtkRelationType relationship, AtkObject *target); 608 return atk_object_remove_relationship(atkObject, relationship, (target is null) ? null : target.getObjectAtkStruct()); 609 } 610 611 /** 612 * Get a list of properties applied to this object as a whole, as an AtkAttributeSet consisting of 613 * name-value pairs. As such these attributes may be considered weakly-typed properties or annotations, 614 * as distinct from strongly-typed object data available via other get/set methods. 615 * Not all objects have explicit "name-value pair" AtkAttributeSet properties. 616 * Since 1.12 617 * Returns: an AtkAttributeSet consisting of all explicit properties/annotations applied to the object, or an empty set if the object has no name-value pair attributes assigned to it. [transfer none] 618 */ 619 public AtkAttributeSet* getAttributes() 620 { 621 // AtkAttributeSet * atk_object_get_attributes (AtkObject *accessible); 622 return atk_object_get_attributes(atkObject); 623 } 624 625 /** 626 * Gets the description string describing the AtkRole role. 627 * Params: 628 * role = The AtkRole whose name is required 629 * Returns: the string describing the AtkRole 630 */ 631 public static string roleGetName(AtkRole role) 632 { 633 // const gchar * atk_role_get_name (AtkRole role); 634 return Str.toString(atk_role_get_name(role)); 635 } 636 637 /** 638 * Gets the localized description string describing the AtkRole role. 639 * Params: 640 * role = The AtkRole whose localized name is required 641 * Returns: the localized string describing the AtkRole 642 */ 643 public static string roleGetLocalizedName(AtkRole role) 644 { 645 // const gchar * atk_role_get_localized_name (AtkRole role); 646 return Str.toString(atk_role_get_localized_name(role)); 647 } 648 649 /** 650 * Get the AtkRole type corresponding to a rolew name. 651 * Params: 652 * name = a string which is the (non-localized) name of an ATK role. 653 * Returns: the AtkRole enumerated type corresponding to the specified name, or ATK_ROLE_INVALID if no matching role is found. 654 */ 655 public static AtkRole roleForName(string name) 656 { 657 // AtkRole atk_role_for_name (const gchar *name); 658 return atk_role_for_name(Str.toStringz(name)); 659 } 660 }