diff options
author | Aren Villanueva <arenvillanueva@yomogi-soft.com> | 2016-04-21 11:58:53 +1000 |
---|---|---|
committer | Aren Villanueva <arenvillanueva@yomogi-soft.com> | 2016-04-21 11:58:53 +1000 |
commit | d75856146cccd9547eb41ce64bca95cd71f6fb66 (patch) | |
tree | 632a31a3552d217e3a6b8ab30c61c48e599082b6 /scene/resources | |
parent | c0ec7e933ac6b6419e564b276b49c8d9a6d03f30 (diff) |
Adds a remove class item option in the theme editor.
I've also added a get_stylebox_types helper function to the theme class in order to figure out exactly what types are available to a theme.
Diffstat (limited to 'scene/resources')
-rw-r--r-- | scene/resources/theme.cpp | 9 | ||||
-rw-r--r-- | scene/resources/theme.h | 2 |
2 files changed, 10 insertions, 1 deletions
diff --git a/scene/resources/theme.cpp b/scene/resources/theme.cpp index 74e59b09c3..20405a57b2 100644 --- a/scene/resources/theme.cpp +++ b/scene/resources/theme.cpp @@ -370,6 +370,13 @@ void Theme::get_stylebox_list(StringName p_type, List<StringName> *p_list) const } +void Theme::get_stylebox_types(List<StringName> *p_list) const { + const StringName *key=NULL; + while((key=style_map.next(key))) { + p_list->push_back(*key); + } +} + void Theme::set_font(const StringName& p_name,const StringName& p_type,const Ref<Font>& p_font) { ERR_FAIL_COND(p_font.is_null()); @@ -380,7 +387,6 @@ void Theme::set_font(const StringName& p_name,const StringName& p_type,const Ref if (new_value) { _change_notify(); emit_changed();; - } } Ref<Font> Theme::get_font(const StringName& p_name,const StringName& p_type) const { @@ -604,6 +610,7 @@ void Theme::_bind_methods() { ObjectTypeDB::bind_method(_MD("has_stylebox","name","type"),&Theme::has_stylebox); ObjectTypeDB::bind_method(_MD("clear_stylebox","name","type"),&Theme::clear_stylebox); ObjectTypeDB::bind_method(_MD("get_stylebox_list","type"),&Theme::_get_stylebox_list); + ObjectTypeDB::bind_method(_MD("get_stylebox_types"),&Theme::_get_stylebox_types); ObjectTypeDB::bind_method(_MD("set_font","name","type","font:Font"),&Theme::set_font); ObjectTypeDB::bind_method(_MD("get_font:Font","name","type"),&Theme::get_font); diff --git a/scene/resources/theme.h b/scene/resources/theme.h index 36630087f6..9b84d0e8ad 100644 --- a/scene/resources/theme.h +++ b/scene/resources/theme.h @@ -65,6 +65,7 @@ protected: DVector<String> _get_icon_list(const String& p_type) const { DVector<String> ilret; List<StringName> il; get_icon_list(p_type,&il); for(List<StringName>::Element *E=il.front();E;E=E->next()) { ilret.push_back(E->get()); } return ilret; } DVector<String> _get_stylebox_list(const String& p_type) const { DVector<String> ilret; List<StringName> il; get_stylebox_list(p_type,&il); for(List<StringName>::Element *E=il.front();E;E=E->next()) { ilret.push_back(E->get()); } return ilret; } + DVector<String> _get_stylebox_types(void) const { DVector<String> ilret; List<StringName> il; get_stylebox_types(&il); for(List<StringName>::Element *E=il.front();E;E=E->next()) { ilret.push_back(E->get()); } return ilret; } DVector<String> _get_font_list(const String& p_type) const { DVector<String> ilret; List<StringName> il; get_font_list(p_type,&il); for(List<StringName>::Element *E=il.front();E;E=E->next()) { ilret.push_back(E->get()); } return ilret; } DVector<String> _get_color_list(const String& p_type) const { DVector<String> ilret; List<StringName> il; get_color_list(p_type,&il); for(List<StringName>::Element *E=il.front();E;E=E->next()) { ilret.push_back(E->get()); } return ilret; } DVector<String> _get_constant_list(const String& p_type) const { DVector<String> ilret; List<StringName> il; get_constant_list(p_type,&il); for(List<StringName>::Element *E=il.front();E;E=E->next()) { ilret.push_back(E->get()); } return ilret; } @@ -100,6 +101,7 @@ public: bool has_stylebox(const StringName& p_name,const StringName& p_type) const; void clear_stylebox(const StringName& p_name,const StringName& p_type); void get_stylebox_list(StringName p_type, List<StringName> *p_list) const; + void get_stylebox_types(List<StringName> *p_list) const; void set_font(const StringName& p_name,const StringName& p_type,const Ref<Font>& p_font); Ref<Font> get_font(const StringName& p_name,const StringName& p_type) const; |