| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
|
| 29 |
|
| 30 |
|
| 31 |
#pragma once |
| 32 |
|
| 33 |
#include "core/object/worker_thread_pool.h" |
| 34 |
#include "core/templates/rid_owner.h" |
| 35 |
#include "scene/gui/popup_menu.h" |
| 36 |
#include "scene/gui/scroll_bar.h" |
| 37 |
#include "scene/resources/image_texture.h" |
| 38 |
#include "scene/resources/text_paragraph.h" |
| 39 |
|
| 40 |
#ifdef TOOLS_ENABLED |
| 41 |
#include "editor/themes/editor_scale.h" |
| 42 |
#endif |
| 43 |
|
| 44 |
class CharFXTransform; |
| 45 |
class RichTextEffect; |
| 46 |
|
| 47 |
class RichTextLabel : public Control { |
| 48 |
GDCLASS(RichTextLabel, Control); |
| 49 |
|
| 50 |
enum RTLDrawStep { |
| 51 |
DRAW_STEP_BACKGROUND, |
| 52 |
DRAW_STEP_SHADOW_OUTLINE, |
| 53 |
DRAW_STEP_SHADOW, |
| 54 |
DRAW_STEP_OUTLINE, |
| 55 |
DRAW_STEP_TEXT, |
| 56 |
DRAW_STEP_FOREGROUND, |
| 57 |
DRAW_STEP_MAX, |
| 58 |
}; |
| 59 |
|
| 60 |
public: |
| 61 |
enum ListType { |
| 62 |
LIST_NUMBERS, |
| 63 |
LIST_LETTERS, |
| 64 |
LIST_ROMAN, |
| 65 |
LIST_DOTS |
| 66 |
}; |
| 67 |
|
| 68 |
enum MetaUnderline { |
| 69 |
META_UNDERLINE_NEVER, |
| 70 |
META_UNDERLINE_ALWAYS, |
| 71 |
META_UNDERLINE_ON_HOVER, |
| 72 |
}; |
| 73 |
|
| 74 |
enum ItemType { |
| 75 |
ITEM_FRAME, |
| 76 |
ITEM_TEXT, |
| 77 |
ITEM_IMAGE, |
| 78 |
ITEM_NEWLINE, |
| 79 |
ITEM_FONT, |
| 80 |
ITEM_FONT_SIZE, |
| 81 |
ITEM_FONT_FEATURES, |
| 82 |
ITEM_COLOR, |
| 83 |
ITEM_OUTLINE_SIZE, |
| 84 |
ITEM_OUTLINE_COLOR, |
| 85 |
ITEM_UNDERLINE, |
| 86 |
ITEM_STRIKETHROUGH, |
| 87 |
ITEM_PARAGRAPH, |
| 88 |
ITEM_INDENT, |
| 89 |
ITEM_LIST, |
| 90 |
ITEM_TABLE, |
| 91 |
ITEM_FADE, |
| 92 |
ITEM_SHAKE, |
| 93 |
ITEM_WAVE, |
| 94 |
ITEM_TORNADO, |
| 95 |
ITEM_RAINBOW, |
| 96 |
ITEM_PULSE, |
| 97 |
ITEM_BGCOLOR, |
| 98 |
ITEM_FGCOLOR, |
| 99 |
ITEM_META, |
| 100 |
ITEM_HINT, |
| 101 |
ITEM_DROPCAP, |
| 102 |
ITEM_CUSTOMFX, |
| 103 |
ITEM_CONTEXT, |
| 104 |
ITEM_LANGUAGE, |
| 105 |
}; |
| 106 |
|
| 107 |
enum MenuItems { |
| 108 |
MENU_COPY, |
| 109 |
MENU_SELECT_ALL, |
| 110 |
MENU_MAX |
| 111 |
}; |
| 112 |
|
| 113 |
enum DefaultFont { |
| 114 |
RTL_NORMAL_FONT, |
| 115 |
RTL_BOLD_FONT, |
| 116 |
RTL_ITALICS_FONT, |
| 117 |
RTL_BOLD_ITALICS_FONT, |
| 118 |
RTL_MONO_FONT, |
| 119 |
RTL_CUSTOM_FONT, |
| 120 |
}; |
| 121 |
|
| 122 |
enum ImageUpdateMask { |
| 123 |
UPDATE_TEXTURE = 1 << 0, |
| 124 |
UPDATE_SIZE = 1 << 1, |
| 125 |
UPDATE_COLOR = 1 << 2, |
| 126 |
UPDATE_ALIGNMENT = 1 << 3, |
| 127 |
UPDATE_REGION = 1 << 4, |
| 128 |
UPDATE_PAD = 1 << 5, |
| 129 |
UPDATE_TOOLTIP = 1 << 6, |
| 130 |
UPDATE_WIDTH_IN_PERCENT = 1 << 7, |
| 131 |
}; |
| 132 |
|
| 133 |
protected: |
| 134 |
virtual void _update_theme_item_cache() override; |
| 135 |
|
| 136 |
void _notification(int p_what); |
| 137 |
static void _bind_methods(); |
| 138 |
|
| 139 |
#ifndef DISABLE_DEPRECATED |
| 140 |
void _push_font_bind_compat_79053(const Ref<Font> &p_font, int p_size); |
| 141 |
void _set_table_column_expand_bind_compat_79053(int p_column, bool p_expand, int p_ratio); |
| 142 |
void _push_meta_bind_compat_99481(const Variant &p_meta, MetaUnderline p_underline_mode); |
| 143 |
void _push_meta_bind_compat_89024(const Variant &p_meta); |
| 144 |
void _add_image_bind_compat_80410(const Ref<Texture2D> &p_image, const int p_width, const int p_height, const Color &p_color, InlineAlignment p_alignment, const Rect2 &p_region); |
| 145 |
void _add_image_bind_compat_76829(const Ref<Texture2D> &p_image, const int p_width, const int p_height, const Color &p_color, InlineAlignment p_alignment, const Rect2 &p_region, const Variant &p_key, bool p_pad, const String &p_tooltip, bool p_size_in_percent); |
| 146 |
void _push_table_bind_compat_76829(int p_columns, InlineAlignment p_alignment, int p_align_to_row); |
| 147 |
bool _remove_paragraph_bind_compat_91098(int p_paragraph); |
| 148 |
void _set_table_column_expand_bind_compat_101482(int p_column, bool p_expand, int p_ratio); |
| 149 |
void _push_underline_bind_compat_106300(); |
| 150 |
void _push_strikethrough_bind_compat_106300(); |
| 151 |
void _add_image_bind_compat_107347(const Ref<Texture2D> &p_image, int p_width = 0, int p_height = 0, const Color &p_color = Color(1.0, 1.0, 1.0), InlineAlignment p_alignment = INLINE_ALIGNMENT_CENTER, const Rect2 &p_region = Rect2(), const Variant &p_key = Variant(), bool p_pad = false, const String &p_tooltip = String(), bool p_size_in_percent = false, const String &p_alt_text = String()); |
| 152 |
void _update_image_bind_compat_107347(const Variant &p_key, BitField<ImageUpdateMask> p_mask, const Ref<Texture2D> &p_image, int p_width = 0, int p_height = 0, const Color &p_color = Color(1.0, 1.0, 1.0), InlineAlignment p_alignment = INLINE_ALIGNMENT_CENTER, const Rect2 &p_region = Rect2(), bool p_pad = false, const String &p_tooltip = String(), bool p_size_in_percent = false); |
| 153 |
|
| 154 |
static void _bind_compatibility_methods(); |
| 155 |
#endif |
| 156 |
|
| 157 |
private: |
| 158 |
struct Item; |
| 159 |
|
| 160 |
struct Line { |
| 161 |
Item *from = nullptr; |
| 162 |
|
| 163 |
Ref<TextLine> text_prefix; |
| 164 |
Color prefix_color = Color(0, 0, 0, 0); |
| 165 |
int prefix_outline_size = -1; |
| 166 |
Color prefix_outline_color = Color(0, 0, 0, 0); |
| 167 |
float prefix_width = 0; |
| 168 |
Ref<TextParagraph> text_buf; |
| 169 |
Ref<TextParagraph> text_buf_disp; |
| 170 |
|
| 171 |
RID accessibility_line_element; |
| 172 |
RID accessibility_text_element; |
| 173 |
|
| 174 |
Item *dc_item = nullptr; |
| 175 |
Color dc_color; |
| 176 |
int dc_ol_size = 0; |
| 177 |
Color dc_ol_color; |
| 178 |
|
| 179 |
Vector2 offset; |
| 180 |
float indent = 0.0; |
| 181 |
int char_offset = 0; |
| 182 |
int char_count = 0; |
| 183 |
|
| 184 |
Line() { |
| 185 |
text_buf.instantiate(); |
| 186 |
} |
| 187 |
~Line() { |
| 188 |
if (accessibility_line_element.is_valid()) { |
| 189 |
DisplayServer::get_singleton()->accessibility_free_element(accessibility_line_element); |
| 190 |
accessibility_line_element = RID(); |
| 191 |
accessibility_text_element = RID(); |
| 192 |
} |
| 193 |
} |
| 194 |
|
| 195 |
_FORCE_INLINE_ float get_height(float p_line_separation, float p_paragraph_separation) const { |
| 196 |
return offset.y + text_buf->get_size().y + text_buf->get_line_count() * p_line_separation + p_paragraph_separation; |
| 197 |
} |
| 198 |
}; |
| 199 |
|
| 200 |
struct Item { |
| 201 |
int index = 0; |
| 202 |
int char_ofs = 0; |
| 203 |
Item *parent = nullptr; |
| 204 |
ItemType type = ITEM_FRAME; |
| 205 |
List<Item *> subitems; |
| 206 |
List<Item *>::Element *E = nullptr; |
| 207 |
ObjectID owner; |
| 208 |
int line = 0; |
| 209 |
RID rid; |
| 210 |
|
| 211 |
RID accessibility_item_element; |
| 212 |
|
| 213 |
void _clear_children() { |
| 214 |
RichTextLabel *owner_rtl = ObjectDB::get_instance<RichTextLabel>(owner); |
| 215 |
while (subitems.size()) { |
| 216 |
Item *subitem = subitems.front()->get(); |
| 217 |
if (subitem && subitem->rid.is_valid() && owner_rtl) { |
| 218 |
owner_rtl->items.free(subitem->rid); |
| 219 |
} |
| 220 |
memdelete(subitem); |
| 221 |
subitems.pop_front(); |
| 222 |
} |
| 223 |
} |
| 224 |
|
| 225 |
virtual ~Item() { _clear_children(); } |
| 226 |
}; |
| 227 |
|
| 228 |
struct ItemFrame : public Item { |
| 229 |
bool cell = false; |
| 230 |
|
| 231 |
LocalVector<Line> lines; |
| 232 |
std::atomic<int> first_invalid_line; |
| 233 |
std::atomic<int> first_invalid_font_line; |
| 234 |
std::atomic<int> first_resized_line; |
| 235 |
|
| 236 |
ItemFrame *parent_frame = nullptr; |
| 237 |
|
| 238 |
Color odd_row_bg = Color(0, 0, 0, 0); |
| 239 |
Color even_row_bg = Color(0, 0, 0, 0); |
| 240 |
Color border = Color(0, 0, 0, 0); |
| 241 |
Size2 min_size_over = Size2(-1, -1); |
| 242 |
Size2 max_size_over = Size2(-1, -1); |
| 243 |
Rect2 padding; |
| 244 |
int indent_level = 0; |
| 245 |
|
| 246 |
ItemFrame() { |
| 247 |
type = ITEM_FRAME; |
| 248 |
first_invalid_line.store(0); |
| 249 |
first_invalid_font_line.store(0); |
| 250 |
first_resized_line.store(0); |
| 251 |
} |
| 252 |
}; |
| 253 |
|
| 254 |
struct ItemText : public Item { |
| 255 |
String text; |
| 256 |
ItemText() { type = ITEM_TEXT; } |
| 257 |
}; |
| 258 |
|
| 259 |
struct ItemDropcap : public Item { |
| 260 |
String text; |
| 261 |
Ref<Font> font; |
| 262 |
int font_size = 0; |
| 263 |
Color color; |
| 264 |
int ol_size = 0; |
| 265 |
Color ol_color; |
| 266 |
Rect2 dropcap_margins; |
| 267 |
ItemDropcap() { type = ITEM_DROPCAP; } |
| 268 |
~ItemDropcap() { |
| 269 |
if (font.is_valid()) { |
| 270 |
RichTextLabel *owner_rtl = ObjectDB::get_instance<RichTextLabel>(owner); |
| 271 |
if (owner_rtl) { |
| 272 |
font->disconnect_changed(callable_mp(owner_rtl, &RichTextLabel::_invalidate_fonts)); |
| 273 |
} |
| 274 |
} |
| 275 |
} |
| 276 |
}; |
| 277 |
|
| 278 |
struct ItemImage : public Item { |
| 279 |
Ref<Texture2D> image; |
| 280 |
String alt_text; |
| 281 |
InlineAlignment inline_align = INLINE_ALIGNMENT_CENTER; |
| 282 |
bool pad = false; |
| 283 |
bool width_in_percent = false; |
| 284 |
bool height_in_percent = false; |
| 285 |
Rect2 region; |
| 286 |
Size2 size; |
| 287 |
Size2 rq_size; |
| 288 |
Color color; |
| 289 |
Variant key; |
| 290 |
String tooltip; |
| 291 |
ItemImage() { type = ITEM_IMAGE; } |
| 292 |
~ItemImage() { |
| 293 |
if (image.is_valid()) { |
| 294 |
RichTextLabel *owner_rtl = ObjectDB::get_instance<RichTextLabel>(owner); |
| 295 |
if (owner_rtl) { |
| 296 |
if (owner_rtl->hr_list.has(rid)) { |
| 297 |
owner_rtl->hr_list.erase((rid)); |
| 298 |
} |
| 299 |
image->disconnect_changed(callable_mp(owner_rtl, &RichTextLabel::_texture_changed)); |
| 300 |
} |
| 301 |
} |
| 302 |
} |
| 303 |
}; |
| 304 |
|
| 305 |
struct ItemFont : public Item { |
| 306 |
DefaultFont def_font = RTL_CUSTOM_FONT; |
| 307 |
Ref<Font> font; |
| 308 |
bool variation = false; |
| 309 |
bool def_size = false; |
| 310 |
int font_size = 0; |
| 311 |
ItemFont() { type = ITEM_FONT; } |
| 312 |
~ItemFont() { |
| 313 |
if (font.is_valid()) { |
| 314 |
RichTextLabel *owner_rtl = ObjectDB::get_instance<RichTextLabel>(owner); |
| 315 |
if (owner_rtl) { |
| 316 |
font->disconnect_changed(callable_mp(owner_rtl, &RichTextLabel::_invalidate_fonts)); |
| 317 |
} |
| 318 |
} |
| 319 |
} |
| 320 |
}; |
| 321 |
|
| 322 |
struct ItemFontSize : public Item { |
| 323 |
int font_size = 16; |
| 324 |
ItemFontSize() { type = ITEM_FONT_SIZE; } |
| 325 |
}; |
| 326 |
|
| 327 |
struct ItemColor : public Item { |
| 328 |
Color color; |
| 329 |
ItemColor() { type = ITEM_COLOR; } |
| 330 |
}; |
| 331 |
|
| 332 |
struct ItemOutlineSize : public Item { |
| 333 |
int outline_size = 0; |
| 334 |
ItemOutlineSize() { type = ITEM_OUTLINE_SIZE; } |
| 335 |
}; |
| 336 |
|
| 337 |
struct ItemOutlineColor : public Item { |
| 338 |
Color color; |
| 339 |
ItemOutlineColor() { type = ITEM_OUTLINE_COLOR; } |
| 340 |
}; |
| 341 |
|
| 342 |
struct ItemUnderline : public Item { |
| 343 |
Color color; |
| 344 |
ItemUnderline() { type = ITEM_UNDERLINE; } |
| 345 |
}; |
| 346 |
|
| 347 |
struct ItemStrikethrough : public Item { |
| 348 |
Color color; |
| 349 |
ItemStrikethrough() { type = ITEM_STRIKETHROUGH; } |
| 350 |
}; |
| 351 |
|
| 352 |
struct ItemMeta : public Item { |
| 353 |
Variant meta; |
| 354 |
MetaUnderline underline = META_UNDERLINE_ALWAYS; |
| 355 |
String tooltip; |
| 356 |
ItemMeta() { type = ITEM_META; } |
| 357 |
}; |
| 358 |
|
| 359 |
struct ItemHint : public Item { |
| 360 |
String description; |
| 361 |
ItemHint() { type = ITEM_HINT; } |
| 362 |
}; |
| 363 |
|
| 364 |
struct ItemLanguage : public Item { |
| 365 |
String language; |
| 366 |
ItemLanguage() { type = ITEM_LANGUAGE; } |
| 367 |
}; |
| 368 |
|
| 369 |
struct ItemParagraph : public Item { |
| 370 |
HorizontalAlignment alignment = HORIZONTAL_ALIGNMENT_LEFT; |
| 371 |
String language; |
| 372 |
Control::TextDirection direction = Control::TEXT_DIRECTION_AUTO; |
| 373 |
TextServer::StructuredTextParser st_parser = TextServer::STRUCTURED_TEXT_DEFAULT; |
| 374 |
BitField<TextServer::JustificationFlag> jst_flags = TextServer::JUSTIFICATION_WORD_BOUND | TextServer::JUSTIFICATION_KASHIDA | TextServer::JUSTIFICATION_SKIP_LAST_LINE | TextServer::JUSTIFICATION_DO_NOT_SKIP_SINGLE_LINE; |
| 375 |
PackedFloat32Array tab_stops; |
| 376 |
ItemParagraph() { type = ITEM_PARAGRAPH; } |
| 377 |
}; |
| 378 |
|
| 379 |
struct ItemIndent : public Item { |
| 380 |
int level = 0; |
| 381 |
ItemIndent() { type = ITEM_INDENT; } |
| 382 |
}; |
| 383 |
|
| 384 |
struct ItemList : public Item { |
| 385 |
ListType list_type = LIST_DOTS; |
| 386 |
bool capitalize = false; |
| 387 |
int level = 0; |
| 388 |
String bullet = U"•"; |
| 389 |
float max_width = 0; |
| 390 |
ItemList() { type = ITEM_LIST; } |
| 391 |
}; |
| 392 |
|
| 393 |
struct ItemNewline : public Item { |
| 394 |
ItemNewline() { type = ITEM_NEWLINE; } |
| 395 |
}; |
| 396 |
|
| 397 |
struct ItemTable : public Item { |
| 398 |
struct Column { |
| 399 |
String name; |
| 400 |
bool expand = false; |
| 401 |
bool shrink = true; |
| 402 |
int expand_ratio = 0; |
| 403 |
int min_width = 0; |
| 404 |
int max_width = 0; |
| 405 |
int width = 0; |
| 406 |
int width_with_padding = 0; |
| 407 |
}; |
| 408 |
|
| 409 |
LocalVector<Column> columns; |
| 410 |
LocalVector<float> rows; |
| 411 |
LocalVector<float> rows_no_padding; |
| 412 |
LocalVector<float> rows_baseline; |
| 413 |
String name; |
| 414 |
|
| 415 |
int align_to_row = -1; |
| 416 |
int total_width = 0; |
| 417 |
int total_height = 0; |
| 418 |
int char_count = 0; |
| 419 |
InlineAlignment inline_align = INLINE_ALIGNMENT_TOP; |
| 420 |
ItemTable() { type = ITEM_TABLE; } |
| 421 |
}; |
| 422 |
|
| 423 |
struct ItemFade : public Item { |
| 424 |
int starting_index = 0; |
| 425 |
int length = 0; |
| 426 |
|
| 427 |
ItemFade() { type = ITEM_FADE; } |
| 428 |
}; |
| 429 |
|
| 430 |
struct ItemFX : public Item { |
| 431 |
double elapsed_time = 0.f; |
| 432 |
bool connected = true; |
| 433 |
}; |
| 434 |
|
| 435 |
struct ItemShake : public ItemFX { |
| 436 |
int strength = 0; |
| 437 |
float rate = 0.0f; |
| 438 |
uint64_t _current_rng = 0; |
| 439 |
uint64_t _previous_rng = 0; |
| 440 |
Vector2 prev_off; |
| 441 |
|
| 442 |
ItemShake() { type = ITEM_SHAKE; } |
| 443 |
|
| 444 |
void reroll_random() { |
| 445 |
_previous_rng = _current_rng; |
| 446 |
_current_rng = Math::rand(); |
| 447 |
} |
| 448 |
|
| 449 |
uint64_t offset_random(int p_index) { |
| 450 |
return (_current_rng >> (p_index % 64)) | |
| 451 |
(_current_rng << (64 - (p_index % 64))); |
| 452 |
} |
| 453 |
|
| 454 |
uint64_t offset_previous_random(int p_index) { |
| 455 |
return (_previous_rng >> (p_index % 64)) | |
| 456 |
(_previous_rng << (64 - (p_index % 64))); |
| 457 |
} |
| 458 |
}; |
| 459 |
|
| 460 |
struct ItemWave : public ItemFX { |
| 461 |
float frequency = 1.0f; |
| 462 |
float amplitude = 1.0f; |
| 463 |
Vector2 prev_off; |
| 464 |
|
| 465 |
ItemWave() { type = ITEM_WAVE; } |
| 466 |
}; |
| 467 |
|
| 468 |
struct ItemTornado : public ItemFX { |
| 469 |
float radius = 1.0f; |
| 470 |
float frequency = 1.0f; |
| 471 |
Vector2 prev_off; |
| 472 |
|
| 473 |
ItemTornado() { type = ITEM_TORNADO; } |
| 474 |
}; |
| 475 |
|
| 476 |
struct ItemRainbow : public ItemFX { |
| 477 |
float saturation = 0.9f; |
| 478 |
float value = 1.0f; |
| 479 |
float frequency = 1.0f; |
| 480 |
float speed = 1.0f; |
| 481 |
|
| 482 |
ItemRainbow() { type = ITEM_RAINBOW; } |
| 483 |
}; |
| 484 |
|
| 485 |
struct ItemPulse : public ItemFX { |
| 486 |
Color color = Color(1.0, 1.0, 1.0, 0.25); |
| 487 |
float frequency = 1.0f; |
| 488 |
float ease = -2.0f; |
| 489 |
|
| 490 |
ItemPulse() { type = ITEM_PULSE; } |
| 491 |
}; |
| 492 |
|
| 493 |
struct ItemBGColor : public Item { |
| 494 |
Color color; |
| 495 |
ItemBGColor() { type = ITEM_BGCOLOR; } |
| 496 |
}; |
| 497 |
|
| 498 |
struct ItemFGColor : public Item { |
| 499 |
Color color; |
| 500 |
ItemFGColor() { type = ITEM_FGCOLOR; } |
| 501 |
}; |
| 502 |
|
| 503 |
struct ItemCustomFX : public ItemFX { |
| 504 |
Ref<CharFXTransform> char_fx_transform; |
| 505 |
Ref<RichTextEffect> custom_effect; |
| 506 |
|
| 507 |
ItemCustomFX(); |
| 508 |
|
| 509 |
virtual ~ItemCustomFX(); |
| 510 |
}; |
| 511 |
|
| 512 |
struct ItemContext : public Item { |
| 513 |
ItemContext() { type = ITEM_CONTEXT; } |
| 514 |
}; |
| 515 |
const Array formatting_items = { |
| 516 |
|
| 517 |
ITEM_FONT, |
| 518 |
ITEM_FONT_SIZE, |
| 519 |
ITEM_FONT_FEATURES, |
| 520 |
ITEM_COLOR, |
| 521 |
ITEM_OUTLINE_SIZE, |
| 522 |
ITEM_OUTLINE_COLOR, |
| 523 |
ITEM_UNDERLINE, |
| 524 |
ITEM_STRIKETHROUGH, |
| 525 |
ITEM_FADE, |
| 526 |
ITEM_SHAKE, |
| 527 |
ITEM_WAVE, |
| 528 |
ITEM_TORNADO, |
| 529 |
ITEM_RAINBOW, |
| 530 |
ITEM_BGCOLOR, |
| 531 |
ITEM_FGCOLOR, |
| 532 |
ITEM_META, |
| 533 |
ITEM_HINT, |
| 534 |
ITEM_CUSTOMFX, |
| 535 |
ITEM_LANGUAGE, |
| 536 |
ITEM_PULSE, |
| 537 |
}; |
| 538 |
|
| 539 |
ItemFrame *main = nullptr; |
| 540 |
Item *current = nullptr; |
| 541 |
ItemFrame *current_frame = nullptr; |
| 542 |
|
| 543 |
WorkerThreadPool::TaskID task = WorkerThreadPool::INVALID_TASK_ID; |
| 544 |
Mutex data_mutex; |
| 545 |
bool threaded = false; |
| 546 |
std::atomic<bool> stop_thread; |
| 547 |
std::atomic<bool> updating; |
| 548 |
std::atomic<bool> validating; |
| 549 |
std::atomic<double> loaded; |
| 550 |
std::atomic<bool> parsing_bbcode; |
| 551 |
|
| 552 |
uint64_t loading_started = 0; |
| 553 |
int progress_delay = 1000; |
| 554 |
|
| 555 |
VScrollBar *vscroll = nullptr; |
| 556 |
|
| 557 |
TextServer::AutowrapMode autowrap_mode = TextServer::AUTOWRAP_WORD_SMART; |
| 558 |
BitField<TextServer::LineBreakFlag> autowrap_flags_trim = TextServer::BREAK_TRIM_START_EDGE_SPACES | TextServer::BREAK_TRIM_END_EDGE_SPACES; |
| 559 |
|
| 560 |
bool scroll_visible = false; |
| 561 |
bool scroll_follow = false; |
| 562 |
bool scroll_follow_visible_characters = false; |
| 563 |
int follow_vc_pos = 0; |
| 564 |
bool scroll_following = false; |
| 565 |
bool scroll_active = true; |
| 566 |
int scroll_w = 0; |
| 567 |
bool scroll_updated = false; |
| 568 |
bool updating_scroll = false; |
| 569 |
int current_idx = 1; |
| 570 |
int current_char_ofs = 0; |
| 571 |
int visible_paragraph_count = 0; |
| 572 |
int visible_line_count = 0; |
| 573 |
Rect2i visible_rect; |
| 574 |
|
| 575 |
int tab_size = 4; |
| 576 |
bool underline_meta = true; |
| 577 |
bool underline_hint = true; |
| 578 |
bool use_selected_font_color = false; |
| 579 |
|
| 580 |
HorizontalAlignment default_alignment = HORIZONTAL_ALIGNMENT_LEFT; |
| 581 |
VerticalAlignment vertical_alignment = VERTICAL_ALIGNMENT_TOP; |
| 582 |
BitField<TextServer::JustificationFlag> default_jst_flags = TextServer::JUSTIFICATION_WORD_BOUND | TextServer::JUSTIFICATION_KASHIDA | TextServer::JUSTIFICATION_SKIP_LAST_LINE | TextServer::JUSTIFICATION_DO_NOT_SKIP_SINGLE_LINE; |
| 583 |
PackedFloat32Array default_tab_stops; |
| 584 |
|
| 585 |
ItemMeta *meta_hovering = nullptr; |
| 586 |
Variant current_meta; |
| 587 |
|
| 588 |
Array custom_effects; |
| 589 |
|
| 590 |
HashMap<RID, Rect2> ac_element_bounds_cache; |
| 591 |
|
| 592 |
void _update_follow_vc(); |
| 593 |
void _invalidate_accessibility(); |
| 594 |
void _invalidate_current_line(ItemFrame *p_frame); |
| 595 |
|
| 596 |
void _prepare_scroll_anchor(); |
| 597 |
|
| 598 |
void _thread_function(void *p_userdata); |
| 599 |
void _thread_end(); |
| 600 |
void _stop_thread(); |
| 601 |
bool _validate_line_caches(); |
| 602 |
void _process_line_caches(); |
| 603 |
_FORCE_INLINE_ float _update_scroll_exceeds(float p_total_height, float p_ctrl_height, float p_width, int p_idx, float p_old_scroll, float p_text_rect_height); |
| 604 |
|
| 605 |
void _add_item(Item *p_item, bool p_enter = false, bool p_ensure_newline = false); |
| 606 |
void _remove_frame(HashSet<Item *> &r_erase_list, ItemFrame *p_frame, int p_line, bool p_erase, int p_char_offset, int p_line_offset); |
| 607 |
|
| 608 |
void _texture_changed(RID p_item); |
| 609 |
|
| 610 |
RID_PtrOwner<Item> items; |
| 611 |
List<String> tag_stack; |
| 612 |
HashSet<RID> hr_list; |
| 613 |
|
| 614 |
String language; |
| 615 |
TextDirection text_direction = TEXT_DIRECTION_AUTO; |
| 616 |
TextServer::StructuredTextParser st_parser = TextServer::STRUCTURED_TEXT_DEFAULT; |
| 617 |
Array st_args; |
| 618 |
|
| 619 |
struct Selection { |
| 620 |
ItemFrame *click_frame = nullptr; |
| 621 |
int click_line = 0; |
| 622 |
Item *click_item = nullptr; |
| 623 |
int click_char = 0; |
| 624 |
|
| 625 |
ItemFrame *from_frame = nullptr; |
| 626 |
int from_line = 0; |
| 627 |
Item *from_item = nullptr; |
| 628 |
int from_char = 0; |
| 629 |
|
| 630 |
ItemFrame *to_frame = nullptr; |
| 631 |
int to_line = 0; |
| 632 |
Item *to_item = nullptr; |
| 633 |
int to_char = 0; |
| 634 |
|
| 635 |
bool double_click = false; |
| 636 |
bool active = false; |
| 637 |
bool enabled = false; |
| 638 |
bool drag_attempt = false; |
| 639 |
}; |
| 640 |
|
| 641 |
Selection selection; |
| 642 |
Callable selection_modifier; |
| 643 |
bool deselect_on_focus_loss_enabled = true; |
| 644 |
bool drag_and_drop_selection_enabled = true; |
| 645 |
|
| 646 |
ItemFrame *keyboard_focus_frame = nullptr; |
| 647 |
int keyboard_focus_line = 0; |
| 648 |
Item *keyboard_focus_item = nullptr; |
| 649 |
bool keyboard_focus_on_text = true; |
| 650 |
|
| 651 |
bool context_menu_enabled = false; |
| 652 |
bool shortcut_keys_enabled = true; |
| 653 |
|
| 654 |
|
| 655 |
PopupMenu *menu = nullptr; |
| 656 |
void _generate_context_menu(); |
| 657 |
void _update_context_menu(); |
| 658 |
Key _get_menu_action_accelerator(const String &p_action); |
| 659 |
|
| 660 |
int visible_characters = -1; |
| 661 |
float visible_ratio = 1.0; |
| 662 |
TextServer::VisibleCharactersBehavior visible_chars_behavior = TextServer::VC_CHARS_BEFORE_SHAPING; |
| 663 |
|
| 664 |
bool _is_click_inside_selection() const; |
| 665 |
void _find_click(ItemFrame *p_frame, const Point2i &p_click, ItemFrame **r_click_frame = nullptr, int *r_click_line = nullptr, Item **r_click_item = nullptr, int *r_click_char = nullptr, bool *r_outside = nullptr, bool p_meta = false); |
| 666 |
|
| 667 |
String _get_line_text(ItemFrame *p_frame, int p_line, Selection p_sel) const; |
| 668 |
bool _search_table_cell(ItemTable *p_table, List<Item *>::Element *p_cell, const String &p_string, bool p_reverse_search, int p_from_line); |
| 669 |
bool _search_table(ItemTable *p_table, List<Item *>::Element *p_from, const String &p_string, bool p_reverse_search); |
| 670 |
bool _search_line(ItemFrame *p_frame, int p_line, const String &p_string, int p_char_idx, bool p_reverse_search); |
| 671 |
|
| 672 |
float _shape_line(ItemFrame *p_frame, int p_line, const Ref<Font> &p_base_font, int p_base_font_size, int p_width, float p_h, int *r_char_offset); |
| 673 |
float _resize_line(ItemFrame *p_frame, int p_line, const Ref<Font> &p_base_font, int p_base_font_size, int p_width, float p_h); |
| 674 |
|
| 675 |
void _set_table_size(ItemTable *p_table, int p_available_width); |
| 676 |
|
| 677 |
void _update_line_font(ItemFrame *p_frame, int p_line, const Ref<Font> &p_base_font, int p_base_font_size); |
| 678 |
int _draw_line(ItemFrame *p_frame, int p_line, const Vector2 &p_ofs, int p_width, float p_vsep, const Color &p_base_color, int p_outline_size, const Color &p_outline_color, const Color &p_font_shadow_color, int p_shadow_outline_size, const Point2 &p_shadow_ofs, int &r_processed_glyphs); |
| 679 |
float _find_click_in_line(ItemFrame *p_frame, int p_line, const Vector2 &p_ofs, int p_width, float p_vsep, const Point2i &p_click, ItemFrame **r_click_frame = nullptr, int *r_click_line = nullptr, Item **r_click_item = nullptr, int *r_click_char = nullptr, bool p_table = false, bool p_meta = false); |
| 680 |
void _accessibility_update_line(RID p_id, ItemFrame *p_frame, int p_line, const Vector2 &p_ofs, int p_width, float p_vsep); |
| 681 |
|
| 682 |
String _roman(int p_num, bool p_capitalize) const; |
| 683 |
String _letters(int p_num, bool p_capitalize) const; |
| 684 |
|
| 685 |
Item *_find_indentable(Item *p_item); |
| 686 |
Item *_get_item_at_pos(Item *p_item_from, Item *p_item_to, int p_position); |
| 687 |
void _find_frame(Item *p_item, ItemFrame **r_frame, int *r_line); |
| 688 |
ItemFontSize *_find_font_size(Item *p_item); |
| 689 |
ItemFont *_find_font(Item *p_item); |
| 690 |
int _find_outline_size(Item *p_item, int p_default); |
| 691 |
ItemList *_find_list_item(Item *p_item); |
| 692 |
ItemDropcap *_find_dc_item(Item *p_item); |
| 693 |
int _find_list(Item *p_item, Vector<int> &r_index, Vector<int> &r_count, Vector<ItemList *> &r_list); |
| 694 |
int _find_margin(Item *p_item, const Ref<Font> &p_base_font, int p_base_font_size); |
| 695 |
PackedFloat32Array _find_tab_stops(Item *p_item); |
| 696 |
HorizontalAlignment _find_alignment(Item *p_item); |
| 697 |
BitField<TextServer::JustificationFlag> _find_jst_flags(Item *p_item); |
| 698 |
TextServer::Direction _find_direction(Item *p_item); |
| 699 |
TextServer::StructuredTextParser _find_stt(Item *p_item); |
| 700 |
String _find_language(Item *p_item); |
| 701 |
Color _find_color(Item *p_item, const Color &p_default_color); |
| 702 |
Color _find_outline_color(Item *p_item, const Color &p_default_color); |
| 703 |
bool _find_underline(Item *p_item, Color *r_color = nullptr); |
| 704 |
bool _find_strikethrough(Item *p_item, Color *r_color = nullptr); |
| 705 |
bool _find_meta(Item *p_item, Variant *r_meta, ItemMeta **r_item = nullptr); |
| 706 |
bool _find_hint(Item *p_item, String *r_description); |
| 707 |
Color _find_bgcolor(Item *p_item); |
| 708 |
Color _find_fgcolor(Item *p_item); |
| 709 |
bool _find_layout_subitem(Item *from, Item *to); |
| 710 |
void _fetch_item_fx_stack(Item *p_item, Vector<ItemFX *> &r_stack); |
| 711 |
void _normalize_subtags(Vector<String> &subtags); |
| 712 |
|
| 713 |
void _update_fx(ItemFrame *p_frame, double p_delta_time); |
| 714 |
void _scroll_changed(double); |
| 715 |
int _find_first_line(int p_from, int p_to, int p_vofs) const; |
| 716 |
|
| 717 |
#ifdef TOOLS_ENABLED |
| 718 |
const real_t auto_scroll_speed = EDSCALE * 2.0f; |
| 719 |
#else |
| 720 |
const real_t auto_scroll_speed = 2.0f; |
| 721 |
#endif |
| 722 |
Vector2 last_clamped_mouse_pos; |
| 723 |
Timer *click_select_held = nullptr; |
| 724 |
Vector2 local_mouse_pos; |
| 725 |
bool is_selecting_text = false; |
| 726 |
void _update_selection(); |
| 727 |
|
| 728 |
_FORCE_INLINE_ float _calculate_line_vertical_offset(const Line &line) const; |
| 729 |
|
| 730 |
virtual void gui_input(const Ref<InputEvent> &p_event) override; |
| 731 |
virtual String get_tooltip(const Point2 &p_pos) const override; |
| 732 |
Item *_get_next_item(Item *p_item, bool p_free = false) const; |
| 733 |
Item *_get_prev_item(Item *p_item, bool p_free = false) const; |
| 734 |
|
| 735 |
Rect2 _get_text_rect(); |
| 736 |
Ref<RichTextEffect> _get_custom_effect_by_code(String p_bbcode_identifier); |
| 737 |
virtual Dictionary parse_expressions_for_values(Vector<String> p_expressions); |
| 738 |
|
| 739 |
void _invalidate_fonts(); |
| 740 |
|
| 741 |
Size2 _get_image_size(const Ref<Texture2D> &p_image, int p_width = 0, int p_height = 0, const Rect2 &p_region = Rect2()); |
| 742 |
|
| 743 |
String _get_prefix(Item *p_item, const Vector<int> &p_list_index, const Vector<ItemList *> &p_list_items); |
| 744 |
void _add_list_prefixes(ItemFrame *p_frame, int p_line, Line &r_l); |
| 745 |
|
| 746 |
static int _find_unquoted(const String &p_src, char32_t p_chr, int p_from); |
| 747 |
static Vector<String> _split_unquoted(const String &p_src, char32_t p_splitter); |
| 748 |
static String _get_tag_value(const String &p_tag); |
| 749 |
|
| 750 |
#ifndef DISABLE_DEPRECATED |
| 751 |
|
| 752 |
bool _set(const StringName &p_name, const Variant &p_value); |
| 753 |
#endif |
| 754 |
bool use_bbcode = false; |
| 755 |
String text; |
| 756 |
void _apply_translation(); |
| 757 |
|
| 758 |
bool internal_stack_editing = false; |
| 759 |
bool stack_externally_modified = false; |
| 760 |
|
| 761 |
void _accessibility_action_menu(const Variant &p_data); |
| 762 |
void _accessibility_scroll_down(const Variant &p_data); |
| 763 |
void _accessibility_scroll_up(const Variant &p_data); |
| 764 |
void _accessibility_scroll_set(const Variant &p_data); |
| 765 |
void _accessibility_focus_item(const Variant &p_data, uint64_t p_item, bool p_line, bool p_foucs); |
| 766 |
void _accessibility_scroll_to_item(const Variant &p_data, uint64_t p_item); |
| 767 |
|
| 768 |
RID accessibility_scroll_element; |
| 769 |
|
| 770 |
bool fit_content = false; |
| 771 |
|
| 772 |
struct ThemeCache { |
| 773 |
Ref<StyleBox> normal_style; |
| 774 |
Ref<StyleBox> focus_style; |
| 775 |
Ref<StyleBox> progress_bg_style; |
| 776 |
Ref<StyleBox> progress_fg_style; |
| 777 |
|
| 778 |
Ref<Texture2D> horizontal_rule; |
| 779 |
|
| 780 |
int line_separation; |
| 781 |
int paragraph_separation; |
| 782 |
|
| 783 |
Ref<Font> normal_font; |
| 784 |
int normal_font_size; |
| 785 |
|
| 786 |
Color default_color; |
| 787 |
Color font_selected_color; |
| 788 |
Color selection_color; |
| 789 |
Color font_outline_color; |
| 790 |
Color font_shadow_color; |
| 791 |
int shadow_outline_size; |
| 792 |
int shadow_offset_x; |
| 793 |
int shadow_offset_y; |
| 794 |
int outline_size; |
| 795 |
Color outline_color; |
| 796 |
|
| 797 |
Ref<Font> bold_font; |
| 798 |
int bold_font_size; |
| 799 |
Ref<Font> bold_italics_font; |
| 800 |
int bold_italics_font_size; |
| 801 |
Ref<Font> italics_font; |
| 802 |
int italics_font_size; |
| 803 |
Ref<Font> mono_font; |
| 804 |
int mono_font_size; |
| 805 |
|
| 806 |
int text_highlight_h_padding; |
| 807 |
int text_highlight_v_padding; |
| 808 |
|
| 809 |
int underline_alpha; |
| 810 |
int strikethrough_alpha; |
| 811 |
|
| 812 |
int table_h_separation; |
| 813 |
int table_v_separation; |
| 814 |
Color table_odd_row_bg; |
| 815 |
Color table_even_row_bg; |
| 816 |
Color table_border; |
| 817 |
|
| 818 |
float base_scale = 1.0; |
| 819 |
} theme_cache; |
| 820 |
|
| 821 |
public: |
| 822 |
virtual RID get_focused_accessibility_element() const override; |
| 823 |
PackedStringArray get_accessibility_configuration_warnings() const override; |
| 824 |
|
| 825 |
String get_parsed_text() const; |
| 826 |
void add_text(const String &p_text); |
| 827 |
void add_hr(int p_width = 90, int p_height = 2, const Color &p_color = Color(1.0, 1.0, 1.0), HorizontalAlignment p_alignment = HORIZONTAL_ALIGNMENT_LEFT, bool p_width_in_percent = true, bool p_height_in_percent = false); |
| 828 |
void add_image(const Ref<Texture2D> &p_image, int p_width = 0, int p_height = 0, const Color &p_color = Color(1.0, 1.0, 1.0), InlineAlignment p_alignment = INLINE_ALIGNMENT_CENTER, const Rect2 &p_region = Rect2(), const Variant &p_key = Variant(), bool p_pad = false, const String &p_tooltip = String(), bool p_width_in_percent = false, bool p_height_in_percent = false, const String &p_alt_text = String()); |
| 829 |
void update_image(const Variant &p_key, BitField<ImageUpdateMask> p_mask, const Ref<Texture2D> &p_image, int p_width = 0, int p_height = 0, const Color &p_color = Color(1.0, 1.0, 1.0), InlineAlignment p_alignment = INLINE_ALIGNMENT_CENTER, const Rect2 &p_region = Rect2(), bool p_pad = false, const String &p_tooltip = String(), bool p_width_in_percent = false, bool p_height_in_percent = false); |
| 830 |
void add_newline(); |
| 831 |
bool remove_paragraph(int p_paragraph, bool p_no_invalidate = false); |
| 832 |
bool invalidate_paragraph(int p_paragraph); |
| 833 |
void push_dropcap(const String &p_string, const Ref<Font> &p_font, int p_size, const Rect2 &p_dropcap_margins = Rect2(), const Color &p_color = Color(1, 1, 1), int p_ol_size = 0, const Color &p_ol_color = Color(0, 0, 0, 0)); |
| 834 |
void _push_def_font(DefaultFont p_def_font); |
| 835 |
void _push_def_font_var(DefaultFont p_def_font, const Ref<Font> &p_font, int p_size = -1); |
| 836 |
void push_font(const Ref<Font> &p_font, int p_size = 0); |
| 837 |
void push_font_size(int p_font_size); |
| 838 |
void push_outline_size(int p_font_size); |
| 839 |
void push_normal(); |
| 840 |
void push_bold(); |
| 841 |
void push_bold_italics(); |
| 842 |
void push_italics(); |
| 843 |
void push_mono(); |
| 844 |
void push_color(const Color &p_color); |
| 845 |
void push_outline_color(const Color &p_color); |
| 846 |
void push_underline(const Color &p_color = Color(0, 0, 0, 0)); |
| 847 |
void push_strikethrough(const Color &p_color = Color(0, 0, 0, 0)); |
| 848 |
void push_language(const String &p_language); |
| 849 |
void push_paragraph(HorizontalAlignment p_alignment, Control::TextDirection p_direction = Control::TEXT_DIRECTION_INHERITED, const String &p_language = "", TextServer::StructuredTextParser p_st_parser = TextServer::STRUCTURED_TEXT_DEFAULT, BitField<TextServer::JustificationFlag> p_jst_flags = TextServer::JUSTIFICATION_WORD_BOUND | TextServer::JUSTIFICATION_KASHIDA | TextServer::JUSTIFICATION_SKIP_LAST_LINE | TextServer::JUSTIFICATION_DO_NOT_SKIP_SINGLE_LINE, const PackedFloat32Array &p_tab_stops = PackedFloat32Array()); |
| 850 |
void push_indent(int p_level); |
| 851 |
void push_list(int p_level, ListType p_list, bool p_capitalize, const String &p_bullet = String::utf8("•")); |
| 852 |
void push_meta(const Variant &p_meta, MetaUnderline p_underline_mode = META_UNDERLINE_ALWAYS, const String &p_tooltip = String()); |
| 853 |
void push_hint(const String &p_string); |
| 854 |
void push_table(int p_columns, InlineAlignment p_alignment = INLINE_ALIGNMENT_TOP, int p_align_to_row = -1, const String &p_name = String()); |
| 855 |
void push_fade(int p_start_index, int p_length); |
| 856 |
void push_shake(int p_strength, float p_rate, bool p_connected); |
| 857 |
void push_wave(float p_frequency, float p_amplitude, bool p_connected); |
| 858 |
void push_tornado(float p_frequency, float p_radius, bool p_connected); |
| 859 |
void push_rainbow(float p_saturation, float p_value, float p_frequency, float p_speed); |
| 860 |
void push_pulse(const Color &p_color, float p_frequency, float p_ease); |
| 861 |
void push_bgcolor(const Color &p_color); |
| 862 |
void push_fgcolor(const Color &p_color); |
| 863 |
void push_customfx(Ref<RichTextEffect> p_custom_effect, Dictionary p_environment); |
| 864 |
void push_context(); |
| 865 |
void set_table_column_expand(int p_column, bool p_expand, int p_ratio = 1, bool p_shrink = true); |
| 866 |
void set_table_column_name(int p_column, const String &p_name); |
| 867 |
void set_cell_row_background_color(const Color &p_odd_row_bg, const Color &p_even_row_bg); |
| 868 |
void set_cell_border_color(const Color &p_color); |
| 869 |
void set_cell_size_override(const Size2 &p_min_size, const Size2 &p_max_size); |
| 870 |
void set_cell_padding(const Rect2 &p_padding); |
| 871 |
int get_current_table_column() const; |
| 872 |
void push_cell(); |
| 873 |
void pop(); |
| 874 |
void pop_context(); |
| 875 |
void pop_all(); |
| 876 |
|
| 877 |
void clear(); |
| 878 |
|
| 879 |
void set_offset(int p_pixel); |
| 880 |
|
| 881 |
void set_meta_underline(bool p_underline); |
| 882 |
bool is_meta_underlined() const; |
| 883 |
|
| 884 |
void set_hint_underline(bool p_underline); |
| 885 |
bool is_hint_underlined() const; |
| 886 |
|
| 887 |
void set_scroll_active(bool p_active); |
| 888 |
bool is_scroll_active() const; |
| 889 |
|
| 890 |
void set_scroll_follow(bool p_follow); |
| 891 |
bool is_scroll_following() const; |
| 892 |
|
| 893 |
void set_scroll_follow_visible_characters(bool p_follow); |
| 894 |
bool is_scroll_following_visible_characters() const; |
| 895 |
|
| 896 |
void set_tab_size(int p_spaces); |
| 897 |
int get_tab_size() const; |
| 898 |
|
| 899 |
void set_context_menu_enabled(bool p_enabled); |
| 900 |
bool is_context_menu_enabled() const; |
| 901 |
|
| 902 |
void set_shortcut_keys_enabled(bool p_enabled); |
| 903 |
bool is_shortcut_keys_enabled() const; |
| 904 |
|
| 905 |
void set_fit_content(bool p_enabled); |
| 906 |
bool is_fit_content_enabled() const; |
| 907 |
|
| 908 |
bool search(const String &p_string, bool p_from_selection = false, bool p_search_previous = false); |
| 909 |
|
| 910 |
void scroll_to_paragraph(int p_paragraph); |
| 911 |
int get_paragraph_count() const; |
| 912 |
int get_visible_paragraph_count() const; |
| 913 |
|
| 914 |
float get_line_offset(int p_line); |
| 915 |
float get_paragraph_offset(int p_paragraph); |
| 916 |
|
| 917 |
void scroll_to_line(int p_line); |
| 918 |
int get_line_count() const; |
| 919 |
Vector2i get_line_range(int p_line); |
| 920 |
int get_visible_line_count() const; |
| 921 |
|
| 922 |
int get_content_height() const; |
| 923 |
int get_content_width() const; |
| 924 |
|
| 925 |
int get_line_height(int p_line) const; |
| 926 |
int get_line_width(int p_line) const; |
| 927 |
|
| 928 |
Rect2i get_visible_content_rect() const; |
| 929 |
|
| 930 |
void scroll_to_selection(); |
| 931 |
|
| 932 |
VScrollBar *get_v_scroll_bar() { return vscroll; } |
| 933 |
|
| 934 |
virtual CursorShape get_cursor_shape(const Point2 &p_pos) const override; |
| 935 |
virtual Variant get_drag_data(const Point2 &p_point) override; |
| 936 |
|
| 937 |
void set_selection_enabled(bool p_enabled); |
| 938 |
bool is_selection_enabled() const; |
| 939 |
int get_selection_from() const; |
| 940 |
int get_selection_to() const; |
| 941 |
float get_selection_line_offset() const; |
| 942 |
String get_selected_text() const; |
| 943 |
void select_all(); |
| 944 |
|
| 945 |
_FORCE_INLINE_ void set_selection_modifier(const Callable &p_modifier) { |
| 946 |
selection_modifier = p_modifier; |
| 947 |
} |
| 948 |
|
| 949 |
void set_deselect_on_focus_loss_enabled(const bool p_enabled); |
| 950 |
bool is_deselect_on_focus_loss_enabled() const; |
| 951 |
|
| 952 |
void set_drag_and_drop_selection_enabled(const bool p_enabled); |
| 953 |
bool is_drag_and_drop_selection_enabled() const; |
| 954 |
|
| 955 |
void deselect(); |
| 956 |
|
| 957 |
int get_pending_paragraphs() const; |
| 958 |
bool is_finished() const; |
| 959 |
bool is_updating() const; |
| 960 |
void wait_until_finished(); |
| 961 |
|
| 962 |
void set_threaded(bool p_threaded); |
| 963 |
bool is_threaded() const; |
| 964 |
|
| 965 |
void set_progress_bar_delay(int p_delay_ms); |
| 966 |
int get_progress_bar_delay() const; |
| 967 |
|
| 968 |
|
| 969 |
PopupMenu *get_menu() const; |
| 970 |
bool is_menu_visible() const; |
| 971 |
void menu_option(int p_option); |
| 972 |
|
| 973 |
void parse_bbcode(const String &p_bbcode); |
| 974 |
void append_text(const String &p_bbcode); |
| 975 |
|
| 976 |
void set_use_bbcode(bool p_enable); |
| 977 |
bool is_using_bbcode() const; |
| 978 |
|
| 979 |
void set_text(const String &p_bbcode); |
| 980 |
String get_text() const; |
| 981 |
|
| 982 |
void set_horizontal_alignment(HorizontalAlignment p_alignment); |
| 983 |
HorizontalAlignment get_horizontal_alignment() const; |
| 984 |
|
| 985 |
void set_vertical_alignment(VerticalAlignment p_alignment); |
| 986 |
VerticalAlignment get_vertical_alignment() const; |
| 987 |
|
| 988 |
void set_justification_flags(BitField<TextServer::JustificationFlag> p_flags); |
| 989 |
BitField<TextServer::JustificationFlag> get_justification_flags() const; |
| 990 |
|
| 991 |
void set_tab_stops(const PackedFloat32Array &p_tab_stops); |
| 992 |
PackedFloat32Array get_tab_stops() const; |
| 993 |
|
| 994 |
void set_text_direction(TextDirection p_text_direction); |
| 995 |
TextDirection get_text_direction() const; |
| 996 |
|
| 997 |
void set_language(const String &p_language); |
| 998 |
String get_language() const; |
| 999 |
|
| 1000 |
void set_autowrap_mode(TextServer::AutowrapMode p_mode); |
| 1001 |
TextServer::AutowrapMode get_autowrap_mode() const; |
| 1002 |
|
| 1003 |
void set_autowrap_trim_flags(BitField<TextServer::LineBreakFlag> p_flags); |
| 1004 |
BitField<TextServer::LineBreakFlag> get_autowrap_trim_flags() const; |
| 1005 |
|
| 1006 |
void set_structured_text_bidi_override(TextServer::StructuredTextParser p_parser); |
| 1007 |
TextServer::StructuredTextParser get_structured_text_bidi_override() const; |
| 1008 |
|
| 1009 |
void set_structured_text_bidi_override_options(const Array &p_args); |
| 1010 |
Array get_structured_text_bidi_override_options() const; |
| 1011 |
|
| 1012 |
void set_visible_characters(int p_visible); |
| 1013 |
int get_visible_characters() const; |
| 1014 |
int get_character_line(int p_char); |
| 1015 |
int get_character_paragraph(int p_char); |
| 1016 |
int get_total_character_count() const; |
| 1017 |
int get_total_glyph_count() const; |
| 1018 |
|
| 1019 |
void set_visible_ratio(float p_ratio); |
| 1020 |
float get_visible_ratio() const; |
| 1021 |
|
| 1022 |
TextServer::VisibleCharactersBehavior get_visible_characters_behavior() const; |
| 1023 |
void set_visible_characters_behavior(TextServer::VisibleCharactersBehavior p_behavior); |
| 1024 |
|
| 1025 |
void set_effects(const Array &p_effects); |
| 1026 |
Array get_effects(); |
| 1027 |
|
| 1028 |
void install_effect(const Variant effect); |
| 1029 |
void reload_effects(); |
| 1030 |
|
| 1031 |
virtual Size2 get_minimum_size() const override; |
| 1032 |
|
| 1033 |
RichTextLabel(const String &p_text = String()); |
| 1034 |
~RichTextLabel(); |
| 1035 |
}; |
| 1036 |
|
| 1037 |
VARIANT_ENUM_CAST(RichTextLabel::ListType); |
| 1038 |
VARIANT_ENUM_CAST(RichTextLabel::MenuItems); |
| 1039 |
VARIANT_ENUM_CAST(RichTextLabel::MetaUnderline); |
| 1040 |
VARIANT_BITFIELD_CAST(RichTextLabel::ImageUpdateMask); |