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 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-toolkit/public-api/controls/scrollable/scroll-component-impl.h>
23 #include <dali-toolkit/internal/controls/scrollable/scrollable-impl.h>
24 #include <dali-toolkit/internal/controls/scroll-component/scroll-bar-internal.h>
36 * ScrollBarInternal is a UI component that can be added to the sides of the ScrollView
37 * indicating the current scroll position within the domain.
39 class ScrollBarInternal : public ScrollComponentImpl
45 * ScrollBarInternal constructor.
46 * @param[in] container Reference to the container of scroll bar
47 * @param[in] vertical Whether ScrollBarInternal should be oriented vertically (true)
48 * or horizontally (false)
50 ScrollBarInternal(Toolkit::Scrollable& container, bool vertical);
55 virtual ~ScrollBarInternal();
58 * Create an initialized ScrollBarInternal
59 * @param[in] container Reference to the container of scroll bar
60 * @param[in] vertical Whether ScrollBarInternal should be oriented vertically (true)
61 * or horizontally (false)
62 * @return A pointer to the created ScrollBarInternal.
64 static Toolkit::ScrollBarInternal New(Toolkit::Scrollable& container, bool vertical);
67 * Show ScrollBarInternal
72 * Hide ScrollBarInternal
79 * @copydoc Toolkit::Control::OnInitialize()
81 virtual void OnInitialize();
84 * @copydoc Toolkit::ScrollComponent::OnDisconnect()
86 virtual void OnDisconnect();
89 * Called when scrollbar is dragged.
90 * @param[in] actor Actor under touch
91 * @param[in] gesture The pan gesture data.
93 void OnPanGesture(Actor actor, PanGesture gesture);
96 * Called when scrolling starts (scroll bars should extend out)
97 * @param[in] position current scroll position.
99 void OnStarted(const Vector3& position);
102 * Called when scrolling ends (scroll bars should contract)
103 * @param[in] position current scroll position.
105 void OnCompleted(const Vector3& position);
108 * Called when timer is finished. This time guarantee contract animation time.
109 * @return Timer is used or not.
111 bool OnContractDelayExpired(void);
114 * Create timer. This timer used for wating contract.
121 void DestructTimer();
126 void WaitingContractDelay();
129 Scrollable& mContainer; ///< Container of scroll bar
130 ImageActor mSlider; ///< Scroll Slider.
131 ImageActor mSliderWrap; ///< Scroll Slider (wrapped view).
132 Actor mHitArea; ///< Hit Area for dragging scroll slider.
133 PanGestureDetector mPanGesture; ///< Pan Gesture detector for dragging scrollbar.
134 Animation mAnimation; ///< Scroll Contract/Expand Animation.
135 bool mVertical; ///< Scroll Axis (Vertical or Horizontal)
136 Vector3 mAxisMask; ///< Scroll Axis mask (Vector3::YAXIS for vert. or Vector3::XAXIS for horiz.)
137 Vector3 mScrollStart; ///< Scroll Start position (start of drag)
138 Vector3 mGestureDisplacement; ///< Gesture Displacement.
139 bool mDragMode; ///< Flag indicating whether currently dragging or not.
140 Timer mTimer; ///< Timer guarantee contract delay time.
143 } // namespace Internal
145 // Helpers for public-api forwarding methods
147 inline Toolkit::Internal::ScrollBarInternal& GetImpl(Toolkit::ScrollBarInternal& scrollBar)
149 DALI_ASSERT_ALWAYS(scrollBar);
151 Dali::RefObject& handle = scrollBar.GetImplementation();
153 return static_cast<Toolkit::Internal::ScrollBarInternal&>(handle);
156 inline const Toolkit::Internal::ScrollBarInternal& GetImpl(const Toolkit::ScrollBarInternal& scrollBar)
158 DALI_ASSERT_ALWAYS(scrollBar);
160 const Dali::RefObject& handle = scrollBar.GetImplementation();
162 return static_cast<const Toolkit::Internal::ScrollBarInternal&>(handle);
165 } // namespace Toolkit
169 #endif // __DALI_TOOLKIT_INTERNAL_SCROLL_BAR_INTERNAL_H__