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