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=f1fea71432eac7b3a5d2a9da1cee1cb5314a094f;hp=935ac86b0aa4d038c6ac2c358e5942308e7034bf;hb=311b47650f088ac9766a72c3deb7aa5a91bb49c2;hpb=41278d3fb755de3cb89edf6d80603b18562b4e01 diff --git a/dali-toolkit/internal/controls/popup/popup-impl.cpp b/dali-toolkit/internal/controls/popup/popup-impl.cpp index 935ac86..f1fea71 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. @@ -27,7 +27,7 @@ #include #include #include -#include +#include #include #include #include @@ -220,7 +220,7 @@ Dali::Toolkit::Popup Popup::New() } Popup::Popup() -: Control( ControlBehaviour( REQUIRES_TOUCH_EVENTS | REQUIRES_STYLE_CHANGE_SIGNALS ) ), +: Control( ControlBehaviour( CONTROL_BEHAVIOUR_DEFAULT ) ), mTouchedOutsideSignal(), mShowingSignal(), mShownSignal(), @@ -305,7 +305,7 @@ void Popup::OnInitialize() mPopupLayout = Toolkit::TableView::New( 3, 1 ); // Adds the default background image. - SetPopupBackgroundImage( Toolkit::ImageView::New( ResourceImage::New( DEFAULT_BACKGROUND_IMAGE_PATH ) ) ); + SetPopupBackgroundImage( Toolkit::ImageView::New( DEFAULT_BACKGROUND_IMAGE_PATH ) ); mPopupLayout.SetName( "popupLayoutTable" ); mPopupLayout.SetParentOrigin( ParentOrigin::CENTER ); @@ -318,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 ); @@ -578,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 ); @@ -703,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 ); @@ -744,7 +747,6 @@ void Popup::SetDisplayState( Toolkit::Popup::DisplayState displayState ) if( focusActor ) { - SetKeyInputFocus(); keyboardFocusManager.SetCurrentFocusActor( focusActor ); } } @@ -861,8 +863,7 @@ void Popup::LayoutTail() if( !image.empty() ) { // Adds the tail actor. - Image tail = ResourceImage::New( image ); - mTailImage = Toolkit::ImageView::New( tail ); + mTailImage = Toolkit::ImageView::New( image ); mTailImage.SetName( "tailImage" ); const Vector3 anchorPoint = AnchorPoint::BOTTOM_RIGHT - position; mTailImage.SetParentOrigin( position ); @@ -902,7 +903,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; } @@ -1237,12 +1238,8 @@ void Popup::SetProperty( BaseObject* object, Property::Index propertyIndex, cons std::string valueString; if( value.Get( valueString ) ) { - Image image = ResourceImage::New( valueString ); - if( image ) - { - Toolkit::ImageView actor = Toolkit::ImageView::New( image ); - popupImpl.SetPopupBackgroundImage( actor ); - } + Toolkit::ImageView actor = Toolkit::ImageView::New( valueString ); + popupImpl.SetPopupBackgroundImage( actor ); } break; } @@ -1454,7 +1451,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 ) @@ -1462,11 +1459,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() ); @@ -1493,7 +1488,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 )