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