X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dali-toolkit%2Finternal%2Fcontrols%2Fpopup%2Fpopup-impl.cpp;h=82746280f409f18483f2e7c23af75256c96bb7e3;hb=41307f75478fd6c6fb5f9ae7e7de5036647f39b3;hp=4862b1de61445031e0e9457b27540284d412169f;hpb=0d8064d02fc1c0a8c343b5a201b91098984ceb88;p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git diff --git a/dali-toolkit/internal/controls/popup/popup-impl.cpp b/dali-toolkit/internal/controls/popup/popup-impl.cpp index 4862b1d..8274628 100755 --- a/dali-toolkit/internal/controls/popup/popup-impl.cpp +++ b/dali-toolkit/internal/controls/popup/popup-impl.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015 Samsung Electronics Co., Ltd. + * Copyright (c) 2016 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -21,13 +21,13 @@ // EXTERNAL INCLUDES #include // for strcmp #include -#include +#include #include #include #include #include #include -#include +#include #include #include #include @@ -36,7 +36,6 @@ // INTERNAL INCLUDES #include #include -#include #include #include #include @@ -221,7 +220,7 @@ Dali::Toolkit::Popup Popup::New() } Popup::Popup() -: Control( ControlBehaviour( REQUIRES_TOUCH_EVENTS | REQUIRES_STYLE_CHANGE_SIGNALS ) ), +: Control( ControlBehaviour( REQUIRES_STYLE_CHANGE_SIGNALS ) ), mTouchedOutsideSignal(), mShowingSignal(), mShownSignal(), @@ -319,7 +318,7 @@ void Popup::OnInitialize() mPopupLayout.SetFitHeight( 0 ); // Set row to fit. mPopupLayout.SetFitHeight( 1 ); // Set row to fit. - mPopupLayout.TouchedSignal().Connect( this, &Popup::OnDialogTouched ); + mPopupLayout.TouchSignal().Connect( this, &Popup::OnDialogTouched ); mPopupContainer.Add( mPopupLayout ); @@ -579,7 +578,7 @@ void Popup::SetPopupBackgroundImage( Actor image ) mPopupBackgroundImage.SetParentOrigin( ParentOrigin::CENTER ); // OnDialogTouched only consumes the event. It prevents the touch event to be caught by the backing. - mPopupBackgroundImage.TouchedSignal().Connect( this, &Popup::OnDialogTouched ); + mPopupBackgroundImage.TouchSignal().Connect( this, &Popup::OnDialogTouched ); // Set the popup border to be slightly larger than the layout contents. mPopupBackgroundImage.SetResizePolicy( ResizePolicy::SIZE_FIXED_OFFSET_FROM_PARENT, Dimension::ALL_DIMENSIONS ); @@ -704,6 +703,9 @@ void Popup::SetDisplayState( Toolkit::Popup::DisplayState displayState ) // Update the state to indicate the current intent. mDisplayState = Toolkit::Popup::SHOWING; + // We want the popup to have key input focus when it is displayed + SetKeyInputFocus(); + // We are displaying so bring the popup layer to the front, and set it visible so it is rendered. mLayer.RaiseToTop(); mLayer.SetVisible( true ); @@ -745,7 +747,6 @@ void Popup::SetDisplayState( Toolkit::Popup::DisplayState displayState ) if( focusActor ) { - SetKeyInputFocus(); keyboardFocusManager.SetCurrentFocusActor( focusActor ); } } @@ -891,7 +892,7 @@ Toolkit::Control Popup::CreateBacking() backing.SetName( "popupBacking" ); // Must always be positioned top-left of stage, regardless of parent. - backing.SetPositionInheritanceMode( DONT_INHERIT_POSITION ); + backing.SetInheritPosition(false); backing.SetAnchorPoint( AnchorPoint::TOP_LEFT ); // Always the full size of the stage. @@ -903,7 +904,7 @@ Toolkit::Control Popup::CreateBacking() // Default to being transparent. backing.SetProperty( Actor::Property::COLOR_ALPHA, 0.0f ); - backing.TouchedSignal().Connect( this, &Popup::OnBackingTouched ); + backing.TouchSignal().Connect( this, &Popup::OnBackingTouched ); backing.WheelEventSignal().Connect( this, &Popup::OnBackingWheelEvent ); return backing; } @@ -1455,7 +1456,7 @@ bool Popup::DoConnectSignal( BaseObject* object, ConnectionTrackerInterface* tra return connected; } -bool Popup::OnBackingTouched( Actor actor, const TouchEvent& event ) +bool Popup::OnBackingTouched( Actor actor, const TouchData& touch ) { // Allow events to pass through if touch transparency is enabled. if( mTouchTransparent ) @@ -1463,11 +1464,9 @@ bool Popup::OnBackingTouched( Actor actor, const TouchEvent& event ) return false; } - if( event.GetPointCount() > 0 ) + if( touch.GetPointCount() > 0 ) { - const TouchPoint& point = event.GetPoint( 0 ); - - if( point.state == TouchPoint::Down ) + if( touch.GetState( 0 ) == PointState::DOWN ) { // Guard against destruction during signal emission. Toolkit::Popup handle( GetOwner() ); @@ -1494,7 +1493,7 @@ bool Popup::OnBackingWheelEvent( Actor actor, const WheelEvent& event ) return true; } -bool Popup::OnDialogTouched(Actor actor, const TouchEvent& event) +bool Popup::OnDialogTouched( Actor actor, const TouchData& touch ) { // Allow events to pass through if touch transparency is enabled. if( mTouchTransparent ) @@ -1507,14 +1506,18 @@ bool Popup::OnDialogTouched(Actor actor, const TouchEvent& event) return true; } -void Popup::OnControlStageConnection() +void Popup::OnStageConnection( int depth ) { + Control::OnStageConnection( depth ); + mLayoutDirty = true; RelayoutRequest(); } -void Popup::OnControlChildAdd( Actor& child ) +void Popup::OnChildAdd( Actor& child ) { + Control::OnChildAdd( child ); + // Re-parent any children added by user to the body layer. if( mAlterAddedChild ) {