From 1322dc77ec087d634072eb341a2ed66dc61eff32 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mart=C3=ADn=20Lucas=20Golini?= Date: Sun, 27 Jan 2019 13:47:05 -0300 Subject: [PATCH] More CSS and UIStyle clean up. --HG-- branch : dev --- include/eepp/ui/css/stylesheet.hpp | 2 +- include/eepp/ui/css/stylesheetproperty.hpp | 8 ++ include/eepp/ui/uistyle.hpp | 29 +---- src/eepp/ui/css/stylesheet.cpp | 4 +- src/eepp/ui/css/stylesheetproperty.cpp | 22 ++++ src/eepp/ui/css/stylesheetselector.cpp | 2 +- src/eepp/ui/uistyle.cpp | 135 ++++++--------------- src/eepp/ui/uitextview.cpp | 5 +- src/eepp/ui/uiwidget.cpp | 30 ++--- 9 files changed, 93 insertions(+), 144 deletions(-) diff --git a/include/eepp/ui/css/stylesheet.hpp b/include/eepp/ui/css/stylesheet.hpp index 152425d56..7a85dbbdc 100644 --- a/include/eepp/ui/css/stylesheet.hpp +++ b/include/eepp/ui/css/stylesheet.hpp @@ -25,7 +25,7 @@ class EE_API StyleSheet { StyleSheetPseudoClassProperties getElementPropertiesByState( StyleSheetElement * element ); - StyleSheetStyleVector getElementStyles( StyleSheetElement * element ); + StyleSheetStyleVector getElementStyles( StyleSheetElement * element, const bool& applyPseudo = false ); const StyleSheetStyleList& getStyles() const; protected: diff --git a/include/eepp/ui/css/stylesheetproperty.hpp b/include/eepp/ui/css/stylesheetproperty.hpp index 533f5f520..9dff66cae 100644 --- a/include/eepp/ui/css/stylesheetproperty.hpp +++ b/include/eepp/ui/css/stylesheetproperty.hpp @@ -13,6 +13,8 @@ class EE_API StyleSheetProperty { explicit StyleSheetProperty( const std::string& name, const std::string& value ); + explicit StyleSheetProperty( const std::string& name, const std::string& value, const Uint32& specificity ); + const std::string& getName() const; const std::string& getValue() const; @@ -20,6 +22,12 @@ class EE_API StyleSheetProperty { const Uint32& getSpecificity() const; void setSpecificity( const Uint32& specificity ); + + bool isEmpty() const; + + void setName(const std::string & name); + + void setValue(const std::string & value); protected: std::string mName; std::string mValue; diff --git a/include/eepp/ui/uistyle.hpp b/include/eepp/ui/uistyle.hpp index d0b6e54e5..3920af5f9 100644 --- a/include/eepp/ui/uistyle.hpp +++ b/include/eepp/ui/uistyle.hpp @@ -48,33 +48,17 @@ class EE_API UIStyle : public UIState { bool stateExists( const Uint32& state ) const; - void addAttribute( int state, NodeAttribute attribute ); - void load(); void onStateChange(); - Font * getFontFamily( const Uint32& state = StateFlagNormal ) const; + CSS::StyleSheetProperty getStyleSheetProperty( const Uint32& state, const std::string& attributeName ) const; - int getFontCharacterSize( const Uint32& state = StateFlagNormal, const int& defaultValue = 12 ) const; + CSS::StyleSheetProperty getStyleSheetPropertyFromNames( const Uint32& state, const std::vector& propertiesNames ) const; - Color getTextColor( const Uint32& state = StateFlagNormal ) const; + NodeAttribute getNodeAttribute( const Uint32& state, const std::string& attributeName ) const; - Color getTextShadowColor( const Uint32& state = StateFlagNormal ) const; - - Uint32 getTextStyle( const Uint32& state = StateFlagNormal ) const; - - Float getFontOutlineThickness( const Uint32& state = StateFlagNormal ) const; - - Color getFontOutlineColor( const Uint32& state = StateFlagNormal ) const; - - FontStyleConfig getFontStyleConfig( const Uint32& state = StateFlagNormal ) const; - - NodeAttribute getAttribute( const Uint32& state, const std::string& attributeName ) const; - - bool hasAttribute( const Uint32& state, const std::string& attributeName ) const; - - NodeAttribute getAttributeFromNames( const Uint32& state, const std::vector& attributeNames ) const; + bool hasStyleSheetProperty( const Uint32& state, const std::string& propertyName ) const; void addStyleSheetProperties( const Uint32& state, const CSS::StyleSheetProperties& properties ); @@ -84,13 +68,12 @@ class EE_API UIStyle : public UIState { TransitionInfo getTransition( const Uint32& state, const std::string& propertyName ); protected: - typedef std::map AttributesMap; typedef std::map TransitionsMap; UIWidget * mWidget; - std::map mStates; + std::map mStates; std::map mTransitions; - std::map> mTransitionAttributes; + std::map> mTransitionAttributes; void updateState(); diff --git a/src/eepp/ui/css/stylesheet.cpp b/src/eepp/ui/css/stylesheet.cpp index 848b1904d..a88143e6e 100644 --- a/src/eepp/ui/css/stylesheet.cpp +++ b/src/eepp/ui/css/stylesheet.cpp @@ -66,14 +66,14 @@ StyleSheet::StyleSheetPseudoClassProperties StyleSheet::getElementPropertiesBySt return propertiesSelectedByPseudoClass; } -StyleSheetStyleVector StyleSheet::getElementStyles( StyleSheetElement * element ) { +StyleSheetStyleVector StyleSheet::getElementStyles( StyleSheetElement * element , const bool& applyPseudo ) { StyleSheetStyleVector styles; for ( auto it = mNodes.begin(); it != mNodes.end(); ++it ) { StyleSheetStyle& node = it->second; const StyleSheetSelector& selector = node.getSelector(); - if ( selector.select( element, false ) ) { + if ( selector.select( element, applyPseudo ) ) { styles.push_back( node ); } } diff --git a/src/eepp/ui/css/stylesheetproperty.cpp b/src/eepp/ui/css/stylesheetproperty.cpp index cdcbb24cc..c66e8402a 100644 --- a/src/eepp/ui/css/stylesheetproperty.cpp +++ b/src/eepp/ui/css/stylesheetproperty.cpp @@ -1,5 +1,9 @@ #include #include +#include +#include +#include +#include namespace EE { namespace UI { namespace CSS { @@ -11,6 +15,12 @@ StyleSheetProperty::StyleSheetProperty( const std::string& name, const std::stri mValue( String::trim( value ) ) {} +StyleSheetProperty::StyleSheetProperty( const std::string & name, const std::string& value, const Uint32 & specificity ) : + mName( String::toLower( String::trim( name ) ) ), + mValue( String::trim( value ) ), + mSpecificity( specificity ) +{} + const std::string &StyleSheetProperty::getName() const { return mName; } @@ -27,4 +37,16 @@ void StyleSheetProperty::setSpecificity( const Uint32 & specificity ) { mSpecificity = specificity; } +bool StyleSheetProperty::isEmpty() const { + return mName.empty(); +} + +void StyleSheetProperty::setName( const std::string& name ) { + mName = name; +} + +void StyleSheetProperty::setValue( const std::string& value ) { + mValue = value; +} + }}} diff --git a/src/eepp/ui/css/stylesheetselector.cpp b/src/eepp/ui/css/stylesheetselector.cpp index 3b87f1603..ad653d3fb 100644 --- a/src/eepp/ui/css/stylesheetselector.cpp +++ b/src/eepp/ui/css/stylesheetselector.cpp @@ -105,7 +105,7 @@ const bool &StyleSheetSelector::isCacheable() const { return mCacheable; } -bool StyleSheetSelector::select( StyleSheetElement * element , const bool& applyPseudo ) const { +bool StyleSheetSelector::select( StyleSheetElement * element, const bool& applyPseudo ) const { if ( mSelectorRules.empty() ) return false; diff --git a/src/eepp/ui/uistyle.cpp b/src/eepp/ui/uistyle.cpp index 934f0a8a3..47f48a422 100644 --- a/src/eepp/ui/uistyle.cpp +++ b/src/eepp/ui/uistyle.cpp @@ -4,6 +4,7 @@ #include #include +using namespace EE::UI::CSS; namespace EE { namespace UI { @@ -24,24 +25,23 @@ bool UIStyle::stateExists( const EE::Uint32 & state ) const { return mStates.find( state ) != mStates.end(); } -void UIStyle::addAttribute( int state, NodeAttribute attribute ) { +void UIStyle::addStyleSheetProperty( const Uint32& state, const StyleSheetProperty& attribute ) { if ( attribute.getName() == "padding" ) { - Rectf rect( attribute.asRectf() ); - mStates[ state ][ "paddingleft" ] = NodeAttribute( "paddingleft", String::toStr( rect.Left ) ); - mStates[ state ][ "paddingright" ] = NodeAttribute( "paddingright", String::toStr( rect.Right ) ); - mStates[ state ][ "paddingtop" ] = NodeAttribute( "paddingtop", String::toStr( rect.Top ) ); - mStates[ state ][ "paddingbottom" ] = NodeAttribute( "paddingbottom", String::toStr( rect.Bottom ) ); + Rectf rect( NodeAttribute( attribute.getName(), attribute.getValue() ).asRectf() ); + mStates[ state ][ "paddingleft" ] = StyleSheetProperty( "paddingleft", String::toStr( rect.Left ), attribute.getSpecificity() ); + mStates[ state ][ "paddingright" ] = StyleSheetProperty( "paddingright", String::toStr( rect.Right ), attribute.getSpecificity() ); + mStates[ state ][ "paddingtop" ] = StyleSheetProperty( "paddingtop", String::toStr( rect.Top ), attribute.getSpecificity() ); + mStates[ state ][ "paddingbottom" ] = StyleSheetProperty( "paddingbottom", String::toStr( rect.Bottom ), attribute.getSpecificity() ); } else if ( attribute.getName() == "layout_margin" ) { - Rect rect( attribute.asRect() ); - mStates[ state ][ "layout_marginleft" ] = NodeAttribute( "layout_marginleft", String::toStr( rect.Left ) ); - mStates[ state ][ "layout_marginright" ] = NodeAttribute( "layout_marginright", String::toStr( rect.Right ) ); - mStates[ state ][ "layout_margintop" ] = NodeAttribute( "layout_margintop", String::toStr( rect.Top ) ); - mStates[ state ][ "layout_marginbottom" ] = NodeAttribute( "layout_marginbottom", String::toStr( rect.Bottom ) ); + Rect rect( NodeAttribute( attribute.getName(), attribute.getValue() ).asRect() ); + mStates[ state ][ "layout_marginleft" ] = StyleSheetProperty( "layout_marginleft", String::toStr( rect.Left ), attribute.getSpecificity() ); + mStates[ state ][ "layout_marginright" ] = StyleSheetProperty( "layout_marginright", String::toStr( rect.Right ), attribute.getSpecificity() ); + mStates[ state ][ "layout_margintop" ] = StyleSheetProperty( "layout_margintop", String::toStr( rect.Top ), attribute.getSpecificity() ); + mStates[ state ][ "layout_marginbottom" ] = StyleSheetProperty( "layout_marginbottom", String::toStr( rect.Bottom ), attribute.getSpecificity() ); } else { mStates[ state ][ attribute.getName() ] = attribute; } - if ( String::startsWith( attribute.getName(), "transition" ) ) { mTransitionAttributes[ state ].push_back( attribute ); @@ -81,15 +81,11 @@ void UIStyle::addStyleSheetProperties(const Uint32 & state, const CSS::StyleShee for ( auto it = properties.begin(); it != properties.end(); ++it ) { CSS::StyleSheetProperty property = it->second; - addAttribute( state, NodeAttribute( property.getName(), property.getValue() ) ); + addStyleSheetProperty( state, property ); } } } -void UIStyle::addStyleSheetProperty( const Uint32& state, const CSS::StyleSheetProperty& property ) { - addAttribute( state, NodeAttribute( property.getName(), property.getValue() ) ); -} - bool UIStyle::hasTransition( const Uint32& state, const std::string& propertyName ) { bool ret = mTransitions.find( state ) != mTransitions.end() && ( mTransitions[ state ].find( propertyName ) != mTransitions[ state ].end() || @@ -139,15 +135,13 @@ UIStyle::TransitionInfo UIStyle::getTransition( const Uint32& state, const std:: void UIStyle::onStateChange() { if ( NULL != mWidget && stateExists( mCurrentState ) ) { - AttributesMap& attrs = mStates[ mCurrentState ]; + auto& attrs = mStates[ mCurrentState ]; if ( !attrs.empty() ) { mWidget->beginAttributesTransaction(); - for ( auto it = attrs.begin(); it != attrs.end(); ++it ) { - NodeAttribute& nodeAttr = it->second; - - mWidget->setAttribute( nodeAttr, mCurrentState ); + for ( auto& nodeAttr : attrs ) { + mWidget->setAttribute( NodeAttribute( nodeAttr.second.getName(), nodeAttr.second.getValue() ), mCurrentState ); } mWidget->endAttributesTransaction(); @@ -155,10 +149,9 @@ void UIStyle::onStateChange() { } } - -NodeAttribute UIStyle::getAttribute( const Uint32& state, const std::string& attributeName ) const { +StyleSheetProperty UIStyle::getStyleSheetProperty( const Uint32& state, const std::string& attributeName ) const { if ( !attributeName.empty() && stateExists( state ) ) { - const AttributesMap& attributesMap = mStates.at( state ); + auto& attributesMap = mStates.at( state ); auto attributeFound = attributesMap.find( attributeName ); @@ -167,24 +160,15 @@ NodeAttribute UIStyle::getAttribute( const Uint32& state, const std::string& att } } - return NodeAttribute(); + return StyleSheetProperty(); } -bool UIStyle::hasAttribute(const Uint32 & state, const std::string & attributeName) const { - if ( !attributeName.empty() && stateExists( state ) ) { - const AttributesMap& attributesMap = mStates.at( state ); - return attributesMap.find( attributeName ) != attributesMap.end(); - } +StyleSheetProperty UIStyle::getStyleSheetPropertyFromNames( const Uint32& state, const std::vector& propertiesNames ) const { + if ( !propertiesNames.empty() && stateExists( state ) ) { + auto& attributesMap = mStates.at( state ); - return false; -} - -NodeAttribute UIStyle::getAttributeFromNames( const Uint32& state, const std::vector& attributeNames ) const { - if ( !attributeNames.empty() && stateExists( state ) ) { - const AttributesMap& attributesMap = mStates.at( state ); - - for ( size_t i = 0; i < attributeNames.size(); i++ ) { - const std::string& name = attributeNames[i]; + for ( size_t i = 0; i < propertiesNames.size(); i++ ) { + const std::string& name = propertiesNames[i]; auto attributeFound = attributesMap.find( name ); if ( attributeFound != attributesMap.end() ) { @@ -194,69 +178,21 @@ NodeAttribute UIStyle::getAttributeFromNames( const Uint32& state, const std::ve } } - return NodeAttribute(); + return StyleSheetProperty(); } -Font * UIStyle::getFontFamily( const Uint32& state ) const { - NodeAttribute attribute = getAttributeFromNames( state, { "fontfamily", "fontname" } ); +NodeAttribute UIStyle::getNodeAttribute( const Uint32& state, const std::string& attributeName ) const { + StyleSheetProperty property( getStyleSheetProperty( state, attributeName ) ); + return NodeAttribute( property.getName(), property.getValue() ); +} - if ( !attribute.isEmpty() ) { - return FontManager::instance()->getByName( attribute.asString() ); +bool UIStyle::hasStyleSheetProperty( const Uint32 & state, const std::string& propertyName ) const { + if ( !propertyName.empty() && stateExists( state ) ) { + auto& attributesMap = mStates.at( state ); + return attributesMap.find( propertyName ) != attributesMap.end(); } - return UIThemeManager::instance()->getDefaultFont(); -} - -int UIStyle::getFontCharacterSize(const Uint32& state, const int& defaultValue ) const { - NodeAttribute attribute = getAttributeFromNames( state, { "textsize", "fontsize", "charactersize" } ); - - if ( !attribute.isEmpty() ) { - return attribute.asDpDimensionI(); - } - - return defaultValue; -} - -Color UIStyle::getTextColor( const Uint32& state ) const { - NodeAttribute attribute = getAttribute( state, "textcolor" ); - - return attribute.isEmpty() ? Color::White : attribute.asColor(); -} - -Color UIStyle::getTextShadowColor( const Uint32& state ) const { - NodeAttribute attribute = getAttribute( state, "textshadowcolor" ); - - return attribute.isEmpty() ? Color::Black : attribute.asColor(); -} - -Uint32 UIStyle::getTextStyle( const Uint32& state ) const { - NodeAttribute attribute = getAttribute( state, "textstyle" ); - - return attribute.isEmpty() ? 0 : attribute.asFontStyle(); -} - -Float UIStyle::getFontOutlineThickness( const Uint32& state ) const { - NodeAttribute attribute = getAttribute( state, "fontoutlinethickness" ); - - return attribute.isEmpty() ? 0.f : attribute.asFloat(); -} - -Color UIStyle::getFontOutlineColor( const Uint32& state ) const { - NodeAttribute attribute = getAttribute( state, "fontoutlinecolor" ); - - return attribute.isEmpty() ? Color::White : attribute.asColor(); -} - -FontStyleConfig UIStyle::getFontStyleConfig( const Uint32& state ) const { - FontStyleConfig fontStyleConfig; - fontStyleConfig.Font = getFontFamily( state ); - fontStyleConfig.CharacterSize = getFontCharacterSize( state ); - fontStyleConfig.Style = getTextStyle( state ); - fontStyleConfig.FontColor = getTextColor( state ); - fontStyleConfig.ShadowColor = getTextShadowColor( state ); - fontStyleConfig.OutlineColor = getFontOutlineColor( state ); - fontStyleConfig.OutlineThickness = getFontOutlineThickness( state ); - return fontStyleConfig; + return false; } void UIStyle::updateState() { @@ -295,8 +231,7 @@ void UIStyle::parseTransitions( const Uint32& state ) { auto transitionAttributes = mTransitionAttributes[ state ]; - for ( auto it = transitionAttributes.begin(); it != transitionAttributes.end(); ++it ) { - NodeAttribute& attr = *it; + for ( auto& attr : transitionAttributes ) { if ( attr.getName() == "transition" ) { auto strTransitions = String::split( attr.getValue(), ',' ); diff --git a/src/eepp/ui/uitextview.cpp b/src/eepp/ui/uitextview.cpp index da6820d7c..6e4a61acf 100644 --- a/src/eepp/ui/uitextview.cpp +++ b/src/eepp/ui/uitextview.cpp @@ -9,6 +9,7 @@ #include #include #include +#include namespace EE { namespace UI { @@ -552,9 +553,9 @@ void UITextView::resetSelCache() { } #define SAVE_NORMAL_STATE_ATTR( ATTR_FORMATED ) \ - NodeAttribute oldAttribute = mStyle->getAttribute( UIState::StateFlagNormal, attribute.getName() ); \ + CSS::StyleSheetProperty oldAttribute = mStyle->getStyleSheetProperty( UIState::StateFlagNormal, attribute.getName() ); \ if ( oldAttribute.isEmpty() && mStyle->getPreviousState() == UIState::StateFlagNormal ) \ - mStyle->addAttribute( UIState::StateFlagNormal, NodeAttribute( attribute.getName(), ATTR_FORMATED ) ); \ + mStyle->addStyleSheetProperty( UIState::StateFlagNormal, CSS::StyleSheetProperty( attribute.getName(), ATTR_FORMATED ) ); \ bool UITextView::setAttribute( const NodeAttribute& attribute, const Uint32& state ) { const std::string& name = attribute.getName(); diff --git a/src/eepp/ui/uiwidget.cpp b/src/eepp/ui/uiwidget.cpp index fd1053aa4..7872dc8bf 100644 --- a/src/eepp/ui/uiwidget.cpp +++ b/src/eepp/ui/uiwidget.cpp @@ -7,6 +7,7 @@ #include #include #include +#include #include namespace EE { namespace UI { @@ -639,10 +640,9 @@ bool UIWidget::setAttribute( const std::string& name, const std::string& value, } #define SAVE_NORMAL_STATE_ATTR( ATTR_FORMATED ) \ - NodeAttribute oldAttribute = mStyle->getAttribute( UIState::StateFlagNormal, attribute.getName() ); \ + CSS::StyleSheetProperty oldAttribute = mStyle->getStyleSheetProperty( UIState::StateFlagNormal, attribute.getName() ); \ if ( oldAttribute.isEmpty() && mStyle->getPreviousState() == UIState::StateFlagNormal ) \ - mStyle->addAttribute( UIState::StateFlagNormal, NodeAttribute( attribute.getName(), ATTR_FORMATED ) ); \ - + mStyle->addStyleSheetProperty( UIState::StateFlagNormal, CSS::StyleSheetProperty( attribute.getName(), ATTR_FORMATED ) ); \ bool UIWidget::setAttribute( const NodeAttribute& attribute, const Uint32& state ) { const std::string& name = attribute.getName(); @@ -971,19 +971,19 @@ bool UIWidget::setAttribute( const NodeAttribute& attribute, const Uint32& state UIStyle::TransitionInfo transitionInfo( mStyle->getTransition( state, attribute.getName() ) ); Action * action = Actions::MarginMove::New( mLayoutMargin, margin, transitionInfo.duration, transitionInfo.timingFunction, marginFlag ); - NodeAttribute oldAttribute = mStyle->getAttribute( UIState::StateFlagNormal, attribute.getName() ); + CSS::StyleSheetProperty oldAttribute = mStyle->getStyleSheetProperty( UIState::StateFlagNormal, attribute.getName() ); if ( oldAttribute.isEmpty() && mStyle->getPreviousState() == UIState::StateFlagNormal ) { if ( "layout_marginleft" == name || "layout_margin" == name ) - mStyle->addAttribute( UIState::StateFlagNormal, NodeAttribute( attribute.getName(), String::format( "%d", mLayoutMargin.Left ) ) ); + mStyle->addStyleSheetProperty( UIState::StateFlagNormal, CSS::StyleSheetProperty( attribute.getName(), String::format( "%d", mLayoutMargin.Left ) ) ); if ( "layout_marginright" == name || "layout_margin" == name ) - mStyle->addAttribute( UIState::StateFlagNormal, NodeAttribute( attribute.getName(), String::format( "%d", mLayoutMargin.Right ) ) ); + mStyle->addStyleSheetProperty( UIState::StateFlagNormal, CSS::StyleSheetProperty( attribute.getName(), String::format( "%d", mLayoutMargin.Right ) ) ); if ( "layout_margintop" == name || "layout_margin" == name ) - mStyle->addAttribute( UIState::StateFlagNormal, NodeAttribute( attribute.getName(), String::format( "%d", mLayoutMargin.Top ) ) ); + mStyle->addStyleSheetProperty( UIState::StateFlagNormal, CSS::StyleSheetProperty( attribute.getName(), String::format( "%d", mLayoutMargin.Top ) ) ); if ( "layout_marginbottom" == name || "layout_margin" == name ) - mStyle->addAttribute( UIState::StateFlagNormal, NodeAttribute( attribute.getName(), String::format( "%d", mLayoutMargin.Bottom ) ) ); + mStyle->addStyleSheetProperty( UIState::StateFlagNormal, CSS::StyleSheetProperty( attribute.getName(), String::format( "%d", mLayoutMargin.Bottom ) ) ); } if ( Time::Zero != transitionInfo.delay ) @@ -1085,7 +1085,7 @@ bool UIWidget::setAttribute( const NodeAttribute& attribute, const Uint32& state } else if ( "rotation" == name ) { if ( !isSceneNodeLoading() && NULL != mStyle && mStyle->hasTransition( state, attribute.getName() ) ) { UIStyle::TransitionInfo transitionInfo( mStyle->getTransition( state, attribute.getName() ) ); - Float newRotation( mStyle->getAttribute( state, attribute.getName() ).asFloat() ); + Float newRotation( mStyle->getNodeAttribute( state, attribute.getName() ).asFloat() ); Action * action = Actions::Rotate::New( mRotation, newRotation, transitionInfo.duration, transitionInfo.timingFunction ); SAVE_NORMAL_STATE_ATTR( String::format( "%2.f", mRotation ) ) @@ -1100,7 +1100,7 @@ bool UIWidget::setAttribute( const NodeAttribute& attribute, const Uint32& state } else if ( "scale" == name ) { if ( !isSceneNodeLoading() && NULL != mStyle && mStyle->hasTransition( state, attribute.getName() ) ) { UIStyle::TransitionInfo transitionInfo( mStyle->getTransition( state, attribute.getName() ) ); - Vector2f newScale( mStyle->getAttribute( state, attribute.getName() ).asVector2f() ); + Vector2f newScale( mStyle->getNodeAttribute( state, attribute.getName() ).asVector2f() ); Action * action = Actions::Scale::New( mScale, newScale, transitionInfo.duration, transitionInfo.timingFunction ); SAVE_NORMAL_STATE_ATTR( String::format( "%2.f, %2.f", mScale.x, mScale.y ) ) @@ -1143,19 +1143,19 @@ bool UIWidget::setAttribute( const NodeAttribute& attribute, const Uint32& state UIStyle::TransitionInfo transitionInfo( mStyle->getTransition( state, attribute.getName() ) ); Action * action = Actions::PaddingTransition::New( mPadding, padding, transitionInfo.duration, transitionInfo.timingFunction, paddingFlag ); - NodeAttribute oldAttribute = mStyle->getAttribute( UIState::StateFlagNormal, attribute.getName() ); + CSS::StyleSheetProperty oldAttribute = mStyle->getStyleSheetProperty( UIState::StateFlagNormal, attribute.getName() ); if ( oldAttribute.isEmpty() && mStyle->getPreviousState() == UIState::StateFlagNormal ) { if ( "paddingleft" == name || "padding" == name ) - mStyle->addAttribute( UIState::StateFlagNormal, NodeAttribute( attribute.getName(), String::format( "%2.f", mPadding.Left ) ) ); + mStyle->addStyleSheetProperty( UIState::StateFlagNormal, CSS::StyleSheetProperty( attribute.getName(), String::format( "%2.f", mPadding.Left ) ) ); if ( "paddingright" == name || "padding" == name ) - mStyle->addAttribute( UIState::StateFlagNormal, NodeAttribute( attribute.getName(), String::format( "%2.f", mPadding.Right ) ) ); + mStyle->addStyleSheetProperty( UIState::StateFlagNormal, CSS::StyleSheetProperty( attribute.getName(), String::format( "%2.f", mPadding.Right ) ) ); if ( "paddingtop" == name || "padding" == name ) - mStyle->addAttribute( UIState::StateFlagNormal, NodeAttribute( attribute.getName(), String::format( "%2.f", mPadding.Top ) ) ); + mStyle->addStyleSheetProperty( UIState::StateFlagNormal, CSS::StyleSheetProperty( attribute.getName(), String::format( "%2.f", mPadding.Top ) ) ); if ( "paddingbottom" == name || "padding" == name ) - mStyle->addAttribute( UIState::StateFlagNormal, NodeAttribute( attribute.getName(), String::format( "%2.f", mPadding.Bottom ) ) ); + mStyle->addStyleSheetProperty( UIState::StateFlagNormal, CSS::StyleSheetProperty( attribute.getName(), String::format( "%2.f", mPadding.Bottom ) ) ); } if ( Time::Zero != transitionInfo.delay )