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
63 static const std::string ANCHOR_POINT_PROPERTY_NAME;
64 static const std::string SCROLL_AMOUNT_PROPERTY_NAME; ///< Property, name "scroll-amount", type VECTOR3
69 FlagTranslate = 0x0001, ///< indicates that translation is wanted
70 FlagTranslateIn = 0x0002, ///< translating onto the screen is a separate value
71 FlagTranslateOut = 0x0004, ///< translating off the screen is a separate value
72 FlagTranslateMask = FlagTranslate | FlagTranslateIn | FlagTranslateOut,
73 FlagRotate = 0x0008, ///< indicates that a positional rotation is wanted (rotate all pages around a single point like inner cube effect)
74 FlagRotateIn = 0x0010, ///< rotating onto the screen is a separate value
75 FlagRotateOut = 0x0020, ///< rotating off the screen is a separate value
76 FlagRotateAngleForcedOrigin = 0x0040,
77 FlagRotateMask = FlagRotate | FlagRotateIn | FlagRotateOut | FlagRotateAngleForcedOrigin,
78 FlagRotateOrigin = 0x0080, ///< indicates to use a global origin to rotate all pages around
79 FlagRotateOriginIn = 0x0100, ///<
80 FlagRotateOriginOut = 0x0200, ///<
81 FlagRotateOriginMask = FlagRotateOrigin | FlagRotateOriginIn | FlagRotateOriginOut,
82 FlagSwingAngle = 0x0400, ///< indicates that a SwingAngle is wanted (rotate all pages around a single point like inner cube effect)
83 FlagSwingAngleIn = 0x0800, ///< SwingAngle onto the screen is a separate value
84 FlagSwingAngleOut = 0x1000, ///< SwingAngle off the screen is a separate value
85 FlagSwingAngleMask = FlagSwingAngle | FlagSwingAngleIn | FlagSwingAngleOut,
86 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)
87 FlagSwingAnchorIn = 0x4000, ///< Swing anchor onto the screen is a separate value
88 FlagSwingAnchorOut = 0x8000, ///< Swing anchor off the screen is a separate value
89 FlagSwingAnchorMask = FlagSwingAnchor | FlagSwingAnchorIn | FlagSwingAnchorOut,
90 FlagOpacityThreshold = 0x00010000, ///<
91 FlagOpacityThresholdIn = 0x00020000, ///<
92 FlagOpacityThresholdOut = 0x00040000, ///<
93 FlagOpacityThresholdMask = FlagOpacityThreshold | FlagOpacityThresholdIn | FlagOpacityThresholdOut,
94 FlagTranslationAlphaFunctionIn = 0x00080000,
95 FlagTranslationAlphaFunctionOut = 0x00100000,
96 FlagTranslationAlphaFunctionMask = FlagTranslationAlphaFunctionIn | FlagTranslationAlphaFunctionOut,
97 FlagRotateAlphaFunctionIn = 0x00200000,
98 FlagRotateAlphaFunctionOut = 0x00400000,
99 FlagRotateAlphaFunctionMask = FlagRotateAlphaFunctionIn | FlagRotateAlphaFunctionOut,
100 FlagRotateOriginAlphaFunctionIn = 0x00800000,
101 FlagRotateOriginAlphaFunctionOut = 0x01000000,
102 FlagRotateOriginAlphaFunctionMask = FlagRotateOriginAlphaFunctionIn | FlagRotateOriginAlphaFunctionOut,
103 FlagSwingAngleAlphaFunctionIn = 0x02000000,
104 FlagSwingAngleAlphaFunctionOut = 0x04000000,
105 FlagSwingAngleAlphaFunctionMask = FlagSwingAngleAlphaFunctionIn | FlagSwingAngleAlphaFunctionOut,
106 FlagSwingAnchorAlphaFunctionIn = 0x08000000,
107 FlagSwingAnchorAlphaFunctionOut = 0x10000000,
108 FlagSwingAnchorAlphaFunctionMask = FlagSwingAnchorAlphaFunctionIn | FlagSwingAnchorAlphaFunctionOut,
109 FlagOpacityAlphaFunctionIn = 0x20000000,
110 FlagOpacityAlphaFunctionOut = 0x40000000,
111 FlagOpacityAlphaFunctionMask = FlagOpacityAlphaFunctionIn | FlagOpacityAlphaFunctionOut
115 * Create an initialized ScrollViewPageCubeEffect.
116 * @return A handle to a newly allocated Dali resource.
118 static ScrollViewCustomEffect New();
121 * Create an uninitialized ScrollViewPageCubeEffect; this can be initialized with ScrollViewPageCubeEffect::New()
122 * Calling member functions with an uninitialized Toolkit::ScrollViewPageCubeEffect is not allowed.
124 ScrollViewCustomEffect();
127 * Downcast an Object handle to ScrollViewCustomEffect. If handle points to a ScrollViewCustomEffect the
128 * downcast produces valid handle. If not the returned handle is left uninitialized.
129 * @param[in] handle Handle to an object
130 * @return handle to a ScrollViewCustomEffect or an uninitialized handle
132 static ScrollViewCustomEffect DownCast( BaseHandle handle );
135 * @brief SetPageSpacing
138 void SetPageSpacing(const Vector2& spacing);
141 * @brief SetPageTranslation sets a simple translate on/off value
144 void SetPageTranslation(const Vector3& translation);
147 * @brief SetPageTranslation
148 * @param translationIn
149 * @param translationOut
151 void SetPageTranslation(const Vector3& translationIn, const Vector3& translationOut);
154 * @brief SetPageTranslationIn
157 void SetPageTranslationIn(const Vector3& translation);
160 * @brief SetPageTranslationOut
163 void SetPageTranslationOut(const Vector3& translation);
166 * @brief SetPageTranslateAlphaFunction
169 void SetPageTranslateAlphaFunction(AlphaFunction func);
172 * @brief SetPageTranslateAlphaFunction
176 void SetPageTranslateAlphaFunction(AlphaFunction funcIn, AlphaFunction funcOut);
179 * @brief SetPageTranslateAlphaFunctionIn
182 void SetPageTranslateAlphaFunctionIn(AlphaFunction func);
185 * @brief SetPageTranslateAlphaFunctionOut
188 void SetPageTranslateAlphaFunctionOut(AlphaFunction func);
191 * @brief SetGlobalPageRotation
195 void SetGlobalPageRotation(float angle, const Vector3& axis);
198 * @brief SetAnglePageRotation uses the angle and page size passed in on creation to create a faked origin (inner cube needs this method)
201 void SetAngledOriginPageRotation(const Vector3& angle);
204 * @brief SetGlobalPageRotation
210 void SetGlobalPageRotation(float angleIn, const Vector3& axisIn, float angleOut, const Vector3& axisOut);
213 * @brief SetGlobalPageRotationIn
217 void SetGlobalPageRotationIn(float angle, const Vector3& axis);
220 * @brief SetGlobalPageRotationOut
224 void SetGlobalPageRotationOut(float angle, const Vector3& axis);
227 * @brief SetPageRotationOrigin Set the origin to rotate all the pages around
228 * - The default value is (0,0,0)
231 void SetGlobalPageRotationOrigin(const Vector3& origin);
234 * @brief SetGlobalPageRotationOrigin
238 void SetGlobalPageRotationOrigin(const Vector3& originIn, const Vector3& originOut);
241 * @brief SetGlobalPageRotationOriginIn
244 void SetGlobalPageRotationOriginIn(const Vector3& origin);
247 * @brief SetGlobalPageRotationOriginOut
250 void SetGlobalPageRotationOriginOut(const Vector3& origin);
253 * @brief SetSwingAngle
257 void SetSwingAngle(float angle, const Vector3& axis);
260 * @brief SetSwingAngle
266 void SetSwingAngle(float angleIn, const Vector3& axisIn, float angleOut, const Vector3& axisOut);
269 * @brief SetSwingAngleIn
273 void SetSwingAngleIn(float angle, const Vector3& axis);
276 * @brief SetSwingAngleOut
280 void SetSwingAngleOut(float angle, const Vector3& axis);
283 * @brief SetSwingAngleAlphaFunction
286 void SetSwingAngleAlphaFunction(AlphaFunction func);
289 * @brief SetSwingAngleAlphaFunction
293 void SetSwingAngleAlphaFunction(AlphaFunction funcIn, AlphaFunction funcOut);
296 * @brief SetSwingAngleAlphaFunctionIn
299 void SetSwingAngleAlphaFunctionIn(AlphaFunction func);
302 * @brief SetSwingAngleAlphaFunctionOut
305 void SetSwingAngleAlphaFunctionOut(AlphaFunction func);
308 * @brief SetPageRotationOrigin Set the origin to rotate all the pages around
309 * - The default value is (0,0,0)
312 void SetSwingAnchor(const Vector3& anchor);
315 * @brief SetSwingAnchor
319 void SetSwingAnchor(const Vector3& anchorIn, const Vector3& anchorOut);
322 * @brief SetSwingAnchorIn
325 void SetSwingAnchorIn(const Vector3& anchor);
328 * @brief SetSwingAnchorOut
331 void SetSwingAnchorOut(const Vector3& anchor);
334 * @brief SetSwingAnchorAlphaFunction
337 void SetSwingAnchorAlphaFunction(AlphaFunction func);
340 * @brief SetSwingAnchorAlphaFunction
344 void SetSwingAnchorAlphaFunction(AlphaFunction funcIn, AlphaFunction funcOut);
347 * @brief SetSwingAnchorAlphaFunctionIn
350 void SetSwingAnchorAlphaFunctionIn(AlphaFunction func);
353 * @brief SetSwingAnchorAlphaFunctionOut
356 void SetSwingAnchorAlphaFunctionOut(AlphaFunction func);
359 * @brief SetOpacityThreshold
362 void SetOpacityThreshold(float thresh);
365 * @brief SetOpacityThreshold
369 void SetOpacityThreshold(float threshIn, float threshOut);
372 * @brief SetOpacityThresholdIn
375 void SetOpacityThresholdIn(float thresh);
378 * @brief SetOpacityThresholdOut
381 void SetOpacityThresholdOut(float thresh);
384 * @brief SetOpacityAlphaFunction
387 void SetOpacityAlphaFunction(AlphaFunction func);
390 * @brief SetOpacityAlphaFunction
394 void SetOpacityAlphaFunction(AlphaFunction funcIn, AlphaFunction funcOut);
397 * @brief SetOpacityAlphaFunctionIn
400 void SetOpacityAlphaFunctionIn(AlphaFunction func);
403 * @brief SetOpacityAlphaFunctionOut
406 void SetOpacityAlphaFunctionOut(AlphaFunction func);
409 * Applies the effect to a page
410 * @param page the page to apply this effect to
411 * @param pageSize not needed, page size is determined by scroll view
414 void ApplyToPage(Actor page, Vector3 pageSize);
419 * This constructor is used by Dali New() methods.
420 * @param [in] impl A pointer to a newly allocated Dali resource
422 ScrollViewCustomEffect( Internal::ScrollViewCustomEffect *impl );
426 } // namespace Toolkit
433 #endif // __DALI_TOOLKIT_SCROLL_VIEW_CUSTOM_EFFECT_H__