1 #ifndef DALI_TOOLKIT_INTERNAL_SCROLL_VIEW_EFFECT_H
2 #define DALI_TOOLKIT_INTERNAL_SCROLL_VIEW_EFFECT_H
5 * Copyright (c) 2021 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-effect.h>
27 #include <dali-toolkit/public-api/controls/scrollable/scroll-view/scroll-view.h>
39 class ScrollViewEffect;
42 * @copydoc Toolkit::ScrollViewEffect
44 class ScrollViewEffect : public Dali::BaseObject, public ConnectionTracker
50 * Attaches this effect to scrollView.
51 * @pre must not be already attached to a scrollView
52 * @note internally the scrollView effect holds a weak reference
54 * @param[in] scrollView The scrollView instance to attach to.
56 void Attach(Toolkit::ScrollView& scrollView);
59 * Attaches this effect to scrollView.
60 * @pre must not be already attached to a scrollView
61 * @param[in] scrollView The scrollView instance to attach to.
63 void Detach(Toolkit::ScrollView& scrollView);
67 * Called upon Attaching of effect to a scrollView instance.
69 * This will be called once.
71 * @param[in] scrollView The attached scrollView instance.
73 virtual void OnAttach(Toolkit::ScrollView& scrollView) = 0;
76 * Called upon Detaching of effect from a scrollView instance.
78 * This will be called once.
80 * @param[in] scrollView The attached scrollView instance.
82 virtual void OnDetach(Toolkit::ScrollView& scrollView) = 0;
86 * Returns the ScrollView handle that this effect is
88 * @note if it's not attached to any ScrollView then
89 * will return an uninitialized handle.
90 * @return The scrollView handle is returned.
92 Toolkit::ScrollView GetScrollView();
96 * A reference counted object may only be deleted by calling Unreference()
98 virtual ~ScrollViewEffect();
101 Toolkit::Internal::ScrollView* mScrollViewImpl; ///< Attached ScrollView instance (pointer to implementation)
104 } // namespace Internal
106 // Helpers for public-api forwarding methods
108 inline Internal::ScrollViewEffect& GetImpl(Dali::Toolkit::ScrollViewEffect& obj)
110 DALI_ASSERT_ALWAYS(obj);
112 Dali::RefObject& handle = obj.GetBaseObject();
114 return static_cast<Internal::ScrollViewEffect&>(handle);
117 inline const Internal::ScrollViewEffect& GetImpl(const Dali::Toolkit::ScrollViewEffect& obj)
119 DALI_ASSERT_ALWAYS(obj);
121 const Dali::RefObject& handle = obj.GetBaseObject();
123 return static_cast<const Internal::ScrollViewEffect&>(handle);
126 } // namespace Toolkit
130 #endif // DALI_TOOLKIT_INTERNAL_SCROLL_VIEW_EFFECT_H