1 #ifndef __DALI_TOOLKIT_INTERNAL_SCROLL_BAR_INTERNAL_H__
2 #define __DALI_TOOLKIT_INTERNAL_SCROLL_BAR_INTERNAL_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-toolkit/public-api/controls/scrollable/scroll-component-impl.h>
22 #include <dali-toolkit/internal/controls/scrollable/scrollable-impl.h>
23 #include <dali-toolkit/internal/controls/scroll-component/scroll-bar-internal.h>
35 * ScrollBarInternal is a UI component that can be added to the sides of the ScrollView
36 * indicating the current scroll position within the domain.
38 class ScrollBarInternal : public ScrollComponentImpl
44 * ScrollBarInternal constructor.
45 * @param[in] container Reference to the container of scroll bar
46 * @param[in] vertical Whether ScrollBarInternal should be oriented vertically (true)
47 * or horizontally (false)
49 ScrollBarInternal(Toolkit::Scrollable& container, bool vertical);
54 virtual ~ScrollBarInternal();
57 * Create an initialized ScrollBarInternal
58 * @param[in] container Reference to the container of scroll bar
59 * @param[in] vertical Whether ScrollBarInternal should be oriented vertically (true)
60 * or horizontally (false)
61 * @return A pointer to the created ScrollBarInternal.
63 static Toolkit::ScrollBarInternal New(Toolkit::Scrollable& container, bool vertical);
66 * Show ScrollBarInternal
71 * Hide ScrollBarInternal
78 * @copydoc Toolkit::Control::OnInitialize()
80 virtual void OnInitialize();
83 * @copydoc Toolkit::ScrollComponent::OnDisconnect()
85 virtual void OnDisconnect();
88 * Called when scrollbar is dragged.
89 * @param[in] actor Actor under touch
90 * @param[in] gesture The pan gesture data.
92 void OnPanGesture(Actor actor, PanGesture gesture);
95 * Called when scrolling starts (scroll bars should extend out)
96 * @param[in] position current scroll position.
98 void OnStarted(const Vector3& position);
101 * Called when scrolling ends (scroll bars should contract)
102 * @param[in] position current scroll position.
104 void OnCompleted(const Vector3& position);
107 * Called when timer is finished. This time guarantee contract animation time.
108 * @return Timer is used or not.
110 bool OnContractDelayExpired(void);
113 * Create timer. This timer used for wating contract.
120 void DestructTimer();
125 void WaitingContractDelay();
128 Scrollable& mContainer; ///< Container of scroll bar
129 ImageActor mSlider; ///< Scroll Slider.
130 ImageActor mSliderWrap; ///< Scroll Slider (wrapped view).
131 Actor mHitArea; ///< Hit Area for dragging scroll slider.
132 PanGestureDetector mPanGesture; ///< Pan Gesture detector for dragging scrollbar.
133 Animation mAnimation; ///< Scroll Contract/Expand Animation.
134 bool mVertical; ///< Scroll Axis (Vertical or Horizontal)
135 Vector3 mAxisMask; ///< Scroll Axis mask (Vector3::YAXIS for vert. or Vector3::XAXIS for horiz.)
136 Vector3 mScrollStart; ///< Scroll Start position (start of drag)
137 Vector3 mGestureDisplacement; ///< Gesture Displacement.
138 bool mDragMode; ///< Flag indicating whether currently dragging or not.
139 Timer mTimer; ///< Timer guarantee contract delay time.
142 } // namespace Internal
144 // Helpers for public-api forwarding methods
146 inline Toolkit::Internal::ScrollBarInternal& GetImpl(Toolkit::ScrollBarInternal& scrollBar)
148 DALI_ASSERT_ALWAYS(scrollBar);
150 Dali::RefObject& handle = scrollBar.GetImplementation();
152 return static_cast<Toolkit::Internal::ScrollBarInternal&>(handle);
155 inline const Toolkit::Internal::ScrollBarInternal& GetImpl(const Toolkit::ScrollBarInternal& scrollBar)
157 DALI_ASSERT_ALWAYS(scrollBar);
159 const Dali::RefObject& handle = scrollBar.GetImplementation();
161 return static_cast<const Toolkit::Internal::ScrollBarInternal&>(handle);
164 } // namespace Toolkit
168 #endif // __DALI_TOOLKIT_INTERNAL_SCROLL_BAR_INTERNAL_H__