1 /** 2 Label that displays rich text. 3 4 Copyright: 5 Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. 6 Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) 7 Copyright (c) 2017-2018 Godot-D contributors 8 9 License: $(LINK2 https://opensource.org/licenses/MIT, MIT License) 10 11 12 */ 13 module godot.richtextlabel; 14 import std.meta : AliasSeq, staticIndexOf; 15 import std.traits : Unqual; 16 import godot.d.traits; 17 import godot.core; 18 import godot.c; 19 import godot.d.bind; 20 import godot.d.reference; 21 import godot.globalenums; 22 import godot.object; 23 import godot.classdb; 24 import godot.control; 25 import godot.canvasitem; 26 import godot.node; 27 import godot.inputevent; 28 import godot.texture; 29 import godot.vscrollbar; 30 import godot.font; 31 /** 32 Label that displays rich text. 33 34 Rich text can contain custom text, fonts, images and some basic formatting. The label manages these as an internal tag stack. It also adapts itself to given width/heights. 35 $(B Note:) Assignments to $(D bbcodeText) clear the tag stack and reconstruct it from the property's contents. Any edits made to $(D bbcodeText) will erase previous edits made from other manual sources such as $(D appendBbcode) and the `push_*` / $(D pop) methods. 36 $(B Note:) RichTextLabel doesn't support entangled BBCode tags. For example, instead of using `$(B bold$(D i)bold italic)italic$(D /i)`, use `$(B bold$(D i)bold italic$(D /i))$(I italic)`. 37 $(B Note:) Unlike $(D Label), RichTextLabel doesn't have a $(I property) to horizontally align text to the center. Instead, enable $(D bbcodeEnabled) and surround the text in a `$(D center)` tag as follows: `$(D center)Example$(D /center)`. There is currently no built-in way to vertically align text either, but this can be emulated by relying on anchors/containers and the $(D fitContentHeight) property. 38 */ 39 @GodotBaseClass struct RichTextLabel 40 { 41 package(godot) enum string _GODOT_internal_name = "RichTextLabel"; 42 public: 43 @nogc nothrow: 44 union { /** */ godot_object _godot_object; /** */ Control _GODOT_base; } 45 alias _GODOT_base this; 46 alias BaseClasses = AliasSeq!(typeof(_GODOT_base), typeof(_GODOT_base).BaseClasses); 47 package(godot) __gshared bool _classBindingInitialized = false; 48 package(godot) static struct GDNativeClassBinding 49 { 50 __gshared: 51 @GodotName("_gui_input") GodotMethod!(void, InputEvent) _guiInput; 52 @GodotName("_scroll_changed") GodotMethod!(void, double) _scrollChanged; 53 @GodotName("add_image") GodotMethod!(void, Texture, long, long) addImage; 54 @GodotName("add_text") GodotMethod!(void, String) addText; 55 @GodotName("append_bbcode") GodotMethod!(GodotError, String) appendBbcode; 56 @GodotName("clear") GodotMethod!(void) clear; 57 @GodotName("get_bbcode") GodotMethod!(String) getBbcode; 58 @GodotName("get_content_height") GodotMethod!(long) getContentHeight; 59 @GodotName("get_effects") GodotMethod!(Array) getEffects; 60 @GodotName("get_line_count") GodotMethod!(long) getLineCount; 61 @GodotName("get_percent_visible") GodotMethod!(double) getPercentVisible; 62 @GodotName("get_tab_size") GodotMethod!(long) getTabSize; 63 @GodotName("get_text") GodotMethod!(String) getText; 64 @GodotName("get_total_character_count") GodotMethod!(long) getTotalCharacterCount; 65 @GodotName("get_v_scroll") GodotMethod!(VScrollBar) getVScroll; 66 @GodotName("get_visible_characters") GodotMethod!(long) getVisibleCharacters; 67 @GodotName("get_visible_line_count") GodotMethod!(long) getVisibleLineCount; 68 @GodotName("install_effect") GodotMethod!(void, Variant) installEffect; 69 @GodotName("is_fit_content_height_enabled") GodotMethod!(bool) isFitContentHeightEnabled; 70 @GodotName("is_meta_underlined") GodotMethod!(bool) isMetaUnderlined; 71 @GodotName("is_overriding_selected_font_color") GodotMethod!(bool) isOverridingSelectedFontColor; 72 @GodotName("is_scroll_active") GodotMethod!(bool) isScrollActive; 73 @GodotName("is_scroll_following") GodotMethod!(bool) isScrollFollowing; 74 @GodotName("is_selection_enabled") GodotMethod!(bool) isSelectionEnabled; 75 @GodotName("is_using_bbcode") GodotMethod!(bool) isUsingBbcode; 76 @GodotName("newline") GodotMethod!(void) newline; 77 @GodotName("parse_bbcode") GodotMethod!(GodotError, String) parseBbcode; 78 @GodotName("parse_expressions_for_values") GodotMethod!(Dictionary, PoolStringArray) parseExpressionsForValues; 79 @GodotName("pop") GodotMethod!(void) pop; 80 @GodotName("push_align") GodotMethod!(void, long) pushAlign; 81 @GodotName("push_bold") GodotMethod!(void) pushBold; 82 @GodotName("push_bold_italics") GodotMethod!(void) pushBoldItalics; 83 @GodotName("push_cell") GodotMethod!(void) pushCell; 84 @GodotName("push_color") GodotMethod!(void, Color) pushColor; 85 @GodotName("push_font") GodotMethod!(void, Font) pushFont; 86 @GodotName("push_indent") GodotMethod!(void, long) pushIndent; 87 @GodotName("push_italics") GodotMethod!(void) pushItalics; 88 @GodotName("push_list") GodotMethod!(void, long) pushList; 89 @GodotName("push_meta") GodotMethod!(void, Variant) pushMeta; 90 @GodotName("push_mono") GodotMethod!(void) pushMono; 91 @GodotName("push_normal") GodotMethod!(void) pushNormal; 92 @GodotName("push_strikethrough") GodotMethod!(void) pushStrikethrough; 93 @GodotName("push_table") GodotMethod!(void, long) pushTable; 94 @GodotName("push_underline") GodotMethod!(void) pushUnderline; 95 @GodotName("remove_line") GodotMethod!(bool, long) removeLine; 96 @GodotName("scroll_to_line") GodotMethod!(void, long) scrollToLine; 97 @GodotName("set_bbcode") GodotMethod!(void, String) setBbcode; 98 @GodotName("set_effects") GodotMethod!(void, Array) setEffects; 99 @GodotName("set_fit_content_height") GodotMethod!(void, bool) setFitContentHeight; 100 @GodotName("set_meta_underline") GodotMethod!(void, bool) setMetaUnderline; 101 @GodotName("set_override_selected_font_color") GodotMethod!(void, bool) setOverrideSelectedFontColor; 102 @GodotName("set_percent_visible") GodotMethod!(void, double) setPercentVisible; 103 @GodotName("set_scroll_active") GodotMethod!(void, bool) setScrollActive; 104 @GodotName("set_scroll_follow") GodotMethod!(void, bool) setScrollFollow; 105 @GodotName("set_selection_enabled") GodotMethod!(void, bool) setSelectionEnabled; 106 @GodotName("set_tab_size") GodotMethod!(void, long) setTabSize; 107 @GodotName("set_table_column_expand") GodotMethod!(void, long, bool, long) setTableColumnExpand; 108 @GodotName("set_text") GodotMethod!(void, String) setText; 109 @GodotName("set_use_bbcode") GodotMethod!(void, bool) setUseBbcode; 110 @GodotName("set_visible_characters") GodotMethod!(void, long) setVisibleCharacters; 111 } 112 /// 113 pragma(inline, true) bool opEquals(in RichTextLabel other) const 114 { return _godot_object.ptr is other._godot_object.ptr; } 115 /// 116 pragma(inline, true) typeof(null) opAssign(typeof(null) n) 117 { _godot_object.ptr = n; return null; } 118 /// 119 pragma(inline, true) bool opEquals(typeof(null) n) const 120 { return _godot_object.ptr is n; } 121 /// 122 size_t toHash() const @trusted { return cast(size_t)_godot_object.ptr; } 123 mixin baseCasts; 124 /// Construct a new instance of RichTextLabel. 125 /// Note: use `memnew!RichTextLabel` instead. 126 static RichTextLabel _new() 127 { 128 static godot_class_constructor constructor; 129 if(constructor is null) constructor = _godot_api.godot_get_class_constructor("RichTextLabel"); 130 if(constructor is null) return typeof(this).init; 131 return cast(RichTextLabel)(constructor()); 132 } 133 @disable new(size_t s); 134 /// 135 enum Align : int 136 { 137 /** 138 Makes text left aligned. 139 */ 140 alignLeft = 0, 141 /** 142 Makes text centered. 143 */ 144 alignCenter = 1, 145 /** 146 Makes text right aligned. 147 */ 148 alignRight = 2, 149 /** 150 Makes text fill width. 151 */ 152 alignFill = 3, 153 } 154 /// 155 enum ListType : int 156 { 157 /** 158 Each list item has a number marker. 159 */ 160 listNumbers = 0, 161 /** 162 Each list item has a letter marker. 163 */ 164 listLetters = 1, 165 /** 166 Each list item has a filled circle marker. 167 */ 168 listDots = 2, 169 } 170 /// 171 enum ItemType : int 172 { 173 /** 174 175 */ 176 itemFrame = 0, 177 /** 178 179 */ 180 itemText = 1, 181 /** 182 183 */ 184 itemImage = 2, 185 /** 186 187 */ 188 itemNewline = 3, 189 /** 190 191 */ 192 itemFont = 4, 193 /** 194 195 */ 196 itemColor = 5, 197 /** 198 199 */ 200 itemUnderline = 6, 201 /** 202 203 */ 204 itemStrikethrough = 7, 205 /** 206 207 */ 208 itemAlign = 8, 209 /** 210 211 */ 212 itemIndent = 9, 213 /** 214 215 */ 216 itemList = 10, 217 /** 218 219 */ 220 itemTable = 11, 221 /** 222 223 */ 224 itemFade = 12, 225 /** 226 227 */ 228 itemShake = 13, 229 /** 230 231 */ 232 itemWave = 14, 233 /** 234 235 */ 236 itemTornado = 15, 237 /** 238 239 */ 240 itemRainbow = 16, 241 /** 242 243 */ 244 itemMeta = 17, 245 /** 246 247 */ 248 itemCustomfx = 18, 249 } 250 /// 251 enum Constants : int 252 { 253 listNumbers = 0, 254 itemFrame = 0, 255 alignLeft = 0, 256 listLetters = 1, 257 alignCenter = 1, 258 itemText = 1, 259 listDots = 2, 260 itemImage = 2, 261 alignRight = 2, 262 alignFill = 3, 263 itemNewline = 3, 264 itemFont = 4, 265 itemColor = 5, 266 itemUnderline = 6, 267 itemStrikethrough = 7, 268 itemAlign = 8, 269 itemIndent = 9, 270 itemList = 10, 271 itemTable = 11, 272 itemFade = 12, 273 itemShake = 13, 274 itemWave = 14, 275 itemTornado = 15, 276 itemRainbow = 16, 277 itemMeta = 17, 278 itemCustomfx = 18, 279 } 280 /** 281 282 */ 283 void _guiInput(InputEvent arg0) 284 { 285 Array _GODOT_args = Array.make(); 286 _GODOT_args.append(arg0); 287 String _GODOT_method_name = String("_gui_input"); 288 this.callv(_GODOT_method_name, _GODOT_args); 289 } 290 /** 291 292 */ 293 void _scrollChanged(in double arg0) 294 { 295 Array _GODOT_args = Array.make(); 296 _GODOT_args.append(arg0); 297 String _GODOT_method_name = String("_scroll_changed"); 298 this.callv(_GODOT_method_name, _GODOT_args); 299 } 300 /** 301 Adds an image's opening and closing tags to the tag stack, optionally providing a `width` and `height` to resize the image. 302 If `width` or `height` is set to 0, the image size will be adjusted in order to keep the original aspect ratio. 303 */ 304 void addImage(Texture image, in long width = 0, in long height = 0) 305 { 306 checkClassBinding!(typeof(this))(); 307 ptrcall!(void)(GDNativeClassBinding.addImage, _godot_object, image, width, height); 308 } 309 /** 310 Adds raw non-BBCode-parsed text to the tag stack. 311 */ 312 void addText(in String text) 313 { 314 checkClassBinding!(typeof(this))(); 315 ptrcall!(void)(GDNativeClassBinding.addText, _godot_object, text); 316 } 317 /** 318 Parses `bbcode` and adds tags to the tag stack as needed. Returns the result of the parsing, $(D constant OK) if successful. 319 $(B Note:) Using this method, you can't close a tag that was opened in a previous $(D appendBbcode) call. This is done to improve performance, especially when updating large RichTextLabels since rebuilding the whole BBCode every time would be slower. If you absolutely need to close a tag in a future method call, append the $(D bbcodeText) instead of using $(D appendBbcode). 320 */ 321 GodotError appendBbcode(in String bbcode) 322 { 323 checkClassBinding!(typeof(this))(); 324 return ptrcall!(GodotError)(GDNativeClassBinding.appendBbcode, _godot_object, bbcode); 325 } 326 /** 327 Clears the tag stack and sets $(D bbcodeText) to an empty string. 328 */ 329 void clear() 330 { 331 checkClassBinding!(typeof(this))(); 332 ptrcall!(void)(GDNativeClassBinding.clear, _godot_object); 333 } 334 /** 335 336 */ 337 String getBbcode() const 338 { 339 checkClassBinding!(typeof(this))(); 340 return ptrcall!(String)(GDNativeClassBinding.getBbcode, _godot_object); 341 } 342 /** 343 Returns the height of the content. 344 */ 345 long getContentHeight() const 346 { 347 checkClassBinding!(typeof(this))(); 348 return ptrcall!(long)(GDNativeClassBinding.getContentHeight, _godot_object); 349 } 350 /** 351 352 */ 353 Array getEffects() 354 { 355 checkClassBinding!(typeof(this))(); 356 return ptrcall!(Array)(GDNativeClassBinding.getEffects, _godot_object); 357 } 358 /** 359 Returns the total number of newlines in the tag stack's text tags. Considers wrapped text as one line. 360 */ 361 long getLineCount() const 362 { 363 checkClassBinding!(typeof(this))(); 364 return ptrcall!(long)(GDNativeClassBinding.getLineCount, _godot_object); 365 } 366 /** 367 368 */ 369 double getPercentVisible() const 370 { 371 checkClassBinding!(typeof(this))(); 372 return ptrcall!(double)(GDNativeClassBinding.getPercentVisible, _godot_object); 373 } 374 /** 375 376 */ 377 long getTabSize() const 378 { 379 checkClassBinding!(typeof(this))(); 380 return ptrcall!(long)(GDNativeClassBinding.getTabSize, _godot_object); 381 } 382 /** 383 384 */ 385 String getText() 386 { 387 checkClassBinding!(typeof(this))(); 388 return ptrcall!(String)(GDNativeClassBinding.getText, _godot_object); 389 } 390 /** 391 Returns the total number of characters from text tags. Does not include BBCodes. 392 */ 393 long getTotalCharacterCount() const 394 { 395 checkClassBinding!(typeof(this))(); 396 return ptrcall!(long)(GDNativeClassBinding.getTotalCharacterCount, _godot_object); 397 } 398 /** 399 Returns the vertical scrollbar. 400 */ 401 VScrollBar getVScroll() 402 { 403 checkClassBinding!(typeof(this))(); 404 return ptrcall!(VScrollBar)(GDNativeClassBinding.getVScroll, _godot_object); 405 } 406 /** 407 408 */ 409 long getVisibleCharacters() const 410 { 411 checkClassBinding!(typeof(this))(); 412 return ptrcall!(long)(GDNativeClassBinding.getVisibleCharacters, _godot_object); 413 } 414 /** 415 Returns the number of visible lines. 416 */ 417 long getVisibleLineCount() const 418 { 419 checkClassBinding!(typeof(this))(); 420 return ptrcall!(long)(GDNativeClassBinding.getVisibleLineCount, _godot_object); 421 } 422 /** 423 Installs a custom effect. `effect` should be a valid $(D RichTextEffect). 424 */ 425 void installEffect(VariantArg0)(in VariantArg0 effect) 426 { 427 checkClassBinding!(typeof(this))(); 428 ptrcall!(void)(GDNativeClassBinding.installEffect, _godot_object, effect); 429 } 430 /** 431 432 */ 433 bool isFitContentHeightEnabled() const 434 { 435 checkClassBinding!(typeof(this))(); 436 return ptrcall!(bool)(GDNativeClassBinding.isFitContentHeightEnabled, _godot_object); 437 } 438 /** 439 440 */ 441 bool isMetaUnderlined() const 442 { 443 checkClassBinding!(typeof(this))(); 444 return ptrcall!(bool)(GDNativeClassBinding.isMetaUnderlined, _godot_object); 445 } 446 /** 447 448 */ 449 bool isOverridingSelectedFontColor() const 450 { 451 checkClassBinding!(typeof(this))(); 452 return ptrcall!(bool)(GDNativeClassBinding.isOverridingSelectedFontColor, _godot_object); 453 } 454 /** 455 456 */ 457 bool isScrollActive() const 458 { 459 checkClassBinding!(typeof(this))(); 460 return ptrcall!(bool)(GDNativeClassBinding.isScrollActive, _godot_object); 461 } 462 /** 463 464 */ 465 bool isScrollFollowing() const 466 { 467 checkClassBinding!(typeof(this))(); 468 return ptrcall!(bool)(GDNativeClassBinding.isScrollFollowing, _godot_object); 469 } 470 /** 471 472 */ 473 bool isSelectionEnabled() const 474 { 475 checkClassBinding!(typeof(this))(); 476 return ptrcall!(bool)(GDNativeClassBinding.isSelectionEnabled, _godot_object); 477 } 478 /** 479 480 */ 481 bool isUsingBbcode() const 482 { 483 checkClassBinding!(typeof(this))(); 484 return ptrcall!(bool)(GDNativeClassBinding.isUsingBbcode, _godot_object); 485 } 486 /** 487 Adds a newline tag to the tag stack. 488 */ 489 void newline() 490 { 491 checkClassBinding!(typeof(this))(); 492 ptrcall!(void)(GDNativeClassBinding.newline, _godot_object); 493 } 494 /** 495 The assignment version of $(D appendBbcode). Clears the tag stack and inserts the new content. Returns $(D constant OK) if parses `bbcode` successfully. 496 */ 497 GodotError parseBbcode(in String bbcode) 498 { 499 checkClassBinding!(typeof(this))(); 500 return ptrcall!(GodotError)(GDNativeClassBinding.parseBbcode, _godot_object, bbcode); 501 } 502 /** 503 Parses BBCode parameter `expressions` into a dictionary. 504 */ 505 Dictionary parseExpressionsForValues(in PoolStringArray expressions) 506 { 507 checkClassBinding!(typeof(this))(); 508 return ptrcall!(Dictionary)(GDNativeClassBinding.parseExpressionsForValues, _godot_object, expressions); 509 } 510 /** 511 Terminates the current tag. Use after `push_*` methods to close BBCodes manually. Does not need to follow `add_*` methods. 512 */ 513 void pop() 514 { 515 checkClassBinding!(typeof(this))(); 516 ptrcall!(void)(GDNativeClassBinding.pop, _godot_object); 517 } 518 /** 519 Adds an `$(D align)` tag based on the given `align` value. See $(D _align) for possible values. 520 */ 521 void pushAlign(in long _align) 522 { 523 checkClassBinding!(typeof(this))(); 524 ptrcall!(void)(GDNativeClassBinding.pushAlign, _godot_object, _align); 525 } 526 /** 527 Adds a `$(D font)` tag with a bold font to the tag stack. This is the same as adding a `$(D b)` tag if not currently in a `$(D i)` tag. 528 */ 529 void pushBold() 530 { 531 checkClassBinding!(typeof(this))(); 532 ptrcall!(void)(GDNativeClassBinding.pushBold, _godot_object); 533 } 534 /** 535 Adds a `$(D font)` tag with a bold italics font to the tag stack. 536 */ 537 void pushBoldItalics() 538 { 539 checkClassBinding!(typeof(this))(); 540 ptrcall!(void)(GDNativeClassBinding.pushBoldItalics, _godot_object); 541 } 542 /** 543 Adds a `$(D cell)` tag to the tag stack. Must be inside a `$(D table)` tag. See $(D pushTable) for details. 544 */ 545 void pushCell() 546 { 547 checkClassBinding!(typeof(this))(); 548 ptrcall!(void)(GDNativeClassBinding.pushCell, _godot_object); 549 } 550 /** 551 Adds a `$(D color)` tag to the tag stack. 552 */ 553 void pushColor(in Color color) 554 { 555 checkClassBinding!(typeof(this))(); 556 ptrcall!(void)(GDNativeClassBinding.pushColor, _godot_object, color); 557 } 558 /** 559 Adds a `$(D font)` tag to the tag stack. Overrides default fonts for its duration. 560 */ 561 void pushFont(Font font) 562 { 563 checkClassBinding!(typeof(this))(); 564 ptrcall!(void)(GDNativeClassBinding.pushFont, _godot_object, font); 565 } 566 /** 567 Adds an `$(D indent)` tag to the tag stack. Multiplies `level` by current $(D tabSize) to determine new margin length. 568 */ 569 void pushIndent(in long level) 570 { 571 checkClassBinding!(typeof(this))(); 572 ptrcall!(void)(GDNativeClassBinding.pushIndent, _godot_object, level); 573 } 574 /** 575 Adds a `$(D font)` tag with a italics font to the tag stack. This is the same as adding a `$(D i)` tag if not currently in a `$(D b)` tag. 576 */ 577 void pushItalics() 578 { 579 checkClassBinding!(typeof(this))(); 580 ptrcall!(void)(GDNativeClassBinding.pushItalics, _godot_object); 581 } 582 /** 583 Adds a `$(D list)` tag to the tag stack. Similar to the BBCodes `$(D ol)` or `$(D ul)`, but supports more list types. Not fully implemented! 584 */ 585 void pushList(in long type) 586 { 587 checkClassBinding!(typeof(this))(); 588 ptrcall!(void)(GDNativeClassBinding.pushList, _godot_object, type); 589 } 590 /** 591 Adds a `$(D meta)` tag to the tag stack. Similar to the BBCode `$(D url=something){text}$(D /url)`, but supports non-$(D String) metadata types. 592 */ 593 void pushMeta(VariantArg0)(in VariantArg0 data) 594 { 595 checkClassBinding!(typeof(this))(); 596 ptrcall!(void)(GDNativeClassBinding.pushMeta, _godot_object, data); 597 } 598 /** 599 Adds a `$(D font)` tag with a monospace font to the tag stack. 600 */ 601 void pushMono() 602 { 603 checkClassBinding!(typeof(this))(); 604 ptrcall!(void)(GDNativeClassBinding.pushMono, _godot_object); 605 } 606 /** 607 Adds a `$(D font)` tag with a normal font to the tag stack. 608 */ 609 void pushNormal() 610 { 611 checkClassBinding!(typeof(this))(); 612 ptrcall!(void)(GDNativeClassBinding.pushNormal, _godot_object); 613 } 614 /** 615 Adds a `$(D s)` tag to the tag stack. 616 */ 617 void pushStrikethrough() 618 { 619 checkClassBinding!(typeof(this))(); 620 ptrcall!(void)(GDNativeClassBinding.pushStrikethrough, _godot_object); 621 } 622 /** 623 Adds a `$(D table=columns)` tag to the tag stack. 624 */ 625 void pushTable(in long columns) 626 { 627 checkClassBinding!(typeof(this))(); 628 ptrcall!(void)(GDNativeClassBinding.pushTable, _godot_object, columns); 629 } 630 /** 631 Adds a `$(D u)` tag to the tag stack. 632 */ 633 void pushUnderline() 634 { 635 checkClassBinding!(typeof(this))(); 636 ptrcall!(void)(GDNativeClassBinding.pushUnderline, _godot_object); 637 } 638 /** 639 Removes a line of content from the label. Returns `true` if the line exists. 640 The `line` argument is the index of the line to remove, it can take values in the interval `$(D 0, get_line_count() - 1)`. 641 */ 642 bool removeLine(in long line) 643 { 644 checkClassBinding!(typeof(this))(); 645 return ptrcall!(bool)(GDNativeClassBinding.removeLine, _godot_object, line); 646 } 647 /** 648 Scrolls the window's top line to match `line`. 649 */ 650 void scrollToLine(in long line) 651 { 652 checkClassBinding!(typeof(this))(); 653 ptrcall!(void)(GDNativeClassBinding.scrollToLine, _godot_object, line); 654 } 655 /** 656 657 */ 658 void setBbcode(in String text) 659 { 660 checkClassBinding!(typeof(this))(); 661 ptrcall!(void)(GDNativeClassBinding.setBbcode, _godot_object, text); 662 } 663 /** 664 665 */ 666 void setEffects(in Array effects) 667 { 668 checkClassBinding!(typeof(this))(); 669 ptrcall!(void)(GDNativeClassBinding.setEffects, _godot_object, effects); 670 } 671 /** 672 673 */ 674 void setFitContentHeight(in bool enabled) 675 { 676 checkClassBinding!(typeof(this))(); 677 ptrcall!(void)(GDNativeClassBinding.setFitContentHeight, _godot_object, enabled); 678 } 679 /** 680 681 */ 682 void setMetaUnderline(in bool enable) 683 { 684 checkClassBinding!(typeof(this))(); 685 ptrcall!(void)(GDNativeClassBinding.setMetaUnderline, _godot_object, enable); 686 } 687 /** 688 689 */ 690 void setOverrideSelectedFontColor(in bool _override) 691 { 692 checkClassBinding!(typeof(this))(); 693 ptrcall!(void)(GDNativeClassBinding.setOverrideSelectedFontColor, _godot_object, _override); 694 } 695 /** 696 697 */ 698 void setPercentVisible(in double percent_visible) 699 { 700 checkClassBinding!(typeof(this))(); 701 ptrcall!(void)(GDNativeClassBinding.setPercentVisible, _godot_object, percent_visible); 702 } 703 /** 704 705 */ 706 void setScrollActive(in bool active) 707 { 708 checkClassBinding!(typeof(this))(); 709 ptrcall!(void)(GDNativeClassBinding.setScrollActive, _godot_object, active); 710 } 711 /** 712 713 */ 714 void setScrollFollow(in bool follow) 715 { 716 checkClassBinding!(typeof(this))(); 717 ptrcall!(void)(GDNativeClassBinding.setScrollFollow, _godot_object, follow); 718 } 719 /** 720 721 */ 722 void setSelectionEnabled(in bool enabled) 723 { 724 checkClassBinding!(typeof(this))(); 725 ptrcall!(void)(GDNativeClassBinding.setSelectionEnabled, _godot_object, enabled); 726 } 727 /** 728 729 */ 730 void setTabSize(in long spaces) 731 { 732 checkClassBinding!(typeof(this))(); 733 ptrcall!(void)(GDNativeClassBinding.setTabSize, _godot_object, spaces); 734 } 735 /** 736 Edits the selected column's expansion options. If `expand` is `true`, the column expands in proportion to its expansion ratio versus the other columns' ratios. 737 For example, 2 columns with ratios 3 and 4 plus 70 pixels in available width would expand 30 and 40 pixels, respectively. 738 If `expand` is `false`, the column will not contribute to the total ratio. 739 */ 740 void setTableColumnExpand(in long column, in bool expand, in long ratio) 741 { 742 checkClassBinding!(typeof(this))(); 743 ptrcall!(void)(GDNativeClassBinding.setTableColumnExpand, _godot_object, column, expand, ratio); 744 } 745 /** 746 747 */ 748 void setText(in String text) 749 { 750 checkClassBinding!(typeof(this))(); 751 ptrcall!(void)(GDNativeClassBinding.setText, _godot_object, text); 752 } 753 /** 754 755 */ 756 void setUseBbcode(in bool enable) 757 { 758 checkClassBinding!(typeof(this))(); 759 ptrcall!(void)(GDNativeClassBinding.setUseBbcode, _godot_object, enable); 760 } 761 /** 762 763 */ 764 void setVisibleCharacters(in long amount) 765 { 766 checkClassBinding!(typeof(this))(); 767 ptrcall!(void)(GDNativeClassBinding.setVisibleCharacters, _godot_object, amount); 768 } 769 /** 770 If `true`, the label uses BBCode formatting. 771 $(B Note:) Trying to alter the $(D RichTextLabel)'s text with $(D addText) will reset this to `false`. Use instead $(D appendBbcode) to preserve BBCode formatting. 772 */ 773 @property bool bbcodeEnabled() 774 { 775 return isUsingBbcode(); 776 } 777 /// ditto 778 @property void bbcodeEnabled(bool v) 779 { 780 setUseBbcode(v); 781 } 782 /** 783 The label's text in BBCode format. Is not representative of manual modifications to the internal tag stack. Erases changes made by other methods when edited. 784 $(B Note:) It is unadvised to use the `+=` operator with `bbcode_text` (e.g. `bbcode_text += "some string"`) as it replaces the whole text and can cause slowdowns. Use $(D appendBbcode) for adding text instead, unless you absolutely need to close a tag that was opened in an earlier method call. 785 */ 786 @property String bbcodeText() 787 { 788 return getBbcode(); 789 } 790 /// ditto 791 @property void bbcodeText(String v) 792 { 793 setBbcode(v); 794 } 795 /** 796 The currently installed custom effects. This is an array of $(D RichTextEffect)s. 797 To add a custom effect, it's more convenient to use $(D installEffect). 798 */ 799 @property Array customEffects() 800 { 801 return getEffects(); 802 } 803 /// ditto 804 @property void customEffects(Array v) 805 { 806 setEffects(v); 807 } 808 /** 809 If `true`, the label's height will be automatically updated to fit its content. 810 $(B Note:) This property is used as a workaround to fix issues with $(D RichTextLabel) in $(D Container)s, but it's unreliable in some cases and will be removed in future versions. 811 */ 812 @property bool fitContentHeight() 813 { 814 return isFitContentHeightEnabled(); 815 } 816 /// ditto 817 @property void fitContentHeight(bool v) 818 { 819 setFitContentHeight(v); 820 } 821 /** 822 If `true`, the label underlines meta tags such as `$(D url){text}$(D /url)`. 823 */ 824 @property bool metaUnderlined() 825 { 826 return isMetaUnderlined(); 827 } 828 /// ditto 829 @property void metaUnderlined(bool v) 830 { 831 setMetaUnderline(v); 832 } 833 /** 834 If `true`, the label uses the custom font color. 835 */ 836 @property bool overrideSelectedFontColor() 837 { 838 return isOverridingSelectedFontColor(); 839 } 840 /// ditto 841 @property void overrideSelectedFontColor(bool v) 842 { 843 setOverrideSelectedFontColor(v); 844 } 845 /** 846 The range of characters to display, as a $(D double) between 0.0 and 1.0. When assigned an out of range value, it's the same as assigning 1.0. 847 $(B Note:) Setting this property updates $(D visibleCharacters) based on current $(D getTotalCharacterCount). 848 */ 849 @property double percentVisible() 850 { 851 return getPercentVisible(); 852 } 853 /// ditto 854 @property void percentVisible(double v) 855 { 856 setPercentVisible(v); 857 } 858 /** 859 If `true`, the scrollbar is visible. Setting this to `false` does not block scrolling completely. See $(D scrollToLine). 860 */ 861 @property bool scrollActive() 862 { 863 return isScrollActive(); 864 } 865 /// ditto 866 @property void scrollActive(bool v) 867 { 868 setScrollActive(v); 869 } 870 /** 871 If `true`, the window scrolls down to display new content automatically. 872 */ 873 @property bool scrollFollowing() 874 { 875 return isScrollFollowing(); 876 } 877 /// ditto 878 @property void scrollFollowing(bool v) 879 { 880 setScrollFollow(v); 881 } 882 /** 883 If `true`, the label allows text selection. 884 */ 885 @property bool selectionEnabled() 886 { 887 return isSelectionEnabled(); 888 } 889 /// ditto 890 @property void selectionEnabled(bool v) 891 { 892 setSelectionEnabled(v); 893 } 894 /** 895 The number of spaces associated with a single tab length. Does not affect `\t` in text tags, only indent tags. 896 */ 897 @property long tabSize() 898 { 899 return getTabSize(); 900 } 901 /// ditto 902 @property void tabSize(long v) 903 { 904 setTabSize(v); 905 } 906 /** 907 The raw text of the label. 908 When set, clears the tag stack and adds a raw text tag to the top of it. Does not parse BBCodes. Does not modify $(D bbcodeText). 909 */ 910 @property String text() 911 { 912 return getText(); 913 } 914 /// ditto 915 @property void text(String v) 916 { 917 setText(v); 918 } 919 /** 920 The restricted number of characters to display in the label. If `-1`, all characters will be displayed. 921 $(B Note:) Setting this property updates $(D percentVisible) based on current $(D getTotalCharacterCount). 922 */ 923 @property long visibleCharacters() 924 { 925 return getVisibleCharacters(); 926 } 927 /// ditto 928 @property void visibleCharacters(long v) 929 { 930 setVisibleCharacters(v); 931 } 932 }