1 #ifndef __DALI_TOOLKIT_INTERNAL_SCROLL_VIEW_CUSTOM_EFFECT_H__
2 #define __DALI_TOOLKIT_INTERNAL_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 #include <dali/public-api/animation/animation.h>
22 #include <dali/public-api/animation/alpha-functions.h>
23 #include <dali/public-api/animation/time-period.h>
24 #include <dali/public-api/object/ref-object.h>
25 #include <dali-toolkit/public-api/controls/scrollable/scroll-view/scroll-view.h>
26 #include <dali-toolkit/public-api/controls/scrollable/scroll-view/scroll-view-custom-effect.h>
27 #include <dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-effect-impl.h>
44 * @copydoc Toolkit::ScrollViewCustomEffect
46 class ScrollViewCustomEffect : public ScrollViewEffect
48 static const std::string SCROLL_AMOUNT_PROPERTY_STRING;
49 static const std::string ANCHOR_POINT_PROPERTY_STRING;
56 ScrollViewCustomEffect();
61 * @brief SetPageSpacing
64 void SetPageSpacing(const Vector2& spacing);
67 * @brief SetPageTranslation sets a simple translate on/off value
70 void SetPageTranslation(const Vector3& translation);
73 * @brief SetPageTranslation
74 * @param translationIn
75 * @param translationOut
77 void SetPageTranslation(const Vector3& translationIn, const Vector3& translationOut);
80 * @brief SetPageTranslationIn
83 void SetPageTranslationIn(const Vector3& translation);
86 * @brief SetPageTranslationOut
89 void SetPageTranslationOut(const Vector3& translation);
92 * @brief SetPageTranslateAlphaFunction
95 void SetPageTranslateAlphaFunction(AlphaFunction func);
98 * @brief SetPageTranslateAlphaFunction
102 void SetPageTranslateAlphaFunction(AlphaFunction funcIn, AlphaFunction funcOut);
105 * @brief SetPageTranslateAlphaFunctionIn
108 void SetPageTranslateAlphaFunctionIn(AlphaFunction func);
111 * @brief SetPageTranslateAlphaFunctionOut
114 void SetPageTranslateAlphaFunctionOut(AlphaFunction func);
117 * @brief SetGlobalPageRotation
121 void SetGlobalPageRotation(float angle, const Vector3& axis);
124 * @brief SetAnglePageRotation uses the angle and page size passed in on creation to create a faked origin (inner cube needs this method)
127 void SetAngledOriginPageRotation(const Vector3& angle);
130 * @brief SetGlobalPageRotation
136 void SetGlobalPageRotation(float angleIn, const Vector3& axisIn, float angleOut, const Vector3& axisOut);
139 * @brief SetGlobalPageRotationIn
143 void SetGlobalPageRotationIn(float angle, const Vector3& axis);
146 * @brief SetGlobalPageRotationOut
150 void SetGlobalPageRotationOut(float angle, const Vector3& axis);
153 * @brief SetPageRotationOrigin Set the origin to rotate all the pages around
154 * - The default value is (0,0,0)
157 void SetGlobalPageRotationOrigin(const Vector3& origin);
160 * @brief SetGlobalPageRotationOrigin
164 void SetGlobalPageRotationOrigin(const Vector3& originIn, const Vector3& originOut);
167 * @brief SetGlobalPageRotationOriginIn
170 void SetGlobalPageRotationOriginIn(const Vector3& origin);
173 * @brief SetGlobalPageRotationOriginOut
176 void SetGlobalPageRotationOriginOut(const Vector3& origin);
179 * @brief SetSwingAngle
183 void SetSwingAngle(const float angle, const Vector3& axis);
186 * @brief SetSwingAngle
192 void SetSwingAngle(float angleIn, const Vector3& axisIn, float angleOut, const Vector3& axisOut);
195 * @brief SetSwingAngleIn
199 void SetSwingAngleIn(float angle, const Vector3& axis);
202 * @brief SetSwingAngleOut
206 void SetSwingAngleOut(float angle, const Vector3& axis);
209 * @brief SetSwingAngleAlphaFunction
212 void SetSwingAngleAlphaFunction(AlphaFunction func);
215 * @brief SetSwingAngleAlphaFunction
219 void SetSwingAngleAlphaFunction(AlphaFunction funcIn, AlphaFunction funcOut);
222 * @brief SetSwingAngleAlphaFunctionIn
225 void SetSwingAngleAlphaFunctionIn(AlphaFunction func);
228 * @brief SetSwingAngleAlphaFunctionOut
231 void SetSwingAngleAlphaFunctionOut(AlphaFunction func);
234 * @brief SetSwingAnchor
237 void SetSwingAnchor(const Vector3& anchor);
240 * @brief SetSwingAnchor
244 void SetSwingAnchor(const Vector3& anchorIn, const Vector3& anchorOut);
247 * @brief SetSwingAnchorIn
250 void SetSwingAnchorIn(const Vector3& anchor);
253 * @brief SetSwingAnchorOut
256 void SetSwingAnchorOut(const Vector3& anchor);
259 * @brief SetSwingAnchorAlphaFunction
262 void SetSwingAnchorAlphaFunction(AlphaFunction func);
265 * @brief SetSwingAnchorAlphaFunction
269 void SetSwingAnchorAlphaFunction(AlphaFunction funcIn, AlphaFunction funcOut);
272 * @brief SetSwingAnchorAlphaFunctionIn
275 void SetSwingAnchorAlphaFunctionIn(AlphaFunction func);
278 * @brief SetSwingAnchorAlphaFunctionOut
281 void SetSwingAnchorAlphaFunctionOut(AlphaFunction func);
284 * @brief SetOpacityThreshold
287 void SetOpacityThreshold(float thresh);
290 * @brief SetOpacityThreshold
294 void SetOpacityThreshold(float threshIn, float threshOut);
297 * @brief SetOpacityThresholdIn
300 void SetOpacityThresholdIn(float thresh);
303 * @brief SetOpacityThresholdOut
306 void SetOpacityThresholdOut(float thresh);
309 * @brief SetOpacityAlphaFunction
312 void SetOpacityAlphaFunction(AlphaFunction func);
315 * @brief SetOpacityAlphaFunction
319 void SetOpacityAlphaFunction(AlphaFunction funcIn, AlphaFunction funcOut);
322 * @brief SetOpacityAlphaFunctionIn
325 void SetOpacityAlphaFunctionIn(AlphaFunction func);
328 * @brief SetOpacityAlphaFunctionOut
331 void SetOpacityAlphaFunctionOut(AlphaFunction func);
335 * ApplyToPage This is the full internal ApplyToPage function and ALL other ApplyToPage
336 * functions should call this one. Making this internal allows us to change this function
337 * in the future without affecting demo apps
341 void ApplyToPage( Actor page, Vector3 pageSize);
344 * @copydoc ScrollViewEffect::OnAttach
346 virtual void OnAttach( Toolkit::ScrollView& scrollView );
349 * @copydoc ScrollViewEffect::OnDetach
351 virtual void OnDetach( Toolkit::ScrollView& scrollView );
356 * A reference counted object may only be deleted by calling Unreference()
358 virtual ~ScrollViewCustomEffect();
362 Vector3 mPageSize; ///< The logical page size for the 3D effect.
364 uint mFlags; ///< flags describing functionality, set automatically depending on functions called during effect setup
365 Vector2 mPageSpacing; ///< space between pages... kinda obvious really
366 Vector3 mTranslateIn; ///< translation offset to use when scrolling a page onto the screen
367 Vector3 mTranslateOut; ///< translation offset to use when scrolling a page off the screen
368 Quaternion mGlobalRotateIn; ///< rotates the page's position around a point
369 Quaternion mGlobalRotateOut; ///< rotates the page's position around a point
370 Vector3 mGlobalOriginIn; ///< the point to rotate a page around when scrolling onto screen
371 Vector3 mGlobalOriginOut; ///< the point to rotate a page around when scrolling off screen
372 float mSwingAngleIn; ///< angle to rotate a page around its anchor when scrolling onto screen
373 Vector3 mSwingAxisIn;
374 float mSwingAngleOut; ///< angle to rotate a page around its anchor when scrolling off screen
375 Vector3 mSwingAxisOut;
376 Vector3 mSwingAnchorIn; ///< the page anchor point to use when scrolling onto screen
377 Vector3 mSwingAnchorOut; ///< the page anchor point to use when scrolling off screen
378 float mOpacityThresholdIn; ///< the point at which opacity will change as page scrolls onto screen
379 float mOpacityThresholdOut; ///< the point at which opacity will change as page scrolls off screen
380 AlphaFunction mGlobalRotateAlphaFunctionIn;
381 AlphaFunction mGlobalRotateAlphaFunctionOut;
382 AlphaFunction mSwingAlphaFunctionIn;
383 AlphaFunction mSwingAlphaFunctionOut;
384 AlphaFunction mSwingAnchorAlphaFunctionIn;
385 AlphaFunction mSwingAnchorAlphaFunctionOut;
386 AlphaFunction mTranslateAlphaFunctionIn;
387 AlphaFunction mTranslateAlphaFunctionOut;
388 AlphaFunction mOpacityAlphaFunctionIn;
389 AlphaFunction mOpacityAlphaFunctionOut;
392 } // namespace Internal
394 // Helpers for public-api forwarding methods
396 inline Internal::ScrollViewCustomEffect& GetImpl(Dali::Toolkit::ScrollViewCustomEffect& obj)
398 DALI_ASSERT_ALWAYS(obj);
400 Dali::RefObject& handle = obj.GetBaseObject();
402 return static_cast<Internal::ScrollViewCustomEffect&>(handle);
405 inline const Internal::ScrollViewCustomEffect& GetImpl(const Dali::Toolkit::ScrollViewCustomEffect& obj)
407 DALI_ASSERT_ALWAYS(obj);
409 const Dali::RefObject& handle = obj.GetBaseObject();
411 return static_cast<const Internal::ScrollViewCustomEffect&>(handle);
414 } // namespace Toolkit
418 #endif // __DALI_TOOLKIT_INTERNAL_SCROLL_VIEW_CUSTOM_EFFECT_H__