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 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/dali.h>
23 #include <dali-toolkit/public-api/controls/scrollable/scroll-view/scroll-view.h>
24 #include <dali-toolkit/public-api/controls/scrollable/scroll-view/scroll-view-effect.h>
39 class ScrollViewEffect;
42 * @copydoc Toolkit::ScrollViewEffect
44 class ScrollViewEffect : public Dali::BaseObject, public ConnectionTracker
52 * Attaches this effect to scrollView.
53 * @pre must not be already attached to a scrollView
54 * @note internally the scrollView effect holds a weak reference
56 * @param[in] scrollView The scrollView instance to attach to.
58 void Attach(Toolkit::ScrollView& scrollView);
61 * Attaches this effect to scrollView.
62 * @pre must not be already attached to a scrollView
63 * @param[in] scrollView The scrollView instance to attach to.
65 void Detach(Toolkit::ScrollView& scrollView);
70 * Called upon Attaching of effect to a scrollView instance.
72 * This will be called once.
74 * @param[in] scrollView The attached scrollView instance.
76 virtual void OnAttach(Toolkit::ScrollView& scrollView) = 0;
79 * Called upon Detaching of effect from a scrollView instance.
81 * This will be called once.
83 * @param[in] scrollView The attached scrollView instance.
85 virtual void OnDetach(Toolkit::ScrollView& scrollView) = 0;
90 * Returns the ScrollView handle that this effect is
92 * @note if it's not attached to any ScrollView then
93 * will return an uninitialized handle.
94 * @return The scrollView handle is returned.
96 Toolkit::ScrollView GetScrollView();
101 * A reference counted object may only be deleted by calling Unreference()
103 virtual ~ScrollViewEffect();
107 Toolkit::Internal::ScrollView *mScrollViewImpl; ///< Attached ScrollView instance (pointer to implementation)
111 } // namespace Internal
113 // Helpers for public-api forwarding methods
115 inline Internal::ScrollViewEffect& GetImpl(Dali::Toolkit::ScrollViewEffect& obj)
117 DALI_ASSERT_ALWAYS(obj);
119 Dali::RefObject& handle = obj.GetBaseObject();
121 return static_cast<Internal::ScrollViewEffect&>(handle);
124 inline const Internal::ScrollViewEffect& GetImpl(const Dali::Toolkit::ScrollViewEffect& obj)
126 DALI_ASSERT_ALWAYS(obj);
128 const Dali::RefObject& handle = obj.GetBaseObject();
130 return static_cast<const Internal::ScrollViewEffect&>(handle);
133 } // namespace Toolkit
137 #endif // __DALI_TOOLKIT_INTERNAL_SCROLL_VIEW_EFFECT_H__