Register theme properties with ThemeDB

This commit is contained in:
Yuri Sizov
2023-09-08 21:00:10 +02:00
parent 8c1817f755
commit 2924bfd4d3
71 changed files with 837 additions and 802 deletions

View File

@@ -2448,6 +2448,7 @@ void Control::_invalidate_theme_cache() {
}
void Control::_update_theme_item_cache() {
ThemeDB::get_singleton()->update_class_instance_items(this);
}
void Control::set_theme_owner_node(Node *p_node) {
@@ -2669,6 +2670,27 @@ int Control::get_theme_constant(const StringName &p_name, const StringName &p_th
return constant;
}
Variant Control::get_theme_item(Theme::DataType p_data_type, const StringName &p_name, const StringName &p_theme_type) const {
switch (p_data_type) {
case Theme::DATA_TYPE_COLOR:
return get_theme_color(p_name, p_theme_type);
case Theme::DATA_TYPE_CONSTANT:
return get_theme_constant(p_name, p_theme_type);
case Theme::DATA_TYPE_FONT:
return get_theme_font(p_name, p_theme_type);
case Theme::DATA_TYPE_FONT_SIZE:
return get_theme_font_size(p_name, p_theme_type);
case Theme::DATA_TYPE_ICON:
return get_theme_icon(p_name, p_theme_type);
case Theme::DATA_TYPE_STYLEBOX:
return get_theme_stylebox(p_name, p_theme_type);
case Theme::DATA_TYPE_MAX:
break; // Can't happen, but silences warning.
}
return Variant();
}
#ifdef TOOLS_ENABLED
Ref<Texture2D> Control::get_editor_theme_icon(const StringName &p_name) const {
return get_theme_icon(p_name, SNAME("EditorIcons"));