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.ObjectAtk; 26 27 private import atk.RelationSet; 28 private import atk.StateSet; 29 private import glib.Str; 30 private import gobject.ObjectG; 31 private import gobject.Signals; 32 private import gtkc.atk; 33 public import gtkc.atktypes; 34 private import std.algorithm; 35 36 37 /** 38 * This class is the primary class for accessibility support via the 39 * Accessibility ToolKit (ATK). Objects which are instances of 40 * #AtkObject (or instances of AtkObject-derived types) are queried 41 * for properties which relate basic (and generic) properties of a UI 42 * component such as name and description. Instances of #AtkObject 43 * may also be queried as to whether they implement other ATK 44 * interfaces (e.g. #AtkAction, #AtkComponent, etc.), as appropriate 45 * to the role which a given UI component plays in a user interface. 46 * 47 * All UI components in an application which provide useful 48 * information or services to the user must provide corresponding 49 * #AtkObject instances on request (in GTK+, for instance, usually on 50 * a call to #gtk_widget_get_accessible ()), either via ATK support 51 * built into the toolkit for the widget class or ancestor class, or 52 * in the case of custom widgets, if the inherited #AtkObject 53 * implementation is insufficient, via instances of a new #AtkObject 54 * subclass. 55 * 56 * See also: #AtkObjectFactory, #AtkRegistry. (GTK+ users see also 57 * #GtkAccessible). 58 */ 59 public class ObjectAtk : ObjectG 60 { 61 /** the main Gtk struct */ 62 protected AtkObject* atkObject; 63 64 /** Get the main Gtk struct */ 65 public AtkObject* getObjectAtkStruct() 66 { 67 return atkObject; 68 } 69 70 /** the main Gtk struct as a void* */ 71 protected override void* getStruct() 72 { 73 return cast(void*)atkObject; 74 } 75 76 protected override void setStruct(GObject* obj) 77 { 78 atkObject = cast(AtkObject*)obj; 79 super.setStruct(obj); 80 } 81 82 /** 83 * Sets our main struct and passes it to the parent class. 84 */ 85 public this (AtkObject* atkObject, bool ownedRef = false) 86 { 87 this.atkObject = atkObject; 88 super(cast(GObject*)atkObject, ownedRef); 89 } 90 91 92 /** */ 93 public static GType getType() 94 { 95 return atk_object_get_type(); 96 } 97 98 /** 99 * Adds a relationship of the specified type with the specified target. 100 * 101 * Params: 102 * relationship = The #AtkRelationType of the relation 103 * target = The #AtkObject which is to be the target of the relation. 104 * 105 * Returns: TRUE if the relationship is added. 106 */ 107 public bool addRelationship(AtkRelationType relationship, ObjectAtk target) 108 { 109 return atk_object_add_relationship(atkObject, relationship, (target is null) ? null : target.getObjectAtkStruct()) != 0; 110 } 111 112 /** 113 * 114 * 115 * Deprecated: Since 2.12. Connect directly to property-change or 116 * notify signals. 117 * 118 * Params: 119 * handler = a function to be called when a property changes its value 120 * 121 * Returns: a #guint which is the handler id used in 122 * atk_object_remove_property_change_handler() 123 */ 124 public uint connectPropertyChangeHandler(AtkPropertyChangeHandler* handler) 125 { 126 return atk_object_connect_property_change_handler(atkObject, handler); 127 } 128 129 /** 130 * Get a list of properties applied to this object as a whole, as an #AtkAttributeSet consisting of 131 * name-value pairs. As such these attributes may be considered weakly-typed properties or annotations, 132 * as distinct from strongly-typed object data available via other get/set methods. 133 * Not all objects have explicit "name-value pair" #AtkAttributeSet properties. 134 * 135 * Returns: an #AtkAttributeSet consisting of all 136 * explicit properties/annotations applied to the object, or an empty 137 * set if the object has no name-value pair attributes assigned to 138 * it. This #atkattributeset should be freed by a call to 139 * atk_attribute_set_free(). 140 * 141 * Since: 1.12 142 */ 143 public AtkAttributeSet* getAttributes() 144 { 145 return atk_object_get_attributes(atkObject); 146 } 147 148 /** 149 * Gets the accessible description of the accessible. 150 * 151 * Returns: a character string representing the accessible description 152 * of the accessible. 153 */ 154 public string getDescription() 155 { 156 return Str.toString(atk_object_get_description(atkObject)); 157 } 158 159 /** 160 * Gets the 0-based index of this accessible in its parent; returns -1 if the 161 * accessible does not have an accessible parent. 162 * 163 * Returns: an integer which is the index of the accessible in its parent 164 */ 165 public int getIndexInParent() 166 { 167 return atk_object_get_index_in_parent(atkObject); 168 } 169 170 /** 171 * Gets the layer of the accessible. 172 * 173 * Deprecated: Use atk_component_get_layer instead. 174 * 175 * Returns: an #AtkLayer which is the layer of the accessible 176 */ 177 public AtkLayer getLayer() 178 { 179 return atk_object_get_layer(atkObject); 180 } 181 182 /** 183 * Gets the zorder of the accessible. The value G_MININT will be returned 184 * if the layer of the accessible is not ATK_LAYER_MDI. 185 * 186 * Deprecated: Use atk_component_get_mdi_zorder instead. 187 * 188 * Returns: a gint which is the zorder of the accessible, i.e. the depth at 189 * which the component is shown in relation to other components in the same 190 * container. 191 */ 192 public int getMdiZorder() 193 { 194 return atk_object_get_mdi_zorder(atkObject); 195 } 196 197 /** 198 * Gets the number of accessible children of the accessible. 199 * 200 * Returns: an integer representing the number of accessible children 201 * of the accessible. 202 */ 203 public int getNAccessibleChildren() 204 { 205 return atk_object_get_n_accessible_children(atkObject); 206 } 207 208 /** 209 * Gets the accessible name of the accessible. 210 * 211 * Returns: a character string representing the accessible name of the object. 212 */ 213 public string getName() 214 { 215 return Str.toString(atk_object_get_name(atkObject)); 216 } 217 218 /** 219 * Gets a UTF-8 string indicating the POSIX-style LC_MESSAGES locale 220 * of @accessible. 221 * 222 * Returns: a UTF-8 string indicating the POSIX-style LC_MESSAGES 223 * locale of @accessible. 224 * 225 * Since: 2.8 226 */ 227 public string getObjectLocale() 228 { 229 return Str.toString(atk_object_get_object_locale(atkObject)); 230 } 231 232 /** 233 * Gets the accessible parent of the accessible. By default this is 234 * the one assigned with atk_object_set_parent(), but it is assumed 235 * that ATK implementors have ways to get the parent of the object 236 * without the need of assigning it manually with 237 * atk_object_set_parent(), and will return it with this method. 238 * 239 * If you are only interested on the parent assigned with 240 * atk_object_set_parent(), use atk_object_peek_parent(). 241 * 242 * Returns: an #AtkObject representing the accessible 243 * parent of the accessible 244 */ 245 public ObjectAtk getParent() 246 { 247 auto p = atk_object_get_parent(atkObject); 248 249 if(p is null) 250 { 251 return null; 252 } 253 254 return ObjectG.getDObject!(ObjectAtk)(cast(AtkObject*) p); 255 } 256 257 /** 258 * Gets the role of the accessible. 259 * 260 * Returns: an #AtkRole which is the role of the accessible 261 */ 262 public AtkRole getRole() 263 { 264 return atk_object_get_role(atkObject); 265 } 266 267 /** 268 * This function is called when implementing subclasses of #AtkObject. 269 * It does initialization required for the new object. It is intended 270 * that this function should called only in the ..._new() functions used 271 * to create an instance of a subclass of #AtkObject 272 * 273 * Params: 274 * data = a #gpointer which identifies the object for which the AtkObject was created. 275 */ 276 public void initialize(void* data) 277 { 278 atk_object_initialize(atkObject, data); 279 } 280 281 /** 282 * Emits a state-change signal for the specified state. 283 * 284 * Note that as a general rule when the state of an existing object changes, 285 * emitting a notification is expected. 286 * 287 * Params: 288 * state = an #AtkState whose state is changed 289 * value = a gboolean which indicates whether the state is being set on or off 290 */ 291 public void notifyStateChange(AtkState state, bool value) 292 { 293 atk_object_notify_state_change(atkObject, state, value); 294 } 295 296 /** 297 * Gets the accessible parent of the accessible, if it has been 298 * manually assigned with atk_object_set_parent. Otherwise, this 299 * function returns %NULL. 300 * 301 * This method is intended as an utility for ATK implementors, and not 302 * to be exposed to accessible tools. See atk_object_get_parent() for 303 * further reference. 304 * 305 * Returns: an #AtkObject representing the accessible 306 * parent of the accessible if assigned 307 */ 308 public ObjectAtk peekParent() 309 { 310 auto p = atk_object_peek_parent(atkObject); 311 312 if(p is null) 313 { 314 return null; 315 } 316 317 return ObjectG.getDObject!(ObjectAtk)(cast(AtkObject*) p); 318 } 319 320 /** 321 * Gets a reference to the specified accessible child of the object. 322 * The accessible children are 0-based so the first accessible child is 323 * at index 0, the second at index 1 and so on. 324 * 325 * Params: 326 * i = a gint representing the position of the child, starting from 0 327 * 328 * Returns: an #AtkObject representing the specified 329 * accessible child of the accessible. 330 */ 331 public ObjectAtk refAccessibleChild(int i) 332 { 333 auto p = atk_object_ref_accessible_child(atkObject, i); 334 335 if(p is null) 336 { 337 return null; 338 } 339 340 return ObjectG.getDObject!(ObjectAtk)(cast(AtkObject*) p, true); 341 } 342 343 /** 344 * Gets the #AtkRelationSet associated with the object. 345 * 346 * Returns: an #AtkRelationSet representing the relation set 347 * of the object. 348 */ 349 public RelationSet refRelationSet() 350 { 351 auto p = atk_object_ref_relation_set(atkObject); 352 353 if(p is null) 354 { 355 return null; 356 } 357 358 return ObjectG.getDObject!(RelationSet)(cast(AtkRelationSet*) p, true); 359 } 360 361 /** 362 * Gets a reference to the state set of the accessible; the caller must 363 * unreference it when it is no longer needed. 364 * 365 * Returns: a reference to an #AtkStateSet which is the state 366 * set of the accessible 367 */ 368 public StateSet refStateSet() 369 { 370 auto p = atk_object_ref_state_set(atkObject); 371 372 if(p is null) 373 { 374 return null; 375 } 376 377 return ObjectG.getDObject!(StateSet)(cast(AtkStateSet*) p, true); 378 } 379 380 /** 381 * 382 * 383 * Deprecated: Since 2.12. 384 * 385 * Removes a property change handler. 386 * 387 * Params: 388 * handlerId = a guint which identifies the handler to be removed. 389 */ 390 public void removePropertyChangeHandler(uint handlerId) 391 { 392 atk_object_remove_property_change_handler(atkObject, handlerId); 393 } 394 395 /** 396 * Removes a relationship of the specified type with the specified target. 397 * 398 * Params: 399 * relationship = The #AtkRelationType of the relation 400 * target = The #AtkObject which is the target of the relation to be removed. 401 * 402 * Returns: TRUE if the relationship is removed. 403 */ 404 public bool removeRelationship(AtkRelationType relationship, ObjectAtk target) 405 { 406 return atk_object_remove_relationship(atkObject, relationship, (target is null) ? null : target.getObjectAtkStruct()) != 0; 407 } 408 409 /** 410 * Sets the accessible description of the accessible. You can't set 411 * the description to NULL. This is reserved for the initial value. In 412 * this aspect NULL is similar to ATK_ROLE_UNKNOWN. If you want to set 413 * the name to a empty value you can use "". 414 * 415 * Params: 416 * description = a character string to be set as the accessible description 417 */ 418 public void setDescription(string description) 419 { 420 atk_object_set_description(atkObject, Str.toStringz(description)); 421 } 422 423 /** 424 * Sets the accessible name of the accessible. You can't set the name 425 * to NULL. This is reserved for the initial value. In this aspect 426 * NULL is similar to ATK_ROLE_UNKNOWN. If you want to set the name to 427 * a empty value you can use "". 428 * 429 * Params: 430 * name = a character string to be set as the accessible name 431 */ 432 public void setName(string name) 433 { 434 atk_object_set_name(atkObject, Str.toStringz(name)); 435 } 436 437 /** 438 * Sets the accessible parent of the accessible. @parent can be NULL. 439 * 440 * Params: 441 * parent = an #AtkObject to be set as the accessible parent 442 */ 443 public void setParent(ObjectAtk parent) 444 { 445 atk_object_set_parent(atkObject, (parent is null) ? null : parent.getObjectAtkStruct()); 446 } 447 448 /** 449 * Sets the role of the accessible. 450 * 451 * Params: 452 * role = an #AtkRole to be set as the role 453 */ 454 public void setRole(AtkRole role) 455 { 456 atk_object_set_role(atkObject, role); 457 } 458 459 protected class OnActiveDescendantChangedDelegateWrapper 460 { 461 static OnActiveDescendantChangedDelegateWrapper[] listeners; 462 void delegate(void*, ObjectAtk) dlg; 463 gulong handlerId; 464 465 this(void delegate(void*, ObjectAtk) dlg) 466 { 467 this.dlg = dlg; 468 this.listeners ~= this; 469 } 470 471 void remove(OnActiveDescendantChangedDelegateWrapper source) 472 { 473 foreach(index, wrapper; listeners) 474 { 475 if (wrapper.handlerId == source.handlerId) 476 { 477 listeners[index] = null; 478 listeners = std.algorithm.remove(listeners, index); 479 break; 480 } 481 } 482 } 483 } 484 485 /** 486 * The "active-descendant-changed" signal is emitted by an object 487 * which has the state ATK_STATE_MANAGES_DESCENDANTS when the focus 488 * object in the object changes. For instance, a table will emit the 489 * signal when the cell in the table which has focus changes. 490 * 491 * Params: 492 * arg1 = the newly focused object. 493 */ 494 gulong addOnActiveDescendantChanged(void delegate(void*, ObjectAtk) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 495 { 496 auto wrapper = new OnActiveDescendantChangedDelegateWrapper(dlg); 497 wrapper.handlerId = Signals.connectData( 498 this, 499 "active-descendant-changed", 500 cast(GCallback)&callBackActiveDescendantChanged, 501 cast(void*)wrapper, 502 cast(GClosureNotify)&callBackActiveDescendantChangedDestroy, 503 connectFlags); 504 return wrapper.handlerId; 505 } 506 507 extern(C) static void callBackActiveDescendantChanged(AtkObject* objectatkStruct, void* arg1, OnActiveDescendantChangedDelegateWrapper wrapper) 508 { 509 wrapper.dlg(arg1, wrapper.outer); 510 } 511 512 extern(C) static void callBackActiveDescendantChangedDestroy(OnActiveDescendantChangedDelegateWrapper wrapper, GClosure* closure) 513 { 514 wrapper.remove(wrapper); 515 } 516 517 protected class OnChildrenChangedDelegateWrapper 518 { 519 static OnChildrenChangedDelegateWrapper[] listeners; 520 void delegate(uint, void*, ObjectAtk) dlg; 521 gulong handlerId; 522 523 this(void delegate(uint, void*, ObjectAtk) dlg) 524 { 525 this.dlg = dlg; 526 this.listeners ~= this; 527 } 528 529 void remove(OnChildrenChangedDelegateWrapper source) 530 { 531 foreach(index, wrapper; listeners) 532 { 533 if (wrapper.handlerId == source.handlerId) 534 { 535 listeners[index] = null; 536 listeners = std.algorithm.remove(listeners, index); 537 break; 538 } 539 } 540 } 541 } 542 543 /** 544 * The signal "children-changed" is emitted when a child is added or 545 * removed form an object. It supports two details: "add" and 546 * "remove" 547 * 548 * Params: 549 * arg1 = The index of the added or removed child. The value can be 550 * -1. This is used if the value is not known by the implementor 551 * when the child is added/removed or irrelevant. 552 * arg2 = A gpointer to the child AtkObject which was added or 553 * removed. If the child was removed, it is possible that it is not 554 * available for the implementor. In that case this pointer can be 555 * NULL. 556 */ 557 gulong addOnChildrenChanged(void delegate(uint, void*, ObjectAtk) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 558 { 559 auto wrapper = new OnChildrenChangedDelegateWrapper(dlg); 560 wrapper.handlerId = Signals.connectData( 561 this, 562 "children-changed", 563 cast(GCallback)&callBackChildrenChanged, 564 cast(void*)wrapper, 565 cast(GClosureNotify)&callBackChildrenChangedDestroy, 566 connectFlags); 567 return wrapper.handlerId; 568 } 569 570 extern(C) static void callBackChildrenChanged(AtkObject* objectatkStruct, uint arg1, void* arg2, OnChildrenChangedDelegateWrapper wrapper) 571 { 572 wrapper.dlg(arg1, arg2, wrapper.outer); 573 } 574 575 extern(C) static void callBackChildrenChangedDestroy(OnChildrenChangedDelegateWrapper wrapper, GClosure* closure) 576 { 577 wrapper.remove(wrapper); 578 } 579 580 protected class OnFocusDelegateWrapper 581 { 582 static OnFocusDelegateWrapper[] listeners; 583 void delegate(bool, ObjectAtk) dlg; 584 gulong handlerId; 585 586 this(void delegate(bool, ObjectAtk) dlg) 587 { 588 this.dlg = dlg; 589 this.listeners ~= this; 590 } 591 592 void remove(OnFocusDelegateWrapper source) 593 { 594 foreach(index, wrapper; listeners) 595 { 596 if (wrapper.handlerId == source.handlerId) 597 { 598 listeners[index] = null; 599 listeners = std.algorithm.remove(listeners, index); 600 break; 601 } 602 } 603 } 604 } 605 606 /** 607 * The signal "focus-event" is emitted when an object gained or lost 608 * focus. 609 * 610 * Deprecated: Use the #AtkObject::state-change signal instead. 611 * 612 * Params: 613 * arg1 = a boolean value which indicates whether the object gained 614 * or lost focus. 615 */ 616 gulong addOnFocus(void delegate(bool, ObjectAtk) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 617 { 618 auto wrapper = new OnFocusDelegateWrapper(dlg); 619 wrapper.handlerId = Signals.connectData( 620 this, 621 "focus-event", 622 cast(GCallback)&callBackFocus, 623 cast(void*)wrapper, 624 cast(GClosureNotify)&callBackFocusDestroy, 625 connectFlags); 626 return wrapper.handlerId; 627 } 628 629 extern(C) static void callBackFocus(AtkObject* objectatkStruct, bool arg1, OnFocusDelegateWrapper wrapper) 630 { 631 wrapper.dlg(arg1, wrapper.outer); 632 } 633 634 extern(C) static void callBackFocusDestroy(OnFocusDelegateWrapper wrapper, GClosure* closure) 635 { 636 wrapper.remove(wrapper); 637 } 638 639 protected class OnPropertyChangeDelegateWrapper 640 { 641 static OnPropertyChangeDelegateWrapper[] listeners; 642 void delegate(void*, ObjectAtk) dlg; 643 gulong handlerId; 644 645 this(void delegate(void*, ObjectAtk) dlg) 646 { 647 this.dlg = dlg; 648 this.listeners ~= this; 649 } 650 651 void remove(OnPropertyChangeDelegateWrapper source) 652 { 653 foreach(index, wrapper; listeners) 654 { 655 if (wrapper.handlerId == source.handlerId) 656 { 657 listeners[index] = null; 658 listeners = std.algorithm.remove(listeners, index); 659 break; 660 } 661 } 662 } 663 } 664 665 /** 666 * The signal "property-change" is emitted when an object's property 667 * value changes. @arg1 contains an #AtkPropertyValues with the name 668 * and the new value of the property whose value has changed. Note 669 * that, as with GObject notify, getting this signal does not 670 * guarantee that the value of the property has actually changed; it 671 * may also be emitted when the setter of the property is called to 672 * reinstate the previous value. 673 * 674 * Toolkit implementor note: ATK implementors should use 675 * g_object_notify() to emit property-changed 676 * notifications. #AtkObject::property-changed is needed by the 677 * implementation of atk_add_global_event_listener() because GObject 678 * notify doesn't support emission hooks. 679 * 680 * Params: 681 * arg1 = an #AtkPropertyValues containing the new value of the 682 * property which changed. 683 */ 684 gulong addOnPropertyChange(void delegate(void*, ObjectAtk) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 685 { 686 auto wrapper = new OnPropertyChangeDelegateWrapper(dlg); 687 wrapper.handlerId = Signals.connectData( 688 this, 689 "property-change", 690 cast(GCallback)&callBackPropertyChange, 691 cast(void*)wrapper, 692 cast(GClosureNotify)&callBackPropertyChangeDestroy, 693 connectFlags); 694 return wrapper.handlerId; 695 } 696 697 extern(C) static void callBackPropertyChange(AtkObject* objectatkStruct, void* arg1, OnPropertyChangeDelegateWrapper wrapper) 698 { 699 wrapper.dlg(arg1, wrapper.outer); 700 } 701 702 extern(C) static void callBackPropertyChangeDestroy(OnPropertyChangeDelegateWrapper wrapper, GClosure* closure) 703 { 704 wrapper.remove(wrapper); 705 } 706 707 protected class OnStateChangeDelegateWrapper 708 { 709 static OnStateChangeDelegateWrapper[] listeners; 710 void delegate(string, bool, ObjectAtk) dlg; 711 gulong handlerId; 712 713 this(void delegate(string, bool, ObjectAtk) dlg) 714 { 715 this.dlg = dlg; 716 this.listeners ~= this; 717 } 718 719 void remove(OnStateChangeDelegateWrapper source) 720 { 721 foreach(index, wrapper; listeners) 722 { 723 if (wrapper.handlerId == source.handlerId) 724 { 725 listeners[index] = null; 726 listeners = std.algorithm.remove(listeners, index); 727 break; 728 } 729 } 730 } 731 } 732 733 /** 734 * The "state-change" signal is emitted when an object's state 735 * changes. The detail value identifies the state type which has 736 * changed. 737 * 738 * Params: 739 * arg1 = The name of the state which has changed 740 * arg2 = A boolean which indicates whether the state has been set or unset. 741 */ 742 gulong addOnStateChange(void delegate(string, bool, ObjectAtk) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 743 { 744 auto wrapper = new OnStateChangeDelegateWrapper(dlg); 745 wrapper.handlerId = Signals.connectData( 746 this, 747 "state-change", 748 cast(GCallback)&callBackStateChange, 749 cast(void*)wrapper, 750 cast(GClosureNotify)&callBackStateChangeDestroy, 751 connectFlags); 752 return wrapper.handlerId; 753 } 754 755 extern(C) static void callBackStateChange(AtkObject* objectatkStruct, char* arg1, bool arg2, OnStateChangeDelegateWrapper wrapper) 756 { 757 wrapper.dlg(Str.toString(arg1), arg2, wrapper.outer); 758 } 759 760 extern(C) static void callBackStateChangeDestroy(OnStateChangeDelegateWrapper wrapper, GClosure* closure) 761 { 762 wrapper.remove(wrapper); 763 } 764 765 protected class OnVisibleDataChangedDelegateWrapper 766 { 767 static OnVisibleDataChangedDelegateWrapper[] listeners; 768 void delegate(ObjectAtk) dlg; 769 gulong handlerId; 770 771 this(void delegate(ObjectAtk) dlg) 772 { 773 this.dlg = dlg; 774 this.listeners ~= this; 775 } 776 777 void remove(OnVisibleDataChangedDelegateWrapper source) 778 { 779 foreach(index, wrapper; listeners) 780 { 781 if (wrapper.handlerId == source.handlerId) 782 { 783 listeners[index] = null; 784 listeners = std.algorithm.remove(listeners, index); 785 break; 786 } 787 } 788 } 789 } 790 791 /** 792 * The "visible-data-changed" signal is emitted when the visual 793 * appearance of the object changed. 794 */ 795 gulong addOnVisibleDataChanged(void delegate(ObjectAtk) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 796 { 797 auto wrapper = new OnVisibleDataChangedDelegateWrapper(dlg); 798 wrapper.handlerId = Signals.connectData( 799 this, 800 "visible-data-changed", 801 cast(GCallback)&callBackVisibleDataChanged, 802 cast(void*)wrapper, 803 cast(GClosureNotify)&callBackVisibleDataChangedDestroy, 804 connectFlags); 805 return wrapper.handlerId; 806 } 807 808 extern(C) static void callBackVisibleDataChanged(AtkObject* objectatkStruct, OnVisibleDataChangedDelegateWrapper wrapper) 809 { 810 wrapper.dlg(wrapper.outer); 811 } 812 813 extern(C) static void callBackVisibleDataChangedDestroy(OnVisibleDataChangedDelegateWrapper wrapper, GClosure* closure) 814 { 815 wrapper.remove(wrapper); 816 } 817 818 /** 819 * Get the #AtkRole type corresponding to a rolew name. 820 * 821 * Params: 822 * name = a string which is the (non-localized) name of an ATK role. 823 * 824 * Returns: the #AtkRole enumerated type corresponding to the specified name, 825 * or #ATK_ROLE_INVALID if no matching role is found. 826 */ 827 public static AtkRole roleForName(string name) 828 { 829 return atk_role_for_name(Str.toStringz(name)); 830 } 831 832 /** 833 * Gets the localized description string describing the #AtkRole @role. 834 * 835 * Params: 836 * role = The #AtkRole whose localized name is required 837 * 838 * Returns: the localized string describing the AtkRole 839 */ 840 public static string roleGetLocalizedName(AtkRole role) 841 { 842 return Str.toString(atk_role_get_localized_name(role)); 843 } 844 845 /** 846 * Gets the description string describing the #AtkRole @role. 847 * 848 * Params: 849 * role = The #AtkRole whose name is required 850 * 851 * Returns: the string describing the AtkRole 852 */ 853 public static string roleGetName(AtkRole role) 854 { 855 return Str.toString(atk_role_get_name(role)); 856 } 857 858 /** 859 * Registers the role specified by @name. @name must be a meaningful 860 * name. So it should not be empty, or consisting on whitespaces. 861 * 862 * Deprecated: Since 2.12. If your application/toolkit doesn't find a 863 * suitable role for a specific object defined at #AtkRole, please 864 * submit a bug in order to add a new role to the specification. 865 * 866 * Params: 867 * name = a character string describing the new role. 868 * 869 * Returns: an #AtkRole for the new role if added 870 * properly. ATK_ROLE_INVALID in case of error. 871 */ 872 public static AtkRole roleRegister(string name) 873 { 874 return atk_role_register(Str.toStringz(name)); 875 } 876 }