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/public-api/object/base-object.h>
23 #include <dali/public-api/signals/connection-tracker.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-effect.h>
42 class ScrollViewEffect;
45 * @copydoc Toolkit::ScrollViewEffect
47 class ScrollViewEffect : public Dali::BaseObject, public ConnectionTracker
55 * Attaches this effect to scrollView.
56 * @pre must not be already attached to a scrollView
57 * @note internally the scrollView effect holds a weak reference
59 * @param[in] scrollView The scrollView instance to attach to.
61 void Attach(Toolkit::ScrollView& scrollView);
64 * Attaches this effect to scrollView.
65 * @pre must not be already attached to a scrollView
66 * @param[in] scrollView The scrollView instance to attach to.
68 void Detach(Toolkit::ScrollView& scrollView);
73 * Called upon Attaching of effect to a scrollView instance.
75 * This will be called once.
77 * @param[in] scrollView The attached scrollView instance.
79 virtual void OnAttach(Toolkit::ScrollView& scrollView) = 0;
82 * Called upon Detaching of effect from a scrollView instance.
84 * This will be called once.
86 * @param[in] scrollView The attached scrollView instance.
88 virtual void OnDetach(Toolkit::ScrollView& scrollView) = 0;
93 * Returns the ScrollView handle that this effect is
95 * @note if it's not attached to any ScrollView then
96 * will return an uninitialized handle.
97 * @return The scrollView handle is returned.
99 Toolkit::ScrollView GetScrollView();
104 * A reference counted object may only be deleted by calling Unreference()
106 virtual ~ScrollViewEffect();
110 Toolkit::Internal::ScrollView *mScrollViewImpl; ///< Attached ScrollView instance (pointer to implementation)
114 } // namespace Internal
116 // Helpers for public-api forwarding methods
118 inline Internal::ScrollViewEffect& GetImpl(Dali::Toolkit::ScrollViewEffect& obj)
120 DALI_ASSERT_ALWAYS(obj);
122 Dali::RefObject& handle = obj.GetBaseObject();
124 return static_cast<Internal::ScrollViewEffect&>(handle);
127 inline const Internal::ScrollViewEffect& GetImpl(const Dali::Toolkit::ScrollViewEffect& obj)
129 DALI_ASSERT_ALWAYS(obj);
131 const Dali::RefObject& handle = obj.GetBaseObject();
133 return static_cast<const Internal::ScrollViewEffect&>(handle);
136 } // namespace Toolkit
140 #endif // __DALI_TOOLKIT_INTERNAL_SCROLL_VIEW_EFFECT_H__