-//
-// Copyright (c) 2014 Samsung Electronics Co., Ltd.
-//
-// Licensed under the Flora License, Version 1.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://floralicense.org/license/
-//
-// 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.
-//
+/*
+ * Copyright (c) 2014 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/internal/controls/page-turn-view/page-turn-view-impl.h>
+// EXTERNAL INCLUDES
+#include <dali/public-api/animation/animation.h>
+#include <dali/public-api/animation/active-constraint.h>
+#include <dali/public-api/animation/constraint.h>
+#include <dali/public-api/events/hit-test-algorithm.h>
+#include <dali/public-api/object/type-registry.h>
+#include <dali/public-api/render-tasks/render-task-list.h>
+
// INTERNAL INCLUDES
#include <dali-toolkit/public-api/controls/default-controls/solid-color-actor.h>
const float PageTurnView::STATIC_PAGE_INTERVAL_DISTANCE = 1.0f;
PageTurnView::PageTurnView( PageFactory& pageFactory, const Vector2& pageSize )
-: ControlImpl( true ),
+: Control( REQUIRES_TOUCH_EVENTS ),
mPageFactory( pageFactory ),
mPageSize( pageSize ),
+ mTotalPageCount( 0 ),
mIsEditMode( false ),
+ mNeedOffscreenRendering( false ),
mPanning( false ),
mSpineShadowParameter( DEFAULT_SPINE_SHADOW_PARAMETER ),
mCurrentPageIndex( 0 ),
mIndex( 0 ),
mPress( false ),
mPageUpdated( true ),
+ mDistanceUpCorner( 0.f ),
+ mDistanceBottomCorner( 0.f ),
+ mPanDisplacement( 0.f ),
+ mConstraints( false ),
mPageTurnStartedSignal(),
mPageTurnFinishedSignal(),
mPagePanStartedSignal(),
for( int i = 0; i < MAXIMUM_TURNING_NUM; i++ )
{
mTurnEffect[i] = Toolkit::PageTurnEffect::New( false );
- mTurnEffect[i].SetProperty( ShaderEffect::GRID_DENSITY, Property::Value( DEFAULT_GRID_DENSITY ) );
+ mTurnEffect[i].SetProperty( ShaderEffect::Property::GRID_DENSITY, Property::Value( DEFAULT_GRID_DENSITY ) );
mTurnEffect[i].SetPageSize( mPageSize );
mTurnEffect[i].SetShadowWidth(0.f);
mTurnEffect[i].SetSpineShadowParameter( mSpineShadowParameter );
Self().Add( mPageSourceActor[i] );
mPageSourceActor[i].SetSensitive( false );
- mRenderedPage[i] = FrameBufferImage::New( mControlSize.width, mControlSize.height, Pixel::RGB8888, Image::Unused );
+ 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);
RenderPage( mCurrentPageIndex );
}
-void PageTurnView::OnPan( PanGesture gesture )
+void PageTurnView::OnPan( const PanGesture& gesture )
{
if( mIsEditMode )
{
GetImpl( mTurnEffect[mIndex] ).ApplyInternalConstraint();
float distance = offset.Length();
- Constraint rotationConstraint = Constraint::New<Quaternion>( Actor::ROTATION,
+ Constraint rotationConstraint = Constraint::New<Quaternion>( Actor::Property::ROTATION,
Source( self, mPropertyPanDisplacement[mIndex] ),
RotationConstraint(distance, mPageSize.width, mIsTurnBack[mPanActor]));
mPanActor.ApplyConstraint( rotationConstraint );
mPagePanFinishedSignal.Emit( handle );
- Actor actor = mPanActor;
+ ImageActor actor = mPanActor;
if(mPress)
{
if(!mConstraints) // if with constraints, the pan finished position is near spine, set up an animation to turn the page over
void PageTurnView::TurnedOver( Animation& animation )
{
- Actor actor = mAnimationActorPair[animation];
+ ImageActor actor = mAnimationActorPair[animation];
mIsTurnBack[actor] = !mIsTurnBack[actor];
actor.RemoveConstraints();
mRootOnScreen.Add(actor);
void PageTurnView::SliddenBack( Animation& animation )
{
- Actor actor = mAnimationActorPair[animation];
+ ImageActor actor = mAnimationActorPair[animation];
mRootOnScreen.Add(actor);
int index = mAnimationIndexPair[animation];
mIsSliding[index] = false;
}
}
-void PageTurnView::SetShaderEffect( Actor actor, ShaderEffect shaderEffect )
+void PageTurnView::SetShaderEffect( ImageActor actor, ShaderEffect shaderEffect )
{
- actor.SetShaderEffect( shaderEffect );
-
- if( actor.GetChildCount() > 0 )
- {
- actor.GetChildAt( 0 ).SetShaderEffect(shaderEffect);
- }
+ SetShaderEffectRecursively( actor, shaderEffect );
}
Toolkit::PageTurnView::PageTurnSignal& PageTurnView::PageTurnStartedSignal()