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 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
11 * http://www.apache.org/licenses/LICENSE-2.0
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.
22 * @addtogroup CAPI_DALI_TOOLKIT_SCROLL_VIEW_MODULE
27 #include <dali-toolkit/public-api/controls/scrollable/scroll-view/scroll-view-effect.h>
29 namespace Dali DALI_IMPORT_API
37 namespace Internal DALI_INTERNAL
39 class ScrollViewCustomEffect;
43 * @brief This class has many transition effects for use when scrolling pages, e.g opacity, rotation, swing, translation.
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
65 * @brief Bitflags for effect types.
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 * @brief Create an initialized ScrollViewCustomEffect.
117 * @return A handle to a newly allocated Dali resource.
119 static ScrollViewCustomEffect New();
122 * @brief Create an uninitialized ScrollViewCustomEffect; this can be initialized with ScrollViewCustomEffect::New().
124 * Calling member functions with an uninitialized Toolkit::ScrollViewCustomEffect is not allowed.
126 ScrollViewCustomEffect();
129 * @brief Downcast an Object handle to ScrollViewCustomEffect.
131 * If handle points to a ScrollViewCustomEffect the downcast
132 * produces valid handle. If not the returned handle is left
135 * @param[in] handle Handle to an object
136 * @return handle to a ScrollViewCustomEffect or an uninitialized handle
138 static ScrollViewCustomEffect DownCast( BaseHandle handle );
141 * @brief SetPageSpacing.
145 void SetPageSpacing(const Vector2& spacing);
148 * @brief SetPageTranslation sets a simple translate on/off value.
152 void SetPageTranslation(const Vector3& translation);
155 * @brief SetPageTranslation.
157 * @param translationIn
158 * @param translationOut
160 void SetPageTranslation(const Vector3& translationIn, const Vector3& translationOut);
163 * @brief SetPageTranslationIn.
166 void SetPageTranslationIn(const Vector3& translation);
169 * @brief SetPageTranslationOut.
173 void SetPageTranslationOut(const Vector3& translation);
176 * @brief SetPageTranslateAlphaFunction.
180 void SetPageTranslateAlphaFunction(AlphaFunction func);
183 * @brief SetPageTranslateAlphaFunction.
188 void SetPageTranslateAlphaFunction(AlphaFunction funcIn, AlphaFunction funcOut);
191 * @brief SetPageTranslateAlphaFunctionIn.
195 void SetPageTranslateAlphaFunctionIn(AlphaFunction func);
198 * @brief SetPageTranslateAlphaFunctionOut.
201 void SetPageTranslateAlphaFunctionOut(AlphaFunction func);
204 * @brief SetGlobalPageRotation.
209 void SetGlobalPageRotation(float angle, const Vector3& axis);
212 * @brief SetAnglePageRotation uses the angle and page size passed in on creation to create a faked origin (inner cube needs this method).
216 void SetAngledOriginPageRotation(const Vector3& angle);
219 * @brief SetGlobalPageRotation.
226 void SetGlobalPageRotation(float angleIn, const Vector3& axisIn, float angleOut, const Vector3& axisOut);
229 * @brief SetGlobalPageRotationIn.
234 void SetGlobalPageRotationIn(float angle, const Vector3& axis);
237 * @brief SetGlobalPageRotationOut.
242 void SetGlobalPageRotationOut(float angle, const Vector3& axis);
245 * @brief SetPageRotationOrigin Set the origin to rotate all the pages around.
247 * - The default value is (0,0,0)
250 void SetGlobalPageRotationOrigin(const Vector3& origin);
253 * @brief SetGlobalPageRotationOrigin.
258 void SetGlobalPageRotationOrigin(const Vector3& originIn, const Vector3& originOut);
261 * @brief SetGlobalPageRotationOriginIn.
265 void SetGlobalPageRotationOriginIn(const Vector3& origin);
268 * @brief SetGlobalPageRotationOriginOut.
272 void SetGlobalPageRotationOriginOut(const Vector3& origin);
275 * @brief SetSwingAngle.
280 void SetSwingAngle(float angle, const Vector3& axis);
283 * @brief SetSwingAngle.
290 void SetSwingAngle(float angleIn, const Vector3& axisIn, float angleOut, const Vector3& axisOut);
293 * @brief SetSwingAngleIn.
298 void SetSwingAngleIn(float angle, const Vector3& axis);
301 * @brief SetSwingAngleOut.
306 void SetSwingAngleOut(float angle, const Vector3& axis);
309 * @brief SetSwingAngleAlphaFunction.
313 void SetSwingAngleAlphaFunction(AlphaFunction func);
316 * @brief SetSwingAngleAlphaFunction.
321 void SetSwingAngleAlphaFunction(AlphaFunction funcIn, AlphaFunction funcOut);
324 * @brief SetSwingAngleAlphaFunctionIn.
328 void SetSwingAngleAlphaFunctionIn(AlphaFunction func);
331 * @brief SetSwingAngleAlphaFunctionOut.
335 void SetSwingAngleAlphaFunctionOut(AlphaFunction func);
338 * @brief SetPageRotationOrigin Set the origin to rotate all the pages around.
340 * - The default value is (0,0,0)
343 void SetSwingAnchor(const Vector3& anchor);
346 * @brief SetSwingAnchor.
351 void SetSwingAnchor(const Vector3& anchorIn, const Vector3& anchorOut);
354 * @brief SetSwingAnchorIn.
358 void SetSwingAnchorIn(const Vector3& anchor);
361 * @brief SetSwingAnchorOut.
365 void SetSwingAnchorOut(const Vector3& anchor);
368 * @brief SetSwingAnchorAlphaFunction.
372 void SetSwingAnchorAlphaFunction(AlphaFunction func);
375 * @brief SetSwingAnchorAlphaFunction.
380 void SetSwingAnchorAlphaFunction(AlphaFunction funcIn, AlphaFunction funcOut);
383 * @brief SetSwingAnchorAlphaFunctionIn.
387 void SetSwingAnchorAlphaFunctionIn(AlphaFunction func);
390 * @brief SetSwingAnchorAlphaFunctionOut.
393 void SetSwingAnchorAlphaFunctionOut(AlphaFunction func);
396 * @brief SetOpacityThreshold.
400 void SetOpacityThreshold(float thresh);
403 * @brief SetOpacityThreshold.
408 void SetOpacityThreshold(float threshIn, float threshOut);
411 * @brief SetOpacityThresholdIn.
415 void SetOpacityThresholdIn(float thresh);
418 * @brief SetOpacityThresholdOut.
422 void SetOpacityThresholdOut(float thresh);
425 * @brief SetOpacityAlphaFunction.
429 void SetOpacityAlphaFunction(AlphaFunction func);
432 * @brief SetOpacityAlphaFunction.
437 void SetOpacityAlphaFunction(AlphaFunction funcIn, AlphaFunction funcOut);
440 * @brief SetOpacityAlphaFunctionIn.
444 void SetOpacityAlphaFunctionIn(AlphaFunction func);
447 * @brief SetOpacityAlphaFunctionOut.
451 void SetOpacityAlphaFunctionOut(AlphaFunction func);
454 * @brief Applies the effect to a page.
456 * @param page the page to apply this effect to
457 * @param pageSize not needed, page size is determined by scroll view
460 void ApplyToPage(Actor page, Vector3 pageSize);
465 * @brief This constructor is used by Dali New() methods.
467 * @param [in] impl A pointer to a newly allocated Dali resource
469 ScrollViewCustomEffect( Internal::ScrollViewCustomEffect *impl );
473 } // namespace Toolkit
480 #endif // __DALI_TOOLKIT_SCROLL_VIEW_CUSTOM_EFFECT_H__