diff options
Diffstat (limited to 'scene/resources/theme.cpp')
-rw-r--r-- | scene/resources/theme.cpp | 104 |
1 files changed, 52 insertions, 52 deletions
diff --git a/scene/resources/theme.cpp b/scene/resources/theme.cpp index 685b2e07e1..74e59b09c3 100644 --- a/scene/resources/theme.cpp +++ b/scene/resources/theme.cpp @@ -104,67 +104,67 @@ bool Theme::_get(const StringName& p_name,Variant &r_ret) const { } void Theme::_get_property_list( List<PropertyInfo> *p_list) const { - + List<PropertyInfo> list; const StringName *key=NULL; - + while((key=icon_map.next(key))) { - + const StringName *key2=NULL; - + while((key2=icon_map[*key].next(key2))) { list.push_back( PropertyInfo( Variant::OBJECT, String()+*key+"/icons/"+*key2, PROPERTY_HINT_RESOURCE_TYPE, "Texture" ) ); } } - + key=NULL; - + while((key=style_map.next(key))) { - + const StringName *key2=NULL; - + while((key2=style_map[*key].next(key2))) { - + list.push_back( PropertyInfo( Variant::OBJECT, String()+*key+"/styles/"+*key2, PROPERTY_HINT_RESOURCE_TYPE, "StyleBox" ) ); } } - + key=NULL; - + while((key=font_map.next(key))) { - + const StringName *key2=NULL; - + while((key2=font_map[*key].next(key2))) { - + list.push_back( PropertyInfo( Variant::OBJECT, String()+*key+"/fonts/"+*key2, PROPERTY_HINT_RESOURCE_TYPE, "Font" ) ); } } - + key=NULL; - + while((key=color_map.next(key))) { - + const StringName *key2=NULL; - + while((key2=color_map[*key].next(key2))) { - + list.push_back( PropertyInfo( Variant::COLOR, String()+*key+"/colors/"+*key2 ) ); } } - + key=NULL; - + while((key=constant_map.next(key))) { - + const StringName *key2=NULL; - + while((key2=constant_map[*key].next(key2))) { - + list.push_back( PropertyInfo( Variant::INT, String()+*key+"/constants/"+*key2 ) ); } } @@ -173,12 +173,12 @@ void Theme::_get_property_list( List<PropertyInfo> *p_list) const { for(List<PropertyInfo>::Element *E=list.front();E;E=E->next()) { p_list->push_back(E->get()); } - + } Ref<Theme> Theme::get_default() { - - return default_theme; + + return default_theme; } @@ -193,7 +193,7 @@ Ref<Font> Theme::get_default_theme_font() const { } void Theme::set_default(const Ref<Theme>& p_default) { - + default_theme=p_default; } @@ -221,7 +221,7 @@ void Theme::set_icon(const StringName& p_name,const StringName& p_type,const Ref bool new_value=!icon_map.has(p_type) || !icon_map[p_type].has(p_name); - icon_map[p_type][p_name]=p_icon; + icon_map[p_type][p_name]=p_icon; if (new_value) { _change_notify(); @@ -229,7 +229,7 @@ void Theme::set_icon(const StringName& p_name,const StringName& p_type,const Ref } } Ref<Texture> Theme::get_icon(const StringName& p_name,const StringName& p_type) const { - + if (icon_map.has(p_type) && icon_map[p_type].has(p_name) && icon_map[p_type][p_name].is_valid()) { return icon_map[p_type][p_name]; @@ -239,7 +239,7 @@ Ref<Texture> Theme::get_icon(const StringName& p_name,const StringName& p_type) } bool Theme::has_icon(const StringName& p_name,const StringName& p_type) const { - + return (icon_map.has(p_type) && icon_map[p_type].has(p_name)); } @@ -266,13 +266,13 @@ void Theme::get_icon_list(StringName p_type, List<StringName> *p_list) const { p_list->push_back(*key); } - + } void Theme::set_shader(const StringName &p_name,const StringName &p_type,const Ref<Shader>& p_shader) { bool new_value=!shader_map.has(p_type) || !shader_map[p_type].has(p_name); - shader_map[p_type][p_name]=p_shader; + shader_map[p_type][p_name]=p_shader; if (new_value) { _change_notify(); @@ -311,7 +311,7 @@ void Theme::get_shader_list(const StringName &p_type, List<StringName> *p_list) p_list->push_back(*key); } - + } @@ -331,7 +331,7 @@ void Theme::set_stylebox(const StringName& p_name,const StringName& p_type,const Ref<StyleBox> Theme::get_stylebox(const StringName& p_name,const StringName& p_type) const { - + if (style_map.has(p_type) && style_map[p_type].has(p_name) && style_map[p_type][p_name].is_valid()) { return style_map[p_type][p_name]; @@ -341,7 +341,7 @@ Ref<StyleBox> Theme::get_stylebox(const StringName& p_name,const StringName& p_t } bool Theme::has_stylebox(const StringName& p_name,const StringName& p_type) const { - + return (style_map.has(p_type) && style_map[p_type].has(p_name) ); } @@ -384,18 +384,18 @@ void Theme::set_font(const StringName& p_name,const StringName& p_type,const Ref } } Ref<Font> Theme::get_font(const StringName& p_name,const StringName& p_type) const { - + if (font_map.has(p_type) && font_map[p_type].has(p_name) && font_map[p_type][p_name].is_valid()) - return font_map[p_type][p_name]; + return font_map[p_type][p_name]; else if (default_theme_font.is_valid()) return default_theme_font; else return default_font; - + } bool Theme::has_font(const StringName& p_name,const StringName& p_type) const { - + return (font_map.has(p_type) && font_map[p_type].has(p_name)); } @@ -425,7 +425,7 @@ void Theme::get_font_list(StringName p_type, List<StringName> *p_list) const { } void Theme::set_color(const StringName& p_name,const StringName& p_type,const Color& p_color) { - + bool new_value=!color_map.has(p_type) || !color_map[p_type].has(p_name); color_map[p_type][p_name]=p_color; @@ -440,16 +440,16 @@ void Theme::set_color(const StringName& p_name,const StringName& p_type,const Co Color Theme::get_color(const StringName& p_name,const StringName& p_type) const { - + if (color_map.has(p_type) && color_map[p_type].has(p_name)) - return color_map[p_type][p_name]; + return color_map[p_type][p_name]; else return Color(); - + } bool Theme::has_color(const StringName& p_name,const StringName& p_type) const { - + return (color_map.has(p_type) && color_map[p_type].has(p_name)); } @@ -479,7 +479,7 @@ void Theme::get_color_list(StringName p_type, List<StringName> *p_list) const { } void Theme::set_constant(const StringName& p_name,const StringName& p_type,int p_constant) { - + bool new_value=!constant_map.has(p_type) || !constant_map[p_type].has(p_name); constant_map[p_type][p_name]=p_constant; @@ -490,17 +490,17 @@ void Theme::set_constant(const StringName& p_name,const StringName& p_type,int p } int Theme::get_constant(const StringName& p_name,const StringName& p_type) const { - + if (constant_map.has(p_type) && constant_map[p_type].has(p_name)) - return constant_map[p_type][p_name]; + return constant_map[p_type][p_name]; else { return 0; } - + } bool Theme::has_constant(const StringName& p_name,const StringName& p_type) const { - + return (constant_map.has(p_type) && constant_map[p_type].has(p_name)); } @@ -635,8 +635,8 @@ void Theme::_bind_methods() { } Theme::Theme() { - - + + } |