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