X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=examples%2Fpage-turn-view%2Fpage-turn-view-example.cpp;h=4d2d7d7e15af185ab9326c11c61e418100bfbec2;hb=acbfb8bba3f98b42d7ca96887091fa8391bccca8;hp=9d10ca0363d3bb99e40bc508748a794fb51c9697;hpb=fcd958ebbc2723b0b47843a5978b5f4126387656;p=platform%2Fcore%2Fuifw%2Fdali-demo.git diff --git a/examples/page-turn-view/page-turn-view-example.cpp b/examples/page-turn-view/page-turn-view-example.cpp index 9d10ca0..4d2d7d7 100644 --- a/examples/page-turn-view/page-turn-view-example.cpp +++ b/examples/page-turn-view/page-turn-view-example.cpp @@ -15,11 +15,20 @@ * */ +#include +#include +#include +#include +#include +#include +#include + #include #include #include -#include -#include +#include + +#include "shared/view.h" using namespace Dali; using namespace Dali::Toolkit; @@ -77,14 +86,18 @@ class PortraitPageFactory : public PageFactory */ virtual Actor NewPage( unsigned int pageId ) { + ImageActor page; + if( pageId == 0 ) { - return ImageActor::New( ResourceImage::New( BOOK_COVER_PORTRAIT ) ); + page = ImageActor::New( ResourceImage::New( BOOK_COVER_PORTRAIT ) ); } else { - return ImageActor::New( ResourceImage::New( PAGE_IMAGES_PORTRAIT[ (pageId-1) % NUMBER_OF_PORTRAIT_IMAGE ] ) ); + page = ImageActor::New( ResourceImage::New( PAGE_IMAGES_PORTRAIT[ (pageId-1) % NUMBER_OF_PORTRAIT_IMAGE ] ) ); } + + return page; } }; @@ -119,6 +132,7 @@ class LandscapePageFactory : public PageFactory pageBack = ImageActor::New( ResourceImage::New( PAGE_IMAGES_LANDSCAPE[ (imageId+1) % NUMBER_OF_LANDSCAPE_IMAGE ] ) ); } pageFront.Add(pageBack); + return pageFront; } }; @@ -144,11 +158,9 @@ private: /** * This method gets called when the screen is rotated, switch between portrait and landscape views - * param [in] view The view receiving the orientation change signal - * param [in] animation The Orientation Rotating animation * param [in] orientation The current screen orientation */ - void OnOrientationAnimationStarted( View view, Animation& animation, const Orientation& orientation ); + void OnOrientationAnimationStarted( Orientation orientation ); /** * Main key event handler @@ -188,7 +200,7 @@ private: private: Application& mApplication; - View mView; + Actor mView; PageTurnView mPageTurnPortraitView; PageTurnView mPageTurnLandscapeView; @@ -215,13 +227,18 @@ void PageTurnController::OnInit( Application& app ) { // The Init signal is received once ( only ) during the Application lifetime + DemoHelper::RequestThemeChange(); + Stage::GetCurrent().KeyEventSignal().Connect(this, &PageTurnController::OnKeyEvent); Stage stage = Stage::GetCurrent(); Vector2 stageSize = stage.GetSize(); // Create default View. - mView = View::New(); + mView = Actor::New(); + mView.SetAnchorPoint( Dali::AnchorPoint::CENTER ); + mView.SetParentOrigin( Dali::ParentOrigin::CENTER ); + mView.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS ); stage.Add( mView ); Dali::Window winHandle = app.GetWindow(); @@ -229,10 +246,9 @@ void PageTurnController::OnInit( Application& app ) winHandle.AddAvailableOrientation( Dali::Window::LANDSCAPE ); winHandle.AddAvailableOrientation( Dali::Window::PORTRAIT_INVERSE ); winHandle.AddAvailableOrientation( Dali::Window::LANDSCAPE_INVERSE ); - // FIXME - //app.GetOrientation().ChangedSignal().Connect( &mView, &View::OrientationChanged ); + // view will response to orientation change to display portrait or landscape views - mView.OrientationAnimationStartedSignal().Connect( this, &PageTurnController::OnOrientationAnimationStarted ); + app.GetWindow().GetOrientation().ChangedSignal().Connect( this, &PageTurnController::OnOrientationAnimationStarted ); mPageTurnPortraitView = PageTurnPortraitView::New( mPortraitPageFactory, stageSize ); mPageTurnPortraitView.SetSpineShadowParameter( Vector2(70.f, 30.f) ); @@ -252,7 +268,7 @@ void PageTurnController::OnInit( Application& app ) mView.Add(mPageTurnPortraitView); } -void PageTurnController::OnOrientationAnimationStarted( View view, Animation& animation, const Orientation& orientation ) +void PageTurnController::OnOrientationAnimationStarted( Orientation orientation ) { switch( orientation.GetDegrees() ) {