diff options
Diffstat (limited to 'scene/gui')
-rw-r--r-- | scene/gui/item_list.cpp | 2 | ||||
-rw-r--r-- | scene/gui/line_edit.cpp | 2 | ||||
-rw-r--r-- | scene/gui/popup.cpp | 8 | ||||
-rw-r--r-- | scene/gui/text_edit.cpp | 2 | ||||
-rw-r--r-- | scene/gui/tree.cpp | 8 | ||||
-rw-r--r-- | scene/gui/tree.h | 1 |
6 files changed, 20 insertions, 3 deletions
diff --git a/scene/gui/item_list.cpp b/scene/gui/item_list.cpp index 91b76839d7..a3bc68ffcd 100644 --- a/scene/gui/item_list.cpp +++ b/scene/gui/item_list.cpp @@ -754,7 +754,7 @@ void ItemList::_gui_input(const Ref<InputEvent> &p_event) { for (int i = current + 1; i <= items.size(); i++) { if (i == items.size()) { - if (current == 0) + if (current == 0 || current == -1) break; else i = 0; diff --git a/scene/gui/line_edit.cpp b/scene/gui/line_edit.cpp index 7a015f77db..3dcbf64e7c 100644 --- a/scene/gui/line_edit.cpp +++ b/scene/gui/line_edit.cpp @@ -1191,7 +1191,7 @@ void LineEdit::set_cursor_position(int p_pos) { if (cursor_pos <= window_pos) { /* Adjust window if cursor goes too much to the left */ set_window_pos(MAX(0, cursor_pos - 1)); - } else if (cursor_pos > window_pos) { + } else { /* Adjust window if cursor goes too much to the right */ int window_width = get_size().width - style->get_minimum_size().width; bool display_clear_icon = !text.empty() && is_editable() && clear_button_enabled; diff --git a/scene/gui/popup.cpp b/scene/gui/popup.cpp index 492e379440..9e996e5519 100644 --- a/scene/gui/popup.cpp +++ b/scene/gui/popup.cpp @@ -48,6 +48,14 @@ void Popup::_notification(int p_what) { update_configuration_warning(); } + if (p_what == NOTIFICATION_EXIT_TREE) { + if (popped_up) { + popped_up = false; + notification(NOTIFICATION_POPUP_HIDE); + emit_signal("popup_hide"); + } + } + if (p_what == NOTIFICATION_ENTER_TREE) { //small helper to make editing of these easier in editor #ifdef TOOLS_ENABLED diff --git a/scene/gui/text_edit.cpp b/scene/gui/text_edit.cpp index 9242e7997a..a7b4e08553 100644 --- a/scene/gui/text_edit.cpp +++ b/scene/gui/text_edit.cpp @@ -1403,7 +1403,7 @@ void TextEdit::_notification(int p_what) { } int line_from = CLAMP(completion_index - lines / 2, 0, completion_options.size() - lines); VisualServer::get_singleton()->canvas_item_add_rect(ci, Rect2(Point2(completion_rect.position.x, completion_rect.position.y + (completion_index - line_from) * get_row_height()), Size2(completion_rect.size.width, get_row_height())), cache.completion_selected_color); - draw_rect(Rect2(completion_rect.position, Size2(nofs, completion_rect.size.height)), cache.completion_existing_color); + draw_rect(Rect2(completion_rect.position + Vector2(icon_area_size.x + icon_hsep, 0), Size2(nofs, completion_rect.size.height)), cache.completion_existing_color); for (int i = 0; i < lines; i++) { diff --git a/scene/gui/tree.cpp b/scene/gui/tree.cpp index c2493ab321..8624baa005 100644 --- a/scene/gui/tree.cpp +++ b/scene/gui/tree.cpp @@ -571,7 +571,14 @@ int TreeItem::get_button_by_id(int p_column, int p_id) const { return -1; } +void TreeItem::set_disable_button(int p_column, int p_idx, bool p_disabled) { + ERR_FAIL_INDEX(p_column, cells.size()); + ERR_FAIL_INDEX(p_idx, cells[p_column].buttons.size()); + + cells.write[p_column].buttons.write[p_idx].disabled = p_disabled; + _changed_notify(p_column); +} bool TreeItem::is_button_disabled(int p_column, int p_idx) const { ERR_FAIL_INDEX_V(p_column, cells.size(), false); @@ -786,6 +793,7 @@ void TreeItem::_bind_methods() { ClassDB::bind_method(D_METHOD("set_button", "column", "button_idx", "button"), &TreeItem::set_button); ClassDB::bind_method(D_METHOD("erase_button", "column", "button_idx"), &TreeItem::erase_button); ClassDB::bind_method(D_METHOD("is_button_disabled", "column", "button_idx"), &TreeItem::is_button_disabled); + ClassDB::bind_method(D_METHOD("set_disable_button", "column", "button_idx", "disabled"), &TreeItem::set_disable_button); ClassDB::bind_method(D_METHOD("set_expand_right", "column", "enable"), &TreeItem::set_expand_right); ClassDB::bind_method(D_METHOD("get_expand_right", "column"), &TreeItem::get_expand_right); diff --git a/scene/gui/tree.h b/scene/gui/tree.h index 45d451eb72..6e5e2c1eba 100644 --- a/scene/gui/tree.h +++ b/scene/gui/tree.h @@ -212,6 +212,7 @@ public: bool is_button_disabled(int p_column, int p_idx) const; void set_button(int p_column, int p_idx, const Ref<Texture> &p_button); void set_button_color(int p_column, int p_idx, const Color &p_color); + void set_disable_button(int p_column, int p_idx, bool p_disabled); /* range works for mode number or mode combo */ |