summaryrefslogtreecommitdiffstats
path: root/scene/gui/item_list.cpp
diff options
context:
space:
mode:
authorYuri Sizov <yuris@humnom.net>2023-09-08 21:00:10 +0200
committerYuri Sizov <yuris@humnom.net>2023-09-11 13:45:23 +0200
commit2924bfd4d3c6dbdf01df3263000070634826f0a9 (patch)
tree779d2aa57557af3c2fe2828e6a3a570a32e7a61b /scene/gui/item_list.cpp
parent8c1817f755b63a69378774d8d0f74499f663afe2 (diff)
downloadredot-engine-2924bfd4d3c6dbdf01df3263000070634826f0a9.tar.gz
Register theme properties with ThemeDB
Diffstat (limited to 'scene/gui/item_list.cpp')
-rw-r--r--scene/gui/item_list.cpp51
1 files changed, 24 insertions, 27 deletions
diff --git a/scene/gui/item_list.cpp b/scene/gui/item_list.cpp
index b03d3c52d2..6b1b172ec3 100644
--- a/scene/gui/item_list.cpp
+++ b/scene/gui/item_list.cpp
@@ -33,6 +33,7 @@
#include "core/config/project_settings.h"
#include "core/os/os.h"
#include "core/string/translation.h"
+#include "scene/theme/theme_db.h"
void ItemList::_shape_text(int p_idx) {
Item &item = items.write[p_idx];
@@ -992,33 +993,6 @@ static Rect2 _adjust_to_max_size(Size2 p_size, Size2 p_max_size) {
return Rect2(ofs_x, ofs_y, tex_width, tex_height);
}
-void ItemList::_update_theme_item_cache() {
- Control::_update_theme_item_cache();
-
- theme_cache.h_separation = get_theme_constant(SNAME("h_separation"));
- theme_cache.v_separation = get_theme_constant(SNAME("v_separation"));
-
- theme_cache.panel_style = get_theme_stylebox(SNAME("panel"));
- theme_cache.focus_style = get_theme_stylebox(SNAME("focus"));
-
- theme_cache.font = get_theme_font(SNAME("font"));
- theme_cache.font_size = get_theme_font_size(SNAME("font_size"));
- theme_cache.font_color = get_theme_color(SNAME("font_color"));
- theme_cache.font_hovered_color = get_theme_color(SNAME("font_hovered_color"));
- theme_cache.font_selected_color = get_theme_color(SNAME("font_selected_color"));
- theme_cache.font_outline_size = get_theme_constant(SNAME("outline_size"));
- theme_cache.font_outline_color = get_theme_color(SNAME("font_outline_color"));
-
- theme_cache.line_separation = get_theme_constant(SNAME("line_separation"));
- theme_cache.icon_margin = get_theme_constant(SNAME("icon_margin"));
- theme_cache.hovered_style = get_theme_stylebox(SNAME("hovered"));
- theme_cache.selected_style = get_theme_stylebox(SNAME("selected"));
- theme_cache.selected_focus_style = get_theme_stylebox(SNAME("selected_focus"));
- theme_cache.cursor_style = get_theme_stylebox(SNAME("cursor_unfocused"));
- theme_cache.cursor_focus_style = get_theme_stylebox(SNAME("cursor"));
- theme_cache.guide_color = get_theme_color(SNAME("guide_color"));
-}
-
void ItemList::_notification(int p_what) {
switch (p_what) {
case NOTIFICATION_RESIZED: {
@@ -1909,6 +1883,29 @@ void ItemList::_bind_methods() {
ADD_SIGNAL(MethodInfo("item_clicked", PropertyInfo(Variant::INT, "index"), PropertyInfo(Variant::VECTOR2, "at_position"), PropertyInfo(Variant::INT, "mouse_button_index")));
ADD_SIGNAL(MethodInfo("multi_selected", PropertyInfo(Variant::INT, "index"), PropertyInfo(Variant::BOOL, "selected")));
ADD_SIGNAL(MethodInfo("item_activated", PropertyInfo(Variant::INT, "index")));
+
+ BIND_THEME_ITEM(Theme::DATA_TYPE_CONSTANT, ItemList, h_separation);
+ BIND_THEME_ITEM(Theme::DATA_TYPE_CONSTANT, ItemList, v_separation);
+
+ BIND_THEME_ITEM_CUSTOM(Theme::DATA_TYPE_STYLEBOX, ItemList, panel_style, "panel");
+ BIND_THEME_ITEM_CUSTOM(Theme::DATA_TYPE_STYLEBOX, ItemList, focus_style, "focus");
+
+ BIND_THEME_ITEM(Theme::DATA_TYPE_FONT, ItemList, font);
+ BIND_THEME_ITEM(Theme::DATA_TYPE_FONT_SIZE, ItemList, font_size);
+ BIND_THEME_ITEM(Theme::DATA_TYPE_COLOR, ItemList, font_color);
+ BIND_THEME_ITEM(Theme::DATA_TYPE_COLOR, ItemList, font_hovered_color);
+ BIND_THEME_ITEM(Theme::DATA_TYPE_COLOR, ItemList, font_selected_color);
+ BIND_THEME_ITEM_CUSTOM(Theme::DATA_TYPE_CONSTANT, ItemList, font_outline_size, "outline_size");
+ BIND_THEME_ITEM(Theme::DATA_TYPE_COLOR, ItemList, font_outline_color);
+
+ BIND_THEME_ITEM(Theme::DATA_TYPE_CONSTANT, ItemList, line_separation);
+ BIND_THEME_ITEM(Theme::DATA_TYPE_CONSTANT, ItemList, icon_margin);
+ BIND_THEME_ITEM_CUSTOM(Theme::DATA_TYPE_STYLEBOX, ItemList, hovered_style, "hovered");
+ BIND_THEME_ITEM_CUSTOM(Theme::DATA_TYPE_STYLEBOX, ItemList, selected_style, "selected");
+ BIND_THEME_ITEM_CUSTOM(Theme::DATA_TYPE_STYLEBOX, ItemList, selected_focus_style, "selected_focus");
+ BIND_THEME_ITEM_CUSTOM(Theme::DATA_TYPE_STYLEBOX, ItemList, cursor_style, "cursor_unfocused");
+ BIND_THEME_ITEM_CUSTOM(Theme::DATA_TYPE_STYLEBOX, ItemList, cursor_focus_style, "cursor");
+ BIND_THEME_ITEM(Theme::DATA_TYPE_COLOR, ItemList, guide_color);
}
ItemList::ItemList() {