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.TextT; 26 27 public import glib.Str; 28 public import gobject.Signals; 29 public import gtkc.atk; 30 public import gtkc.atktypes; 31 public import gtkc.gdktypes; 32 33 34 /** 35 * #AtkText should be implemented by #AtkObjects on behalf of widgets 36 * that have text content which is either attributed or otherwise 37 * non-trivial. #AtkObjects whose text content is simple, 38 * unattributed, and very brief may expose that content via 39 * #atk_object_get_name instead; however if the text is editable, 40 * multi-line, typically longer than three or four words, attributed, 41 * selectable, or if the object already uses the 'name' ATK property 42 * for other information, the #AtkText interface should be used to 43 * expose the text content. In the case of editable text content, 44 * #AtkEditableText (a subtype of the #AtkText interface) should be 45 * implemented instead. 46 * 47 * #AtkText provides not only traversal facilities and change 48 * notification for text content, but also caret tracking and glyph 49 * bounding box calculations. Note that the text strings are exposed 50 * as UTF-8, and are therefore potentially multi-byte, and 51 * caret-to-byte offset mapping makes no assumptions about the 52 * character length; also bounding box glyph-to-offset mapping may be 53 * complex for languages which use ligatures. 54 */ 55 public template TextT(TStruct) 56 { 57 /** Get the main Gtk struct */ 58 public AtkText* getTextStruct() 59 { 60 return cast(AtkText*)getStruct(); 61 } 62 63 /** 64 */ 65 66 /** 67 * Frees the memory associated with an array of AtkTextRange. It is assumed 68 * that the array was returned by the function atk_text_get_bounded_ranges 69 * and is NULL terminated. 70 * 71 * Params: 72 * ranges = A pointer to an array of #AtkTextRange which is 73 * to be freed. 74 * 75 * Since: 1.3 76 */ 77 public static void freeRanges(AtkTextRange*[] ranges) 78 { 79 atk_text_free_ranges(ranges.ptr); 80 } 81 82 /** 83 * Adds a selection bounded by the specified offsets. 84 * 85 * Params: 86 * startOffset = the start position of the selected region 87 * endOffset = the offset of the first character after the selected region. 88 * 89 * Return: %TRUE if success, %FALSE otherwise 90 */ 91 public bool addSelection(int startOffset, int endOffset) 92 { 93 return atk_text_add_selection(getTextStruct(), startOffset, endOffset) != 0; 94 } 95 96 /** 97 * Get the ranges of text in the specified bounding box. 98 * 99 * Params: 100 * rect = An AtkTextRectangle giving the dimensions of the bounding box. 101 * coordType = Specify whether coordinates are relative to the screen or widget window. 102 * xClipType = Specify the horizontal clip type. 103 * yClipType = Specify the vertical clip type. 104 * 105 * Return: Array of AtkTextRange. The last 106 * element of the array returned by this function will be NULL. 107 * 108 * Since: 1.3 109 */ 110 public AtkTextRange*[] getBoundedRanges(AtkTextRectangle* rect, AtkCoordType coordType, AtkTextClipType xClipType, AtkTextClipType yClipType) 111 { 112 auto p = atk_text_get_bounded_ranges(getTextStruct(), rect, coordType, xClipType, yClipType); 113 114 return p[0 .. getArrayLength(p)]; 115 } 116 117 /** 118 * Gets the offset position of the caret (cursor). 119 * 120 * Return: the offset position of the caret (cursor). 121 */ 122 public int getCaretOffset() 123 { 124 return atk_text_get_caret_offset(getTextStruct()); 125 } 126 127 /** 128 * Gets the specified text. 129 * 130 * Params: 131 * offset = position 132 * 133 * Return: the character at @offset. 134 */ 135 public dchar getCharacterAtOffset(int offset) 136 { 137 return atk_text_get_character_at_offset(getTextStruct(), offset); 138 } 139 140 /** 141 * Gets the character count. 142 * 143 * Return: the number of characters. 144 */ 145 public int getCharacterCount() 146 { 147 return atk_text_get_character_count(getTextStruct()); 148 } 149 150 /** 151 * Get the bounding box containing the glyph representing the character at 152 * a particular text offset. 153 * 154 * Params: 155 * offset = The offset of the text character for which bounding information is required. 156 * x = Pointer for the x cordinate of the bounding box 157 * y = Pointer for the y cordinate of the bounding box 158 * width = Pointer for the width of the bounding box 159 * height = Pointer for the height of the bounding box 160 * coords = specify whether coordinates are relative to the screen or widget window 161 */ 162 public void getCharacterExtents(int offset, int* x, int* y, int* width, int* height, AtkCoordType coords) 163 { 164 atk_text_get_character_extents(getTextStruct(), offset, x, y, width, height, coords); 165 } 166 167 /** 168 * Creates an #AtkAttributeSet which consists of the default values of 169 * attributes for the text. See the enum AtkTextAttribute for types of text 170 * attributes that can be returned. Note that other attributes may also be 171 * returned. 172 * 173 * Return: an #AtkAttributeSet which contains the default 174 * values of attributes. at @offset. this #atkattributeset should be freed by 175 * a call to atk_attribute_set_free(). 176 */ 177 public AtkAttributeSet* getDefaultAttributes() 178 { 179 return atk_text_get_default_attributes(getTextStruct()); 180 } 181 182 /** 183 * Gets the number of selected regions. 184 * 185 * Return: The number of selected regions, or -1 if a failure 186 * occurred. 187 */ 188 public int getNSelections() 189 { 190 return atk_text_get_n_selections(getTextStruct()); 191 } 192 193 /** 194 * Gets the offset of the character located at coordinates @x and @y. @x and @y 195 * are interpreted as being relative to the screen or this widget's window 196 * depending on @coords. 197 * 198 * Params: 199 * x = screen x-position of character 200 * y = screen y-position of character 201 * coords = specify whether coordinates are relative to the screen or 202 * widget window 203 * 204 * Return: the offset to the character which is located at 205 * the specified @x and @y coordinates. 206 */ 207 public int getOffsetAtPoint(int x, int y, AtkCoordType coords) 208 { 209 return atk_text_get_offset_at_point(getTextStruct(), x, y, coords); 210 } 211 212 /** 213 * Get the bounding box for text within the specified range. 214 * 215 * Params: 216 * startOffset = The offset of the first text character for which boundary 217 * information is required. 218 * endOffset = The offset of the text character after the last character 219 * for which boundary information is required. 220 * coordType = Specify whether coordinates are relative to the screen or widget window. 221 * rect = A pointer to a AtkTextRectangle which is filled in by this function. 222 * 223 * Since: 1.3 224 */ 225 public void getRangeExtents(int startOffset, int endOffset, AtkCoordType coordType, AtkTextRectangle* rect) 226 { 227 atk_text_get_range_extents(getTextStruct(), startOffset, endOffset, coordType, rect); 228 } 229 230 /** 231 * Creates an #AtkAttributeSet which consists of the attributes explicitly 232 * set at the position @offset in the text. @start_offset and @end_offset are 233 * set to the start and end of the range around @offset where the attributes are 234 * invariant. Note that @end_offset is the offset of the first character 235 * after the range. See the enum AtkTextAttribute for types of text 236 * attributes that can be returned. Note that other attributes may also be 237 * returned. 238 * 239 * Params: 240 * offset = the offset at which to get the attributes, -1 means the offset of 241 * the character to be inserted at the caret location. 242 * startOffset = the address to put the start offset of the range 243 * endOffset = the address to put the end offset of the range 244 * 245 * Return: an #AtkAttributeSet which contains the attributes 246 * explicitly set at @offset. This #AtkAttributeSet should be freed by a call 247 * to atk_attribute_set_free(). 248 */ 249 public AtkAttributeSet* getRunAttributes(int offset, out int startOffset, out int endOffset) 250 { 251 return atk_text_get_run_attributes(getTextStruct(), offset, &startOffset, &endOffset); 252 } 253 254 /** 255 * Gets the text from the specified selection. 256 * 257 * Params: 258 * selectionNum = The selection number. The selected regions are 259 * assigned numbers that correspond to how far the region is from the 260 * start of the text. The selected region closest to the beginning 261 * of the text region is assigned the number 0, etc. Note that adding, 262 * moving or deleting a selected region can change the numbering. 263 * startOffset = passes back the start position of the selected region 264 * endOffset = passes back the end position of (e.g. offset immediately past) 265 * the selected region 266 * 267 * Return: a newly allocated string containing the selected text. Use g_free() 268 * to free the returned string. 269 */ 270 public string getSelection(int selectionNum, out int startOffset, out int endOffset) 271 { 272 return Str.toString(atk_text_get_selection(getTextStruct(), selectionNum, &startOffset, &endOffset)); 273 } 274 275 /** 276 * Gets a portion of the text exposed through an #AtkText according to a given @offset 277 * and a specific @granularity, along with the start and end offsets defining the 278 * boundaries of such a portion of text. 279 * 280 * If @granularity is ATK_TEXT_GRANULARITY_CHAR the character at the 281 * offset is returned. 282 * 283 * If @granularity is ATK_TEXT_GRANULARITY_WORD the returned string 284 * is from the word start at or before the offset to the word start after 285 * the offset. 286 * 287 * The returned string will contain the word at the offset if the offset 288 * is inside a word and will contain the word before the offset if the 289 * offset is not inside a word. 290 * 291 * If @granularity is ATK_TEXT_GRANULARITY_SENTENCE the returned string 292 * is from the sentence start at or before the offset to the sentence 293 * start after the offset. 294 * 295 * The returned string will contain the sentence at the offset if the offset 296 * is inside a sentence and will contain the sentence before the offset 297 * if the offset is not inside a sentence. 298 * 299 * If @granularity is ATK_TEXT_GRANULARITY_LINE the returned string 300 * is from the line start at or before the offset to the line 301 * start after the offset. 302 * 303 * If @granularity is ATK_TEXT_GRANULARITY_PARAGRAPH the returned string 304 * is from the start of the paragraph at or before the offset to the start 305 * of the following paragraph after the offset. 306 * 307 * Params: 308 * offset = position 309 * granularity = An #AtkTextGranularity 310 * startOffset = the start offset of the returned string, or -1 311 * if an error has occurred (e.g. invalid offset, not implemented) 312 * endOffset = the offset of the first character after the returned string, 313 * or -1 if an error has occurred (e.g. invalid offset, not implemented) 314 * 315 * Return: a newly allocated string containing the text 316 * at the @offset bounded by the specified @granularity. Use 317 * g_free() to free the returned string. Returns %NULL if the 318 * offset is invalid or no implementation is available. 319 * 320 * Since: 2.10 321 */ 322 public string getStringAtOffset(int offset, AtkTextGranularity granularity, out int startOffset, out int endOffset) 323 { 324 return Str.toString(atk_text_get_string_at_offset(getTextStruct(), offset, granularity, &startOffset, &endOffset)); 325 } 326 327 /** 328 * Gets the specified text. 329 * 330 * Params: 331 * startOffset = start position 332 * endOffset = end position, or -1 for the end of the string. 333 * 334 * Return: a newly allocated string containing the text from @start_offset up 335 * to, but not including @end_offset. Use g_free() to free the returned string. 336 */ 337 public string getText(int startOffset, int endOffset) 338 { 339 return Str.toString(atk_text_get_text(getTextStruct(), startOffset, endOffset)); 340 } 341 342 /** 343 * Gets the specified text. 344 * 345 * Deprecated: Please use atk_text_get_string_at_offset() instead. 346 * 347 * Params: 348 * offset = position 349 * boundaryType = An #AtkTextBoundary 350 * startOffset = the start offset of the returned string 351 * endOffset = the offset of the first character after the 352 * returned substring 353 * 354 * Return: a newly allocated string containing the text after @offset bounded 355 * by the specified @boundary_type. Use g_free() to free the returned string. 356 */ 357 public string getTextAfterOffset(int offset, AtkTextBoundary boundaryType, out int startOffset, out int endOffset) 358 { 359 return Str.toString(atk_text_get_text_after_offset(getTextStruct(), offset, boundaryType, &startOffset, &endOffset)); 360 } 361 362 /** 363 * Gets the specified text. 364 * 365 * If the boundary_type if ATK_TEXT_BOUNDARY_CHAR the character at the 366 * offset is returned. 367 * 368 * If the boundary_type is ATK_TEXT_BOUNDARY_WORD_START the returned string 369 * is from the word start at or before the offset to the word start after 370 * the offset. 371 * 372 * The returned string will contain the word at the offset if the offset 373 * is inside a word and will contain the word before the offset if the 374 * offset is not inside a word. 375 * 376 * If the boundary type is ATK_TEXT_BOUNDARY_SENTENCE_START the returned 377 * string is from the sentence start at or before the offset to the sentence 378 * start after the offset. 379 * 380 * The returned string will contain the sentence at the offset if the offset 381 * is inside a sentence and will contain the sentence before the offset 382 * if the offset is not inside a sentence. 383 * 384 * If the boundary type is ATK_TEXT_BOUNDARY_LINE_START the returned 385 * string is from the line start at or before the offset to the line 386 * start after the offset. 387 * 388 * Deprecated: This method is deprecated since ATK version 389 * 2.9.4. Please use atk_text_get_string_at_offset() instead. 390 * 391 * Params: 392 * offset = position 393 * boundaryType = An #AtkTextBoundary 394 * startOffset = the start offset of the returned string 395 * endOffset = the offset of the first character after the 396 * returned substring 397 * 398 * Return: a newly allocated string containing the text at @offset bounded by 399 * the specified @boundary_type. Use g_free() to free the returned string. 400 */ 401 public string getTextAtOffset(int offset, AtkTextBoundary boundaryType, out int startOffset, out int endOffset) 402 { 403 return Str.toString(atk_text_get_text_at_offset(getTextStruct(), offset, boundaryType, &startOffset, &endOffset)); 404 } 405 406 /** 407 * Gets the specified text. 408 * 409 * Deprecated: Please use atk_text_get_string_at_offset() instead. 410 * 411 * Params: 412 * offset = position 413 * boundaryType = An #AtkTextBoundary 414 * startOffset = the start offset of the returned string 415 * endOffset = the offset of the first character after the 416 * returned substring 417 * 418 * Return: a newly allocated string containing the text before @offset bounded 419 * by the specified @boundary_type. Use g_free() to free the returned string. 420 */ 421 public string getTextBeforeOffset(int offset, AtkTextBoundary boundaryType, out int startOffset, out int endOffset) 422 { 423 return Str.toString(atk_text_get_text_before_offset(getTextStruct(), offset, boundaryType, &startOffset, &endOffset)); 424 } 425 426 /** 427 * Removes the specified selection. 428 * 429 * Params: 430 * selectionNum = The selection number. The selected regions are 431 * assigned numbers that correspond to how far the region is from the 432 * start of the text. The selected region closest to the beginning 433 * of the text region is assigned the number 0, etc. Note that adding, 434 * moving or deleting a selected region can change the numbering. 435 * 436 * Return: %TRUE if success, %FALSE otherwise 437 */ 438 public bool removeSelection(int selectionNum) 439 { 440 return atk_text_remove_selection(getTextStruct(), selectionNum) != 0; 441 } 442 443 /** 444 * Sets the caret (cursor) position to the specified @offset. 445 * 446 * Params: 447 * offset = position 448 * 449 * Return: %TRUE if success, %FALSE otherwise. 450 */ 451 public bool setCaretOffset(int offset) 452 { 453 return atk_text_set_caret_offset(getTextStruct(), offset) != 0; 454 } 455 456 /** 457 * Changes the start and end offset of the specified selection. 458 * 459 * Params: 460 * selectionNum = The selection number. The selected regions are 461 * assigned numbers that correspond to how far the region is from the 462 * start of the text. The selected region closest to the beginning 463 * of the text region is assigned the number 0, etc. Note that adding, 464 * moving or deleting a selected region can change the numbering. 465 * startOffset = the new start position of the selection 466 * endOffset = the new end position of (e.g. offset immediately past) 467 * the selection 468 * 469 * Return: %TRUE if success, %FALSE otherwise 470 */ 471 public bool setSelection(int selectionNum, int startOffset, int endOffset) 472 { 473 return atk_text_set_selection(getTextStruct(), selectionNum, startOffset, endOffset) != 0; 474 } 475 476 int[string] connectedSignals; 477 478 void delegate(TextIF)[] _onTextAttributesChangedListeners; 479 @property void delegate(TextIF)[] onTextAttributesChangedListeners() 480 { 481 return _onTextAttributesChangedListeners; 482 } 483 /** 484 * The "text-attributes-changed" signal is emitted when the text 485 * attributes of the text of an object which implements AtkText 486 * changes. 487 */ 488 void addOnTextAttributesChanged(void delegate(TextIF) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 489 { 490 if ( "text-attributes-changed" !in connectedSignals ) 491 { 492 Signals.connectData( 493 this, 494 "text-attributes-changed", 495 cast(GCallback)&callBackTextAttributesChanged, 496 cast(void*)cast(TextIF)this, 497 null, 498 connectFlags); 499 connectedSignals["text-attributes-changed"] = 1; 500 } 501 _onTextAttributesChangedListeners ~= dlg; 502 } 503 extern(C) static void callBackTextAttributesChanged(AtkText* textStruct, TextIF _text) 504 { 505 foreach ( void delegate(TextIF) dlg; _text.onTextAttributesChangedListeners ) 506 { 507 dlg(_text); 508 } 509 } 510 511 void delegate(int, TextIF)[] _onTextCaretMovedListeners; 512 @property void delegate(int, TextIF)[] onTextCaretMovedListeners() 513 { 514 return _onTextCaretMovedListeners; 515 } 516 /** 517 * The "text-caret-moved" signal is emitted when the caret 518 * position of the text of an object which implements AtkText 519 * changes. 520 * 521 * Params: 522 * arg1 = The new position of the text caret. 523 */ 524 void addOnTextCaretMoved(void delegate(int, TextIF) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 525 { 526 if ( "text-caret-moved" !in connectedSignals ) 527 { 528 Signals.connectData( 529 this, 530 "text-caret-moved", 531 cast(GCallback)&callBackTextCaretMoved, 532 cast(void*)cast(TextIF)this, 533 null, 534 connectFlags); 535 connectedSignals["text-caret-moved"] = 1; 536 } 537 _onTextCaretMovedListeners ~= dlg; 538 } 539 extern(C) static void callBackTextCaretMoved(AtkText* textStruct, int arg1, TextIF _text) 540 { 541 foreach ( void delegate(int, TextIF) dlg; _text.onTextCaretMovedListeners ) 542 { 543 dlg(arg1, _text); 544 } 545 } 546 547 void delegate(int, int, TextIF)[] _onTextChangedListeners; 548 @property void delegate(int, int, TextIF)[] onTextChangedListeners() 549 { 550 return _onTextChangedListeners; 551 } 552 /** 553 * The "text-changed" signal is emitted when the text of the 554 * object which implements the AtkText interface changes, This 555 * signal will have a detail which is either "insert" or 556 * "delete" which identifies whether the text change was an 557 * insertion or a deletion. 558 * 559 * Deprecated: Use #AtkObject::text-insert or 560 * #AtkObject::text-remove instead. 561 * 562 * Params: 563 * arg1 = The position (character offset) of the insertion or deletion. 564 * arg2 = The length (in characters) of text inserted or deleted. 565 */ 566 void addOnTextChanged(void delegate(int, int, TextIF) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 567 { 568 if ( "text-changed" !in connectedSignals ) 569 { 570 Signals.connectData( 571 this, 572 "text-changed", 573 cast(GCallback)&callBackTextChanged, 574 cast(void*)cast(TextIF)this, 575 null, 576 connectFlags); 577 connectedSignals["text-changed"] = 1; 578 } 579 _onTextChangedListeners ~= dlg; 580 } 581 extern(C) static void callBackTextChanged(AtkText* textStruct, int arg1, int arg2, TextIF _text) 582 { 583 foreach ( void delegate(int, int, TextIF) dlg; _text.onTextChangedListeners ) 584 { 585 dlg(arg1, arg2, _text); 586 } 587 } 588 589 void delegate(int, int, string, TextIF)[] _onTextInsertListeners; 590 @property void delegate(int, int, string, TextIF)[] onTextInsertListeners() 591 { 592 return _onTextInsertListeners; 593 } 594 /** 595 * The "text-insert" signal is emitted when a new text is 596 * inserted. If the signal was not triggered by the user 597 * (e.g. typing or pasting text), the "system" detail should be 598 * included. 599 * 600 * Params: 601 * arg1 = The position (character offset) of the insertion. 602 * arg2 = The length (in characters) of text inserted. 603 * arg3 = The new text inserted 604 */ 605 void addOnTextInsert(void delegate(int, int, string, TextIF) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 606 { 607 if ( "text-insert" !in connectedSignals ) 608 { 609 Signals.connectData( 610 this, 611 "text-insert", 612 cast(GCallback)&callBackTextInsert, 613 cast(void*)cast(TextIF)this, 614 null, 615 connectFlags); 616 connectedSignals["text-insert"] = 1; 617 } 618 _onTextInsertListeners ~= dlg; 619 } 620 extern(C) static void callBackTextInsert(AtkText* textStruct, int arg1, int arg2, char* arg3, TextIF _text) 621 { 622 foreach ( void delegate(int, int, string, TextIF) dlg; _text.onTextInsertListeners ) 623 { 624 dlg(arg1, arg2, Str.toString(arg3), _text); 625 } 626 } 627 628 void delegate(int, int, string, TextIF)[] _onTextRemoveListeners; 629 @property void delegate(int, int, string, TextIF)[] onTextRemoveListeners() 630 { 631 return _onTextRemoveListeners; 632 } 633 /** 634 * The "text-remove" signal is emitted when a new text is 635 * removed. If the signal was not triggered by the user 636 * (e.g. typing or pasting text), the "system" detail should be 637 * included. 638 * 639 * Params: 640 * arg1 = The position (character offset) of the removal. 641 * arg2 = The length (in characters) of text removed. 642 * arg3 = The old text removed 643 */ 644 void addOnTextRemove(void delegate(int, int, string, TextIF) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 645 { 646 if ( "text-remove" !in connectedSignals ) 647 { 648 Signals.connectData( 649 this, 650 "text-remove", 651 cast(GCallback)&callBackTextRemove, 652 cast(void*)cast(TextIF)this, 653 null, 654 connectFlags); 655 connectedSignals["text-remove"] = 1; 656 } 657 _onTextRemoveListeners ~= dlg; 658 } 659 extern(C) static void callBackTextRemove(AtkText* textStruct, int arg1, int arg2, char* arg3, TextIF _text) 660 { 661 foreach ( void delegate(int, int, string, TextIF) dlg; _text.onTextRemoveListeners ) 662 { 663 dlg(arg1, arg2, Str.toString(arg3), _text); 664 } 665 } 666 667 void delegate(TextIF)[] _onTextSelectionChangedListeners; 668 @property void delegate(TextIF)[] onTextSelectionChangedListeners() 669 { 670 return _onTextSelectionChangedListeners; 671 } 672 /** 673 * The "text-selection-changed" signal is emitted when the 674 * selected text of an object which implements AtkText changes. 675 */ 676 void addOnTextSelectionChanged(void delegate(TextIF) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 677 { 678 if ( "text-selection-changed" !in connectedSignals ) 679 { 680 Signals.connectData( 681 this, 682 "text-selection-changed", 683 cast(GCallback)&callBackTextSelectionChanged, 684 cast(void*)cast(TextIF)this, 685 null, 686 connectFlags); 687 connectedSignals["text-selection-changed"] = 1; 688 } 689 _onTextSelectionChangedListeners ~= dlg; 690 } 691 extern(C) static void callBackTextSelectionChanged(AtkText* textStruct, TextIF _text) 692 { 693 foreach ( void delegate(TextIF) dlg; _text.onTextSelectionChangedListeners ) 694 { 695 dlg(_text); 696 } 697 } 698 699 /** 700 * Frees the memory used by an #AtkAttributeSet, including all its 701 * #AtkAttributes. 702 * 703 * Params: 704 * attribSet = The #AtkAttributeSet to free 705 */ 706 public static void attributeSetFree(AtkAttributeSet* attribSet) 707 { 708 atk_attribute_set_free(attribSet); 709 } 710 711 /** 712 * Get the #AtkTextAttribute type corresponding to a text attribute name. 713 * 714 * Params: 715 * name = a string which is the (non-localized) name of an ATK text attribute. 716 * 717 * Return: the #AtkTextAttribute enumerated type corresponding to the specified 718 * name, 719 * or #ATK_TEXT_ATTRIBUTE_INVALID if no matching text attribute is found. 720 */ 721 public static AtkTextAttribute attributeForName(string name) 722 { 723 return atk_text_attribute_for_name(Str.toStringz(name)); 724 } 725 726 /** 727 * Gets the name corresponding to the #AtkTextAttribute 728 * 729 * Params: 730 * attr = The #AtkTextAttribute whose name is required 731 * 732 * Return: a string containing the name; this string should not be freed 733 */ 734 public static string attributeGetName(AtkTextAttribute attr) 735 { 736 return Str.toString(atk_text_attribute_get_name(attr)); 737 } 738 739 /** 740 * Gets the value for the index of the #AtkTextAttribute 741 * 742 * Params: 743 * attr = The #AtkTextAttribute for which a value is required 744 * index = The index of the required value 745 * 746 * Return: a string containing the value; this string 747 * should not be freed; %NULL is returned if there are no values 748 * maintained for the attr value. 749 */ 750 public static string attributeGetValue(AtkTextAttribute attr, int index) 751 { 752 return Str.toString(atk_text_attribute_get_value(attr, index)); 753 } 754 755 /** 756 * Associate @name with a new #AtkTextAttribute 757 * 758 * Params: 759 * name = a name string 760 * 761 * Return: an #AtkTextAttribute associated with @name 762 */ 763 public static AtkTextAttribute attributeRegister(string name) 764 { 765 return atk_text_attribute_register(Str.toStringz(name)); 766 } 767 }