21f522cc3aea6e6a5be03caaa6becc933fee3e8e
[platform/core/uifw/dali-toolkit.git] / optional / dali-toolkit / internal / shader-effects / page-turn-effect-impl.h
1 #ifndef __DALI_TOOLKIT_INTERNAL_PAGE_TURN_EFFECT_H__
2 #define __DALI_TOOLKIT_INTERNAL_PAGE_TURN_EFFECT_H__
3
4 //
5 // Copyright (c) 2014 Samsung Electronics Co., Ltd.
6 //
7 // Licensed under the Flora License, Version 1.0 (the License);
8 // you may not use this file except in compliance with the License.
9 // You may obtain a copy of the License at
10 //
11 //     http://floralicense.org/license/
12 //
13 // Unless required by applicable law or agreed to in writing, software
14 // distributed under the License is distributed on an AS IS BASIS,
15 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 // See the License for the specific language governing permissions and
17 // limitations under the License.
18 //
19 // INTERNAL INCLUDES
20 #include <dali/dali.h>
21 #include <dali-toolkit/public-api/shader-effects/page-turn-effect.h>
22
23 namespace Dali
24 {
25
26 namespace Toolkit
27 {
28
29 namespace Internal
30 {
31
32 /**
33  * PageTurnEffect implementation class
34  */
35 class PageTurnEffect : public ShaderEffect::Extension
36 {
37 public:
38
39   PageTurnEffect();
40   /**
41    * Virtual destructor.
42    */
43   virtual ~PageTurnEffect();
44
45   /**
46    * @copydoc Dali::Toolkit::PageTurnEffect::New
47    */
48   static Toolkit::PageTurnEffect CreateShaderEffect( bool enableBlending );
49
50   /**
51    * @copydoc Dali::Toolkit::PageTurnEffect::SetPageSize
52    */
53   void SetPageSize(const Vector2& pageSize);
54
55   /**
56    * @copydoc Dali::Toolkit::PageTurnEffect::SetOriginalCenter
57    */
58   void SetOriginalCenter(const Vector2& originalCenter);
59
60   /**
61    * @copydoc Dali::Toolkit::PageTurnEffect::SetCurrentCenter
62    */
63   void SetCurrentCenter(const Vector2& currentCenter);
64
65   /**
66    * @copydoc Dali::Toolkit::PageTurnEffect::SetIsTurningBack
67    */
68   void SetIsTurningBack(bool isTurningBack);
69
70   /**
71    * @copydoc Dali::Toolkit::PageTurnEffect::SetShadowWidth
72    */
73   void SetShadowWidth(float shadowWidth);
74
75   /**
76    *@copydoc Dali::Toolkit::PageTurnEffect::SetSpineShadowParameter
77    */
78   void SetSpineShadowParameter(const Vector2& spineShadowParameter);
79
80   /**
81    * The internal constraint uses the OriginalCenter property and the CurrentCenter Property
82    * to update the variety of common parameters which are with the same value for all the vertices.
83    * Note: For each actor, the constraints are applied in the same order as the calls to Actor::ApplyConstraint().
84    * So if there are other contraints applied to the OriginalCenter or CurrentCenter while when using this effect,
85    * call this method to get the internal constraints and re-apply it afterwards.
86    */
87   void ApplyInternalConstraint();
88
89   /**
90    * @copydoc Dali::Toolkit::PageTurnEffect::GetPageSizePropertyName
91    */
92   const std::string& GetPageSizePropertyName() const;
93
94   /**
95   * @copydoc Dali::Toolkit::PageTurnEffect::GetOriginalCenterPropertyName
96   */
97   const std::string& GetOriginalCenterPropertyName() const;
98
99   /**
100    * @copydoc Dali::Toolkit::PageTurnEffect::GetCurrentCenterPropertyName
101    */
102   const std::string& GetCurrentCenterPropertyName() const;
103
104 private:
105
106   void Initialize( ShaderEffect shaderEffect );
107
108 private:
109   ShaderEffect mShaderEffect;
110
111   Property::Index mOriginalCenterPropertyIndex;
112   Property::Index mCurrentCenterPropertyIndex;
113   Constraint mInternalConstraint;
114
115 private:
116   //undefined copy constructor.
117   PageTurnEffect( const PageTurnEffect& );
118
119   //Undefined assignment operator.
120   PageTurnEffect& operator=( const PageTurnEffect& );
121
122 };
123
124 } // namespace Internal
125
126 //Helpers for public-api forwarding methods
127 inline Toolkit::Internal::PageTurnEffect& GetImpl( Toolkit::PageTurnEffect& effect )
128 {
129   DALI_ASSERT_ALWAYS( effect );
130   return static_cast<Internal::PageTurnEffect&>( effect.GetExtension() );
131 }
132
133 inline const Toolkit::Internal::PageTurnEffect& GetImpl( const Toolkit::PageTurnEffect& effect )
134 {
135   DALI_ASSERT_ALWAYS( effect );
136   return static_cast<const Internal::PageTurnEffect&>( effect.GetExtension() );
137 }
138
139 } // namespace Toolkit
140
141 } // namespace Dali
142
143 #endif /* __DALI_TOOLKIT_INTERNAL_PAGE_TURN_EFFECT_H__*/