diff options
author | RĂ©mi Verschelde <remi@verschelde.fr> | 2022-05-18 17:45:56 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-05-18 17:45:56 +0200 |
commit | 838cb598e3ef5572018d3d549c15bb27b0a5864d (patch) | |
tree | ac5a54eab20f24b31843972889db9fbd817b7fed /scene/resources/theme.cpp | |
parent | 03f240ba9309d0d8640eb061080bec92a23614c0 (diff) | |
parent | 21b253a87076de8f0169acbae49cd8b720fa3b33 (diff) |
Merge pull request #61155 from YuriSizov/theme-using-using
Diffstat (limited to 'scene/resources/theme.cpp')
-rw-r--r-- | scene/resources/theme.cpp | 68 |
1 files changed, 34 insertions, 34 deletions
diff --git a/scene/resources/theme.cpp b/scene/resources/theme.cpp index e14f5f224e..e65763ba2e 100644 --- a/scene/resources/theme.cpp +++ b/scene/resources/theme.cpp @@ -129,42 +129,42 @@ void Theme::_get_property_list(List<PropertyInfo> *p_list) const { } // Icons. - for (const KeyValue<StringName, HashMap<StringName, Ref<Texture2D>>> &E : icon_map) { + for (const KeyValue<StringName, ThemeIconMap> &E : icon_map) { for (const KeyValue<StringName, Ref<Texture2D>> &F : E.value) { list.push_back(PropertyInfo(Variant::OBJECT, String() + E.key + "/icons/" + F.key, PROPERTY_HINT_RESOURCE_TYPE, "Texture2D", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_STORE_IF_NULL)); } } // Styles. - for (const KeyValue<StringName, HashMap<StringName, Ref<StyleBox>>> &E : style_map) { + for (const KeyValue<StringName, ThemeStyleMap> &E : style_map) { for (const KeyValue<StringName, Ref<StyleBox>> &F : E.value) { list.push_back(PropertyInfo(Variant::OBJECT, String() + E.key + "/styles/" + F.key, PROPERTY_HINT_RESOURCE_TYPE, "StyleBox", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_STORE_IF_NULL)); } } // Fonts. - for (const KeyValue<StringName, HashMap<StringName, Ref<Font>>> &E : font_map) { + for (const KeyValue<StringName, ThemeFontMap> &E : font_map) { for (const KeyValue<StringName, Ref<Font>> &F : E.value) { list.push_back(PropertyInfo(Variant::OBJECT, String() + E.key + "/fonts/" + F.key, PROPERTY_HINT_RESOURCE_TYPE, "Font", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_STORE_IF_NULL)); } } // Font sizes. - for (const KeyValue<StringName, HashMap<StringName, int>> &E : font_size_map) { + for (const KeyValue<StringName, ThemeFontSizeMap> &E : font_size_map) { for (const KeyValue<StringName, int> &F : E.value) { list.push_back(PropertyInfo(Variant::INT, String() + E.key + "/font_sizes/" + F.key, PROPERTY_HINT_RANGE, "0,256,1,or_greater")); } } // Colors. - for (const KeyValue<StringName, HashMap<StringName, Color>> &E : color_map) { + for (const KeyValue<StringName, ThemeColorMap> &E : color_map) { for (const KeyValue<StringName, Color> &F : E.value) { - list.push_back(PropertyInfo(Variant::INT, String() + E.key + "/colors/" + F.key)); + list.push_back(PropertyInfo(Variant::COLOR, String() + E.key + "/colors/" + F.key)); } } // Constants. - for (const KeyValue<StringName, HashMap<StringName, int>> &E : constant_map) { + for (const KeyValue<StringName, ThemeConstantMap> &E : constant_map) { for (const KeyValue<StringName, int> &F : E.value) { list.push_back(PropertyInfo(Variant::INT, String() + E.key + "/constants/" + F.key)); } @@ -407,7 +407,7 @@ void Theme::add_icon_type(const StringName &p_theme_type) { if (icon_map.has(p_theme_type)) { return; } - icon_map[p_theme_type] = HashMap<StringName, Ref<Texture2D>>(); + icon_map[p_theme_type] = ThemeIconMap(); } void Theme::remove_icon_type(const StringName &p_theme_type) { @@ -432,7 +432,7 @@ void Theme::remove_icon_type(const StringName &p_theme_type) { void Theme::get_icon_type_list(List<StringName> *p_list) const { ERR_FAIL_NULL(p_list); - for (const KeyValue<StringName, HashMap<StringName, Ref<Texture2D>>> &E : icon_map) { + for (const KeyValue<StringName, ThemeIconMap> &E : icon_map) { p_list->push_back(E.key); } } @@ -517,7 +517,7 @@ void Theme::add_stylebox_type(const StringName &p_theme_type) { if (style_map.has(p_theme_type)) { return; } - style_map[p_theme_type] = HashMap<StringName, Ref<StyleBox>>(); + style_map[p_theme_type] = ThemeStyleMap(); } void Theme::remove_stylebox_type(const StringName &p_theme_type) { @@ -542,7 +542,7 @@ void Theme::remove_stylebox_type(const StringName &p_theme_type) { void Theme::get_stylebox_type_list(List<StringName> *p_list) const { ERR_FAIL_NULL(p_list); - for (const KeyValue<StringName, HashMap<StringName, Ref<StyleBox>>> &E : style_map) { + for (const KeyValue<StringName, ThemeStyleMap> &E : style_map) { p_list->push_back(E.key); } } @@ -629,7 +629,7 @@ void Theme::add_font_type(const StringName &p_theme_type) { if (font_map.has(p_theme_type)) { return; } - font_map[p_theme_type] = HashMap<StringName, Ref<Font>>(); + font_map[p_theme_type] = ThemeFontMap(); } void Theme::remove_font_type(const StringName &p_theme_type) { @@ -654,7 +654,7 @@ void Theme::remove_font_type(const StringName &p_theme_type) { void Theme::get_font_type_list(List<StringName> *p_list) const { ERR_FAIL_NULL(p_list); - for (const KeyValue<StringName, HashMap<StringName, Ref<Font>>> &E : font_map) { + for (const KeyValue<StringName, ThemeFontMap> &E : font_map) { p_list->push_back(E.key); } } @@ -728,7 +728,7 @@ void Theme::add_font_size_type(const StringName &p_theme_type) { if (font_size_map.has(p_theme_type)) { return; } - font_size_map[p_theme_type] = HashMap<StringName, int>(); + font_size_map[p_theme_type] = ThemeFontSizeMap(); } void Theme::remove_font_size_type(const StringName &p_theme_type) { @@ -742,7 +742,7 @@ void Theme::remove_font_size_type(const StringName &p_theme_type) { void Theme::get_font_size_type_list(List<StringName> *p_list) const { ERR_FAIL_NULL(p_list); - for (const KeyValue<StringName, HashMap<StringName, int>> &E : font_size_map) { + for (const KeyValue<StringName, ThemeFontSizeMap> &E : font_size_map) { p_list->push_back(E.key); } } @@ -814,7 +814,7 @@ void Theme::add_color_type(const StringName &p_theme_type) { if (color_map.has(p_theme_type)) { return; } - color_map[p_theme_type] = HashMap<StringName, Color>(); + color_map[p_theme_type] = ThemeColorMap(); } void Theme::remove_color_type(const StringName &p_theme_type) { @@ -828,7 +828,7 @@ void Theme::remove_color_type(const StringName &p_theme_type) { void Theme::get_color_type_list(List<StringName> *p_list) const { ERR_FAIL_NULL(p_list); - for (const KeyValue<StringName, HashMap<StringName, Color>> &E : color_map) { + for (const KeyValue<StringName, ThemeColorMap> &E : color_map) { p_list->push_back(E.key); } } @@ -900,7 +900,7 @@ void Theme::add_constant_type(const StringName &p_theme_type) { if (constant_map.has(p_theme_type)) { return; } - constant_map[p_theme_type] = HashMap<StringName, int>(); + constant_map[p_theme_type] = ThemeConstantMap(); } void Theme::remove_constant_type(const StringName &p_theme_type) { @@ -914,7 +914,7 @@ void Theme::remove_constant_type(const StringName &p_theme_type) { void Theme::get_constant_type_list(List<StringName> *p_list) const { ERR_FAIL_NULL(p_list); - for (const KeyValue<StringName, HashMap<StringName, int>> &E : constant_map) { + for (const KeyValue<StringName, ThemeConstantMap> &E : constant_map) { p_list->push_back(E.key); } } @@ -1278,32 +1278,32 @@ void Theme::get_type_list(List<StringName> *p_list) const { RBSet<StringName> types; // Icons. - for (const KeyValue<StringName, HashMap<StringName, Ref<Texture2D>>> &E : icon_map) { + for (const KeyValue<StringName, ThemeIconMap> &E : icon_map) { types.insert(E.key); } // Styles. - for (const KeyValue<StringName, HashMap<StringName, Ref<StyleBox>>> &E : style_map) { + for (const KeyValue<StringName, ThemeStyleMap> &E : style_map) { types.insert(E.key); } // Fonts. - for (const KeyValue<StringName, HashMap<StringName, Ref<Font>>> &E : font_map) { + for (const KeyValue<StringName, ThemeFontMap> &E : font_map) { types.insert(E.key); } // Font sizes. - for (const KeyValue<StringName, HashMap<StringName, int>> &E : font_size_map) { + for (const KeyValue<StringName, ThemeFontSizeMap> &E : font_size_map) { types.insert(E.key); } // Colors. - for (const KeyValue<StringName, HashMap<StringName, Color>> &E : color_map) { + for (const KeyValue<StringName, ThemeColorMap> &E : color_map) { types.insert(E.key); } // Constants. - for (const KeyValue<StringName, HashMap<StringName, int>> &E : constant_map) { + for (const KeyValue<StringName, ThemeConstantMap> &E : constant_map) { types.insert(E.key); } @@ -1620,7 +1620,7 @@ void Theme::merge_with(const Ref<Theme> &p_other) { // Colors. { - for (const KeyValue<StringName, HashMap<StringName, Color>> &E : p_other->color_map) { + for (const KeyValue<StringName, ThemeColorMap> &E : p_other->color_map) { for (const KeyValue<StringName, Color> &F : E.value) { set_color(F.key, E.key, F.value); } @@ -1629,7 +1629,7 @@ void Theme::merge_with(const Ref<Theme> &p_other) { // Constants. { - for (const KeyValue<StringName, HashMap<StringName, int>> &E : p_other->constant_map) { + for (const KeyValue<StringName, ThemeConstantMap> &E : p_other->constant_map) { for (const KeyValue<StringName, int> &F : E.value) { set_constant(F.key, E.key, F.value); } @@ -1638,7 +1638,7 @@ void Theme::merge_with(const Ref<Theme> &p_other) { // Fonts. { - for (const KeyValue<StringName, HashMap<StringName, Ref<Font>>> &E : p_other->font_map) { + for (const KeyValue<StringName, ThemeFontMap> &E : p_other->font_map) { for (const KeyValue<StringName, Ref<Font>> &F : E.value) { set_font(F.key, E.key, F.value); } @@ -1647,7 +1647,7 @@ void Theme::merge_with(const Ref<Theme> &p_other) { // Font sizes. { - for (const KeyValue<StringName, HashMap<StringName, int>> &E : p_other->font_size_map) { + for (const KeyValue<StringName, ThemeFontSizeMap> &E : p_other->font_size_map) { for (const KeyValue<StringName, int> &F : E.value) { set_font_size(F.key, E.key, F.value); } @@ -1656,7 +1656,7 @@ void Theme::merge_with(const Ref<Theme> &p_other) { // Icons. { - for (const KeyValue<StringName, HashMap<StringName, Ref<Texture2D>>> &E : p_other->icon_map) { + for (const KeyValue<StringName, ThemeIconMap> &E : p_other->icon_map) { for (const KeyValue<StringName, Ref<Texture2D>> &F : E.value) { set_icon(F.key, E.key, F.value); } @@ -1665,7 +1665,7 @@ void Theme::merge_with(const Ref<Theme> &p_other) { // Styleboxes. { - for (const KeyValue<StringName, HashMap<StringName, Ref<StyleBox>>> &E : p_other->style_map) { + for (const KeyValue<StringName, ThemeStyleMap> &E : p_other->style_map) { for (const KeyValue<StringName, Ref<StyleBox>> &F : E.value) { set_stylebox(F.key, E.key, F.value); } @@ -1685,7 +1685,7 @@ void Theme::merge_with(const Ref<Theme> &p_other) { void Theme::clear() { // These items need disconnecting. { - for (const KeyValue<StringName, HashMap<StringName, Ref<Texture2D>>> &E : icon_map) { + for (const KeyValue<StringName, ThemeIconMap> &E : icon_map) { for (const KeyValue<StringName, Ref<Texture2D>> &F : E.value) { if (F.value.is_valid()) { Ref<Texture2D> icon = F.value; @@ -1696,7 +1696,7 @@ void Theme::clear() { } { - for (const KeyValue<StringName, HashMap<StringName, Ref<StyleBox>>> &E : style_map) { + for (const KeyValue<StringName, ThemeStyleMap> &E : style_map) { for (const KeyValue<StringName, Ref<StyleBox>> &F : E.value) { if (F.value.is_valid()) { Ref<StyleBox> style = F.value; @@ -1707,7 +1707,7 @@ void Theme::clear() { } { - for (const KeyValue<StringName, HashMap<StringName, Ref<Font>>> &E : font_map) { + for (const KeyValue<StringName, ThemeFontMap> &E : font_map) { for (const KeyValue<StringName, Ref<Font>> &F : E.value) { if (F.value.is_valid()) { Ref<Font> font = F.value; |