#include <string.h>
#include <sstream>
#include <dali-toolkit-test-suite-utils.h>
-#include <dali-toolkit/dali-toolkit.h>
#include <dali/integration-api/events/pan-gesture-event.h>
-#include <dali-toolkit/devel-api/controls/page-turn-view/page-factory.h>
-#include <dali-toolkit/devel-api/controls/page-turn-view/page-turn-landscape-view.h>
-#include <dali-toolkit/devel-api/controls/page-turn-view/page-turn-portrait-view.h>
-#include <dali-toolkit/devel-api/controls/page-turn-view/page-turn-view.h>
+#include <dali-toolkit/public-api/controls/page-turn-view/page-factory.h>
+#include <dali-toolkit/public-api/controls/page-turn-view/page-turn-landscape-view.h>
+#include <dali-toolkit/public-api/controls/page-turn-view/page-turn-portrait-view.h>
+#include <dali-toolkit/public-api/controls/page-turn-view/page-turn-view.h>
actor.SetParentOrigin( ParentOrigin::CENTER );
actor.SetAnchorPoint( AnchorPoint::CENTER );
- SetActorHittability( actor, true );
-
mSourceActors[pageId] = actor;
}
END_TEST;
}
-int UtcDaliPageTurnViewSetAndGetSpineShadowParameter(void)
+int UtcDaliPageTurnViewSetGetProperty(void)
{
ToolkitTestApplication application;
- tet_infoline(" UtcDaliPageTurnViewSetAndGetSpineShadowParameter ");
+ tet_infoline(" UtcDaliPageTurnViewSetGetProperty ");
TestPageFactory factory(application);
PageTurnView landscapeView = PageTurnLandscapeView::New( factory, PAGE_SIZE );
- DALI_TEST_CHECK( landscapeView.GetSpineShadowParameter() != SPINE_SHADOW_PARAMETER);
- landscapeView.SetSpineShadowParameter(SPINE_SHADOW_PARAMETER);
- DALI_TEST_CHECK( landscapeView.GetSpineShadowParameter() == SPINE_SHADOW_PARAMETER);
- END_TEST;
-}
-
-int UtcDaliPageTurnViewGoToPageAndGetCurrentPage(void)
-{
- ToolkitTestApplication application;
-
- tet_infoline(" UtcDaliPageTurnViewGoToPageAndGetCurrentPage ");
-
- TestPageFactory factory(application);
- PageTurnView portraitView = PageTurnPortraitView::New( factory, PAGE_SIZE );
- DALI_TEST_CHECK( portraitView.GetCurrentPage() == 0 );
-
- portraitView.GoToPage( 10 );
- DALI_TEST_CHECK( portraitView.GetCurrentPage() == 10 );
-
- portraitView.GoToPage( 5 );
- DALI_TEST_CHECK( portraitView.GetCurrentPage() == 5 );
- END_TEST;
-}
-
-int UtcDaliPageTurnViewEnterLeaveEditMode(void)
-{
- ToolkitTestApplication application;
-
- tet_infoline( " UtcDaliPageTurnViewEnterLeaveEditMode " );
-
- application.GetGlAbstraction().SetCheckFramebufferStatusResult(GL_FRAMEBUFFER_COMPLETE );
-
- TestPageFactory factory(application);
- factory.EnableOffscreenRendering( );
-
- PageTurnView pageTurnView = PageTurnLandscapeView::New( factory, PAGE_SIZE );
- pageTurnView.SetPositionInheritanceMode( USE_PARENT_POSITION );
- Stage::GetCurrent().Add( pageTurnView );
-
- Vector2 size = Stage::GetCurrent().GetSize();
-
- pageTurnView.GoToPage(5);
-
- // Render and notify
- application.SendNotification();
- application.Render(RENDER_FRAME_INTERVAL);
-
- Actor actor = pageTurnView.EnterEditMode();
- // Test that when entering edit mode, current page source actor is returned.
- unsigned int pageId;
- std::istringstream( actor.GetName() ) >> pageId;
- DALI_TEST_CHECK( pageId == 5 );
-
- bool signalVerified;
- PageTurnView currentView;
- unsigned int pageIndex;
- bool isTurningForwards;
- PageSignalCallback callbackPanStarted( signalVerified, currentView, pageIndex, isTurningForwards );
- pageTurnView.PagePanStartedSignal().Connect( &callbackPanStarted, &PageSignalCallback::PagePanSignalCallback );
-
- currentView = pageTurnView;
- pageIndex = 5;
- DALI_TEST_CHECK( !callbackPanStarted.mSignalVerified );
-
- // Test that the control does not receive pan gesture in edit-mode
- PerformGestureDiagonalSwipe( application, Vector2(size*0.75f), Vector2(size*0.01f), 10, true, true);
- DALI_TEST_CHECK( !callbackPanStarted.mSignalVerified );
-
- pageTurnView.LeaveEditMode();
- // Test that the control receives pan gesture after leaving edit-mode
- PerformGestureDiagonalSwipe( application, Vector2(size*0.75f), Vector2(size*0.01f), 10, true, true);
- DALI_TEST_CHECK( callbackPanStarted.mSignalVerified );
- END_TEST;
-}
-
-int UtcDaliPageTurnViewGetHitActor(void)
-{
- ToolkitTestApplication application;
-
- tet_infoline(" UtcDaliPageTurnViewGetHitActor ");
-
- application.GetGlAbstraction().SetCheckFramebufferStatusResult(GL_FRAMEBUFFER_COMPLETE );
-
- TestPageFactory factory(application);
- factory.EnableOffscreenRendering( );
-
- PageTurnView pageTurnView = PageTurnPortraitView::New( factory, PAGE_SIZE );
- pageTurnView.SetParentOrigin( ParentOrigin::TOP_LEFT );
- pageTurnView.SetAnchorPoint( AnchorPoint::TOP_LEFT );
- Stage::GetCurrent().Add( pageTurnView );
+ DALI_TEST_CHECK( landscapeView );
- // Render and notify
- application.SendNotification();
- application.Render(RENDER_FRAME_INTERVAL);
+ Stage::GetCurrent().Add( landscapeView );
- pageTurnView.GoToPage(3);
+ // Test "page-size" property
+ DALI_TEST_CHECK( landscapeView.GetPropertyIndex("page-size") == PageTurnView::Property::PAGE_SIZE );
+ DALI_TEST_EQUALS( landscapeView.GetProperty(PageTurnView::Property::PAGE_SIZE).Get<Vector2>(), PAGE_SIZE, TEST_LOCATION );
- Vector2 localCoordinate = Vector2();
- Vector2 screenCoordinate = PAGE_SIZE*0.5f+Vector2(7.f,8.f);
- Actor hitActor = pageTurnView.GetHitActor( screenCoordinate, localCoordinate );
- DALI_TEST_CHECK( hitActor );
- unsigned int pageId;
- std::istringstream( hitActor.GetName() ) >> pageId;
- DALI_TEST_CHECK( pageId == 3 );
- DALI_TEST_EQUALS( localCoordinate, IMAGE_SIZE*0.5f+Vector2(7.f,8.f), 0.1f, TEST_LOCATION );
+ Vector2 newSize( PAGE_SIZE.x*0.75, PAGE_SIZE.y*0.5f );
+ landscapeView.SetProperty( PageTurnView::Property::PAGE_SIZE, newSize );
+ DALI_TEST_EQUALS( landscapeView.GetProperty(PageTurnView::Property::PAGE_SIZE).Get<Vector2>(), newSize, TEST_LOCATION );
+ Wait( application);
+ DALI_TEST_EQUALS( Vector2(landscapeView.GetTargetSize()), Vector2(newSize.x*2.f, newSize.y), TEST_LOCATION);
- screenCoordinate = PAGE_SIZE*0.5f+IMAGE_SIZE;
- hitActor = pageTurnView.GetHitActor( screenCoordinate, localCoordinate );
- DALI_TEST_CHECK( !hitActor );
- END_TEST;
-}
+ landscapeView.SetProperty( PageTurnView::Property::PAGE_SIZE,newSize*1.5f);
+ DALI_TEST_EQUALS( landscapeView.GetProperty(PageTurnView::Property::PAGE_SIZE).Get<Vector2>(), newSize*1.5f, TEST_LOCATION );
+ Wait( application);
+ DALI_TEST_EQUALS( Vector2(landscapeView.GetTargetSize()), Vector2(newSize.x*3.f, newSize.y*1.5f), TEST_LOCATION);
-int UtcDaliPageTurnViewRefresh(void)
-{
- ToolkitTestApplication application;
+ // Test "current-page-id" property
+ DALI_TEST_CHECK( landscapeView.GetPropertyIndex("current-page-id") == PageTurnView::Property::CURRENT_PAGE_ID );
+ DALI_TEST_EQUALS( landscapeView.GetProperty(PageTurnView::Property::CURRENT_PAGE_ID).Get<int>(), 0, TEST_LOCATION );
- tet_infoline(" UtcDaliPageTurnViewRefresh ");
+ int pageId = static_cast<int>(TOTAL_PAGE_NUMBER)/3;
+ landscapeView.SetProperty( PageTurnView::Property::CURRENT_PAGE_ID, pageId );
+ DALI_TEST_EQUALS( landscapeView.GetProperty(PageTurnView::Property::CURRENT_PAGE_ID).Get<int>(), pageId, TEST_LOCATION );
- application.GetGlAbstraction().SetCheckFramebufferStatusResult(GL_FRAMEBUFFER_COMPLETE );
+ landscapeView.SetProperty( PageTurnView::Property::CURRENT_PAGE_ID, pageId*2 );
+ DALI_TEST_EQUALS( landscapeView.GetProperty(PageTurnView::Property::CURRENT_PAGE_ID).Get<int>(), pageId*2, TEST_LOCATION );
- TestPageFactory factory(application);
- factory.EnableOffscreenRendering( );
- PageTurnView pageTurnView = PageTurnPortraitView::New( factory, PAGE_SIZE );
- pageTurnView.SetParentOrigin( ParentOrigin::TOP_LEFT );
- pageTurnView.SetAnchorPoint( AnchorPoint::TOP_LEFT );
- Stage::GetCurrent().Add( pageTurnView );
+ // Test "spin-shadow" property
+ DALI_TEST_CHECK( landscapeView.GetPropertyIndex( "spine-shadow" ) == PageTurnView::Property::SPINE_SHADOW );
+ landscapeView.SetProperty( PageTurnView::Property::SPINE_SHADOW, SPINE_SHADOW_PARAMETER );
+ DALI_TEST_EQUALS( landscapeView.GetProperty(PageTurnView::Property::SPINE_SHADOW).Get<Vector2>(), SPINE_SHADOW_PARAMETER, TEST_LOCATION );
- // Render and notify
- application.SendNotification();
- application.Render(RENDER_FRAME_INTERVAL);
- application.Render(RENDER_FRAME_INTERVAL);
- application.SendNotification();
+ landscapeView.SetProperty( PageTurnView::Property::SPINE_SHADOW, SPINE_SHADOW_PARAMETER*0.75f );
+ DALI_TEST_EQUALS( landscapeView.GetProperty(PageTurnView::Property::SPINE_SHADOW).Get<Vector2>(), SPINE_SHADOW_PARAMETER*0.75f, TEST_LOCATION );
- factory.DeletePage( 0 );
-
- pageTurnView.RefreshCurrentPage();
- // simply calls the certain off screen render task to refresh
- Vector2 localCoordinate = Vector2();
- Vector2 screenCoordinate = PAGE_SIZE*0.5f;
- Actor hitActor = pageTurnView.GetHitActor( screenCoordinate, localCoordinate );
- unsigned int pageId;
- std::istringstream( hitActor.GetName() ) >> pageId;
- DALI_TEST_CHECK( pageId == 0 );
-
- pageTurnView.RefreshAll();
- // re-parent all the source actors and refresh
- hitActor = pageTurnView.GetHitActor( screenCoordinate, localCoordinate );
- std::istringstream( hitActor.GetName() ) >> pageId;
- DALI_TEST_CHECK( pageId == 1 );
END_TEST;
}
Vector2 start = size * 0.75f;
Vector2 direction = -size*0.05f; //-size*0.5f/10.f;
- DALI_TEST_CHECK( portraitView.GetCurrentPage() == 0);
+ DALI_TEST_EQUALS( portraitView.GetProperty(PageTurnView::Property::CURRENT_PAGE_ID).Get<int>(), 0, TEST_LOCATION );
PerformGestureDiagonalSwipe( application, start, direction, 5, true, false);
DALI_TEST_CHECK( callbackTurnStarted.mSignalVerified );
DALI_TEST_CHECK( !callbackTurnFinished.mSignalVerified );
Wait(application, 1000);
DALI_TEST_CHECK( callbackTurnFinished.mSignalVerified );
- DALI_TEST_CHECK( portraitView.GetCurrentPage() == pageIndex+1); // the page is turn over
+ // the page is turn over
+ DALI_TEST_EQUALS( portraitView.GetProperty(PageTurnView::Property::CURRENT_PAGE_ID).Get<int>(), pageIndex+1, TEST_LOCATION );
//---Test 2: pan from position( size*0.5f ) to position( size.width, size.height*0.5f ) to position( size * 0.75f ), page 1 will bent then slid back---
callbackTurnStarted.Reset();
callbackTurnFinished.Reset();
callbackPanStarted.Reset();
callbackPanFinished.Reset();
- portraitView.GoToPage(5);
+ portraitView.SetProperty( PageTurnView::Property::CURRENT_PAGE_ID, 5 );
pageIndex = 5;
isTurningForwards = true;
Wait(application, 1000);
DALI_TEST_CHECK( callbackTurnFinished.mSignalVerified );
- DALI_TEST_CHECK( portraitView.GetCurrentPage() == pageIndex); // the page is not turned over
+ DALI_TEST_EQUALS( portraitView.GetProperty(PageTurnView::Property::CURRENT_PAGE_ID).Get<int>(), pageIndex, TEST_LOCATION ); // the page is not turned over
// ----Test 3: pan 10 frames from position( size*0.25f ) to position( size.width*0.75f, size.height*0.25f ), the previous page will be turned backwards---
callbackTurnStarted.Reset();
callbackTurnFinished.Reset();
callbackPanStarted.Reset();
callbackPanFinished.Reset();
- portraitView.GoToPage(10);
+ portraitView.SetProperty( PageTurnView::Property::CURRENT_PAGE_ID, 10);
pageIndex = 9; // will turn the previous page back
isTurningForwards = false;
start = size*0.25f;
Wait( application, 1000 );
DALI_TEST_CHECK( callbackTurnFinished.mSignalVerified );
- DALI_TEST_CHECK( portraitView.GetCurrentPage() == 9);
+ DALI_TEST_EQUALS( portraitView.GetProperty(PageTurnView::Property::CURRENT_PAGE_ID).Get<int>(), 9, TEST_LOCATION );
END_TEST;
}
develapieffectsviewdir = $(develapicontrolsdir)/effects-view
develapimagnifierdir = $(develapicontrolsdir)/magnifier
develapipopupdir = $(develapicontrolsdir)/popup
-develapipageturnviewdir = $(develapicontrolsdir)/page-turn-view
develapisliderdir = $(develapicontrolsdir)/slider
develapishadowviewdir = $(develapicontrolsdir)/shadow-view
develapisuperblurviewdir = $(develapicontrolsdir)/super-blur-view
develapieffectsview_HEADERS = $(devel_api_effects_view_header_files)
develapifocusmanager_HEADERS = $(devel_api_focus_manager_header_files)
develapimagnifier_HEADERS = $(devel_api_magnifier_header_files)
-develapipageturnview_HEADERS = $(devel_api_page_turn_view_header_files)
develapipopup_HEADERS = $(devel_api_popup_header_files)
develapiscripting_HEADERS = $(devel_api_scripting_header_files)
develapishadowview_HEADERS = $(devel_api_shadow_view_header_files)
publicapigaussianblurviewdir = $(publicapicontrolsdir)/gaussian-blur-view
publicapiimageviewdir = $(publicapicontrolsdir)/image-view
publicapimodel3dviewdir = $(publicapicontrolsdir)/model3d-view
+publicapipageturnviewdir = $(publicapicontrolsdir)/page-turn-view
publicapiscrollbardir = $(publicapicontrolsdir)/scroll-bar
publicapiscrollabledir = $(publicapicontrolsdir)/scrollable
publicapiscrollviewdir = $(publicapicontrolsdir)/scrollable/scroll-view
publicapiimageview_HEADERS = $(public_api_image_view_header_files)
publicapiitemview_HEADERS = $(public_api_item_view_header_files)
publicapimodel3dview_HEADERS = $(public_api_model3d_view_header_files)
+publicapipageturnview_HEADERS = $(public_api_page_turn_view_header_files)
publicapiscrollbar_HEADERS = $(public_api_scroll_bar_header_files)
publicapiscrollable_HEADERS = $(public_api_scrollable_header_files)
publicapiscrollview_HEADERS = $(public_api_scroll_view_header_files)
#include <dali-toolkit/public-api/controls/gaussian-blur-view/gaussian-blur-view.h>
#include <dali-toolkit/public-api/controls/image-view/image-view.h>
#include <dali-toolkit/public-api/controls/model3d-view/model3d-view.h>
+#include <dali-toolkit/public-api/controls/page-turn-view/page-factory.h>
+#include <dali-toolkit/public-api/controls/page-turn-view/page-turn-landscape-view.h>
+#include <dali-toolkit/public-api/controls/page-turn-view/page-turn-portrait-view.h>
+#include <dali-toolkit/public-api/controls/page-turn-view/page-turn-view.h>
#include <dali-toolkit/public-api/controls/scroll-bar/scroll-bar.h>
#include <dali-toolkit/public-api/controls/scrollable/item-view/default-item-layout.h>
#include <dali-toolkit/public-api/controls/scrollable/item-view/item-factory.h>
+++ /dev/null
-/*
- * Copyright (c) 2015 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.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-// CLASS HEADER
-#include <dali-toolkit/devel-api/controls/page-turn-view/page-factory.h>
-
-namespace Dali
-{
-
-namespace Toolkit
-{
-
-const std::string PageFactory::ACTOR_HITTABLE( "actor-hittable" );
-
-PageFactory::PageFactory( )
-: mNeedOffscreenRendering( false )
-{
-}
-
-PageFactory::~PageFactory()
-{
-}
-
-void PageFactory::EnableOffscreenRendering( )
-{
- mNeedOffscreenRendering = true;
-}
-
-bool PageFactory::IsOffscreenRenderingNeeded()
-{
- return mNeedOffscreenRendering;
-}
-
-void PageFactory::SetActorHittability( Actor actor, bool hittable )
-{
- // Create actor focusable property if not already created.
- Property::Index propertyActorHittable = actor.GetPropertyIndex(ACTOR_HITTABLE);
- if(propertyActorHittable == Property::INVALID_INDEX && hittable)
- {
- actor.RegisterProperty(ACTOR_HITTABLE, true);
- }
- else
- {
- actor.SetProperty( propertyActorHittable, hittable );
- }
-}
-
-bool PageFactory::GetActorHittability( Actor actor )
-{
- bool hittable = false;
-
- Property::Index propertyActorHittable = actor.GetPropertyIndex(ACTOR_HITTABLE);
- if(propertyActorHittable != Property::INVALID_INDEX)
- {
- hittable = actor.GetProperty<bool>( propertyActorHittable );
- }
-
- return hittable;
-}
-
-PageFactory::RefreshSignal& PageFactory::PageRefreshSignal()
-{
- return mPageRefreshSignal;
-}
-
-void PageFactory::EmitPageRefreshSignal( int pageId )
-{
- mPageRefreshSignal.Emit( pageId );
-}
-
-} // namespace Toolkit
-
-} // namespace Dali
+++ /dev/null
-#ifndef __DALI_TOOLKIT_PAGE_FACTORY_H__
-#define __DALI_TOOLKIT_PAGE_FACTORY_H__
-
-/*
- * Copyright (c) 2015 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.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-// EXTERNAL INCLUDES
-#include <dali/public-api/actors/actor.h>
-
-namespace Dali
-{
-
-namespace Toolkit
-{
-
-/**
- * PageFactory is an abstract interface for providing image actors to PageTurnView
- * Each image actor is identified by a unique ID, and has a linear order from 0 to GetNumberOfPages()-1
- */
-class DALI_IMPORT_API PageFactory
-{
-public:
- // Property Names
- static const std::string ACTOR_HITTABLE; ///< name "actor-hittable", type bool
-
-public:
-
- /**
- * Constructor
- * By default, the off screen rendering is disabled
- * Is off screen rendering is required to create the page image,
- * call EnableOffscreenRendering() before pass it as parameter to the PageTurnView
- */
- PageFactory();
-
- /**
- * Virtual destructor
- */
- virtual ~PageFactory();
-
- /**
- * Enable the off screen rendering to create the page image from actor tree
- */
- void EnableOffscreenRendering( );
-
- /**
- * Query whether offscreen rendering is needed to create the page image
- * @return
- */
- bool IsOffscreenRenderingNeeded();
-
- /**
- * Query the number of pages available from the factory.
- * The maximum available page has an ID of GetNumberOfPages()-1.
- */
- virtual unsigned int GetNumberOfPages() = 0;
-
- /**
- * Create an actor to represent the page content.
- * @param[in] pageId The ID of the page to create.
- * @return An actor, or an uninitialized pointer if the ID is out of range.
- */
- virtual Actor NewPage( unsigned int pageId ) = 0;
-
-public: //Signal
- /**
- * Signal type for notification
- */
- typedef Signal< void ( int ) > RefreshSignal;
-
- /**
- * Signal emitted when the Actor tree is ready for rendering into the page image.
- * The signal is connected to the page refresh function inside PageTurnView.
- */
- RefreshSignal& PageRefreshSignal();
-
- /**
- * Emit the page ready singal. The PageTurn view will be notified to refresh the given page accordingly.
- * @param[in] pageId the index of the page which is ready for refreshing.
- */
- void EmitPageRefreshSignal( int pageId );
-
-protected:
-
- /**
- * Sets whether an actor should be hittable for the PageTurnView::GetHitActor().
- * It is useful when a sub-tree should be hit instead of the 'leaf' actor in the actor tree.
- * By default, actors are not hittable for PageTurnView::GetHitActor()
- * @param[in] actor The actor to be set with the hittablity
- * @param[in] hittable True to be hittable, false otherwise.
- */
- void SetActorHittability( Actor actor, bool hittable );
-
- /**
- * Query whether an actor is hittable for the PageTurnView::GetHitActor().
- */
- bool GetActorHittability( Actor actor );
-
-private:
-
- bool mNeedOffscreenRendering;
-
- RefreshSignal mPageRefreshSignal;
-};
-
-} // namespace Toolkit
-
-} // namespace Dali
-#endif /* __DALI_TOOLKIT_PAGE_FACTORY_H__ */
$(devel_api_src_dir)/controls/bubble-effect/bubble-emitter.cpp \
$(devel_api_src_dir)/controls/effects-view/effects-view.cpp \
$(devel_api_src_dir)/controls/magnifier/magnifier.cpp \
- $(devel_api_src_dir)/controls/page-turn-view/page-factory.cpp \
- $(devel_api_src_dir)/controls/page-turn-view/page-turn-landscape-view.cpp \
- $(devel_api_src_dir)/controls/page-turn-view/page-turn-portrait-view.cpp \
- $(devel_api_src_dir)/controls/page-turn-view/page-turn-view.cpp \
$(devel_api_src_dir)/controls/popup/confirmation-popup.cpp \
$(devel_api_src_dir)/controls/popup/popup.cpp \
$(devel_api_src_dir)/controls/shadow-view/shadow-view.cpp \
devel_api_magnifier_header_files = \
$(devel_api_src_dir)/controls/magnifier/magnifier.h
-devel_api_page_turn_view_header_files = \
- $(devel_api_src_dir)/controls/page-turn-view/page-factory.h \
- $(devel_api_src_dir)/controls/page-turn-view/page-turn-landscape-view.h \
- $(devel_api_src_dir)/controls/page-turn-view/page-turn-portrait-view.h \
- $(devel_api_src_dir)/controls/page-turn-view/page-turn-view.h
-
devel_api_popup_header_files = \
$(devel_api_src_dir)/controls/popup/confirmation-popup.h \
$(devel_api_src_dir)/controls/popup/popup.h
* please set the uniforms with the same values as the PageTurnEffect.
*
* Animatable/Constrainable uniforms:
- * "uShadowWidth" - The width of shadow to be pageSize * shadowWidth. This shadow appears at the edges of the actor
- * which is not visible on static pages
* "uSpineShadowParameter" - The two parameters are the major&minor radius (in pixels) to form an ellipse shape. The top-left
* quarter of this ellipse is used to calculate spine normal for simulating shadow
* "uIsBackImageVisible" - Set whether the current page is with its backside visible. Need to pass the parameter as true for
**/
inline ShaderEffect CreatePageTurnBookSpineEffect()
{
- std::string vertexSource(
- "precision mediump float;\n"
- "uniform float uShadowWidth;\n"
- " void main()\n"
- " {\n"
- " gl_Position = uProjection * uModelView * vec4(aPosition, 1.0);\n"
- " vTexCoord.x = (aTexCoord.x-sTextureRect.s) /( 1.0 - uShadowWidth ) + sTextureRect.s;\n"
- " vTexCoord.y = ( aTexCoord.y-sTextureRect.t-0.5*uShadowWidth*(sTextureRect.q-sTextureRect.t) )/( 1.0 - uShadowWidth ) + sTextureRect.t;\n"
- " }");
+ std::string vertexSource = DALI_COMPOSE_SHADER(
+ precision mediump float;\n
+ void main()\n
+ {\n
+ gl_Position = uProjection * uModelView * vec4(aPosition, 1.0);\n
+ vTexCoord = aTexCoord;\n
+ }\n);
// the simplified version of the fragment shader of page turn effect
- std::string fragmentSource(
- "precision mediump float;\n"
- "uniform float uIsBackImageVisible;\n"
- "uniform float uPageWidth;\n"
- "uniform vec2 uSpineShadowParameter;\n"
- " void main()\n"
- " {\n"
- // leave the border for display shadow, not visible( out of the screen ) when the page is static
- " if( vTexCoord.y > sTextureRect.q || vTexCoord.y < sTextureRect.t || vTexCoord.x > sTextureRect.p )\n"
- " {\n"
- " gl_FragColor = vec4( 0.0 );\n"
- " }\n"
- " else \n"
- " { \n"
+ std::string fragmentSource = DALI_COMPOSE_SHADER(
+ precision mediump float;\n
+ uniform float uIsBackImageVisible;\n
+ uniform float uPageWidth;\n
+ uniform vec2 uSpineShadowParameter;\n
+ void main()\n
+ {\n
// flip the image horizontally by changing the x component of the texture coordinate
- " if( uIsBackImageVisible == 1.0 ) gl_FragColor = texture2D( sTexture, vec2( sTextureRect.p+sTextureRect.s-vTexCoord.x, vTexCoord.y ) ) * uColor; \n"
- " else gl_FragColor = texture2D( sTexture, vTexCoord ) * uColor;\n"
- " \n"
+ if( uIsBackImageVisible == 1.0 )\n
+ gl_FragColor = texture2D( sTexture, vec2( sTextureRect.p+sTextureRect.s-vTexCoord.x, vTexCoord.y ) ) * uColor; \n
+ else\n
+ gl_FragColor = texture2D( sTexture, vTexCoord ) * uColor;\n
// display book spine, a stripe of shadowed texture
- " float pixelPos = (vTexCoord.x-sTextureRect.s)*uPageWidth; \n"
- " if(pixelPos < uSpineShadowParameter.x) \n"
- " {\n"
- " float x = pixelPos - uSpineShadowParameter.x;\n"
- " float y = sqrt( uSpineShadowParameter.x*uSpineShadowParameter.x - x*x );\n"
- " vec2 spineNormal = normalize(vec2(uSpineShadowParameter.y*x/uSpineShadowParameter.x, y));\n"
- " gl_FragColor.rgb *= spineNormal.y; \n"
- " }"
- " }\n"
- " }" );
-
- const float DEFAULT_SHADOW_WIDTH(0.15f);
+ float pixelPos = (vTexCoord.x-sTextureRect.s)*uPageWidth; \n
+ if(pixelPos < uSpineShadowParameter.x) \n
+ {\n
+ float x = pixelPos - uSpineShadowParameter.x;\n
+ float y = sqrt( uSpineShadowParameter.x*uSpineShadowParameter.x - x*x );\n
+ vec2 spineNormal = normalize(vec2(uSpineShadowParameter.y*x/uSpineShadowParameter.x, y));\n
+ gl_FragColor.rgb *= spineNormal.y; \n
+ }
+ } );
+
const Vector2 DEFAULT_SPINE_SHADOW_PARAMETER(50.0f, 20.0f);
ShaderEffect shaderEffect = ShaderEffect::New( vertexSource, fragmentSource );
shaderEffect.SetUniform( "uIsBackImageVisible", -1.f );
- shaderEffect.SetUniform( "uShadowWidth", DEFAULT_SHADOW_WIDTH );
shaderEffect.SetUniform( "uSpineShadowParameter", DEFAULT_SPINE_SHADOW_PARAMETER );
float defaultPageWidth = Dali::Stage::GetCurrent().GetSize().x;
- shaderEffect.SetUniform( "uPageWidth", defaultPageWidth/(1.f-DEFAULT_SHADOW_WIDTH) );
+ shaderEffect.SetUniform( "uPageWidth", defaultPageWidth );
return shaderEffect;
}
constraint.Apply();
}
-ShaderEffect Dali::Toolkit::Internal::CreatePageTurnEffect(bool enableBlending)
+ShaderEffect Dali::Toolkit::Internal::CreatePageTurnEffect()
{
std::string vertexShader = DALI_COMPOSE_SHADER(
/*
\n
uniform vec2 uPageSize;\n
uniform float uIsTurningBack;\n
- uniform float uShadowWidth;\n
varying vec3 vNormal;\n
varying vec4 vPosition;\n
varying float vEdgeShadow;\n
vTexCoord = aTexCoord;
vNormal = uNormalMatrix*normal;\n
vPosition = uModelView * position;\n
- );
-
- std::string vertexShaderWithFakedShadow = DALI_COMPOSE_SHADER(
- // display shadow, the fake shadow value is calculated according to the height and the distance from page edge
- vTexCoord.x = (aTexCoord.x-sTextureRect.s) /( 1.0 - uShadowWidth ) + sTextureRect.s;\n
- vTexCoord.y = ( aTexCoord.y-sTextureRect.t-0.5*uShadowWidth*(sTextureRect.q-sTextureRect.t) )/( 1.0 - uShadowWidth ) + sTextureRect.t;\n
- float heightCoef = (1.0 + position.z*uIsTurningBack*3.0 / uPageSize.x) * 0.6;
- vEdgeShadow = clamp(0.9 - heightCoef, 0.0, 0.9 ); \n
- if( vTexCoord.y >= sTextureRect.q || vTexCoord.y <= sTextureRect.t || vTexCoord.x >= sTextureRect.p )\n
- {\n
- float inversedShadowWidth = (1.0-uShadowWidth) / uShadowWidth ;\n
- float alpha1 = (vTexCoord.x-sTextureRect.p) * inversedShadowWidth / (sTextureRect.p - sTextureRect.s);\n
- inversedShadowWidth = 2.0 * inversedShadowWidth / (sTextureRect.q - sTextureRect.t); \n
- float alpha2 = (vTexCoord.y-sTextureRect.q) * inversedShadowWidth;\n
- float alpha3 = (sTextureRect.t-vTexCoord.y) * inversedShadowWidth;\n
- float alpha;\n
- if(alpha1 > 0.0 && alpha2 > 0.0) alpha = sqrt(alpha2*alpha2+alpha1*alpha1)/sqrt(1.0 + max(alpha1,alpha2)*max(alpha1,alpha2));\n //bottom-right corner
- else if(alpha1 > 0.0 && alpha3 > 0.0) alpha = sqrt(alpha3*alpha3+alpha1*alpha1)/sqrt(1.0+max(alpha1,alpha3)*max(alpha1,alpha3));\n //top-right corner
- else alpha = max(alpha1,max(alpha2,alpha3)); \n
- alpha = 0.9 - alpha*0.9;\n
- vEdgeShadow = clamp(alpha - heightCoef, 0.0, 0.9 ); \n
}\n
);
- std::string vertexShaderEnd("}");
-
- std::string fragmentShaderPartOne = DALI_COMPOSE_SHADER(
+ std::string fragmentShader = DALI_COMPOSE_SHADER(
precision mediump float;\n
uniform vec2 uPageSize;\n
uniform vec2 uSpineShadowParameter;\n
vec3 normal = normalize(vNormal);\n
vec4 texel;\n
float spineShadowCoef = 1.0; \n
- );
-
- std::string fragmentShaderWithFakedShadow = DALI_COMPOSE_SHADER(
- if( vTexCoord.y > sTextureRect.q || vTexCoord.y < sTextureRect.t || vTexCoord.x > sTextureRect.p )\n
- texel = vec4(0.0,0.0,0.0,vEdgeShadow);
- else \n
- );
-
- std::string fragmentShaderPartTwo = DALI_COMPOSE_SHADER(
- { \n
- // display page content
- // display back image of the page, flip the texture
- if( dot(vPosition.xyz, normal) > 0.0 ) texel = texture2D( sTexture, vec2( sTextureRect.p+sTextureRect.s-vTexCoord.x, vTexCoord.y ) );\n
- // display front image of the page
- else texel = texture2D( sTexture, vTexCoord );\n
- // display book spine, a stripe of shadowed texture
- float pixelPos = (vTexCoord.x-sTextureRect.s)*uPageSize.x; \n
- if(pixelPos < uSpineShadowParameter.x) \n
- {\n
- float x = pixelPos - uSpineShadowParameter.x;\n
- float y = sqrt( uSpineShadowParameter.x*uSpineShadowParameter.x - x*x);\n
- spineShadowCoef = normalize( vec2( uSpineShadowParameter.y*x/uSpineShadowParameter.x, y ) ).y;\n
- }\n
- }\n
- // calculate the lighting
- // set the ambient color as vec3(0.4);
- float lightColor = abs( normal.z ) * 0.6 + 0.4;\n
- gl_FragColor = vec4( ( spineShadowCoef* lightColor)* texel.rgb , texel.a ) * uColor;\n
+ // display page content
+ // display back image of the page, flip the texture
+ if( dot(vPosition.xyz, normal) > 0.0 ) texel = texture2D( sTexture, vec2( sTextureRect.p+sTextureRect.s-vTexCoord.x, vTexCoord.y ) );\n
+ // display front image of the page
+ else texel = texture2D( sTexture, vTexCoord );\n
+ // display book spine, a stripe of shadowed texture
+ float pixelPos = (vTexCoord.x-sTextureRect.s)*uPageSize.x; \n
+ if(pixelPos < uSpineShadowParameter.x) \n
+ {\n
+ float x = pixelPos - uSpineShadowParameter.x;\n
+ float y = sqrt( uSpineShadowParameter.x*uSpineShadowParameter.x - x*x);\n
+ spineShadowCoef = normalize( vec2( uSpineShadowParameter.y*x/uSpineShadowParameter.x, y ) ).y;\n
+ }\n
+ // calculate the lighting
+ // set the ambient color as vec3(0.4);
+ float lightColor = abs( normal.z ) * 0.6 + 0.4;\n
+ gl_FragColor = vec4( ( spineShadowCoef* lightColor)* texel.rgb , texel.a ) * uColor;\n
}
);
// Create the implementation, temporarily owned on stack,
- Dali::ShaderEffect shaderEffectCustom;
- std::ostringstream vertexShaderStringStream;
- std::ostringstream fragmentShaderStringStream;
- if( enableBlending )
- {
- vertexShaderStringStream<< vertexShader << vertexShaderWithFakedShadow << vertexShaderEnd;
- fragmentShaderStringStream<< fragmentShaderPartOne << fragmentShaderWithFakedShadow << fragmentShaderPartTwo;
- shaderEffectCustom = Dali::ShaderEffect::New( vertexShaderStringStream.str(), fragmentShaderStringStream.str(),
- ShaderEffect::GeometryHints( ShaderEffect::HINT_GRID | ShaderEffect::HINT_DEPTH_BUFFER | ShaderEffect::HINT_BLENDING) );
- }
- else
- {
- vertexShaderStringStream<< vertexShader << vertexShaderEnd;
- fragmentShaderStringStream<< fragmentShaderPartOne << fragmentShaderPartTwo;
- shaderEffectCustom = Dali::ShaderEffect::New( vertexShaderStringStream.str(), fragmentShaderStringStream.str(),
- ShaderEffect::GeometryHints( ShaderEffect::HINT_GRID | ShaderEffect::HINT_DEPTH_BUFFER ) );
- }
+ Dali::ShaderEffect shaderEffectCustom = Dali::ShaderEffect::New( vertexShader, fragmentShader,ShaderEffect::HINT_GRID );
- static const float DEFAULT_SHADOW_WIDTH(0.15f);
static const Vector2 DEFAULT_SPINE_SHADOW_PARAMETER(50.0f, 20.0f);
Vector2 defaultPageSize = Dali::Stage::GetCurrent().GetSize();
Dali::Matrix zeroMatrix(true);
shaderEffectCustom.SetUniform( "uCommonParameters", zeroMatrix );
- shaderEffectCustom.SetUniform( "uPageSize", defaultPageSize/(1.f-DEFAULT_SHADOW_WIDTH) );
- shaderEffectCustom.SetUniform( "uShadowWidth", DEFAULT_SHADOW_WIDTH );
+ shaderEffectCustom.SetUniform( "uPageSize", defaultPageSize );
shaderEffectCustom.SetUniform( "uSpineShadowParameter", DEFAULT_SPINE_SHADOW_PARAMETER );
shaderEffectCustom.RegisterProperty( "uOriginalCenter", Vector2( defaultPageSize[0], defaultPageSize[1]*0.5f ) );
* //set initial values
* pageTurnEffect.SetUniform("uPageSize", Vector2);\n
* pageTurnEffect.SetUniform("uOriginalCenter", Vector2);\n
- * pageTurnEffect.SetUniform("uIsTurningBack", bool) SetIsTurningBack();\n
+ * pageTurnEffect.SetUniform("uIsTurningBack", bool);\n
* pageTurnEffect.SetUniform("uCurrentCenter",Vector2);\n
*
* //Animate it with the current center property\n
* animation[mAnimationIndex].Play(); \n
*
* Animatable/Constrainable uniforms:
- *
- * @param[in] enableBlending If true, apply HINT_BLENDING when creating the shader object; If false, disable the HINT_BLENDING
- * @return A handle to a newly allocated ShaderEffect
*/
-ShaderEffect CreatePageTurnEffect(bool enableBlending = true);
+ShaderEffect CreatePageTurnEffect();
} // namespace Internal
mTurningPageLayer.SetParentOrigin( ParentOrigin::CENTER );
}
-ImageActor PageTurnLandscapeView::NewPageFromRenderBuffer( int pageIndex )
-{
- int index = pageIndex % NUMBER_OF_CACHED_PAGES;
- ImageActor page = ImageActor::New( mRenderedPage[ index ],
- ImageActor::PixelArea( mPageSize.width, 0, mPageSize.width, mPageSize.height ) );
- if( pageIndex <= mTotalPageCount-1)
- {
- int nextIndex = (pageIndex+1) % NUMBER_OF_CACHED_PAGES;
- page.Add( ImageActor::New( mRenderedPage[ nextIndex ],ImageActor::PixelArea( 0, 0, mPageSize.width, mPageSize.height ) ) );
- }
- return page;
-}
-
void PageTurnLandscapeView::OnAddPage( ImageActor newPage, bool isLeftSide )
{
newPage.SetParentOrigin( ParentOrigin::CENTER );
if( panPosition.x > mPageSize.width && mCurrentPageIndex < mTotalPageCount-1 )
{
mPanActor = mPageActors[mCurrentPageIndex%NUMBER_OF_CACHED_PAGES]; // right side page
+ mTurningPageIndex = mCurrentPageIndex;
}
else if( panPosition.x <= mPageSize.width && mCurrentPageIndex > 0 )
{
mPanActor = mPageActors[ (mCurrentPageIndex-1)%NUMBER_OF_CACHED_PAGES ]; // left side page
+ mTurningPageIndex = mCurrentPageIndex - 1;
}
else
{
*/
// INTERNAL INCLUDES
-#include <dali-toolkit/devel-api/controls/page-turn-view/page-turn-landscape-view.h>
+#include <dali-toolkit/public-api/controls/page-turn-view/page-turn-landscape-view.h>
#include <dali-toolkit/internal/controls/page-turn-view/page-turn-view-impl.h>
namespace Dali
virtual void OnPageTurnViewInitialize();
/**
- * copydoc PageTurnView::NewPAgeFromRenderBuffer
- */
- virtual ImageActor NewPageFromRenderBuffer( int pageIndex );
-
- /**
* @copydoc PageTurnView::OnAddPage
*/
virtual void OnAddPage( ImageActor newPage, bool isLeftSide );
mTurningPageLayer.SetParentOrigin( ParentOrigin::CENTER_LEFT );
}
-ImageActor PageTurnPortraitView::NewPageFromRenderBuffer( int pageIndex )
-{
- return ImageActor::New(mRenderedPage[pageIndex % NUMBER_OF_CACHED_PAGES]);
-}
-
Vector2 PageTurnPortraitView::SetPanPosition( const Vector2& gesturePosition )
{
return gesturePosition;
if( mCurrentPageIndex < mTotalPageCount )
{
mPanActor = mPageActors[mCurrentPageIndex%NUMBER_OF_CACHED_PAGES];
+ mTurningPageIndex = mCurrentPageIndex;
}
else
{
if( mCurrentPageIndex > 0 && gestureSpeed > GESTURE_SPEED_THRESHOLD && offset.x > fabs( offset.y ))
{
ImageActor actor = mPageActors[ (mCurrentPageIndex-1) % NUMBER_OF_CACHED_PAGES ];
- if(actor.GetParent() != mRootOnScreen)
+ if(actor.GetParent() != Self())
{
return;
}
// Guard against destruction during signal emission
//Emit signal, to notify that page[mCurrentPageIndex-1] is turning backwards
Toolkit::PageTurnView handle( GetOwner() );
- mPageTurnStartedSignal.Emit( handle, static_cast<unsigned int>(mCurrentPageIndex-1), false );
+ mTurningPageIndex = mCurrentPageIndex-1;
+ mPageTurnStartedSignal.Emit( handle, static_cast<unsigned int>(mTurningPageIndex), false );
//update pages
mCurrentPageIndex--;
AddPage( mCurrentPageIndex-NUMBER_OF_CACHED_PAGES_EACH_SIDE );
OrganizePageDepth();
+ mPageActors[mTurningPageIndex%NUMBER_OF_CACHED_PAGES].SetVisible(true);
+
// Add the page to tuning page layer and set up PageTurnEffect
mShadowView.Add( actor );
actor.SetShaderEffect( mTurnEffect[mIndex] );
// Start an animation to turn the previous page back
Animation animation = Animation::New( PAGE_TURN_OVER_ANIMATION_DURATION );
- mAnimationActorPair[animation] = actor;
+ mAnimationPageIdPair[animation] = mCurrentPageIndex;
mAnimationIndexPair[animation] = mIndex;
animation.AnimateTo( Property( mTurnEffect[mIndex], "uCurrentCenter" ),
{
SetCullFace( imageActor, CullBack );
}
- animation.FinishedSignal().Connect( this, &PageTurnPortraitView::OnTurnedOver );
+ animation.FinishedSignal().Connect( this, &PageTurnPortraitView::TurnedOverBackwards );
+ }
+}
+
+void PageTurnPortraitView::OnTurnedOver( ImageActor actor, bool isLeftSide )
+{
+ if( isLeftSide )
+ {
+ actor.SetVisible( false );
}
}
-void PageTurnPortraitView::OnTurnedOver( Animation& animation )
+void PageTurnPortraitView::TurnedOverBackwards( Animation& animation )
{
- ImageActor imageActor = ImageActor::DownCast( mAnimationActorPair[ animation ] );
+ ImageActor imageActor = mPageActors[mAnimationPageIdPair[animation] % NUMBER_OF_CACHED_PAGES];
if( imageActor )
{
SetCullFace( imageActor, CullNone );
*/
// INTERNAL INCLUDES
-#include <dali-toolkit/devel-api/controls/page-turn-view/page-turn-portrait-view.h>
+#include <dali-toolkit/public-api/controls/page-turn-view/page-turn-portrait-view.h>
#include <dali-toolkit/internal/controls/page-turn-view/page-turn-view-impl.h>
namespace Dali
virtual void OnPageTurnViewInitialize();
/**
- * @copydoc PageTurnView::NewPageFromRenderBuffer
- */
- virtual ImageActor NewPageFromRenderBuffer( int pageIndex );
-
- /**
* @copydoc PageTurnView::SetPanPosition
*/
virtual Vector2 SetPanPosition( const Vector2& gesturePosition );
*/
virtual void OnPossibleOutwardsFlick( const Vector2& panPosition, float gestureSpeed );
+ virtual void OnTurnedOver( ImageActor actor, bool isLeftSide );
+
private:
/**
* @copydoc PageTurnView::TurnedOver
*/
- void OnTurnedOver( Animation& animation );
+ void TurnedOverBackwards( Animation& animation );
private:
#include <dali-toolkit/internal/controls/page-turn-view/page-turn-view-impl.h>
// EXTERNAL INCLUDES
+#include <cstring> // for strcmp
#include <dali/public-api/animation/animation.h>
#include <dali/public-api/animation/constraint.h>
#include <dali/devel-api/events/hit-test-algorithm.h>
namespace //Unnamed namespace
{
-// To register type
-
-DALI_TYPE_REGISTRATION_BEGIN( Toolkit::PageTurnView, Toolkit::Control, NULL )
-DALI_TYPE_REGISTRATION_END()
-
// default grid density for page turn effect, 10 pixels by 10 pixels
const float DEFAULT_GRID_DENSITY(10.0f);
float mThres;
};
-bool IsActorHittableFunction( Actor actor, Dali::HitTestAlgorithm::TraverseType type )
-{
- bool hittable = false;
-
- switch (type)
- {
- case Dali::HitTestAlgorithm::CHECK_ACTOR:
- {
- // Check whether the actor is visible and not fully transparent.
- Property::Index propertyActorHittable = actor.GetPropertyIndex(Toolkit::PageFactory::ACTOR_HITTABLE);
- if( actor.IsSensitive()
- && actor.IsVisible()
- && actor.GetCurrentWorldColor().a > 0.01f// not FULLY_TRANSPARENT
- && ( propertyActorHittable != Property::INVALID_INDEX &&
- actor.GetProperty<bool>( propertyActorHittable ) ) )
- {
- hittable = true;
- }
- break;
- }
- case Dali::HitTestAlgorithm::DESCEND_ACTOR_TREE:
- {
- if( actor.IsSensitive() && actor.IsVisible() ) // Actor is visible, if not visible then none of its children are visible.
- {
- hittable = true;
- }
- break;
- }
- default:
- {
- break;
- }
- }
-
- return hittable;
-}
-
} //unnamed namespace
namespace Dali
namespace Internal
{
+namespace
+{
+
+BaseHandle Create()
+{
+ // empty handle as we cannot create PageTurnView(but type registered for page turn signal)
+ return BaseHandle();
+}
+
+// Setup properties, signals and actions using the type-registry.
+DALI_TYPE_REGISTRATION_BEGIN( Toolkit::PageTurnView, Toolkit::Control, Create );
+
+DALI_PROPERTY_REGISTRATION( Toolkit, PageTurnView, "page-size", VECTOR2, PAGE_SIZE )
+DALI_PROPERTY_REGISTRATION( Toolkit, PageTurnView, "current-page-id", INTEGER, CURRENT_PAGE_ID )
+DALI_PROPERTY_REGISTRATION( Toolkit, PageTurnView, "spine-shadow", VECTOR2, SPINE_SHADOW )
+
+DALI_SIGNAL_REGISTRATION( Toolkit, PageTurnView, "page-turn-started", SIGNAL_PAGE_TURN_STARTED )
+DALI_SIGNAL_REGISTRATION( Toolkit, PageTurnView, "page-turn-finished", SIGNAL_PAGE_TURN_FINISHED )
+DALI_SIGNAL_REGISTRATION( Toolkit, PageTurnView, "page-pan-started", SIGNAL_PAGE_PAN_STARTED )
+DALI_SIGNAL_REGISTRATION( Toolkit, PageTurnView, "page-pan-finished", SIGNAL_PAGE_PAN_FINISHED )
+
+DALI_TYPE_REGISTRATION_END()
+
+}
+
// these several constants are also used in the derived classes
const int PageTurnView::MAXIMUM_TURNING_NUM = 4;
const int PageTurnView::NUMBER_OF_CACHED_PAGES_EACH_SIDE = MAXIMUM_TURNING_NUM + 1;
mPageFactory( pageFactory ),
mPageSize( pageSize ),
mTotalPageCount( 0 ),
- mIsEditMode( false ),
- mNeedOffscreenRendering( false ),
mPanning( false ),
mSpineShadowParameter( DEFAULT_SPINE_SHADOW_PARAMETER ),
mCurrentPageIndex( 0 ),
+ mTurningPageIndex( 0 ),
mIndex( 0 ),
mPress( false ),
mPageUpdated( true ),
// create the page turn effect objects
for( int i = 0; i < MAXIMUM_TURNING_NUM; i++ )
{
- mTurnEffect[i] = CreatePageTurnEffect( false );
+ mTurnEffect[i] = CreatePageTurnEffect();
mTurnEffect[i].SetProperty( ShaderEffect::Property::GRID_DENSITY, Property::Value( DEFAULT_GRID_DENSITY ) );
mTurnEffect[i].SetUniform( "uPageSize", mPageSize );
mTurnEffect[i].SetUniform( "uShadowWidth", 0.f);
mTurningPageLayer = Layer::New();
mTurningPageLayer.SetAnchorPoint( AnchorPoint::CENTER_LEFT );
- // Set control size and the parent origin of turningPageLayer
+ mTurningPageLayer.SetBehavior(Layer::LAYER_3D);
+
+ // Set control size and the parent origin of page layers
OnPageTurnViewInitialize();
- mRootOnScreen = Actor::New();
- mRootOnScreen.SetPositionInheritanceMode( USE_PARENT_POSITION );
- mRootOnScreen.SetSize( mControlSize );
- Self().Add( mRootOnScreen );
- mRootOnScreen.Add(mTurningPageLayer);
+ Self().Add(mTurningPageLayer);
mTotalPageCount = static_cast<int>( mPageFactory.GetNumberOfPages() );
- mNeedOffscreenRendering = mPageFactory.IsOffscreenRenderingNeeded();
- if( mNeedOffscreenRendering )
- {
- SetupRenderTasks();
- }
-
// add pages to the scene, and set depth for the stacked pages
for( int i = 0; i < NUMBER_OF_CACHED_PAGES_EACH_SIDE; i++ )
{
AddPage( i );
if(mPageActors[i])
{
- mPageActors[i].SetSortModifier( -static_cast<float>( i )*STATIC_PAGE_INTERVAL_DISTANCE );
+ mPageActors[i].SetZ( -static_cast<float>( i )*STATIC_PAGE_INTERVAL_DISTANCE );
}
}
+ mPageActors[0].SetVisible(true);
// enable the pan gesture which is attached to the control
EnableGestureDetection(Gesture::Type(Gesture::Pan));
-
- mPageFactory.PageRefreshSignal().Connect(this, &PageTurnView::RenderPage);
-}
-
-void PageTurnView::SetupRenderTasks()
-{
- mPageSourceActor.resize( NUMBER_OF_CACHED_PAGES );
- mOffscreenTask.resize( NUMBER_OF_CACHED_PAGES );
- mRenderedPage.resize( NUMBER_OF_CACHED_PAGES );
-
- mCameraActor = CameraActor::New(mControlSize);
- mCameraActor.SetParentOrigin(ParentOrigin::CENTER);
- mCameraActor.SetPositionInheritanceMode( DONT_INHERIT_POSITION );
- mCameraActor.SetInheritScale( false );
- Self().Add(mCameraActor);
-
- RenderTaskList taskList = Stage::GetCurrent().GetRenderTaskList();
- for(int i=0; i<NUMBER_OF_CACHED_PAGES; i++)
- {
- mPageSourceActor[i] = Actor::New();
- mPageSourceActor[i].SetParentOrigin(ParentOrigin::CENTER);
- mPageSourceActor[i].SetColorMode( USE_OWN_COLOR );
- mPageSourceActor[i].SetPositionInheritanceMode( DONT_INHERIT_POSITION );
- mPageSourceActor[i].SetInheritScale( false );
- Self().Add( mPageSourceActor[i] );
- mPageSourceActor[i].SetSensitive( false );
-
- mRenderedPage[i] = FrameBufferImage::New( mControlSize.width, mControlSize.height, Pixel::RGB8888, Image::UNUSED );
- mOffscreenTask[i] = taskList.CreateTask();
- mOffscreenTask[i].SetRefreshRate( RenderTask::REFRESH_ONCE );
- mOffscreenTask[i].SetCameraActor(mCameraActor);
- mOffscreenTask[i].SetSourceActor( mPageSourceActor[i] );
- mOffscreenTask[i].SetExclusive(true);
- mOffscreenTask[i].SetInputEnabled( false );
- mOffscreenTask[i].SetClearEnabled( true );
- mOffscreenTask[i].SetClearColor( Vector4(0.f,0.f,0.f,0.f) );
- mOffscreenTask[i].SetTargetFrameBuffer( mRenderedPage[i] );
- mOffscreenTask[i].SetScreenToFrameBufferMappingActor( Self() );
- }
}
void PageTurnView::SetupShadowView()
mShadowView.SetPointLightFieldOfView( Math::PI / 2.0f);
mShadowView.SetShadowColor(DEFAULT_SHADOW_COLOR);
- mShadowLayer = Layer::New();
- mShadowLayer.SetPositionInheritanceMode( USE_PARENT_POSITION );
- mRootOnScreen.Add(mShadowLayer);
- mShadowLayer.Raise();
-
mShadowPlane = CreateSolidColorActor( Vector4 (0.0f, 0.0f, 0.0f, 0.0f) );
mShadowPlane.SetPositionInheritanceMode( USE_PARENT_POSITION_PLUS_LOCAL_POSITION );
mShadowPlane.SetSize( mControlSize );
- mShadowLayer.Add( mShadowPlane );
+ Self().Add( mShadowPlane );
mShadowView.SetShadowPlane( mShadowPlane );
mPointLight = Actor::New();
mPointLight.SetAnchorPoint( origin );
mPointLight.SetParentOrigin( origin );
mPointLight.SetPosition( 0.f, 0.f, mPageSize.width*POINT_LIGHT_HEIGHT_RATIO );
- mRootOnScreen.Add( mPointLight );
+ Self().Add( mPointLight );
mShadowView.SetPointLight( mPointLight );
mTurningPageLayer.Add( mShadowView );
void PageTurnView::OnStageConnection( int depth )
{
SetupShadowView();
- mTurningPageLayer.RaiseToTop();
+ mTurningPageLayer.Raise();
}
void PageTurnView::OnStageDisconnection()
{
if(mShadowView)
{
- Self().Remove(mPointLight);
- Self().Remove(mShadowLayer);
- mTurningPageLayer.Remove( mShadowView );
+ mPointLight.Unparent();
+ mShadowPlane.Unparent();
+ mShadowView.Unparent();
}
// make sure the status of the control is updated correctly when the pan gesture is interrupted
{
mPanning = false;
- mRootOnScreen.Add(mPanActor);
+ Self().Add(mPanActor);
mIsAnimating[mIndex] = false;
mPanActor.RemoveConstraints();
mTurnEffect[mIndex].RemoveConstraints();
}
}
+void PageTurnView::SetPageSize( const Vector2& pageSize )
+{
+ mPageSize = pageSize;
+ mSpineEffectFront.SetUniform("uPageWidth", mPageSize.width );
+ mSpineEffectBack.SetUniform("uPageWidth", mPageSize.width );
+ for( int i = 0; i < MAXIMUM_TURNING_NUM; i++ )
+ {
+ mTurnEffect[i].SetUniform( "uPageSize", mPageSize );
+ }
+
+ if( mPointLight )
+ {
+ mPointLight.SetPosition( 0.f, 0.f, mPageSize.width*POINT_LIGHT_HEIGHT_RATIO );
+ }
+
+ for( size_t i=0; i<mPageActors.size(); i++ )
+ {
+ if( mPageActors[i] )
+ {
+ mPageActors[i].SetSize( mPageSize );
+ if( mPageActors[i].GetChildCount()>0 )
+ {
+ mPageActors[i].GetChildAt(0).SetSize( mPageSize );
+ }
+ }
+ }
+
+ OnPageTurnViewInitialize();
+
+ if( mShadowPlane )
+ {
+ mShadowPlane.SetSize( mControlSize );
+ }
+}
+
+Vector2 PageTurnView::GetPageSize()
+{
+ return mPageSize;
+}
+
void PageTurnView::SetSpineShadowParameter( const Vector2& spineShadowParameter )
{
mSpineShadowParameter = spineShadowParameter;
void PageTurnView::GoToPage( unsigned int pageId )
{
- int pageIdx = static_cast<int>(pageId);
+ int pageIdx = Clamp( static_cast<int>(pageId), 0, mTotalPageCount-1);
+
+ if( mCurrentPageIndex == pageIdx )
+ {
+ return;
+ }
+
// record the new current page index
mCurrentPageIndex = pageIdx;
{
AddPage( i );
}
+
+ mPageActors[pageId%NUMBER_OF_CACHED_PAGES].SetVisible(true);
+ if( pageId > 0 )
+ {
+ mPageActors[(pageId-1)%NUMBER_OF_CACHED_PAGES].SetVisible(true);
+ }
// set ordered depth to the stacked pages
OrganizePageDepth();
}
return static_cast< unsigned int >( mCurrentPageIndex );
}
-Actor PageTurnView::EnterEditMode()
-{
- if( mNeedOffscreenRendering )
- {
- DALI_ASSERT_ALWAYS( mCurrentPageIndex >= 0 );
-
- mIsEditMode = true;
-
- int index = mCurrentPageIndex % NUMBER_OF_CACHED_PAGES;
- mOffscreenTask[index].SetInputEnabled( true );
- mPageSourceActor[index].SetSensitive( true );
- mOffscreenTask[index].SetRefreshRate( RenderTask::REFRESH_ALWAYS );
-
- mRootOnScreen.SetSensitive(false);
-
- return mPageSourceActor[index].GetChildAt( 0 );
- }
- else
- {
- return Actor();
- }
-}
-
-void PageTurnView::LeaveEditMode()
-{
- if( mNeedOffscreenRendering )
- {
- DALI_ASSERT_ALWAYS( mCurrentPageIndex >= 0 );
-
- mIsEditMode = false;
-
- int index = mCurrentPageIndex % NUMBER_OF_CACHED_PAGES;
- mOffscreenTask[index].SetInputEnabled( false );
- mPageSourceActor[index].SetSensitive( false );
- mOffscreenTask[index].SetRefreshRate( RenderTask::REFRESH_ONCE );
-
- mRootOnScreen.SetSensitive(true);
- }
-}
-
-Actor PageTurnView::GetHitActor( Vector2& screenCoordinates, Vector2& actorCoordinates )
-{
- if( mNeedOffscreenRendering && mCurrentPageIndex < mTotalPageCount)
- {
- int index = mCurrentPageIndex % NUMBER_OF_CACHED_PAGES;
-
- Dali::HitTestAlgorithm::Results results;
- if( !mOffscreenTask[index].GetInputEnabled() )
- {
- mOffscreenTask[index].SetInputEnabled( true );
- mPageSourceActor[index].SetSensitive( true );
- Dali::HitTestAlgorithm::HitTest( mOffscreenTask[index], screenCoordinates, results, IsActorHittableFunction );
- mOffscreenTask[index].SetInputEnabled( false );
- mPageSourceActor[index].SetSensitive( false );
- }
- else
- {
- Dali::HitTestAlgorithm::HitTest( mOffscreenTask[index], screenCoordinates, results, IsActorHittableFunction );
- }
- actorCoordinates = results.actorCoordinates;
- return results.actor;
- }
- else
- {
- return Actor();
- }
-}
-
void PageTurnView::AddPage( int pageIndex )
{
if(pageIndex > -1 && pageIndex < mTotalPageCount) // whether the page is available from the page factory
{
int index = pageIndex % NUMBER_OF_CACHED_PAGES;
- ImageActor newPage;
- if( mNeedOffscreenRendering )
- {
- Actor source = mPageFactory.NewPage( pageIndex );
- if( mPageSourceActor[index].GetChildCount() > 0 )
- {
- mPageSourceActor[index].Remove( mPageSourceActor[index].GetChildAt( 0 ) );
- }
- mPageSourceActor[index].Add( source );
- mOffscreenTask[index].SetRefreshRate( RenderTask::REFRESH_ONCE );
- newPage = NewPageFromRenderBuffer( pageIndex );
- }
- else
- {
- newPage= ImageActor::DownCast( mPageFactory.NewPage( pageIndex ) );
- DALI_ASSERT_ALWAYS( newPage );
- }
+ ImageActor newPage= ImageActor::DownCast( mPageFactory.NewPage( pageIndex ) );
+ DALI_ASSERT_ALWAYS( newPage );
+
newPage.SetAnchorPoint( AnchorPoint::CENTER_LEFT );
newPage.SetParentOrigin( ParentOrigin::CENTER_LEFT );
newPage.SetSize( mPageSize );
- mRootOnScreen.Add( newPage );
+ Self().Add( newPage );
mPageActors[index] = newPage;
bool isLeftSide = ( pageIndex < mCurrentPageIndex );
}
else
{
- SetShaderEffect( newPage, mSpineEffectFront);
+ newPage.SetShaderEffect(mSpineEffectFront);
}
+ newPage.SetVisible( false );
+
// For Portrait, nothing to do
// For Landscape, set spineEffectBack to the new effect if it is in the left side, and set properties to the back image actor if it exists
OnAddPage( newPage, isLeftSide );
mPageActors[index].Unparent();
mIsTurnBack.erase( mPageActors[index] );
mPageActors[index].Reset();
- if( mNeedOffscreenRendering )
- {
- mPageSourceActor[index].Remove( mPageSourceActor[index].GetChildAt( 0 ) );
- }
- }
-}
-
-void PageTurnView::RenderPage( int pageIndex )
-{
- if( pageIndex > std::max(-1, mCurrentPageIndex - NUMBER_OF_CACHED_PAGES_EACH_SIDE -1)
- && pageIndex < std::min(mTotalPageCount, mCurrentPageIndex + NUMBER_OF_CACHED_PAGES_EACH_SIDE))
- {
- int index = pageIndex % NUMBER_OF_CACHED_PAGES;
- mOffscreenTask[index].SetRefreshRate( RenderTask::REFRESH_ONCE );
}
}
-void PageTurnView::RefreshAll()
-{
- mTotalPageCount = static_cast<int>( mPageFactory.GetNumberOfPages() );
- if( mTotalPageCount > 0 )
- {
- if(mCurrentPageIndex < mTotalPageCount)
- {
- GoToPage( mCurrentPageIndex );
- }
- else
- {
- GoToPage( mCurrentPageIndex-- );
- }
- }
-}
-
-void PageTurnView::RefreshCurrentPage()
-{
- RenderPage( mCurrentPageIndex );
-}
-
void PageTurnView::OnPan( const PanGesture& gesture )
{
- if( mIsEditMode )
- {
- // when interrupted by the call of DisplayCurrentPageSourceActor(),
- // make sure the panFinished is always called before stopping to responding the gesture
- // so the status of the control is updated correctly
- if(mPanning)
- {
- mPanning = false;
- PanFinished( SetPanPosition( gesture.position ), gesture.GetSpeed() );
- }
-
- return;
- }
// the pan gesture is attached to control itself instead of each page
switch( gesture.state )
{
if( mPageUpdated && animatable )
{
SetPanActor( gesture.position ); // determine which page actor is panned
- if(mPanActor && mPanActor.GetParent() != mRootOnScreen) // if the page is added to turning layer,it is undergoing an animation currently
+ if(mPanActor && mPanActor.GetParent() != Self()) // if the page is added to turning layer,it is undergoing an animation currently
{
mPanActor.Reset();
}
mPress = true;
mIsAnimating[mIndex] = true;
- mPageTurnStartedSignal.Emit( handle, static_cast<unsigned int>(mCurrentPageIndex + ( ( mIsTurnBack[mPanActor] ) ? -1 : 0 ) ), !mIsTurnBack[mPanActor] );
+ mPageTurnStartedSignal.Emit( handle, static_cast<unsigned int>(mTurningPageIndex), !mIsTurnBack[mPanActor] );
+ int id = mTurningPageIndex + (mIsTurnBack[mPanActor]? -1 : 1);
+ if( id >=0 && id < mTotalPageCount )
+ {
+ mPageActors[id%NUMBER_OF_CACHED_PAGES].SetVisible(true);
+ }
mShadowView.RemoveConstraints();
Actor self = Self();
animation.AnimateTo( Property(self, mPropertyPanDisplacement[mIndex]),
width,AlphaFunction::EASE_OUT_SINE);
animation.AnimateTo( Property(self, mPropertyCurrentCenter[mIndex]),
- Vector2(-mPageSize.width, 0.5f*mPageSize.height), AlphaFunction::EASE_OUT_SINE);
- mAnimationActorPair[animation] = actor;
+ Vector2(-mPageSize.width*1.1f, 0.5f*mPageSize.height), AlphaFunction::EASE_OUT_SINE);
+ mAnimationPageIdPair[animation] = mTurningPageIndex;
mAnimationIndexPair[animation] = mIndex;
animation.Play();
animation.FinishedSignal().Connect( this, &PageTurnView::TurnedOver );
Animation animation= Animation::New( PAGE_SLIDE_BACK_ANIMATION_DURATION * (mOriginalCenter.x - mCurrentCenter.x) / mPageSize.width / PAGE_TURN_OVER_THRESHOLD_RATIO );
animation.AnimateTo( Property( mTurnEffect[mIndex], "uCurrentCenter" ),
mOriginalCenter, AlphaFunction::LINEAR );
- mAnimationActorPair[animation] = actor;
+ mAnimationPageIdPair[animation] = mTurningPageIndex;
mAnimationIndexPair[animation] = mIndex;
animation.Play();
mIsSliding[mIndex] = true;
animation.FinishedSignal().Connect( this, &PageTurnView::SliddenBack );
- mPageTurnStartedSignal.Emit( handle, static_cast<unsigned int>( mCurrentPageIndex + ( ( mIsTurnBack[mPanActor] ) ? -1 : 0 ) ), mIsTurnBack[mPanActor] );
+ mPageTurnStartedSignal.Emit( handle, static_cast<unsigned int>(mTurningPageIndex), mIsTurnBack[actor] );
}
}
else
void PageTurnView::TurnedOver( Animation& animation )
{
- ImageActor actor = mAnimationActorPair[animation];
+ int pageId = mAnimationPageIdPair[animation];
+ ImageActor actor = mPageActors[pageId % NUMBER_OF_CACHED_PAGES];
mIsTurnBack[actor] = !mIsTurnBack[actor];
actor.RemoveConstraints();
- mRootOnScreen.Add(actor);
+ Self().Add(actor);
int index = mAnimationIndexPair[animation];
mIsAnimating[index] = false;
mTurnEffect[index].RemoveConstraints();
mAnimationIndexPair.erase( animation );
- mAnimationActorPair.erase( animation );
+ mAnimationPageIdPair.erase( animation );
SetSpineEffect( actor, mIsTurnBack[actor] );
+ int id = pageId + (mIsTurnBack[actor]? -1 : 1);
+ if( id >=0 && id < mTotalPageCount )
+ {
+ mPageActors[id%NUMBER_OF_CACHED_PAGES].SetVisible(false);
+ }
+
+ OnTurnedOver( actor, mIsTurnBack[actor] );
+
// Guard against destruction during signal emission
Toolkit::PageTurnView handle( GetOwner() );
- mPageTurnFinishedSignal.Emit( handle, static_cast<unsigned int>( mCurrentPageIndex + ( ( mIsTurnBack[actor] ) ? -1 : 0 ) ), mIsTurnBack[actor] );
+ mPageTurnFinishedSignal.Emit( handle, static_cast<unsigned int>(pageId), mIsTurnBack[actor] );
}
void PageTurnView::SliddenBack( Animation& animation )
{
- ImageActor actor = mAnimationActorPair[animation];
- mRootOnScreen.Add(actor);
+ int pageId = mAnimationPageIdPair[animation];
+ ImageActor actor = mPageActors[pageId % NUMBER_OF_CACHED_PAGES];
+ Self().Add(actor);
int index = mAnimationIndexPair[animation];
mIsSliding[index] = false;
mIsAnimating[index] = false;
mAnimationIndexPair.erase( animation );
- mAnimationActorPair.erase( animation );
+ mAnimationPageIdPair.erase( animation );
SetSpineEffect( actor, mIsTurnBack[actor] );
+ int id = pageId + (mIsTurnBack[actor]? -1 : 1);
+ if( id >=0 && id < mTotalPageCount )
+ {
+ mPageActors[id%NUMBER_OF_CACHED_PAGES].SetVisible(false);
+ }
+
// Guard against destruction during signal emission
Toolkit::PageTurnView handle( GetOwner() );
- mPageTurnFinishedSignal.Emit( handle, static_cast<unsigned int>( mCurrentPageIndex + ( ( mIsTurnBack[mPanActor] ) ? -1 : 0 ) ), mIsTurnBack[actor] );
+ mPageTurnFinishedSignal.Emit( handle, static_cast<unsigned int>(pageId), mIsTurnBack[actor] );
}
void PageTurnView::OrganizePageDepth()
{
if(mCurrentPageIndex+i < mTotalPageCount)
{
- mPageActors[( mCurrentPageIndex+i )%NUMBER_OF_CACHED_PAGES].SetSortModifier( -static_cast<float>( i )*STATIC_PAGE_INTERVAL_DISTANCE );
+ mPageActors[( mCurrentPageIndex+i )%NUMBER_OF_CACHED_PAGES].SetZ( -static_cast<float>( i )*STATIC_PAGE_INTERVAL_DISTANCE );
}
if( mCurrentPageIndex >= i + 1 )
{
- mPageActors[( mCurrentPageIndex-i-1 )%NUMBER_OF_CACHED_PAGES].SetSortModifier( -static_cast<float>( i )*STATIC_PAGE_INTERVAL_DISTANCE );
+ mPageActors[( mCurrentPageIndex-i-1 )%NUMBER_OF_CACHED_PAGES].SetZ( -static_cast<float>( i )*STATIC_PAGE_INTERVAL_DISTANCE );
}
}
}
return mPagePanFinishedSignal;
}
+bool PageTurnView::DoConnectSignal( BaseObject* object, ConnectionTrackerInterface* tracker, const std::string& signalName, FunctorDelegate* functor )
+{
+ Dali::BaseHandle handle( object );
+
+ bool connected( true );
+ Toolkit::PageTurnView pageTurnView = Toolkit::PageTurnView::DownCast( handle );
+
+ if( 0 == strcmp( signalName.c_str(), SIGNAL_PAGE_TURN_STARTED ) )
+ {
+ pageTurnView.PageTurnStartedSignal().Connect( tracker, functor );
+ }
+ else if( 0 == strcmp( signalName.c_str(), SIGNAL_PAGE_TURN_FINISHED ) )
+ {
+ pageTurnView.PageTurnFinishedSignal().Connect( tracker, functor );
+ }
+ else if( 0 == strcmp( signalName.c_str(), SIGNAL_PAGE_PAN_STARTED ) )
+ {
+ pageTurnView.PagePanStartedSignal().Connect( tracker, functor );
+ }
+ else if( 0 == strcmp( signalName.c_str(), SIGNAL_PAGE_PAN_FINISHED ) )
+ {
+ pageTurnView.PagePanFinishedSignal().Connect( tracker, functor );
+ }
+ else
+ {
+ // signalName does not match any signal
+ connected = false;
+ }
+
+ return connected;
+}
+
+void PageTurnView::SetProperty( BaseObject* object, Property::Index index, const Property::Value& value )
+{
+ Toolkit::PageTurnView pageTurnView = Toolkit::PageTurnView::DownCast( Dali::BaseHandle( object ) );
+
+ if( pageTurnView )
+ {
+ PageTurnView& pageTurnViewImpl( GetImplementation( pageTurnView ) );
+
+ switch( index )
+ {
+ case Toolkit::PageTurnView::Property::PAGE_SIZE:
+ {
+ pageTurnViewImpl.SetPageSize( value.Get<Vector2>() );
+ break;
+ }
+ case Toolkit::PageTurnView::Property::CURRENT_PAGE_ID:
+ {
+ pageTurnViewImpl.GoToPage( value.Get<int>() );
+ break;
+ }
+ case Toolkit::PageTurnView::Property::SPINE_SHADOW:
+ {
+ pageTurnViewImpl.SetSpineShadowParameter( value.Get<Vector2>() );
+ break;
+ }
+ }
+ }
+}
+
+Property::Value PageTurnView::GetProperty( BaseObject* object, Property::Index index )
+{
+ Property::Value value;
+
+ Toolkit::PageTurnView pageTurnView = Toolkit::PageTurnView::DownCast( Dali::BaseHandle( object ) );
+
+ if( pageTurnView )
+ {
+ PageTurnView& pageTurnViewImpl( GetImplementation( pageTurnView ) );
+
+ switch( index )
+ {
+ case Toolkit::PageTurnView::Property::PAGE_SIZE:
+ {
+ value = pageTurnViewImpl.GetPageSize();
+ break;
+ }
+ case Toolkit::PageTurnView::Property::CURRENT_PAGE_ID:
+ {
+ value = static_cast<int>( pageTurnViewImpl.GetCurrentPage() );
+ break;
+ }
+ case Toolkit::PageTurnView::Property::SPINE_SHADOW:
+ {
+ value = pageTurnViewImpl.GetSpineShadowParameter();
+ break;
+ }
+ }
+ }
+ return value;
+}
+
} // namespace Internal
} // namespace Toolkit
// INTERNAL INCLUDES
#include <dali-toolkit/public-api/controls/control-impl.h>
-#include <dali-toolkit/devel-api/controls/page-turn-view/page-turn-view.h>
-#include <dali-toolkit/devel-api/controls/page-turn-view/page-factory.h>
+#include <dali-toolkit/public-api/controls/page-turn-view/page-turn-view.h>
+#include <dali-toolkit/public-api/controls/page-turn-view/page-factory.h>
#include <dali-toolkit/devel-api/controls/shadow-view/shadow-view.h>
namespace Dali
public:
/**
- * @copydoc Toolkit::PageTurnView::SetSpineShadowParameter
+ * Set the page size
+ * @param[in] pageSize The size of pages
*/
- void SetSpineShadowParameter( const Vector2& spineShadowParameter );
-
- /**
- * @copydoc Toolkit::PageTurnView::GetSpineShadowParameter
- */
- Vector2 GetSpineShadowParameter();
-
- /**
- * @copydoc Toolkit::PageTurnView::GoToPage
- */
- void GoToPage( unsigned int pageId );
-
- /**
- * @copydoc Toolkit::PageTurnView::GetCurrentPage
- */
- unsigned int GetCurrentPage();
+ void SetPageSize( const Vector2& pageSize );
/**
- * @copydoc Toolkit::PageTurnView::EnterEditMode
+ * Retrieve the page size.
+ * @return The page size.
*/
- Actor EnterEditMode();
+ Vector2 GetPageSize();
/**
- * @copydoc Toolkit::PageTurnView::LeaveEditMode
+ * Set the spine shadow parameter to the shader effects.
+ * The two parameters are the major&minor radius (in pixels) to form an ellipse shape.
+ * The top-left quarter of this ellipse is used to calculate spine normal for simulating shadow.
+ * @param [in] spineShadowParameter The major&minor ellipse radius for the simulated spine shadow.
*/
- void LeaveEditMode();
+ void SetSpineShadowParameter( const Vector2& spineShadowParameter );
/**
- * @copydoc Toolkit::PageTurnView::GetHitActor
+ * Retrieve the spine shadow parameter of the shader effects.
+ * @return The spine shadow parameter.
*/
- Actor GetHitActor( Vector2& screenCoordinates, Vector2& actorCoordinates );
+ Vector2 GetSpineShadowParameter();
- /**
- * @copydoc Toolkit::PageTurnView::RefreshAll
+ /*
+ * Jump to a given page.
+ * @param[in] pageId The new current page id.
*/
- void RefreshAll();
+ void GoToPage( unsigned int pageId );
/**
- * @copydoc Toolkit::PageTurnView::RefreshCurrentPage
+ * Retrieve the id of the current Page.
+ * @return The current page id.
*/
- void RefreshCurrentPage();
+ unsigned int GetCurrentPage();
protected:
private:
- /**
- * Set up the render tasks for rendering the page actor to off-screen image
- */
- void SetupRenderTasks();
-
/**
* Set up the shadow view control to cast shadow
*/
*/
void SliddenBack( Animation& animation );
- /**
- * Refresh the given page.
- @param[in] the page index.
- */
- void RenderPage( int pageIndex );
private: // from Control
virtual void OnPageTurnViewInitialize() = 0;
/**
- * Create the page actor from off screen buffer
- * @param[in] The index of the page to be added
- */
- virtual ImageActor NewPageFromRenderBuffer( int pageIndex ) = 0;
-
- /**
* This method is called after the a new page is added to the stage.
* Could be re-implemented in subclasses to provide specific behaviour
* @param[in] newPage The added page actor
*/
virtual void OnPossibleOutwardsFlick( const Vector2& panPosition, float gestureSpeed ) { }
-public: //signal
+ /**
+ * This method is called when page is turned over
+ * In portrait view, the page on the left side is not rendered
+ * @param[in] actor The page actor
+ * @param[in] isLeftSide Which side the page is turned to
+ */
+ virtual void OnTurnedOver( ImageActor actor, bool isLeftSide ) { }
+
+public: //signal and property
/**
* @copydoc Toolkit::PageTurnView::PageTurnStartedSignal()
*/
Toolkit::PageTurnView::PagePanSignal& PagePanFinishedSignal();
+ /**
+ * Connects a callback function with the object's signals.
+ * @param[in] object The object providing the signal.
+ * @param[in] tracker Used to disconnect the signal.
+ * @param[in] signalName The signal to connect to.
+ * @param[in] functor A newly allocated FunctorDelegate.
+ * @return True if the signal was connected.
+ * @post If a signal was connected, ownership of functor was passed to CallbackBase. Otherwise the caller is responsible for deleting the unused functor.
+ */
+ static bool DoConnectSignal( BaseObject* object, ConnectionTrackerInterface* tracker, const std::string& signalName, FunctorDelegate* functor );
+
+ // Properties
+
+ /**
+ * Called when a property of an object of this type is set.
+ * @param[in] object The object whose property is set.
+ * @param[in] index The property index.
+ * @param[in] value The new property value.
+ */
+ static void SetProperty( BaseObject* object, Property::Index index, const Property::Value& value );
+
+ /**
+ * Called to retrieve a property of an object of this type.
+ * @param[in] object The object whose property is to be retrieved.
+ * @param[in] index The property index.
+ * @return The current value of the property.
+ */
+ static Property::Value GetProperty( BaseObject* object, Property::Index index );
+
private:
//Undefined
protected:
- Actor mRootOnScreen;
-
Vector2 mControlSize; ///< The size of the control, it is decided by the page size, the SetSize from application can not change it
Layer mTurningPageLayer; ///< The layer for the turning page, to avoid possible depth conflict
Toolkit::ShadowView mShadowView; ///< The shadow view control for shadow casting
ImageActor mShadowPlane; ///< The plane for the shadow to cast on
Actor mPointLight; ///< The point light used for shadow casting
- Layer mShadowLayer; ///< The layer to display the shadow
PageFactory& mPageFactory; ///< The page factory which provides the page actors
Vector2 mPageSize; ///< The page size
int mTotalPageCount; ///< The total number of pages provided by the page factory
- bool mIsEditMode; ///< The boolean to indicate the current page content is edit-able or not
-
- bool mNeedOffscreenRendering; ///< The boolean to indicate whether off screen rendering is required for creating page image
- std::vector<RenderTask> mOffscreenTask; ///< The vector of off screen rendering tasks
- std::vector<Actor> mPageSourceActor; ///< The vector of page source actor
- std::vector<FrameBufferImage> mRenderedPage; ///< The vector of off screen buffers
- CameraActor mCameraActor; ///< The camera actor attached to the off screen tasks
bool mPanning; ///< The boolean to indicate whether the pan gesture is continuing
std::vector<ShaderEffect> mTurnEffect; ///< The group of PageTurnEffects
std::vector<ImageActor> mPageActors; ///< The vector of pages on stage
int mCurrentPageIndex; ///< The index of the current page, between 0 ~ mTotalPageCount-1
+ int mTurningPageIndex; ///< The index of the turning page
std::map<ImageActor,bool> mIsTurnBack; ///< The map to keep track the page actor's turning direction
- std::map<Animation,ImageActor> mAnimationActorPair; ///< The map to keep track which page actor is the animation act on
+ std::map<Animation,int> mAnimationPageIdPair; ///< The map to keep track which page actor is the animation act on
std::map<Animation, int> mAnimationIndexPair; ///< The map to keep track which PageTurnEffect, PanDisplacementProperty, CurrentCenterProperty is used for the animation
int mIndex; ///< The index to keep track which PageTurnEffect, PanDisplacementProperty, CurrentCenterProperty is used for the current panning page
std::vector<bool> mIsAnimating; ///< The boolean vector to keep track which PageTurnEffect, PanDisplacementProperty, CurrentCenterProperty is available for using
mTextDepth( 0u ),
mActiveCopyPastePopup( false ),
mCursorBlinkStatus( true ),
+ mDelayCursorBlink( false ),
mPrimaryCursorVisible( false ),
mSecondaryCursorVisible( false ),
mSwapSelectionHandles( false ),
position.y );
mPrimaryCursor.SetSize( Size( mCursorWidth, cursor.cursorHeight ) );
}
- mPrimaryCursor.SetVisible( mPrimaryCursorVisible );
+ mPrimaryCursor.SetVisible( mPrimaryCursorVisible && mCursorBlinkStatus );
}
if( mSecondaryCursor )
{
cursor.position.y );
mSecondaryCursor.SetSize( Size( mCursorWidth, cursor.cursorHeight ) );
}
- mSecondaryCursor.SetVisible( mSecondaryCursorVisible );
+ mSecondaryCursor.SetVisible( mSecondaryCursorVisible && mCursorBlinkStatus );
}
// Show or hide the grab handle
bool OnCursorBlinkTimerTick()
{
- // Cursor blinking
- if ( mPrimaryCursor )
+ if( !mDelayCursorBlink )
{
- mPrimaryCursor.SetVisible( mPrimaryCursorVisible && mCursorBlinkStatus );
+ // Cursor blinking
+ if ( mPrimaryCursor )
+ {
+ mPrimaryCursor.SetVisible( mPrimaryCursorVisible && mCursorBlinkStatus );
+ }
+ if ( mSecondaryCursor )
+ {
+ mSecondaryCursor.SetVisible( mSecondaryCursorVisible && mCursorBlinkStatus );
+ }
+
+ mCursorBlinkStatus = !mCursorBlinkStatus;
}
- if ( mSecondaryCursor )
+ else
{
- mSecondaryCursor.SetVisible( mSecondaryCursorVisible && mCursorBlinkStatus );
+ // Resume blinking
+ mDelayCursorBlink = false;
}
- mCursorBlinkStatus = !mCursorBlinkStatus;
-
return true;
}
bool mActiveCopyPastePopup : 1;
bool mCursorBlinkStatus : 1; ///< Flag to switch between blink on and blink off.
+ bool mDelayCursorBlink : 1; ///< Used to avoid cursor blinking when entering text.
bool mPrimaryCursorVisible : 1; ///< Whether the primary cursor is visible.
bool mSecondaryCursorVisible : 1; ///< Whether the secondary cursor is visible.
bool mSwapSelectionHandles : 1; ///< Whether to swap the selection handle images.
{
mImpl->mCursorBlinkTimer.Stop();
}
+
+ mImpl->mCursorBlinkStatus = true; // Keep cursor permanently shown
+}
+
+void Decorator::DelayCursorBlink()
+{
+ mImpl->mCursorBlinkStatus = true; // Show cursor for a bit longer
+ mImpl->mDelayCursorBlink = true;
}
void Decorator::SetCursorBlinkInterval( float seconds )
void StopCursorBlink();
/**
+ * @brief Temporarily stops the cursor from blinking.
+ */
+ void DelayCursorBlink();
+
+ /**
* @brief Set the interval between cursor blinks.
*
* @param[in] seconds The interval in seconds.
if( 1u == tapCount )
{
- if( ! IsShowingPlaceholderText() )
+ if( IsShowingRealText() )
{
const float xPosition = event.p2.mFloat - mEventData->mScrollPosition.x - mAlignmentOffset.x;
const float yPosition = event.p3.mFloat - mEventData->mScrollPosition.y - mAlignmentOffset.y;
mEventData->mPrimaryCursorPosition = GetClosestCursorIndex( xPosition,
yPosition );
+
+ // When the cursor position is changing, delay cursor blinking
+ mEventData->mDecorator->DelayCursorBlink();
}
else
{
}
}
+ if( mImpl->mEventData &&
+ 0 != events.size() )
+ {
+ // When the text is being modified, delay cursor blinking
+ mImpl->mEventData->mDecorator->DelayCursorBlink();
+ }
+
// Discard temporary text
events.clear();
}
{
if( 1u == tapCount )
{
+ // This is to avoid unnecessary relayouts when tapping an empty text-field
+ bool relayoutNeeded( false );
+
if( mImpl->IsShowingRealText() &&
EventData::EDITING == mImpl->mEventData->mState )
{
+ // Show grab handle on second tap
mImpl->ChangeState( EventData::EDITING_WITH_GRAB_HANDLE );
+ relayoutNeeded = true;
}
- else if( EventData::EDITING_WITH_GRAB_HANDLE != mImpl->mEventData->mState )
+ else if( EventData::EDITING != mImpl->mEventData->mState &&
+ EventData::EDITING_WITH_GRAB_HANDLE != mImpl->mEventData->mState )
{
- // Handles & cursors must be repositioned after Relayout() i.e. after the Model has been updated
+ // Show cursor on first tap
mImpl->ChangeState( EventData::EDITING );
+ relayoutNeeded = true;
+ }
+ else if( mImpl->IsShowingRealText() )
+ {
+ // Move the cursor
+ relayoutNeeded = true;
}
- Event event( Event::TAP_EVENT );
- event.p1.mUint = tapCount;
- event.p2.mFloat = x;
- event.p3.mFloat = y;
- mImpl->mEventData->mEventQueue.push_back( event );
+ // Handles & cursors must be repositioned after Relayout() i.e. after the Model has been updated
+ if( relayoutNeeded )
+ {
+ Event event( Event::TAP_EVENT );
+ event.p1.mUint = tapCount;
+ event.p2.mFloat = x;
+ event.p3.mFloat = y;
+ mImpl->mEventData->mEventQueue.push_back( event );
- mImpl->RequestRelayout();
+ mImpl->RequestRelayout();
+ }
}
else if( 2u == tapCount )
{
--- /dev/null
+#ifndef __DALI_TOOLKIT_PAGE_FACTORY_H__
+#define __DALI_TOOLKIT_PAGE_FACTORY_H__
+
+/*
+ * Copyright (c) 2015 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// EXTERNAL INCLUDES
+#include <dali/public-api/actors/actor.h>
+
+namespace Dali
+{
+
+namespace Toolkit
+{
+
+/**
+ * PageFactory is an abstract interface for providing image actors to PageTurnView
+ * Each image actor is identified by a unique ID, and has a linear order from 0 to GetNumberOfPages()-1
+ */
+class DALI_IMPORT_API PageFactory
+{
+public:
+
+ /**
+ * Virtual destructor
+ */
+ virtual ~PageFactory(){};
+
+ /**
+ * Query the number of pages available from the factory.
+ * The maximum available page has an ID of GetNumberOfPages()-1.
+ */
+ virtual unsigned int GetNumberOfPages() = 0;
+
+ /**
+ * Create an actor to represent the page content.
+ * @param[in] pageId The ID of the page to create.
+ * @return An actor, or an uninitialized pointer if the ID is out of range.
+ */
+ virtual Actor NewPage( unsigned int pageId ) = 0;
+};
+
+} // namespace Toolkit
+
+} // namespace Dali
+#endif /* __DALI_TOOLKIT_PAGE_FACTORY_H__ */
*/
// CLASS HEADER
-#include <dali-toolkit/devel-api/controls/page-turn-view/page-turn-landscape-view.h>
+#include <dali-toolkit/public-api/controls/page-turn-view/page-turn-landscape-view.h>
// INTERNAL INCLUDES
#include <dali-toolkit/internal/controls/page-turn-view/page-turn-landscape-view-impl.h>
*/
// INTERNAL INCLUDES
-#include <dali-toolkit/devel-api/controls/page-turn-view/page-turn-view.h>
+#include <dali-toolkit/public-api/controls/page-turn-view/page-turn-view.h>
namespace Dali
{
*/
// CLASS HEADER
-#include <dali-toolkit/devel-api/controls/page-turn-view/page-turn-portrait-view.h>
+#include <dali-toolkit/public-api/controls/page-turn-view/page-turn-portrait-view.h>
// INTERNAL INCLUDES
#include <dali-toolkit/internal/controls/page-turn-view/page-turn-portrait-view-impl.h>
*/
// INTERNAL INCLUDES
-#include <dali-toolkit/devel-api/controls/page-turn-view/page-turn-view.h>
+#include <dali-toolkit/public-api/controls/page-turn-view/page-turn-view.h>
namespace Dali
{
*/
// CLASS HEADER
-#include <dali-toolkit/devel-api/controls/page-turn-view/page-turn-view.h>
+#include <dali-toolkit/public-api/controls/page-turn-view/page-turn-view.h>
// INTERNAL INCLUDES
#include <dali-toolkit/internal/controls/page-turn-view/page-turn-view-impl.h>
VerifyCustomActorPointer<Internal::PageTurnView>(internal);
}
-void PageTurnView::SetSpineShadowParameter( const Vector2& spineShadowParameter )
-{
- Toolkit::GetImplementation( *this ).SetSpineShadowParameter( spineShadowParameter );
-}
-
-Vector2 PageTurnView::GetSpineShadowParameter()
-{
- return Toolkit::GetImplementation( *this ).GetSpineShadowParameter();
-}
-
-void PageTurnView::GoToPage( unsigned int pageId )
-{
- Toolkit::GetImplementation( *this ).GoToPage(pageId);
-}
-
-unsigned int PageTurnView::GetCurrentPage()
-{
- return Toolkit::GetImplementation( *this ).GetCurrentPage();
-}
-
PageTurnView::PageTurnSignal& PageTurnView::PageTurnStartedSignal()
{
return Toolkit::GetImplementation( *this ).PageTurnStartedSignal();
return Toolkit::GetImplementation( *this ).PagePanFinishedSignal();
}
-Actor PageTurnView::EnterEditMode()
-{
- return Toolkit::GetImplementation( *this ).EnterEditMode();
-}
-
-void PageTurnView::LeaveEditMode()
-{
- Toolkit::GetImplementation( *this ).LeaveEditMode();
-}
-
-Actor PageTurnView::GetHitActor( Vector2& screenCoordinates, Vector2& actorCoordinates )
-{
- return Toolkit::GetImplementation( *this ).GetHitActor( screenCoordinates, actorCoordinates );
-}
-
-void PageTurnView::RefreshAll()
-{
- Toolkit::GetImplementation( *this ).RefreshAll();
-}
-
-void PageTurnView::RefreshCurrentPage()
-{
- Toolkit::GetImplementation( *this ).RefreshCurrentPage();
-}
-
} // namespace Toolkit
} // namespace Dali
* 3) Pan with no animation: PagePanStarted -> PagePanFinished
* Pan with no animation will occur when the user touches the page in an area that does not start the
* page turning.
+ *
+ * Signals
+ * | %Signal Name | Method |
+ * |--------------------|-------------------------------|
+ * | page-turn-started | @ref PageTurnStartedSignal() |
+ * | page-turn-finished | @ref PageTurnFinishedSignal() |
+ * | page-pan-started | @ref PagePanStartedSignal() |
+ * | page-pan-finished | @ref PagePanFinishedSignal() |
*/
class DALI_IMPORT_API PageTurnView : public Control
{
public:
/**
+ * @brief The start and end property ranges for this control.
+ */
+ enum PropertyRange
+ {
+ PROPERTY_START_INDEX = Control::CONTROL_PROPERTY_END_INDEX + 1,
+ PROPERTY_END_INDEX = PROPERTY_START_INDEX + 1000 ///< Reserve property indices
+ };
+
+ struct Property
+ {
+ enum
+ {
+ PAGE_SIZE = PROPERTY_START_INDEX, ///< name "page-size", type Vector2
+ CURRENT_PAGE_ID, ///< name "current-page-id", type Integer
+
+ /**
+ * The two values are the major&minor radius (in pixels) to form an ellipse shape.
+ * The top-left quarter of this ellipse is used to calculate spine normal for simulating shadow.
+ */
+ SPINE_SHADOW, ///< name "spine-shadow", type Vector2
+ };
+ };
+
+ /**
* Creates an empty PageTurnView handle. Only derived versions can be instantiated.
* Calling member function with an uninitialized handle is not allowed.
*/
*/
static PageTurnView DownCast( BaseHandle handle );
- /**
- * Set the spine shadow parameter to the shader effects
- * The two parameters are the major&minor radius (in pixels) to form an ellipse shape
- * The top-left quarter of this ellipse is used to calculate spine normal for simulating shadow
- * @param [in] spineShadowParameter The major&minor ellipse radius for the simulated spine shadow
- */
- void SetSpineShadowParameter( const Vector2& spineShadowParameter );
-
- /**
- * Retrieve the spine shadow parameter of the shader effects
- * @return The major&minor ellipse radius for the simulated spine shadow
- */
- Vector2 GetSpineShadowParameter();
-
- /*
- * Go to a specific page
- * @param[in] pageId The new current page index
- */
- void GoToPage( unsigned int pageId );
-
- /**
- * Retrieve the index of the current Page
- * @return The index of the current page
- */
- unsigned int GetCurrentPage();
-
- /**
- * Enter edit mode
- * Case 1, the page factory passes image actor into the view as page content, do nothing.
- * Case 2, the page factory passes an actor tree into the view as page content,
- * the actor tree will receive the touch event in edit mode, and set the refresh rate of the off screen render task to always
- * @return an empty actor in case 1; the actor tree root of the current page
- */
- Actor EnterEditMode();
-
- /**
- * Leave edit mode
- * Case 1, the page factory passes image actor into the view as page content, do nothing.
- * Case 2, the page factory passes an actor tree into the view as page content,
- * the page actor will receive all the touch event, and set the refresh rage of the off screen render task to once.
- */
- void LeaveEditMode();
-
- /**
- * Return the actor get hit in the actor tree of the current page by given the touch position on the PageTurnView
- * @param[in] screenCoordinates The hit position of the PageTurnView
- * @param[out] actorCoordinates The local hit position of the hitted actor
- * @return the hitted actor
- */
- Actor GetHitActor( Vector2& screenCoordinates, Vector2& actorCoordinates );
-
- /**
- * Refresh all the cached pages by calling the render task to refresh.
- */
- void RefreshAll();
-
- /**
- * Refresh current page by calling the render task to refresh
- */
- void RefreshCurrentPage();
-
public: //Signal
// Page Turned signal, with page index and boolean turning direction (true = forward, false = backward)
$(public_api_src_dir)/controls/default-controls/solid-color-actor.cpp \
$(public_api_src_dir)/controls/image-view/image-view.cpp \
$(public_api_src_dir)/controls/model3d-view/model3d-view.cpp \
+ $(public_api_src_dir)/controls/page-turn-view/page-turn-landscape-view.cpp \
+ $(public_api_src_dir)/controls/page-turn-view/page-turn-portrait-view.cpp \
+ $(public_api_src_dir)/controls/page-turn-view/page-turn-view.cpp \
$(public_api_src_dir)/controls/scroll-bar/scroll-bar.cpp \
$(public_api_src_dir)/controls/scrollable/item-view/default-item-layout.cpp \
$(public_api_src_dir)/controls/scrollable/item-view/item-layout.cpp \
public_api_image_view_header_files = \
$(public_api_src_dir)/controls/image-view/image-view.h
+public_api_page_turn_view_header_files = \
+ $(public_api_src_dir)/controls/page-turn-view/page-factory.h \
+ $(public_api_src_dir)/controls/page-turn-view/page-turn-landscape-view.h \
+ $(public_api_src_dir)/controls/page-turn-view/page-turn-portrait-view.h \
+ $(public_api_src_dir)/controls/page-turn-view/page-turn-view.h
+
public_api_item_view_header_files = \
$(public_api_src_dir)/controls/scrollable/item-view/default-item-layout.h \
$(public_api_src_dir)/controls/scrollable/item-view/item-factory.h \