1 #ifndef __DALI_TOOLKIT_SCROLL_VIEW_CUSTOM_EFFECT_H__
2 #define __DALI_TOOLKIT_SCROLL_VIEW_CUSTOM_EFFECT_H__
5 // Copyright (c) 2014 Samsung Electronics Co., Ltd.
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
11 // http://floralicense.org/license/
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.
21 * @addtogroup CAPI_DALI_FRAMEWORK
26 #include <dali-toolkit/public-api/controls/scrollable/scroll-view/scroll-view-effect.h>
28 namespace Dali DALI_IMPORT_API
36 namespace Internal DALI_INTERNAL
38 class ScrollViewCustomEffect;
42 * ScrollView Inner Cube-Effect.
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:
51 * You should ensure ScrollView's default constraints have been removed,
52 * by calling ScrollView::RemoveConstraintsFromChildren() before applying
53 * this effect to ScrollView.
56 * ApplyToPage(...) method should be called on every page.
58 * Automatic operation:
61 class ScrollViewCustomEffect : public ScrollViewEffect
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
112 * Create an initialized ScrollViewPageCubeEffect.
113 * @return A handle to a newly allocated Dali resource.
115 static ScrollViewCustomEffect New();
118 * Create an uninitialized ScrollViewPageCubeEffect; this can be initialized with ScrollViewPageCubeEffect::New()
119 * Calling member functions with an uninitialized Toolkit::ScrollViewPageCubeEffect is not allowed.
121 ScrollViewCustomEffect();
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
129 static ScrollViewCustomEffect DownCast( BaseHandle handle );
132 * @brief SetPageSpacing
135 void SetPageSpacing(const Vector2& spacing);
138 * @brief SetPageTranslation sets a simple translate on/off value
141 void SetPageTranslation(const Vector3& translation);
144 * @brief SetPageTranslation
145 * @param translationIn
146 * @param translationOut
148 void SetPageTranslation(const Vector3& translationIn, const Vector3& translationOut);
151 * @brief SetPageTranslationIn
154 void SetPageTranslationIn(const Vector3& translation);
157 * @brief SetPageTranslationOut
160 void SetPageTranslationOut(const Vector3& translation);
163 * @brief SetPageTranslateAlphaFunction
166 void SetPageTranslateAlphaFunction(AlphaFunction func);
169 * @brief SetPageTranslateAlphaFunction
173 void SetPageTranslateAlphaFunction(AlphaFunction funcIn, AlphaFunction funcOut);
176 * @brief SetPageTranslateAlphaFunctionIn
179 void SetPageTranslateAlphaFunctionIn(AlphaFunction func);
182 * @brief SetPageTranslateAlphaFunctionOut
185 void SetPageTranslateAlphaFunctionOut(AlphaFunction func);
188 * @brief SetGlobalPageRotation
192 void SetGlobalPageRotation(float angle, const Vector3& axis);
195 * @brief SetAnglePageRotation uses the angle and page size passed in on creation to create a faked origin (inner cube needs this method)
198 void SetAngledOriginPageRotation(const Vector3& angle);
201 * @brief SetGlobalPageRotation
207 void SetGlobalPageRotation(float angleIn, const Vector3& axisIn, float angleOut, const Vector3& axisOut);
210 * @brief SetGlobalPageRotationIn
214 void SetGlobalPageRotationIn(float angle, const Vector3& axis);
217 * @brief SetGlobalPageRotationOut
221 void SetGlobalPageRotationOut(float angle, const Vector3& axis);
224 * @brief SetPageRotationOrigin Set the origin to rotate all the pages around
225 * - The default value is (0,0,0)
228 void SetGlobalPageRotationOrigin(const Vector3& origin);
231 * @brief SetGlobalPageRotationOrigin
235 void SetGlobalPageRotationOrigin(const Vector3& originIn, const Vector3& originOut);
238 * @brief SetGlobalPageRotationOriginIn
241 void SetGlobalPageRotationOriginIn(const Vector3& origin);
244 * @brief SetGlobalPageRotationOriginOut
247 void SetGlobalPageRotationOriginOut(const Vector3& origin);
250 * @brief SetSwingAngle
254 void SetSwingAngle(float angle, const Vector3& axis);
257 * @brief SetSwingAngle
263 void SetSwingAngle(float angleIn, const Vector3& axisIn, float angleOut, const Vector3& axisOut);
266 * @brief SetSwingAngleIn
270 void SetSwingAngleIn(float angle, const Vector3& axis);
273 * @brief SetSwingAngleOut
277 void SetSwingAngleOut(float angle, const Vector3& axis);
280 * @brief SetSwingAngleAlphaFunction
283 void SetSwingAngleAlphaFunction(AlphaFunction func);
286 * @brief SetSwingAngleAlphaFunction
290 void SetSwingAngleAlphaFunction(AlphaFunction funcIn, AlphaFunction funcOut);
293 * @brief SetSwingAngleAlphaFunctionIn
296 void SetSwingAngleAlphaFunctionIn(AlphaFunction func);
299 * @brief SetSwingAngleAlphaFunctionOut
302 void SetSwingAngleAlphaFunctionOut(AlphaFunction func);
305 * @brief SetPageRotationOrigin Set the origin to rotate all the pages around
306 * - The default value is (0,0,0)
309 void SetSwingAnchor(const Vector3& anchor);
312 * @brief SetSwingAnchor
316 void SetSwingAnchor(const Vector3& anchorIn, const Vector3& anchorOut);
319 * @brief SetSwingAnchorIn
322 void SetSwingAnchorIn(const Vector3& anchor);
325 * @brief SetSwingAnchorOut
328 void SetSwingAnchorOut(const Vector3& anchor);
331 * @brief SetSwingAnchorAlphaFunction
334 void SetSwingAnchorAlphaFunction(AlphaFunction func);
337 * @brief SetSwingAnchorAlphaFunction
341 void SetSwingAnchorAlphaFunction(AlphaFunction funcIn, AlphaFunction funcOut);
344 * @brief SetSwingAnchorAlphaFunctionIn
347 void SetSwingAnchorAlphaFunctionIn(AlphaFunction func);
350 * @brief SetSwingAnchorAlphaFunctionOut
353 void SetSwingAnchorAlphaFunctionOut(AlphaFunction func);
356 * @brief SetOpacityThreshold
359 void SetOpacityThreshold(float thresh);
362 * @brief SetOpacityThreshold
366 void SetOpacityThreshold(float threshIn, float threshOut);
369 * @brief SetOpacityThresholdIn
372 void SetOpacityThresholdIn(float thresh);
375 * @brief SetOpacityThresholdOut
378 void SetOpacityThresholdOut(float thresh);
381 * @brief SetOpacityAlphaFunction
384 void SetOpacityAlphaFunction(AlphaFunction func);
387 * @brief SetOpacityAlphaFunction
391 void SetOpacityAlphaFunction(AlphaFunction funcIn, AlphaFunction funcOut);
394 * @brief SetOpacityAlphaFunctionIn
397 void SetOpacityAlphaFunctionIn(AlphaFunction func);
400 * @brief SetOpacityAlphaFunctionOut
403 void SetOpacityAlphaFunctionOut(AlphaFunction func);
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
411 void ApplyToPage(Actor page, Vector3 pageSize);
416 * This constructor is used by Dali New() methods.
417 * @param [in] impl A pointer to a newly allocated Dali resource
419 ScrollViewCustomEffect( Internal::ScrollViewCustomEffect *impl );
423 } // namespace Toolkit
430 #endif // __DALI_TOOLKIT_SCROLL_VIEW_CUSTOM_EFFECT_H__