diff options
Diffstat (limited to 'scene/gui')
-rw-r--r-- | scene/gui/file_dialog.cpp | 5 | ||||
-rw-r--r-- | scene/gui/line_edit.cpp | 4 | ||||
-rw-r--r-- | scene/gui/rich_text_label.cpp | 14 | ||||
-rw-r--r-- | scene/gui/tab_container.cpp | 45 | ||||
-rw-r--r-- | scene/gui/tab_container.h | 1 | ||||
-rw-r--r-- | scene/gui/tree.cpp | 21 |
6 files changed, 62 insertions, 28 deletions
diff --git a/scene/gui/file_dialog.cpp b/scene/gui/file_dialog.cpp index be6b542ae1..630f3c8ff6 100644 --- a/scene/gui/file_dialog.cpp +++ b/scene/gui/file_dialog.cpp @@ -402,7 +402,9 @@ void FileDialog::update_file_list() { TreeItem *root = tree->create_item(); Ref<Texture2D> folder = vbox->get_theme_icon("folder", "FileDialog"); + Ref<Texture2D> file_icon = vbox->get_theme_icon("file", "FileDialog"); const Color folder_color = vbox->get_theme_color("folder_icon_modulate", "FileDialog"); + const Color file_color = vbox->get_theme_color("file_icon_modulate", "FileDialog"); List<String> files; List<String> dirs; @@ -491,7 +493,10 @@ void FileDialog::update_file_list() { if (get_icon_func) { Ref<Texture2D> icon = get_icon_func(base_dir.plus_file(files.front()->get())); ti->set_icon(0, icon); + } else { + ti->set_icon(0, file_icon); } + ti->set_icon_modulate(0, file_color); if (mode == FILE_MODE_OPEN_DIR) { ti->set_custom_color(0, vbox->get_theme_color("files_disabled", "FileDialog")); diff --git a/scene/gui/line_edit.cpp b/scene/gui/line_edit.cpp index fbacb3ed9e..ee6783167a 100644 --- a/scene/gui/line_edit.cpp +++ b/scene/gui/line_edit.cpp @@ -1211,6 +1211,8 @@ void LineEdit::delete_char() { } void LineEdit::delete_text(int p_from_column, int p_to_column) { + ERR_FAIL_COND_MSG(p_from_column < 0 || p_from_column > p_to_column || p_to_column > text.length(), + vformat("Positional parameters (from: %d, to: %d) are inverted or outside the text length (%d).", p_from_column, p_to_column, text.length())); if (text.size() > 0) { Ref<Font> font = get_theme_font("font"); if (font != nullptr) { @@ -1783,6 +1785,8 @@ void LineEdit::_bind_methods() { ClassDB::bind_method(D_METHOD("set_max_length", "chars"), &LineEdit::set_max_length); ClassDB::bind_method(D_METHOD("get_max_length"), &LineEdit::get_max_length); ClassDB::bind_method(D_METHOD("append_at_cursor", "text"), &LineEdit::append_at_cursor); + ClassDB::bind_method(D_METHOD("delete_char_at_cursor"), &LineEdit::delete_char); + ClassDB::bind_method(D_METHOD("delete_text", "from_column", "to_column"), &LineEdit::delete_text); ClassDB::bind_method(D_METHOD("set_editable", "enabled"), &LineEdit::set_editable); ClassDB::bind_method(D_METHOD("is_editable"), &LineEdit::is_editable); ClassDB::bind_method(D_METHOD("set_secret", "enabled"), &LineEdit::set_secret); diff --git a/scene/gui/rich_text_label.cpp b/scene/gui/rich_text_label.cpp index 2f5af0eda0..92508f7fd2 100644 --- a/scene/gui/rich_text_label.cpp +++ b/scene/gui/rich_text_label.cpp @@ -1970,6 +1970,9 @@ void RichTextLabel::clear() { selection.click = nullptr; selection.active = false; current_idx = 1; + if (scroll_follow) { + scroll_following = true; + } if (fixed_width != -1) { minimum_size_changed(); @@ -2409,6 +2412,17 @@ Error RichTextLabel::append_bbcode(const String &p_bbcode) { } } + Vector<ItemFX *> fx_items; + for (List<Item *>::Element *E = main->subitems.front(); E; E = E->next()) { + Item *subitem = static_cast<Item *>(E->get()); + _fetch_item_fx_stack(subitem, fx_items); + + if (fx_items.size()) { + set_process_internal(true); + break; + } + } + return OK; } diff --git a/scene/gui/tab_container.cpp b/scene/gui/tab_container.cpp index 8c4d9a5ece..0d48fde642 100644 --- a/scene/gui/tab_container.cpp +++ b/scene/gui/tab_container.cpp @@ -435,7 +435,30 @@ void TabContainer::_notification(int p_what) { void TabContainer::_on_theme_changed() { if (get_tab_count() > 0) { - set_current_tab(get_current_tab()); + _repaint(); + update(); + } +} + +void TabContainer::_repaint() { + Ref<StyleBox> sb = get_theme_stylebox("panel"); + Vector<Control *> tabs = _get_tabs(); + for (int i = 0; i < tabs.size(); i++) { + Control *c = tabs[i]; + if (i == current) { + c->show(); + c->set_anchors_and_margins_preset(Control::PRESET_WIDE); + if (tabs_visible) { + c->set_margin(MARGIN_TOP, _get_top_margin()); + } + c->set_margin(Margin(MARGIN_TOP), c->get_margin(Margin(MARGIN_TOP)) + sb->get_margin(Margin(MARGIN_TOP))); + c->set_margin(Margin(MARGIN_LEFT), c->get_margin(Margin(MARGIN_LEFT)) + sb->get_margin(Margin(MARGIN_LEFT))); + c->set_margin(Margin(MARGIN_RIGHT), c->get_margin(Margin(MARGIN_RIGHT)) - sb->get_margin(Margin(MARGIN_RIGHT))); + c->set_margin(Margin(MARGIN_BOTTOM), c->get_margin(Margin(MARGIN_BOTTOM)) - sb->get_margin(Margin(MARGIN_BOTTOM))); + + } else { + c->hide(); + } } } @@ -551,25 +574,7 @@ void TabContainer::set_current_tab(int p_current) { int pending_previous = current; current = p_current; - Ref<StyleBox> sb = get_theme_stylebox("panel"); - Vector<Control *> tabs = _get_tabs(); - for (int i = 0; i < tabs.size(); i++) { - Control *c = tabs[i]; - if (i == current) { - c->show(); - c->set_anchors_and_margins_preset(Control::PRESET_WIDE); - if (tabs_visible) { - c->set_margin(MARGIN_TOP, _get_top_margin()); - } - c->set_margin(Margin(MARGIN_TOP), c->get_margin(Margin(MARGIN_TOP)) + sb->get_margin(Margin(MARGIN_TOP))); - c->set_margin(Margin(MARGIN_LEFT), c->get_margin(Margin(MARGIN_LEFT)) + sb->get_margin(Margin(MARGIN_LEFT))); - c->set_margin(Margin(MARGIN_RIGHT), c->get_margin(Margin(MARGIN_RIGHT)) - sb->get_margin(Margin(MARGIN_RIGHT))); - c->set_margin(Margin(MARGIN_BOTTOM), c->get_margin(Margin(MARGIN_BOTTOM)) - sb->get_margin(Margin(MARGIN_BOTTOM))); - - } else { - c->hide(); - } - } + _repaint(); _change_notify("current_tab"); diff --git a/scene/gui/tab_container.h b/scene/gui/tab_container.h index e8cde74c83..55a5d35b30 100644 --- a/scene/gui/tab_container.h +++ b/scene/gui/tab_container.h @@ -65,6 +65,7 @@ private: Vector<Control *> _get_tabs() const; int _get_tab_width(int p_index) const; void _on_theme_changed(); + void _repaint(); void _on_mouse_exited(); void _update_current_tab(); diff --git a/scene/gui/tree.cpp b/scene/gui/tree.cpp index 45fcb448f8..7b9db7c081 100644 --- a/scene/gui/tree.cpp +++ b/scene/gui/tree.cpp @@ -2364,7 +2364,6 @@ void Tree::_gui_input(Ref<InputEvent> p_event) { if (pos.x < len) { cache.hover_type = Cache::CLICK_TITLE; cache.hover_index = i; - update(); break; } } @@ -2383,6 +2382,9 @@ void Tree::_gui_input(Ref<InputEvent> p_event) { mpos.y += v_scroll->get_value(); } + TreeItem *old_it = cache.hover_item; + int old_col = cache.hover_cell; + int col, h, section; TreeItem *it = _find_item_at_pos(root, mpos, col, h, section); @@ -2397,18 +2399,21 @@ void Tree::_gui_input(Ref<InputEvent> p_event) { } } - if (it != cache.hover_item) { - cache.hover_item = it; - update(); - } + cache.hover_item = it; + cache.hover_cell = col; - if (it && col != cache.hover_cell) { - cache.hover_cell = col; - update(); + if (it != old_it || col != old_col) { + // Only need to update if mouse enters/exits a button + bool was_over_button = old_it && old_it->cells[old_col].custom_button; + bool is_over_button = it && it->cells[col].custom_button; + if (was_over_button || is_over_button) { + update(); + } } } } + // Update if mouse enters/exits columns if (cache.hover_type != old_hover || cache.hover_index != old_index) { update(); } |