Controls no longer have property names.
[platform/core/uifw/dali-toolkit.git] / capi / dali-toolkit / public-api / controls / scrollable / scroll-view / scroll-view-custom-effect.h
1 #ifndef __DALI_TOOLKIT_SCROLL_VIEW_CUSTOM_EFFECT_H__
2 #define __DALI_TOOLKIT_SCROLL_VIEW_CUSTOM_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
20 /**
21  * @addtogroup CAPI_DALI_FRAMEWORK
22  * @{
23  */
24
25 // INTERNAL INCLUDES
26 #include <dali-toolkit/public-api/controls/scrollable/scroll-view/scroll-view-effect.h>
27
28 namespace Dali DALI_IMPORT_API
29 {
30
31 class Actor;
32
33 namespace Toolkit
34 {
35
36 namespace Internal DALI_INTERNAL
37 {
38 class ScrollViewCustomEffect;
39 }
40
41 /**
42  * ScrollView Inner Cube-Effect.
43  *
44  * This effect cause each page in a scroll-view to rotate round an inner 3D cube.
45  * It should be used on the following Actor hierarchy:
46  *
47  * ScrollView
48  * |
49  * Page (1..n)
50  *
51  * You should ensure ScrollView's default constraints have been removed,
52  * by calling ScrollView::RemoveConstraintsFromChildren() before applying
53  * this effect to ScrollView.
54  *
55  * Manual operation:
56  * ApplyToPage(...) method should be called on every page.
57  *
58  * Automatic operation:
59  * not implemented.
60  */
61 class ScrollViewCustomEffect : public ScrollViewEffect
62 {
63 public:
64   enum EFlag
65   {
66     FlagTranslate             = 0x0001,             ///< indicates that translation is wanted
67     FlagTranslateIn           = 0x0002,             ///< translating onto the screen is a separate value
68     FlagTranslateOut          = 0x0004,             ///< translating off the screen is a separate value
69     FlagTranslateMask         = FlagTranslate | FlagTranslateIn | FlagTranslateOut,
70     FlagRotate                = 0x0008,             ///< indicates that a positional rotation is wanted (rotate all pages around a single point like inner cube effect)
71     FlagRotateIn              = 0x0010,             ///< rotating onto the screen is a separate value
72     FlagRotateOut             = 0x0020,             ///< rotating off the screen is a separate value
73     FlagRotateAngleForcedOrigin = 0x0040,
74     FlagRotateMask            = FlagRotate | FlagRotateIn | FlagRotateOut | FlagRotateAngleForcedOrigin,
75     FlagRotateOrigin          = 0x0080,             ///< indicates to use a global origin to rotate all pages around
76     FlagRotateOriginIn        = 0x0100,             ///<
77     FlagRotateOriginOut       = 0x0200,             ///<
78     FlagRotateOriginMask      = FlagRotateOrigin | FlagRotateOriginIn | FlagRotateOriginOut,
79     FlagSwingAngle            = 0x0400,             ///< indicates that a SwingAngle is wanted (rotate all pages around a single point like inner cube effect)
80     FlagSwingAngleIn          = 0x0800,             ///< SwingAngle onto the screen is a separate value
81     FlagSwingAngleOut         = 0x1000,             ///< SwingAngle off the screen is a separate value
82     FlagSwingAngleMask        = FlagSwingAngle | FlagSwingAngleIn | FlagSwingAngleOut,
83     FlagSwingAnchor           = 0x2000,             ///< indicates that a swing requires a specified anchor point, otherwise swings around centre of actor (rotate all pages around a single point like inner cube effect)
84     FlagSwingAnchorIn         = 0x4000,             ///< Swing anchor onto the screen is a separate value
85     FlagSwingAnchorOut        = 0x8000,             ///< Swing anchor off the screen is a separate value
86     FlagSwingAnchorMask       = FlagSwingAnchor | FlagSwingAnchorIn | FlagSwingAnchorOut,
87     FlagOpacityThreshold      = 0x00010000,             ///<
88     FlagOpacityThresholdIn    = 0x00020000,       ///<
89     FlagOpacityThresholdOut   = 0x00040000,      ///<
90     FlagOpacityThresholdMask  = FlagOpacityThreshold | FlagOpacityThresholdIn | FlagOpacityThresholdOut,
91     FlagTranslationAlphaFunctionIn      = 0x00080000,
92     FlagTranslationAlphaFunctionOut     = 0x00100000,
93     FlagTranslationAlphaFunctionMask    = FlagTranslationAlphaFunctionIn | FlagTranslationAlphaFunctionOut,
94     FlagRotateAlphaFunctionIn           = 0x00200000,
95     FlagRotateAlphaFunctionOut          = 0x00400000,
96     FlagRotateAlphaFunctionMask         = FlagRotateAlphaFunctionIn | FlagRotateAlphaFunctionOut,
97     FlagRotateOriginAlphaFunctionIn     = 0x00800000,
98     FlagRotateOriginAlphaFunctionOut    = 0x01000000,
99     FlagRotateOriginAlphaFunctionMask   = FlagRotateOriginAlphaFunctionIn | FlagRotateOriginAlphaFunctionOut,
100     FlagSwingAngleAlphaFunctionIn       = 0x02000000,
101     FlagSwingAngleAlphaFunctionOut      = 0x04000000,
102     FlagSwingAngleAlphaFunctionMask     = FlagSwingAngleAlphaFunctionIn | FlagSwingAngleAlphaFunctionOut,
103     FlagSwingAnchorAlphaFunctionIn      = 0x08000000,
104     FlagSwingAnchorAlphaFunctionOut     = 0x10000000,
105     FlagSwingAnchorAlphaFunctionMask    = FlagSwingAnchorAlphaFunctionIn | FlagSwingAnchorAlphaFunctionOut,
106     FlagOpacityAlphaFunctionIn          = 0x20000000,
107     FlagOpacityAlphaFunctionOut         = 0x40000000,
108     FlagOpacityAlphaFunctionMask        = FlagOpacityAlphaFunctionIn | FlagOpacityAlphaFunctionOut
109   };
110
111   /**
112    * Create an initialized ScrollViewPageCubeEffect.
113    * @return A handle to a newly allocated Dali resource.
114    */
115   static ScrollViewCustomEffect New();
116
117   /**
118    * Create an uninitialized ScrollViewPageCubeEffect; this can be initialized with ScrollViewPageCubeEffect::New()
119    * Calling member functions with an uninitialized Toolkit::ScrollViewPageCubeEffect is not allowed.
120    */
121   ScrollViewCustomEffect();
122
123   /**
124    * Downcast an Object handle to ScrollViewCustomEffect. If handle points to a ScrollViewCustomEffect the
125    * downcast produces valid handle. If not the returned handle is left uninitialized.
126    * @param[in] handle Handle to an object
127    * @return handle to a ScrollViewCustomEffect or an uninitialized handle
128    */
129   static ScrollViewCustomEffect DownCast( BaseHandle handle );
130
131   /**
132    * @brief SetPageSpacing
133    * @param spacing
134    */
135   void SetPageSpacing(const Vector2& spacing);
136
137   /**
138    * @brief SetPageTranslation sets a simple translate on/off value
139    * @param translation
140    */
141   void SetPageTranslation(const Vector3& translation);
142
143   /**
144    * @brief SetPageTranslation
145    * @param translationIn
146    * @param translationOut
147    */
148   void SetPageTranslation(const Vector3& translationIn, const Vector3& translationOut);
149
150   /**
151    * @brief SetPageTranslationIn
152    * @param translation
153    */
154   void SetPageTranslationIn(const Vector3& translation);
155
156   /**
157    * @brief SetPageTranslationOut
158    * @param translation
159    */
160   void SetPageTranslationOut(const Vector3& translation);
161
162   /**
163    * @brief SetPageTranslateAlphaFunction
164    * @param func
165    */
166   void SetPageTranslateAlphaFunction(AlphaFunction func);
167
168   /**
169    * @brief SetPageTranslateAlphaFunction
170    * @param funcIn
171    * @param funcOut
172    */
173   void SetPageTranslateAlphaFunction(AlphaFunction funcIn, AlphaFunction funcOut);
174
175   /**
176    * @brief SetPageTranslateAlphaFunctionIn
177    * @param func
178    */
179   void SetPageTranslateAlphaFunctionIn(AlphaFunction func);
180
181   /**
182    * @brief SetPageTranslateAlphaFunctionOut
183    * @param func
184    */
185   void SetPageTranslateAlphaFunctionOut(AlphaFunction func);
186
187   /**
188    * @brief SetGlobalPageRotation
189    * @param angle
190    * @param axis
191    */
192   void SetGlobalPageRotation(float angle, const Vector3& axis);
193
194   /**
195    * @brief SetAnglePageRotation uses the angle and page size passed in on creation to create a faked origin (inner cube needs this method)
196    * @param angle
197    */
198   void SetAngledOriginPageRotation(const Vector3& angle);
199
200   /**
201    * @brief SetGlobalPageRotation
202    * @param angleIn
203    * @param axisIn
204    * @param angleOut
205    * @param axisOut
206    */
207   void SetGlobalPageRotation(float angleIn, const Vector3& axisIn, float angleOut, const Vector3& axisOut);
208
209   /**
210    * @brief SetGlobalPageRotationIn
211    * @param angle
212    * @param axis
213    */
214   void SetGlobalPageRotationIn(float angle, const Vector3& axis);
215
216   /**
217    * @brief SetGlobalPageRotationOut
218    * @param angle
219    * @param axis
220    */
221   void SetGlobalPageRotationOut(float angle, const Vector3& axis);
222
223   /**
224    * @brief SetPageRotationOrigin Set the origin to rotate all the pages around
225    *        - The default value is (0,0,0)
226    * @param origin
227    */
228   void SetGlobalPageRotationOrigin(const Vector3& origin);
229
230   /**
231    * @brief SetGlobalPageRotationOrigin
232    * @param originIn
233    * @param originOut
234    */
235   void SetGlobalPageRotationOrigin(const Vector3& originIn, const Vector3& originOut);
236
237   /**
238    * @brief SetGlobalPageRotationOriginIn
239    * @param origin
240    */
241   void SetGlobalPageRotationOriginIn(const Vector3& origin);
242
243   /**
244    * @brief SetGlobalPageRotationOriginOut
245    * @param origin
246    */
247   void SetGlobalPageRotationOriginOut(const Vector3& origin);
248
249   /**
250    * @brief SetSwingAngle
251    * @param angle
252    * @param axis
253    */
254   void SetSwingAngle(float angle, const Vector3& axis);
255
256   /**
257    * @brief SetSwingAngle
258    * @param angleIn
259    * @param axisIn
260    * @param angleOut
261    * @param axisOut
262    */
263   void SetSwingAngle(float angleIn, const Vector3& axisIn, float angleOut, const Vector3& axisOut);
264
265   /**
266    * @brief SetSwingAngleIn
267    * @param angle
268    * @param axis
269    */
270   void SetSwingAngleIn(float angle, const Vector3& axis);
271
272   /**
273    * @brief SetSwingAngleOut
274    * @param angle
275    * @param axis
276    */
277   void SetSwingAngleOut(float angle, const Vector3& axis);
278
279   /**
280    * @brief SetSwingAngleAlphaFunction
281    * @param func
282    */
283   void SetSwingAngleAlphaFunction(AlphaFunction func);
284
285   /**
286    * @brief SetSwingAngleAlphaFunction
287    * @param funcIn
288    * @param funcOut
289    */
290   void SetSwingAngleAlphaFunction(AlphaFunction funcIn, AlphaFunction funcOut);
291
292   /**
293    * @brief SetSwingAngleAlphaFunctionIn
294    * @param func
295    */
296   void SetSwingAngleAlphaFunctionIn(AlphaFunction func);
297
298   /**
299    * @brief SetSwingAngleAlphaFunctionOut
300    * @param func
301    */
302   void SetSwingAngleAlphaFunctionOut(AlphaFunction func);
303
304   /**
305    * @brief SetPageRotationOrigin Set the origin to rotate all the pages around
306    *        - The default value is (0,0,0)
307    * @param anchor
308    */
309   void SetSwingAnchor(const Vector3& anchor);
310
311   /**
312    * @brief SetSwingAnchor
313    * @param anchorIn
314    * @param anchorOut
315    */
316   void SetSwingAnchor(const Vector3& anchorIn, const Vector3& anchorOut);
317
318   /**
319    * @brief SetSwingAnchorIn
320    * @param anchor
321    */
322   void SetSwingAnchorIn(const Vector3& anchor);
323
324   /**
325    * @brief SetSwingAnchorOut
326    * @param anchor
327    */
328   void SetSwingAnchorOut(const Vector3& anchor);
329
330   /**
331    * @brief SetSwingAnchorAlphaFunction
332    * @param func
333    */
334   void SetSwingAnchorAlphaFunction(AlphaFunction func);
335
336   /**
337    * @brief SetSwingAnchorAlphaFunction
338    * @param funcIn
339    * @param funcOut
340    */
341   void SetSwingAnchorAlphaFunction(AlphaFunction funcIn, AlphaFunction funcOut);
342
343   /**
344    * @brief SetSwingAnchorAlphaFunctionIn
345    * @param func
346    */
347   void SetSwingAnchorAlphaFunctionIn(AlphaFunction func);
348
349   /**
350    * @brief SetSwingAnchorAlphaFunctionOut
351    * @param func
352    */
353   void SetSwingAnchorAlphaFunctionOut(AlphaFunction func);
354
355   /**
356    * @brief SetOpacityThreshold
357    * @param thresh
358    */
359   void SetOpacityThreshold(float thresh);
360
361   /**
362    * @brief SetOpacityThreshold
363    * @param threshIn
364    * @param threshOut
365    */
366   void SetOpacityThreshold(float threshIn, float threshOut);
367
368   /**
369    * @brief SetOpacityThresholdIn
370    * @param thresh
371    */
372   void SetOpacityThresholdIn(float thresh);
373
374   /**
375    * @brief SetOpacityThresholdOut
376    * @param thresh
377    */
378   void SetOpacityThresholdOut(float thresh);
379
380   /**
381    * @brief SetOpacityAlphaFunction
382    * @param func
383    */
384   void SetOpacityAlphaFunction(AlphaFunction func);
385
386   /**
387    * @brief SetOpacityAlphaFunction
388    * @param funcIn
389    * @param funcOut
390    */
391   void SetOpacityAlphaFunction(AlphaFunction funcIn, AlphaFunction funcOut);
392
393   /**
394    * @brief SetOpacityAlphaFunctionIn
395    * @param func
396    */
397   void SetOpacityAlphaFunctionIn(AlphaFunction func);
398
399   /**
400    * @brief SetOpacityAlphaFunctionOut
401    * @param func
402    */
403   void SetOpacityAlphaFunctionOut(AlphaFunction func);
404
405   /**
406    * Applies the effect to a page
407    * @param page the page to apply this effect to
408    * @param pageSize not needed, page size is determined by scroll view
409
410    */
411   void ApplyToPage(Actor page, Vector3 pageSize);
412
413 protected:
414
415   /**
416    * This constructor is used by Dali New() methods.
417    * @param [in] impl A pointer to a newly allocated Dali resource
418    */
419   ScrollViewCustomEffect( Internal::ScrollViewCustomEffect *impl );
420
421 };
422
423 } // namespace Toolkit
424
425 } // namespace Dali
426
427 /**
428  * @}
429  */
430 #endif // __DALI_TOOLKIT_SCROLL_VIEW_CUSTOM_EFFECT_H__