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 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 #include <dali/public-api/animation/animation.h>
23 #include <dali/public-api/animation/alpha-functions.h>
24 #include <dali/public-api/animation/time-period.h>
25 #include <dali/public-api/object/ref-object.h>
26 #include <dali-toolkit/public-api/controls/scrollable/scroll-view/scroll-view.h>
27 #include <dali-toolkit/public-api/controls/scrollable/scroll-view/scroll-view-custom-effect.h>
28 #include <dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-effect-impl.h>
45 * @copydoc Toolkit::ScrollViewCustomEffect
47 class ScrollViewCustomEffect : public ScrollViewEffect
49 static const std::string SCROLL_AMOUNT_PROPERTY_STRING;
50 static const std::string ANCHOR_POINT_PROPERTY_STRING;
57 ScrollViewCustomEffect();
62 * @brief SetPageSpacing
65 void SetPageSpacing(const Vector2& spacing);
68 * @brief SetPageTranslation sets a simple translate on/off value
71 void SetPageTranslation(const Vector3& translation);
74 * @brief SetPageTranslation
75 * @param translationIn
76 * @param translationOut
78 void SetPageTranslation(const Vector3& translationIn, const Vector3& translationOut);
81 * @brief SetPageTranslationIn
84 void SetPageTranslationIn(const Vector3& translation);
87 * @brief SetPageTranslationOut
90 void SetPageTranslationOut(const Vector3& translation);
93 * @brief SetPageTranslateAlphaFunction
96 void SetPageTranslateAlphaFunction(AlphaFunction func);
99 * @brief SetPageTranslateAlphaFunction
103 void SetPageTranslateAlphaFunction(AlphaFunction funcIn, AlphaFunction funcOut);
106 * @brief SetPageTranslateAlphaFunctionIn
109 void SetPageTranslateAlphaFunctionIn(AlphaFunction func);
112 * @brief SetPageTranslateAlphaFunctionOut
115 void SetPageTranslateAlphaFunctionOut(AlphaFunction func);
118 * @brief SetGlobalPageRotation
122 void SetGlobalPageRotation(float angle, const Vector3& axis);
125 * @brief SetAnglePageRotation uses the angle and page size passed in on creation to create a faked origin (inner cube needs this method)
128 void SetAngledOriginPageRotation(const Vector3& angle);
131 * @brief SetGlobalPageRotation
137 void SetGlobalPageRotation(float angleIn, const Vector3& axisIn, float angleOut, const Vector3& axisOut);
140 * @brief SetGlobalPageRotationIn
144 void SetGlobalPageRotationIn(float angle, const Vector3& axis);
147 * @brief SetGlobalPageRotationOut
151 void SetGlobalPageRotationOut(float angle, const Vector3& axis);
154 * @brief SetPageRotationOrigin Set the origin to rotate all the pages around
155 * - The default value is (0,0,0)
158 void SetGlobalPageRotationOrigin(const Vector3& origin);
161 * @brief SetGlobalPageRotationOrigin
165 void SetGlobalPageRotationOrigin(const Vector3& originIn, const Vector3& originOut);
168 * @brief SetGlobalPageRotationOriginIn
171 void SetGlobalPageRotationOriginIn(const Vector3& origin);
174 * @brief SetGlobalPageRotationOriginOut
177 void SetGlobalPageRotationOriginOut(const Vector3& origin);
180 * @brief SetSwingAngle
184 void SetSwingAngle(const float angle, const Vector3& axis);
187 * @brief SetSwingAngle
193 void SetSwingAngle(float angleIn, const Vector3& axisIn, float angleOut, const Vector3& axisOut);
196 * @brief SetSwingAngleIn
200 void SetSwingAngleIn(float angle, const Vector3& axis);
203 * @brief SetSwingAngleOut
207 void SetSwingAngleOut(float angle, const Vector3& axis);
210 * @brief SetSwingAngleAlphaFunction
213 void SetSwingAngleAlphaFunction(AlphaFunction func);
216 * @brief SetSwingAngleAlphaFunction
220 void SetSwingAngleAlphaFunction(AlphaFunction funcIn, AlphaFunction funcOut);
223 * @brief SetSwingAngleAlphaFunctionIn
226 void SetSwingAngleAlphaFunctionIn(AlphaFunction func);
229 * @brief SetSwingAngleAlphaFunctionOut
232 void SetSwingAngleAlphaFunctionOut(AlphaFunction func);
235 * @brief SetSwingAnchor
238 void SetSwingAnchor(const Vector3& anchor);
241 * @brief SetSwingAnchor
245 void SetSwingAnchor(const Vector3& anchorIn, const Vector3& anchorOut);
248 * @brief SetSwingAnchorIn
251 void SetSwingAnchorIn(const Vector3& anchor);
254 * @brief SetSwingAnchorOut
257 void SetSwingAnchorOut(const Vector3& anchor);
260 * @brief SetSwingAnchorAlphaFunction
263 void SetSwingAnchorAlphaFunction(AlphaFunction func);
266 * @brief SetSwingAnchorAlphaFunction
270 void SetSwingAnchorAlphaFunction(AlphaFunction funcIn, AlphaFunction funcOut);
273 * @brief SetSwingAnchorAlphaFunctionIn
276 void SetSwingAnchorAlphaFunctionIn(AlphaFunction func);
279 * @brief SetSwingAnchorAlphaFunctionOut
282 void SetSwingAnchorAlphaFunctionOut(AlphaFunction func);
285 * @brief SetOpacityThreshold
288 void SetOpacityThreshold(float thresh);
291 * @brief SetOpacityThreshold
295 void SetOpacityThreshold(float threshIn, float threshOut);
298 * @brief SetOpacityThresholdIn
301 void SetOpacityThresholdIn(float thresh);
304 * @brief SetOpacityThresholdOut
307 void SetOpacityThresholdOut(float thresh);
310 * @brief SetOpacityAlphaFunction
313 void SetOpacityAlphaFunction(AlphaFunction func);
316 * @brief SetOpacityAlphaFunction
320 void SetOpacityAlphaFunction(AlphaFunction funcIn, AlphaFunction funcOut);
323 * @brief SetOpacityAlphaFunctionIn
326 void SetOpacityAlphaFunctionIn(AlphaFunction func);
329 * @brief SetOpacityAlphaFunctionOut
332 void SetOpacityAlphaFunctionOut(AlphaFunction func);
336 * ApplyToPage This is the full internal ApplyToPage function and ALL other ApplyToPage
337 * functions should call this one. Making this internal allows us to change this function
338 * in the future without affecting demo apps
342 void ApplyToPage( Actor page, Vector3 pageSize);
345 * @copydoc ScrollViewEffect::OnAttach
347 virtual void OnAttach( Toolkit::ScrollView& scrollView );
350 * @copydoc ScrollViewEffect::OnDetach
352 virtual void OnDetach( Toolkit::ScrollView& scrollView );
357 * A reference counted object may only be deleted by calling Unreference()
359 virtual ~ScrollViewCustomEffect();
363 Vector3 mPageSize; ///< The logical page size for the 3D effect.
365 uint mFlags; ///< flags describing functionality, set automatically depending on functions called during effect setup
366 Vector2 mPageSpacing; ///< space between pages... kinda obvious really
367 Vector3 mTranslateIn; ///< translation offset to use when scrolling a page onto the screen
368 Vector3 mTranslateOut; ///< translation offset to use when scrolling a page off the screen
369 Quaternion mGlobalRotateIn; ///< rotates the page's position around a point
370 Quaternion mGlobalRotateOut; ///< rotates the page's position around a point
371 Vector3 mGlobalOriginIn; ///< the point to rotate a page around when scrolling onto screen
372 Vector3 mGlobalOriginOut; ///< the point to rotate a page around when scrolling off screen
373 float mSwingAngleIn; ///< angle to rotate a page around its anchor when scrolling onto screen
374 Vector3 mSwingAxisIn;
375 float mSwingAngleOut; ///< angle to rotate a page around its anchor when scrolling off screen
376 Vector3 mSwingAxisOut;
377 Vector3 mSwingAnchorIn; ///< the page anchor point to use when scrolling onto screen
378 Vector3 mSwingAnchorOut; ///< the page anchor point to use when scrolling off screen
379 float mOpacityThresholdIn; ///< the point at which opacity will change as page scrolls onto screen
380 float mOpacityThresholdOut; ///< the point at which opacity will change as page scrolls off screen
381 AlphaFunction mGlobalRotateAlphaFunctionIn;
382 AlphaFunction mGlobalRotateAlphaFunctionOut;
383 AlphaFunction mSwingAlphaFunctionIn;
384 AlphaFunction mSwingAlphaFunctionOut;
385 AlphaFunction mSwingAnchorAlphaFunctionIn;
386 AlphaFunction mSwingAnchorAlphaFunctionOut;
387 AlphaFunction mTranslateAlphaFunctionIn;
388 AlphaFunction mTranslateAlphaFunctionOut;
389 AlphaFunction mOpacityAlphaFunctionIn;
390 AlphaFunction mOpacityAlphaFunctionOut;
393 } // namespace Internal
395 // Helpers for public-api forwarding methods
397 inline Internal::ScrollViewCustomEffect& GetImpl(Dali::Toolkit::ScrollViewCustomEffect& obj)
399 DALI_ASSERT_ALWAYS(obj);
401 Dali::RefObject& handle = obj.GetBaseObject();
403 return static_cast<Internal::ScrollViewCustomEffect&>(handle);
406 inline const Internal::ScrollViewCustomEffect& GetImpl(const Dali::Toolkit::ScrollViewCustomEffect& obj)
408 DALI_ASSERT_ALWAYS(obj);
410 const Dali::RefObject& handle = obj.GetBaseObject();
412 return static_cast<const Internal::ScrollViewCustomEffect&>(handle);
415 } // namespace Toolkit
419 #endif // __DALI_TOOLKIT_INTERNAL_SCROLL_VIEW_CUSTOM_EFFECT_H__