1 #ifndef __DALI_TOOLKIT_INTERNAL_SCROLL_VIEW_EFFECT_H__
2 #define __DALI_TOOLKIT_INTERNAL_SCROLL_VIEW_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/dali.h>
22 #include <dali-toolkit/public-api/controls/scrollable/scroll-view/scroll-view.h>
23 #include <dali-toolkit/public-api/controls/scrollable/scroll-view/scroll-view-effect.h>
38 class ScrollViewEffect;
41 * @copydoc Toolkit::ScrollViewEffect
43 class ScrollViewEffect : public Dali::BaseObject, public ConnectionTracker
51 * Attaches this effect to scrollView.
52 * @pre must not be already attached to a scrollView
53 * @note internally the scrollView effect holds a weak reference
55 * @param[in] scrollView The scrollView instance to attach to.
57 void Attach(Toolkit::ScrollView& scrollView);
60 * Attaches this effect to scrollView.
61 * @pre must not be already attached to a scrollView
62 * @param[in] scrollView The scrollView instance to attach to.
64 void Detach(Toolkit::ScrollView& scrollView);
69 * Called upon Attaching of effect to a scrollView instance.
71 * This will be called once.
73 * @param[in] scrollView The attached scrollView instance.
75 virtual void OnAttach(Toolkit::ScrollView& scrollView) = 0;
78 * Called upon Detaching of effect from a scrollView instance.
80 * This will be called once.
82 * @param[in] scrollView The attached scrollView instance.
84 virtual void OnDetach(Toolkit::ScrollView& scrollView) = 0;
89 * Returns the ScrollView handle that this effect is
91 * @note if it's not attached to any ScrollView then
92 * will return an uninitialized handle.
93 * @return The scrollView handle is returned.
95 Toolkit::ScrollView GetScrollView();
100 * A reference counted object may only be deleted by calling Unreference()
102 virtual ~ScrollViewEffect();
106 Toolkit::Internal::ScrollView *mScrollViewImpl; ///< Attached ScrollView instance (pointer to implementation)
110 } // namespace Internal
112 // Helpers for public-api forwarding methods
114 inline Internal::ScrollViewEffect& GetImpl(Dali::Toolkit::ScrollViewEffect& obj)
116 DALI_ASSERT_ALWAYS(obj);
118 Dali::RefObject& handle = obj.GetBaseObject();
120 return static_cast<Internal::ScrollViewEffect&>(handle);
123 inline const Internal::ScrollViewEffect& GetImpl(const Dali::Toolkit::ScrollViewEffect& obj)
125 DALI_ASSERT_ALWAYS(obj);
127 const Dali::RefObject& handle = obj.GetBaseObject();
129 return static_cast<const Internal::ScrollViewEffect&>(handle);
132 } // namespace Toolkit
136 #endif // __DALI_TOOLKIT_INTERNAL_SCROLL_VIEW_EFFECT_H__