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