X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=blobdiff_plain;f=dali-toolkit%2Finternal%2Fcontrols%2Fpopup%2Fpopup-impl.cpp;h=719cfe93e787a3d03211f4bf76090be2418f8658;hp=8a1c6798452ba6a28c79311c64a5b67e0a16d337;hb=a78bb823aebc305823855ac35b3413aaff7bc684;hpb=fc72d9dfdefd7434202ed73ac579d425279947f3 diff --git a/dali-toolkit/internal/controls/popup/popup-impl.cpp b/dali-toolkit/internal/controls/popup/popup-impl.cpp index 8a1c679..719cfe9 100755 --- a/dali-toolkit/internal/controls/popup/popup-impl.cpp +++ b/dali-toolkit/internal/controls/popup/popup-impl.cpp @@ -19,15 +19,16 @@ #include // EXTERNAL INCLUDES +#include // for strcmp #include -#include +#include #include #include #include #include #include #include -#include +#include #include #include @@ -37,6 +38,7 @@ #include #include #include +#include using namespace Dali; @@ -60,8 +62,8 @@ BaseHandle Create() // Setup properties, signals and actions using the type-registry. DALI_TYPE_REGISTRATION_BEGIN( Toolkit::Popup, Toolkit::Control, Create ) -DALI_SIGNAL_REGISTRATION( Popup, "touched-outside", SIGNAL_TOUCHED_OUTSIDE ) -DALI_SIGNAL_REGISTRATION( Popup, "hidden", SIGNAL_HIDDEN ) +DALI_SIGNAL_REGISTRATION( Toolkit, Popup, "touched-outside", SIGNAL_TOUCHED_OUTSIDE ) +DALI_SIGNAL_REGISTRATION( Toolkit, Popup, "hidden", SIGNAL_HIDDEN ) DALI_TYPE_REGISTRATION_END() @@ -171,12 +173,6 @@ void Popup::OnInitialize() SetAsKeyboardFocusGroup(true); } -void Popup::MarkDirtyForRelayout() -{ - // Flag all the popup controls for relayout as it is about to be hidden and miss the main flagging pass - mLayer.RelayoutRequestTree(); -} - void Popup::OnPropertySet( Property::Index index, Property::Value propertyValue ) { if( index == mPropertyTitle ) @@ -301,7 +297,6 @@ void Popup::CreateFooter() // Adds bottom background mBottomBg = Actor::New(); mBottomBg.SetName( "POPUP_BOTTOM_BG" ); - mBottomBg.SetRelayoutEnabled( true ); mBottomBg.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS ); mPopupLayout.SetFixedHeight( 2, mPopupStyle->bottomSize.height ); // Buttons @@ -428,7 +423,7 @@ void Popup::CreateBacking() mLayer.Add( mBacking ); mBacking.SetOpacity(0.0f); mBacking.TouchedSignal().Connect( this, &Popup::OnBackingTouched ); - mBacking.MouseWheelEventSignal().Connect(this, &Popup::OnBackingMouseWheelEvent); + mBacking.WheelEventSignal().Connect(this, &Popup::OnBackingWheelEvent); } void Popup::CreateDialog() @@ -525,13 +520,13 @@ void Popup::HandleStateChange( Toolkit::Popup::PopupState state, float duration if(mShowing) { - mAnimation.AnimateTo( Property(mBacking, Actor::Property::COLOR_ALPHA), targetBackingAlpha, AlphaFunctions::EaseInOut, TimePeriod(0.0f, duration * 0.5f) ); - mAnimation.AnimateTo( Property(self, Actor::Property::SCALE), targetSize, AlphaFunctions::EaseInOut, TimePeriod(duration * 0.5f, duration * 0.5f) ); + mAnimation.AnimateTo( Property(mBacking, Actor::Property::COLOR_ALPHA), targetBackingAlpha, AlphaFunction::EASE_IN_OUT, TimePeriod(0.0f, duration * 0.5f) ); + mAnimation.AnimateTo( Property(self, Actor::Property::SCALE), targetSize, AlphaFunction::EASE_IN_OUT, TimePeriod(duration * 0.5f, duration * 0.5f) ); } else { - mAnimation.AnimateTo( Property(mBacking, Actor::Property::COLOR_ALPHA), targetBackingAlpha, AlphaFunctions::EaseInOut, TimePeriod(0.0f, duration * 0.5f) ); - mAnimation.AnimateTo( Property(self, Actor::Property::SCALE), targetSize, AlphaFunctions::EaseInOut, TimePeriod(0.0f, duration * 0.5f) ); + mAnimation.AnimateTo( Property(mBacking, Actor::Property::COLOR_ALPHA), targetBackingAlpha, AlphaFunction::EASE_IN_OUT, TimePeriod(0.0f, duration * 0.5f) ); + mAnimation.AnimateTo( Property(self, Actor::Property::SCALE), targetSize, AlphaFunction::EASE_IN_OUT, TimePeriod(0.0f, duration * 0.5f) ); } mAnimation.Play(); mAnimation.FinishedSignal().Connect(this, &Popup::OnStateAnimationFinished); @@ -616,9 +611,9 @@ bool Popup::OnBackingTouched(Actor actor, const TouchEvent& event) return true; } -bool Popup::OnBackingMouseWheelEvent(Actor actor, const MouseWheelEvent& event) +bool Popup::OnBackingWheelEvent(Actor actor, const WheelEvent& event) { - // consume mouse wheel event in dimmed backing actor + // consume wheel event in dimmed backing actor return true; } @@ -652,7 +647,7 @@ void Popup::OnRelayout( const Vector2& size, RelayoutContainer& container ) mBackgroundImage.SetVisible( !( mButtons.empty() && mPopupLayout.GetChildCount() == 0 ) ); // Relayout All buttons - if ( !mButtons.empty() ) + if( !mButtons.empty() ) { // All buttons should be the same size and fill the button area. The button spacing needs to be accounted for as well. Vector2 buttonSize( ( ( size.width - mPopupStyle->buttonSpacing * ( mButtons.size() + 1 ) ) / mButtons.size() ), @@ -660,7 +655,7 @@ void Popup::OnRelayout( const Vector2& size, RelayoutContainer& container ) Vector3 buttonPosition( mPopupStyle->buttonSpacing, 0.0f, 0.0f ); - for ( ActorIter iter = mButtons.begin(), endIter = mButtons.end(); + for( std::vector< Actor >::iterator iter = mButtons.begin(), endIter = mButtons.end(); iter != endIter; ++iter, buttonPosition.x += mPopupStyle->buttonSpacing + buttonSize.width ) { @@ -681,8 +676,8 @@ void Popup::OnRelayout( const Vector2& size, RelayoutContainer& container ) button.SetPosition( buttonPosition ); - button.PropagateRelayoutFlags(); // Reset relayout flags for relayout - container.Add( button, buttonSize ); + //Todo: Use the size negotiation pass instead of SetSize directly + button.SetSize( buttonSize ); } } } @@ -815,7 +810,7 @@ float Popup::GetWidthForHeight( float height ) return GetNaturalSize().width; } -Actor Popup::GetNextKeyboardFocusableActor(Actor currentFocusedActor, Toolkit::Control::KeyboardFocusNavigationDirection direction, bool loopEnabled) +Actor Popup::GetNextKeyboardFocusableActor(Actor currentFocusedActor, Toolkit::Control::KeyboardFocus::Direction direction, bool loopEnabled) { Actor nextFocusableActor( currentFocusedActor ); @@ -838,7 +833,7 @@ Actor Popup::GetNextKeyboardFocusableActor(Actor currentFocusedActor, Toolkit::C else { // Rebuild the focus chain because button or content can be added or removed dynamically - ActorContainer focusableActors; + std::vector< Actor > focusableActors; if( mContent && mContent.IsKeyboardFocusable() ) { focusableActors.push_back(mContent); @@ -852,13 +847,13 @@ Actor Popup::GetNextKeyboardFocusableActor(Actor currentFocusedActor, Toolkit::C } } - for ( ActorContainer::iterator iter = focusableActors.begin(), end = focusableActors.end(); iter != end; ++iter ) + for( std::vector< Actor >::iterator iter = focusableActors.begin(), end = focusableActors.end(); iter != end; ++iter ) { if ( currentFocusedActor == *iter ) { switch ( direction ) { - case Toolkit::Control::Left: + case Toolkit::Control::KeyboardFocus::LEFT: { if ( iter == focusableActors.begin() ) { @@ -870,7 +865,7 @@ Actor Popup::GetNextKeyboardFocusableActor(Actor currentFocusedActor, Toolkit::C } break; } - case Toolkit::Control::Right: + case Toolkit::Control::KeyboardFocus::RIGHT: { if ( iter == focusableActors.end() - 1 ) { @@ -883,7 +878,7 @@ Actor Popup::GetNextKeyboardFocusableActor(Actor currentFocusedActor, Toolkit::C break; } - case Toolkit::Control::Up: + case Toolkit::Control::KeyboardFocus::UP: { if ( *iter == mContent ) { @@ -910,7 +905,7 @@ Actor Popup::GetNextKeyboardFocusableActor(Actor currentFocusedActor, Toolkit::C break; } - case Toolkit::Control::Down: + case Toolkit::Control::KeyboardFocus::DOWN: { if ( mContent && mContent.IsKeyboardFocusable() ) {