diff --git a/bin/assets/layouts/test.css b/bin/assets/layouts/test.css index 5ca62475d..61bafed04 100644 --- a/bin/assets/layouts/test.css +++ b/bin/assets/layouts/test.css @@ -94,7 +94,7 @@ Tooltip { layout_marginLeft: 0; padding: 24dp; opacity: 0.8; - backgroundColor: #333; +/* backgroundColor: #333;*/ transition: all 0.25s; } diff --git a/include/eepp/ui/uinode.hpp b/include/eepp/ui/uinode.hpp index 6740c057b..d71624dfe 100644 --- a/include/eepp/ui/uinode.hpp +++ b/include/eepp/ui/uinode.hpp @@ -147,13 +147,9 @@ class EE_API UINode : public Node { UINode * setSkin( UISkin * skin ); - UINode * setSkinColor( const Uint32& state, const Color& color ); - UINode * setSkinColor( const Color& color ); - Color getSkinColor( const Uint32& state )const; - - Color getSkinColor() const; + const Color& getSkinColor() const; void removeSkin(); @@ -195,6 +191,7 @@ class EE_API UINode : public Node { RectangleDrawable * mBorder; Vector2f mDragPoint; Uint32 mDragButton; + Color mSkinColor; virtual Uint32 onMouseDown( const Vector2i& position, const Uint32& flags ); diff --git a/src/eepp/scene/actions/tint.cpp b/src/eepp/scene/actions/tint.cpp index 61fef1d32..1f5cfa783 100644 --- a/src/eepp/scene/actions/tint.cpp +++ b/src/eepp/scene/actions/tint.cpp @@ -148,7 +148,7 @@ void Tint::onUpdate( const Time& ) { } case Skin: { - widget->setSkinColor( widget->getStyleState(), + widget->setSkinColor( Color( mInterpolationR.getPosition(), mInterpolationG.getPosition(), mInterpolationB.getPosition(), diff --git a/src/eepp/ui/uinode.cpp b/src/eepp/ui/uinode.cpp index 17ae3e878..9e8d278bf 100644 --- a/src/eepp/ui/uinode.cpp +++ b/src/eepp/ui/uinode.cpp @@ -36,7 +36,8 @@ UINode::UINode() : mBackgroundState( NULL ), mForegroundState( NULL ), mBorder( NULL ), - mDragButton( EE_BUTTON_LMASK ) + mDragButton( EE_BUTTON_LMASK ), + mSkinColor( Color::White ) { mNodeFlags |= NODE_FLAG_UINODE | NODE_FLAG_OVER_FIND_ALLOWED; @@ -258,6 +259,8 @@ void UINode::drawBox() { void UINode::drawSkin() { if ( NULL != mSkinState ) { + mSkinState->setStateColor( mSkinState->getCurrentState(), mSkinColor ); + if ( mFlags & UI_SKIN_KEEP_SIZE_ON_DRAW ) { Sizef rSize = PixelDensity::dpToPx( getSkinSize( getSkin(), mSkinState->getCurrentState() ) ); Sizef diff = ( mSize - rSize ) * 0.5f; @@ -703,26 +706,13 @@ UINode * UINode::setSkin( UISkin * skin ) { return this; } -UINode * UINode::setSkinColor( const Uint32& state, const Color& color ) { - if ( NULL != mSkinState ) - mSkinState->setStateColor( state, color ); - +UINode * UINode::setSkinColor( const Color& color ) { + mSkinColor = color; return this; } -UINode * UINode::setSkinColor( const Color& color ) { - return setSkinColor( UIState::StateFlagNormal, color ); -} - -Color UINode::getSkinColor( const Uint32& state ) const { - if ( NULL != mSkinState ) - return mSkinState->getStateColor( state ); - - return Color::White; -} - -Color UINode::getSkinColor() const { - return getSkinColor( UIState::StateFlagNormal ); +const Color& UINode::getSkinColor() const { + return mSkinColor; } void UINode::removeSkin() { diff --git a/src/eepp/ui/uiwidget.cpp b/src/eepp/ui/uiwidget.cpp index 3b324d2f6..8bfc7397c 100644 --- a/src/eepp/ui/uiwidget.cpp +++ b/src/eepp/ui/uiwidget.cpp @@ -559,12 +559,6 @@ void UIWidget::pushState( const Uint32& State, bool emitEvent ) { if ( NULL != mSkinState ) mSkinState->pushState( State ); - /*if ( NULL != mBackgroundState ) - mBackgroundState->pushState( State ); - - if ( NULL != mForegroundState ) - mForegroundState->pushState( State );*/ - if ( NULL != mStyle ) { updatePseudoClasses(); mStyle->pushState( State ); @@ -585,12 +579,6 @@ void UIWidget::popState( const Uint32& State, bool emitEvent ) { if ( NULL != mSkinState ) mSkinState->popState( State ); - /*if ( NULL != mBackgroundState ) - mBackgroundState->popState( State ); - - if ( NULL != mForegroundState ) - mForegroundState->popState( State );*/ - if ( NULL != mStyle ) { updatePseudoClasses(); mStyle->popState( State ); @@ -768,6 +756,8 @@ bool UIWidget::setAttribute( const NodeAttribute& attribute, const Uint32& state setBackgroundDrawable( res, res->getDrawableType() == Drawable::SPRITE ); } } else if ( "backgroundcolor" == name ) { + SAVE_NORMAL_STATE_ATTR( getBackgroundColor().toHexString() ); + Color color = attribute.asColor(); if ( !isSceneNodeLoading() && NULL != mStyle && mStyle->hasTransition( attribute.getName() ) ) { @@ -834,6 +824,8 @@ bool UIWidget::setAttribute( const NodeAttribute& attribute, const Uint32& state setForegroundDrawable( res, res->getDrawableType() == Drawable::SPRITE ); } } else if ( "foregroundcolor" == name ) { + SAVE_NORMAL_STATE_ATTR( getForegroundColor().toHexString() ); + Color color = attribute.asColor(); if ( !isSceneNodeLoading() && NULL != mStyle && mStyle->hasTransition( attribute.getName() ) ) { @@ -902,13 +894,13 @@ bool UIWidget::setAttribute( const NodeAttribute& attribute, const Uint32& state mSkinName = attribute.asString(); setThemeSkin( mSkinName ); } else if ( "skincolor" == name ) { - SAVE_NORMAL_STATE_ATTR( getSkinColor( getStylePreviousState() ).toHexString() ) + SAVE_NORMAL_STATE_ATTR( getSkinColor().toHexString() ); Color color = attribute.asColor(); if ( !isSceneNodeLoading() && NULL != mStyle && mStyle->hasTransition( attribute.getName() ) ) { UIStyle::TransitionInfo transitionInfo( mStyle->getTransition( attribute.getName() ) ); - Color start( getSkinColor( getStylePreviousState() ) ); + Color start( getSkinColor() ); Action * action = Actions::Tint::New( start, color, true, transitionInfo.duration, transitionInfo.timingFunction, Actions::Tint::Skin ); @@ -917,7 +909,7 @@ bool UIWidget::setAttribute( const NodeAttribute& attribute, const Uint32& state runAction( action ); } else { - setSkinColor( state, color ); + setSkinColor( color ); } } else if ( "gravity" == name ) { std::string gravity = attribute.asString();