Add 'ExclusiveArch: armv7l' limit build to arm architecture
[platform/core/uifw/dali-toolkit.git] / base / dali-toolkit / internal / controls / scroll-component / scroll-bar-internal-impl.h
1 #ifndef __DALI_TOOLKIT_INTERNAL_SCROLL_BAR_INTERNAL_H__
2 #define __DALI_TOOLKIT_INTERNAL_SCROLL_BAR_INTERNAL_H__
3
4 //
5 // Copyright (c) 2014 Samsung Electronics Co., Ltd.
6 //
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
10 //
11 //     http://floralicense.org/license/
12 //
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.
18 //
19
20 // INTERNAL INCLUDES
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>
24
25 namespace Dali
26 {
27
28 namespace Toolkit
29 {
30
31 namespace Internal
32 {
33
34 /**
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.
37  */
38 class ScrollBarInternal : public ScrollComponentImpl
39 {
40
41 public:
42
43   /**
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)
48    */
49   ScrollBarInternal(Toolkit::Scrollable& container, bool vertical);
50
51   /**
52    * Virtual destructor
53    */
54   virtual ~ScrollBarInternal();
55
56   /**
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.
62    */
63   static Toolkit::ScrollBarInternal New(Toolkit::Scrollable& container, bool vertical);
64
65   /**
66    * Show ScrollBarInternal
67    */
68   void Show();
69
70   /**
71    * Hide ScrollBarInternal
72    */
73   void Hide();
74
75 private:
76
77   /**
78    * @copydoc Toolkit::Control::OnInitialize()
79    */
80   virtual void OnInitialize();
81
82   /**
83    * @copydoc Toolkit::ScrollComponent::OnDisconnect()
84    */
85   virtual void OnDisconnect();
86
87   /**
88    * Called when scrollbar is dragged.
89    * @param[in] actor Actor under touch
90    * @param[in] gesture The pan gesture data.
91    */
92   void OnPanGesture(Actor actor, PanGesture gesture);
93
94   /**
95    * Called when scrolling starts (scroll bars should extend out)
96    * @param[in] position current scroll position.
97    */
98   void OnStarted(const Vector3& position);
99
100   /**
101    * Called when scrolling ends (scroll bars should contract)
102    * @param[in] position current scroll position.
103    */
104   void OnCompleted(const Vector3& position);
105
106   /**
107    * Called when timer is finished. This time guarantee contract animation time.
108    * @return Timer is used or not.
109    */
110   bool OnContractDelayExpired(void);
111
112   /**
113    * Create timer. This timer used for wating contract.
114    */
115   void CreateTimer();
116
117   /**
118    * Destruct timer.
119    */
120   void DestructTimer();
121
122   /**
123    * Wait ContractTime
124    */
125   void WaitingContractDelay();
126
127 private:
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.
140 };
141
142 } // namespace Internal
143
144 // Helpers for public-api forwarding methods
145
146 inline Toolkit::Internal::ScrollBarInternal& GetImpl(Toolkit::ScrollBarInternal& scrollBar)
147 {
148   DALI_ASSERT_ALWAYS(scrollBar);
149
150   Dali::RefObject& handle = scrollBar.GetImplementation();
151
152   return static_cast<Toolkit::Internal::ScrollBarInternal&>(handle);
153 }
154
155 inline const Toolkit::Internal::ScrollBarInternal& GetImpl(const Toolkit::ScrollBarInternal& scrollBar)
156 {
157   DALI_ASSERT_ALWAYS(scrollBar);
158
159   const Dali::RefObject& handle = scrollBar.GetImplementation();
160
161   return static_cast<const Toolkit::Internal::ScrollBarInternal&>(handle);
162 }
163
164 } // namespace Toolkit
165
166 } // namespace Dali
167
168 #endif // __DALI_TOOLKIT_INTERNAL_SCROLL_BAR_INTERNAL_H__