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