mirror of
https://github.com/Relintai/pandemonium_engine.git
synced 2024-12-22 11:56:49 +01:00
parent
d1ddbecc54
commit
220b7e99be
@ -48,6 +48,12 @@
|
||||
Clears the tag stack and sets [member bbcode_text] to an empty string.
|
||||
</description>
|
||||
</method>
|
||||
<method name="deselect">
|
||||
<return type="void" />
|
||||
<description>
|
||||
Clears the current selection.
|
||||
</description>
|
||||
</method>
|
||||
<method name="get_content_height" qualifiers="const">
|
||||
<return type="int" />
|
||||
<description>
|
||||
|
@ -1068,8 +1068,7 @@ void RichTextLabel::_notification(int p_what) {
|
||||
} break;
|
||||
case NOTIFICATION_FOCUS_EXIT: {
|
||||
if (deselect_on_focus_loss_enabled) {
|
||||
selection.active = false;
|
||||
update();
|
||||
deselect();
|
||||
}
|
||||
} break;
|
||||
case Control::NOTIFICATION_DRAG_END: {
|
||||
@ -1177,9 +1176,8 @@ void RichTextLabel::_gui_input(Ref<InputEvent> p_event) {
|
||||
selection.from_char = '\0';
|
||||
selection.to = nullptr;
|
||||
selection.to_char = '\0';
|
||||
selection.active = false;
|
||||
|
||||
update();
|
||||
deselect();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1226,9 +1224,8 @@ void RichTextLabel::_gui_input(Ref<InputEvent> p_event) {
|
||||
selection.from_char = '\0';
|
||||
selection.to = nullptr;
|
||||
selection.to_char = '\0';
|
||||
selection.active = false;
|
||||
|
||||
update();
|
||||
deselect();
|
||||
}
|
||||
}
|
||||
|
||||
@ -1362,7 +1359,7 @@ void RichTextLabel::_gui_input(Ref<InputEvent> p_event) {
|
||||
if (selection.from_char > selection.to_char) {
|
||||
swap = true;
|
||||
} else if (selection.from_char == selection.to_char) {
|
||||
selection.active = false;
|
||||
deselect();
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -2002,10 +1999,10 @@ void RichTextLabel::clear() {
|
||||
main->lines.clear();
|
||||
main->lines.resize(1);
|
||||
main->first_invalid_line = 0;
|
||||
update();
|
||||
selection.click = nullptr;
|
||||
selection.active = false;
|
||||
deselect();
|
||||
current_idx = 1;
|
||||
|
||||
if (scroll_follow) {
|
||||
scroll_following = true;
|
||||
}
|
||||
@ -2532,8 +2529,7 @@ void RichTextLabel::set_selection_enabled(bool p_enabled) {
|
||||
selection.enabled = p_enabled;
|
||||
if (!p_enabled) {
|
||||
if (selection.active) {
|
||||
selection.active = false;
|
||||
update();
|
||||
deselect();
|
||||
}
|
||||
set_focus_mode(FOCUS_NONE);
|
||||
} else {
|
||||
@ -2544,8 +2540,7 @@ void RichTextLabel::set_selection_enabled(bool p_enabled) {
|
||||
void RichTextLabel::set_deselect_on_focus_loss_enabled(const bool p_enabled) {
|
||||
deselect_on_focus_loss_enabled = p_enabled;
|
||||
if (p_enabled && selection.active && !has_focus()) {
|
||||
selection.active = false;
|
||||
update();
|
||||
deselect();
|
||||
}
|
||||
}
|
||||
|
||||
@ -2664,6 +2659,11 @@ String RichTextLabel::get_selected_text() {
|
||||
return text;
|
||||
}
|
||||
|
||||
void RichTextLabel::deselect() {
|
||||
selection.active = false;
|
||||
update();
|
||||
}
|
||||
|
||||
void RichTextLabel::selection_copy() {
|
||||
String text = get_selected_text();
|
||||
|
||||
@ -2814,6 +2814,8 @@ void RichTextLabel::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("pop"), &RichTextLabel::pop);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("clear"), &RichTextLabel::clear);
|
||||
ClassDB::bind_method(D_METHOD("deselect"), &RichTextLabel::deselect);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_selected_text"), &RichTextLabel::get_selected_text);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("set_meta_underline", "enable"), &RichTextLabel::set_meta_underline);
|
||||
|
@ -479,6 +479,7 @@ public:
|
||||
|
||||
void set_deselect_on_focus_loss_enabled(const bool p_enabled);
|
||||
bool is_deselect_on_focus_loss_enabled() const;
|
||||
void deselect();
|
||||
|
||||
Error parse_bbcode(const String &p_bbcode);
|
||||
Error append_bbcode(const String &p_bbcode);
|
||||
|
Loading…
Reference in New Issue
Block a user