Revert to tizen branch.
[platform/core/uifw/dali-toolkit.git] / 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 Apache License, Version 2.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://www.apache.org/licenses/LICENSE-2.0
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  */
20
21 // EXTERNAL INCLUDES
22 #include <dali/public-api/animation/constraint.h>
23
24 // INTERNAL INCLUDES
25 #include <dali-toolkit/public-api/shader-effects/page-turn-effect.h>
26
27 namespace Dali
28 {
29
30 namespace Toolkit
31 {
32
33 namespace Internal
34 {
35
36 /**
37  * PageTurnEffect implementation class
38  */
39 class PageTurnEffect : public ShaderEffect::Extension
40 {
41 public:
42
43   PageTurnEffect();
44   /**
45    * Virtual destructor.
46    */
47   virtual ~PageTurnEffect();
48
49   /**
50    * @copydoc Dali::Toolkit::PageTurnEffect::New
51    */
52   static Toolkit::PageTurnEffect CreateShaderEffect( bool enableBlending );
53
54   /**
55    * @copydoc Dali::Toolkit::PageTurnEffect::SetPageSize
56    */
57   void SetPageSize(const Vector2& pageSize);
58
59   /**
60    * @copydoc Dali::Toolkit::PageTurnEffect::SetOriginalCenter
61    */
62   void SetOriginalCenter(const Vector2& originalCenter);
63
64   /**
65    * @copydoc Dali::Toolkit::PageTurnEffect::SetCurrentCenter
66    */
67   void SetCurrentCenter(const Vector2& currentCenter);
68
69   /**
70    * @copydoc Dali::Toolkit::PageTurnEffect::SetIsTurningBack
71    */
72   void SetIsTurningBack(bool isTurningBack);
73
74   /**
75    * @copydoc Dali::Toolkit::PageTurnEffect::SetShadowWidth
76    */
77   void SetShadowWidth(float shadowWidth);
78
79   /**
80    *@copydoc Dali::Toolkit::PageTurnEffect::SetSpineShadowParameter
81    */
82   void SetSpineShadowParameter(const Vector2& spineShadowParameter);
83
84   /**
85    * The internal constraint uses the OriginalCenter property and the CurrentCenter Property
86    * to update the variety of common parameters which are with the same value for all the vertices.
87    * Note: For each actor, the constraints are applied in the same order as the calls to Actor::ApplyConstraint().
88    * So if there are other contraints applied to the OriginalCenter or CurrentCenter while when using this effect,
89    * call this method to get the internal constraints and re-apply it afterwards.
90    */
91   void ApplyInternalConstraint();
92
93   /**
94    * @copydoc Dali::Toolkit::PageTurnEffect::GetPageSizePropertyName
95    */
96   const std::string& GetPageSizePropertyName() const;
97
98   /**
99   * @copydoc Dali::Toolkit::PageTurnEffect::GetOriginalCenterPropertyName
100   */
101   const std::string& GetOriginalCenterPropertyName() const;
102
103   /**
104    * @copydoc Dali::Toolkit::PageTurnEffect::GetCurrentCenterPropertyName
105    */
106   const std::string& GetCurrentCenterPropertyName() const;
107
108 private:
109
110   void Initialize( ShaderEffect shaderEffect );
111
112 private:
113   ShaderEffect mShaderEffect;
114
115   Property::Index mOriginalCenterPropertyIndex;
116   Property::Index mCurrentCenterPropertyIndex;
117
118 private:
119   //undefined copy constructor.
120   PageTurnEffect( const PageTurnEffect& );
121
122   //Undefined assignment operator.
123   PageTurnEffect& operator=( const PageTurnEffect& );
124
125 };
126
127 } // namespace Internal
128
129 //Helpers for public-api forwarding methods
130 inline Toolkit::Internal::PageTurnEffect& GetImpl( Toolkit::PageTurnEffect& effect )
131 {
132   DALI_ASSERT_ALWAYS( effect );
133   return static_cast<Internal::PageTurnEffect&>( effect.GetExtension() );
134 }
135
136 inline const Toolkit::Internal::PageTurnEffect& GetImpl( const Toolkit::PageTurnEffect& effect )
137 {
138   DALI_ASSERT_ALWAYS( effect );
139   return static_cast<const Internal::PageTurnEffect&>( effect.GetExtension() );
140 }
141
142 } // namespace Toolkit
143
144 } // namespace Dali
145
146 #endif /* __DALI_TOOLKIT_INTERNAL_PAGE_TURN_EFFECT_H__*/