diff options
Diffstat (limited to 'scene/gui/rich_text_label.cpp')
-rw-r--r-- | scene/gui/rich_text_label.cpp | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/scene/gui/rich_text_label.cpp b/scene/gui/rich_text_label.cpp index ec1fbb7e28..4e24c9ba06 100644 --- a/scene/gui/rich_text_label.cpp +++ b/scene/gui/rich_text_label.cpp @@ -780,8 +780,7 @@ int RichTextLabel::_draw_line(ItemFrame *p_frame, int p_line, const Vector2 &p_o } String segment; if (list_items[i]->list_type == LIST_DOTS) { - static const char32_t _prefix[2] = { 0x25CF, 0 }; - prefix = _prefix; + prefix = list_items[i]->bullet; break; } else if (list_items[i]->list_type == LIST_NUMBERS) { segment = itos(list_index[i]); @@ -3305,7 +3304,7 @@ void RichTextLabel::push_indent(int p_level) { _add_item(item, true, true); } -void RichTextLabel::push_list(int p_level, ListType p_list, bool p_capitalize) { +void RichTextLabel::push_list(int p_level, ListType p_list, bool p_capitalize, const String &p_bullet) { _stop_thread(); MutexLock data_lock(data_mutex); @@ -3317,6 +3316,7 @@ void RichTextLabel::push_list(int p_level, ListType p_list, bool p_capitalize) { item->list_type = p_list; item->level = p_level; item->capitalize = p_capitalize; + item->bullet = p_bullet; _add_item(item, true, true); } @@ -4014,6 +4014,12 @@ void RichTextLabel::append_text(const String &p_bbcode) { push_list(indent_level, LIST_DOTS, false); pos = brk_end + 1; tag_stack.push_front(tag); + } else if (tag.begins_with("ul bullet=")) { + String bullet = tag.substr(10, 1); + indent_level++; + push_list(indent_level, LIST_DOTS, false, bullet); + pos = brk_end + 1; + tag_stack.push_front("ul"); } else if ((tag == "ol") || (tag == "ol type=1")) { indent_level++; push_list(indent_level, LIST_NUMBERS, false); @@ -4735,6 +4741,11 @@ void RichTextLabel::set_deselect_on_focus_loss_enabled(const bool p_enabled) { } Variant RichTextLabel::get_drag_data(const Point2 &p_point) { + Variant ret = Control::get_drag_data(p_point); + if (ret != Variant()) { + return ret; + } + if (selection.drag_attempt && selection.enabled) { String t = get_selected_text(); Label *l = memnew(Label); @@ -5344,7 +5355,7 @@ void RichTextLabel::_bind_methods() { ClassDB::bind_method(D_METHOD("push_outline_color", "color"), &RichTextLabel::push_outline_color); ClassDB::bind_method(D_METHOD("push_paragraph", "alignment", "base_direction", "language", "st_parser"), &RichTextLabel::push_paragraph, DEFVAL(TextServer::DIRECTION_AUTO), DEFVAL(""), DEFVAL(TextServer::STRUCTURED_TEXT_DEFAULT)); ClassDB::bind_method(D_METHOD("push_indent", "level"), &RichTextLabel::push_indent); - ClassDB::bind_method(D_METHOD("push_list", "level", "type", "capitalize"), &RichTextLabel::push_list); + ClassDB::bind_method(D_METHOD("push_list", "level", "type", "capitalize", "bullet"), &RichTextLabel::push_list, DEFVAL(String::utf8("•"))); ClassDB::bind_method(D_METHOD("push_meta", "data"), &RichTextLabel::push_meta); ClassDB::bind_method(D_METHOD("push_hint", "description"), &RichTextLabel::push_hint); ClassDB::bind_method(D_METHOD("push_underline"), &RichTextLabel::push_underline); |