summaryrefslogtreecommitdiffstats
path: root/scene/gui
diff options
context:
space:
mode:
Diffstat (limited to 'scene/gui')
-rw-r--r--scene/gui/item_list.cpp52
-rw-r--r--scene/gui/line_edit.cpp5
-rw-r--r--scene/gui/spin_box.cpp5
-rw-r--r--scene/gui/tab_container.cpp2
-rw-r--r--scene/gui/tab_container.h1
5 files changed, 39 insertions, 26 deletions
diff --git a/scene/gui/item_list.cpp b/scene/gui/item_list.cpp
index cff07c6e1c..23b516192e 100644
--- a/scene/gui/item_list.cpp
+++ b/scene/gui/item_list.cpp
@@ -1092,6 +1092,32 @@ void ItemList::_notification(int p_what) {
// Define a visible frame to check against and optimize drawing.
const Rect2 clip(-base_ofs, size);
+ // Do a binary search to find the first separator that is below clip_position.y.
+ int first_visible_separator = 0;
+ {
+ int lo = 0;
+ int hi = separators.size();
+ while (lo < hi) {
+ const int mid = (lo + hi) / 2;
+ if (separators[mid] < clip.position.y) {
+ lo = mid + 1;
+ } else {
+ hi = mid;
+ }
+ }
+ first_visible_separator = lo;
+ }
+
+ // Draw visible separators.
+ for (int i = first_visible_separator; i < separators.size(); i++) {
+ if (separators[i] > clip.position.y + clip.size.y) {
+ break; // done
+ }
+
+ const int y = base_ofs.y + separators[i];
+ draw_line(Vector2(theme_cache.panel_style->get_margin(SIDE_LEFT), y), Vector2(width, y), theme_cache.guide_color);
+ }
+
// Do a binary search to find the first item whose rect reaches below clip.position.y.
int first_item_visible;
{
@@ -1310,32 +1336,6 @@ void ItemList::_notification(int p_what) {
draw_style_box(cursor, r);
}
}
-
- // Do a binary search to find the first separator that is below clip_position.y.
- int first_visible_separator = 0;
- {
- int lo = 0;
- int hi = separators.size();
- while (lo < hi) {
- const int mid = (lo + hi) / 2;
- if (separators[mid] < clip.position.y) {
- lo = mid + 1;
- } else {
- hi = mid;
- }
- }
- first_visible_separator = lo;
- }
-
- // Draw visible separators.
- for (int i = first_visible_separator; i < separators.size(); i++) {
- if (separators[i] > clip.position.y + clip.size.y) {
- break; // done
- }
-
- const int y = base_ofs.y + separators[i];
- draw_line(Vector2(theme_cache.panel_style->get_margin(SIDE_LEFT), y), Vector2(width, y), theme_cache.guide_color);
- }
} break;
}
}
diff --git a/scene/gui/line_edit.cpp b/scene/gui/line_edit.cpp
index bb727ff62c..4c1e591bd7 100644
--- a/scene/gui/line_edit.cpp
+++ b/scene/gui/line_edit.cpp
@@ -482,6 +482,11 @@ void LineEdit::gui_input(const Ref<InputEvent> &p_event) {
return;
}
+ if (k->is_action("ui_cancel")) {
+ release_focus();
+ return;
+ }
+
if (is_shortcut_keys_enabled()) {
if (k->is_action("ui_copy", true)) {
copy_text();
diff --git a/scene/gui/spin_box.cpp b/scene/gui/spin_box.cpp
index 7cb54f24ea..4af694ae3d 100644
--- a/scene/gui/spin_box.cpp
+++ b/scene/gui/spin_box.cpp
@@ -210,6 +210,11 @@ void SpinBox::_line_edit_focus_exit() {
if (line_edit->is_menu_visible()) {
return;
}
+ // Discontinue because the focus_exit was caused by canceling.
+ if (Input::get_singleton()->is_action_pressed("ui_cancel")) {
+ _update_text();
+ return;
+ }
_text_submitted(line_edit->get_text());
}
diff --git a/scene/gui/tab_container.cpp b/scene/gui/tab_container.cpp
index a6be8f2948..28bf58ca04 100644
--- a/scene/gui/tab_container.cpp
+++ b/scene/gui/tab_container.cpp
@@ -162,6 +162,7 @@ void TabContainer::_update_theme_item_cache() {
theme_cache.drop_mark_color = get_theme_color(SNAME("drop_mark_color"));
theme_cache.font_selected_color = get_theme_color(SNAME("font_selected_color"));
+ theme_cache.font_hovered_color = get_theme_color(SNAME("font_hovered_color"));
theme_cache.font_unselected_color = get_theme_color(SNAME("font_unselected_color"));
theme_cache.font_disabled_color = get_theme_color(SNAME("font_disabled_color"));
theme_cache.font_outline_color = get_theme_color(SNAME("font_outline_color"));
@@ -240,6 +241,7 @@ void TabContainer::_on_theme_changed() {
tab_bar->add_theme_color_override(SNAME("drop_mark_color"), theme_cache.drop_mark_color);
tab_bar->add_theme_color_override(SNAME("font_selected_color"), theme_cache.font_selected_color);
+ tab_bar->add_theme_color_override(SNAME("font_hovered_color"), theme_cache.font_hovered_color);
tab_bar->add_theme_color_override(SNAME("font_unselected_color"), theme_cache.font_unselected_color);
tab_bar->add_theme_color_override(SNAME("font_disabled_color"), theme_cache.font_disabled_color);
tab_bar->add_theme_color_override(SNAME("font_outline_color"), theme_cache.font_outline_color);
diff --git a/scene/gui/tab_container.h b/scene/gui/tab_container.h
index 711b57e421..c7a218c290 100644
--- a/scene/gui/tab_container.h
+++ b/scene/gui/tab_container.h
@@ -75,6 +75,7 @@ class TabContainer : public Container {
Color drop_mark_color;
Color font_selected_color;
+ Color font_hovered_color;
Color font_unselected_color;
Color font_disabled_color;
Color font_outline_color;