diff options
Diffstat (limited to 'scene/resources/theme.cpp')
-rw-r--r-- | scene/resources/theme.cpp | 112 |
1 files changed, 106 insertions, 6 deletions
diff --git a/scene/resources/theme.cpp b/scene/resources/theme.cpp index 6a752d32e7..c8bfcdfab4 100644 --- a/scene/resources/theme.cpp +++ b/scene/resources/theme.cpp @@ -51,6 +51,21 @@ Vector<String> Theme::_get_icon_list(const String &p_node_type) const { return ilret; } +Vector<String> Theme::_get_icon_type_list() const { + Vector<String> ilret; + List<StringName> il; + + get_icon_type_list(&il); + ilret.resize(il.size()); + + int i = 0; + String *w = ilret.ptrw(); + for (List<StringName>::Element *E = il.front(); E; E = E->next(), i++) { + w[i] = E->get(); + } + return ilret; +} + Vector<String> Theme::_get_stylebox_list(const String &p_node_type) const { Vector<String> ilret; List<StringName> il; @@ -66,11 +81,11 @@ Vector<String> Theme::_get_stylebox_list(const String &p_node_type) const { return ilret; } -Vector<String> Theme::_get_stylebox_types() const { +Vector<String> Theme::_get_stylebox_type_list() const { Vector<String> ilret; List<StringName> il; - get_stylebox_types(&il); + get_stylebox_type_list(&il); ilret.resize(il.size()); int i = 0; @@ -96,6 +111,21 @@ Vector<String> Theme::_get_font_list(const String &p_node_type) const { return ilret; } +Vector<String> Theme::_get_font_type_list() const { + Vector<String> ilret; + List<StringName> il; + + get_font_type_list(&il); + ilret.resize(il.size()); + + int i = 0; + String *w = ilret.ptrw(); + for (List<StringName>::Element *E = il.front(); E; E = E->next(), i++) { + w[i] = E->get(); + } + return ilret; +} + Vector<String> Theme::_get_font_size_list(const String &p_node_type) const { Vector<String> ilret; List<StringName> il; @@ -126,6 +156,21 @@ Vector<String> Theme::_get_color_list(const String &p_node_type) const { return ilret; } +Vector<String> Theme::_get_color_type_list() const { + Vector<String> ilret; + List<StringName> il; + + get_color_type_list(&il); + ilret.resize(il.size()); + + int i = 0; + String *w = ilret.ptrw(); + for (List<StringName>::Element *E = il.front(); E; E = E->next(), i++) { + w[i] = E->get(); + } + return ilret; +} + Vector<String> Theme::_get_constant_list(const String &p_node_type) const { Vector<String> ilret; List<StringName> il; @@ -141,7 +186,22 @@ Vector<String> Theme::_get_constant_list(const String &p_node_type) const { return ilret; } -Vector<String> Theme::_get_type_list(const String &p_node_type) const { +Vector<String> Theme::_get_constant_type_list() const { + Vector<String> ilret; + List<StringName> il; + + get_constant_type_list(&il); + ilret.resize(il.size()); + + int i = 0; + String *w = ilret.ptrw(); + for (List<StringName>::Element *E = il.front(); E; E = E->next(), i++) { + w[i] = E->get(); + } + return ilret; +} + +Vector<String> Theme::_get_type_list() const { Vector<String> ilret; List<StringName> il; @@ -421,6 +481,15 @@ void Theme::get_icon_list(StringName p_node_type, List<StringName> *p_list) cons } } +void Theme::get_icon_type_list(List<StringName> *p_list) const { + ERR_FAIL_NULL(p_list); + + const StringName *key = nullptr; + while ((key = icon_map.next(key))) { + p_list->push_back(*key); + } +} + void Theme::set_stylebox(const StringName &p_name, const StringName &p_node_type, const Ref<StyleBox> &p_style) { //ERR_FAIL_COND(p_style.is_null()); @@ -482,7 +551,7 @@ void Theme::get_stylebox_list(StringName p_node_type, List<StringName> *p_list) } } -void Theme::get_stylebox_types(List<StringName> *p_list) const { +void Theme::get_stylebox_type_list(List<StringName> *p_list) const { ERR_FAIL_NULL(p_list); const StringName *key = nullptr; @@ -553,6 +622,15 @@ void Theme::get_font_list(StringName p_node_type, List<StringName> *p_list) cons } } +void Theme::get_font_type_list(List<StringName> *p_list) const { + ERR_FAIL_NULL(p_list); + + const StringName *key = nullptr; + while ((key = font_map.next(key))) { + p_list->push_back(*key); + } +} + void Theme::set_font_size(const StringName &p_name, const StringName &p_node_type, int p_font_size) { bool new_value = !font_size_map.has(p_node_type) || !font_size_map[p_node_type].has(p_name); @@ -647,6 +725,15 @@ void Theme::get_color_list(StringName p_node_type, List<StringName> *p_list) con } } +void Theme::get_color_type_list(List<StringName> *p_list) const { + ERR_FAIL_NULL(p_list); + + const StringName *key = nullptr; + while ((key = color_map.next(key))) { + p_list->push_back(*key); + } +} + void Theme::set_constant(const StringName &p_name, const StringName &p_node_type, int p_constant) { bool new_value = !constant_map.has(p_node_type) || !constant_map[p_node_type].has(p_name); constant_map[p_node_type][p_name] = p_constant; @@ -692,6 +779,15 @@ void Theme::get_constant_list(StringName p_node_type, List<StringName> *p_list) } } +void Theme::get_constant_type_list(List<StringName> *p_list) const { + ERR_FAIL_NULL(p_list); + + const StringName *key = nullptr; + while ((key = constant_map.next(key))) { + p_list->push_back(*key); + } +} + void Theme::clear() { //these need disconnecting { @@ -840,19 +936,21 @@ void Theme::_bind_methods() { ClassDB::bind_method(D_METHOD("has_icon", "name", "node_type"), &Theme::has_icon); ClassDB::bind_method(D_METHOD("clear_icon", "name", "node_type"), &Theme::clear_icon); ClassDB::bind_method(D_METHOD("get_icon_list", "node_type"), &Theme::_get_icon_list); + ClassDB::bind_method(D_METHOD("get_icon_type_list"), &Theme::_get_icon_type_list); ClassDB::bind_method(D_METHOD("set_stylebox", "name", "node_type", "texture"), &Theme::set_stylebox); ClassDB::bind_method(D_METHOD("get_stylebox", "name", "node_type"), &Theme::get_stylebox); ClassDB::bind_method(D_METHOD("has_stylebox", "name", "node_type"), &Theme::has_stylebox); ClassDB::bind_method(D_METHOD("clear_stylebox", "name", "node_type"), &Theme::clear_stylebox); ClassDB::bind_method(D_METHOD("get_stylebox_list", "node_type"), &Theme::_get_stylebox_list); - ClassDB::bind_method(D_METHOD("get_stylebox_types"), &Theme::_get_stylebox_types); + ClassDB::bind_method(D_METHOD("get_stylebox_type_list"), &Theme::_get_stylebox_type_list); ClassDB::bind_method(D_METHOD("set_font", "name", "node_type", "font"), &Theme::set_font); ClassDB::bind_method(D_METHOD("get_font", "name", "node_type"), &Theme::get_font); ClassDB::bind_method(D_METHOD("has_font", "name", "node_type"), &Theme::has_font); ClassDB::bind_method(D_METHOD("clear_font", "name", "node_type"), &Theme::clear_font); ClassDB::bind_method(D_METHOD("get_font_list", "node_type"), &Theme::_get_font_list); + ClassDB::bind_method(D_METHOD("get_font_type_list"), &Theme::_get_font_type_list); ClassDB::bind_method(D_METHOD("set_font_size", "name", "node_type", "font_size"), &Theme::set_font_size); ClassDB::bind_method(D_METHOD("get_font_size", "name", "node_type"), &Theme::get_font_size); @@ -865,12 +963,14 @@ void Theme::_bind_methods() { ClassDB::bind_method(D_METHOD("has_color", "name", "node_type"), &Theme::has_color); ClassDB::bind_method(D_METHOD("clear_color", "name", "node_type"), &Theme::clear_color); ClassDB::bind_method(D_METHOD("get_color_list", "node_type"), &Theme::_get_color_list); + ClassDB::bind_method(D_METHOD("get_color_type_list"), &Theme::_get_color_type_list); ClassDB::bind_method(D_METHOD("set_constant", "name", "node_type", "constant"), &Theme::set_constant); ClassDB::bind_method(D_METHOD("get_constant", "name", "node_type"), &Theme::get_constant); ClassDB::bind_method(D_METHOD("has_constant", "name", "node_type"), &Theme::has_constant); ClassDB::bind_method(D_METHOD("clear_constant", "name", "node_type"), &Theme::clear_constant); ClassDB::bind_method(D_METHOD("get_constant_list", "node_type"), &Theme::_get_constant_list); + ClassDB::bind_method(D_METHOD("get_constant_type_list"), &Theme::_get_constant_type_list); ClassDB::bind_method(D_METHOD("clear"), &Theme::clear); @@ -880,7 +980,7 @@ void Theme::_bind_methods() { ClassDB::bind_method(D_METHOD("set_default_font_size", "font_size"), &Theme::set_default_theme_font_size); ClassDB::bind_method(D_METHOD("get_default_font_size"), &Theme::get_default_theme_font_size); - ClassDB::bind_method(D_METHOD("get_type_list", "node_type"), &Theme::_get_type_list); + ClassDB::bind_method(D_METHOD("get_type_list"), &Theme::_get_type_list); ClassDB::bind_method("copy_default_theme", &Theme::copy_default_theme); ClassDB::bind_method(D_METHOD("copy_theme", "other"), &Theme::copy_theme); |