Merge "Bug fix when creating background of control using ImageActor" into devel/master
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / internal / controls / page-turn-view / page-turn-view-impl.h
index 1354c19..0bd7e8a 100644 (file)
@@ -1,31 +1,35 @@
 #ifndef __DALI_TOOLKIT_INTERNAL_PAGE_TURN_VIEW_IMPL_H__
 #define __DALI_TOOLKIT_INTERNAL_PAGE_TURN_VIEW_IMPL_H__
 
-//
-// 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.
+ *
+ */
+
+// EXTERNAL INCLUDES
+#include <dali/devel-api/common/map-wrapper.h>
+#include <dali/public-api/actors/layer.h>
+#include <dali/public-api/actors/camera-actor.h>
+#include <dali/public-api/images/frame-buffer-image.h>
+#include <dali/public-api/render-tasks/render-task.h>
 
 // INTERNAL INCLUDES
-#include <dali/dali.h>
 #include <dali-toolkit/public-api/controls/control-impl.h>
-#include <dali-toolkit/public-api/controls/page-turn-view/page-turn-view.h>
-#include <dali-toolkit/internal/shader-effects/page-turn-effect-impl.h>
-#include <dali-toolkit/public-api/shader-effects/page-turn-effect.h>
-#include <dali-toolkit/public-api/shader-effects/page-turn-book-spine-effect.h>
-#include <dali-toolkit/public-api/controls/page-turn-view/page-factory.h>
-#include <dali-toolkit/public-api/controls/shadow-view/shadow-view.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/devel-api/controls/shadow-view/shadow-view.h>
 
 namespace Dali
 {
@@ -36,7 +40,7 @@ namespace Toolkit
 namespace Internal
 {
 
-class PageTurnView : public ControlImpl
+class PageTurnView : public Control
 {
 protected:
 
@@ -133,7 +137,7 @@ protected:
    * @param[in] actor The actor which the shader effect would be applied onto
    * @param[in] shaderEffect The shader effect to be set to the actor
    */
-  void SetShaderEffect( Actor actor, ShaderEffect shaderEffect );
+  void SetShaderEffect( ImageActor actor, ShaderEffect shaderEffect );
 
 private:
 
@@ -179,12 +183,12 @@ private:
    */
   void RenderPage( int pageIndex );
 
-private: // from ControlImpl
+private: // from Control
 
   /**
    * @copydoc Toolkit::Control::OnPan
    */
-  virtual void OnPan( PanGesture gesture );
+  virtual void OnPan( const PanGesture& gesture );
 
   /**
    * @copydoc Toolkit::Control::OnInitialize
@@ -192,19 +196,14 @@ private: // from ControlImpl
   virtual void OnInitialize();
 
   /**
-   * @copydoc Toolkit::Control::OnControlStageConncection
+   * @copydoc CustomActorImpl::OnStageConnection()
    */
-  virtual void OnControlStageConnection();
+  virtual void OnStageConnection( int depth );
 
   /**
-   * @copydoc Toolkit::Control::OnControlStageDisConnection
+   * @copydoc CustomActorImpl::OnStageDisconnection()
    */
-  virtual void OnControlStageDisconnection();
-
-  /**
-   * @copydoc Toolkit::Control::OnControlSizeSet
-   */
-  virtual void OnControlSizeSet( const Vector3& size );
+  virtual void OnStageDisconnection();
 
 private: // implemented differently by PageTurnLandscapeView and PageTurnPortraitView
 
@@ -252,7 +251,7 @@ private: // implemented differently by PageTurnLandscapeView and PageTurnPortrai
    * @param[in] actor The current page actor
    * @param[in] isLeftSide Which side the current page is located
    */
-  virtual void SetSpineEffect(Actor actor, bool isLeftSide) = 0;
+  virtual void SetSpineEffect(ImageActor actor, bool isLeftSide) = 0;
 
   /**
    * This method is called when pan finished to detect outwards flick
@@ -317,17 +316,17 @@ protected:
   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<Toolkit::PageTurnEffect>    mTurnEffect;     ///< The group of PageTurnEffects
-  PageTurnBookSpineEffect        mSpineEffectFront;        ///< The book spine shader effect without flipping image content
-  PageTurnBookSpineEffect        mSpineEffectBack;         ///< The book spine shader effect with image content flipped
+  std::vector<ShaderEffect>      mTurnEffect;              ///< The group of PageTurnEffects
+  ShaderEffect                   mSpineEffectFront;        ///< The book spine shader effect without flipping image content
+  ShaderEffect                   mSpineEffectBack;         ///< The book spine shader effect with image content flipped
   Vector2                        mSpineShadowParameter;    ///< The spine shadow parameter for all the above shader effects
   Vector2                        mOriginalCenter;          ///< The original center set to the PageTurnEffect
   Vector2                        mCurrentCenter;           ///< The current center set to the PageTurnEffect
 
   std::vector<ImageActor>        mPageActors;              ///< The vector of pages on stage
   int                            mCurrentPageIndex;        ///< The index of the current page, between 0 ~ mTotalPageCount-1
-  std::map<Actor,bool>           mIsTurnBack;              ///< The map to keep track the page actor's turning direction
-  std::map<Animation, Actor>     mAnimationActorPair;      ///< The map to keep track which page actor is the animation act on
+  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>       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