Allow overshoot indicators to be implemented outside of ItemView
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / internal / controls / scrollable / scroll-connector-impl.h
1 #ifndef __DALI_TOOLKIT_INTERNAL_SCROLL_CONNECTOR_H__
2 #define __DALI_TOOLKIT_INTERNAL_SCROLL_CONNECTOR_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-connector.h>
22
23 namespace Dali
24 {
25
26 namespace Toolkit
27 {
28
29 namespace Internal
30 {
31
32 /**
33  * @copydoc Toolkit::ScrollConnector
34  */
35 class ScrollConnector : public Dali::BaseObject
36 {
37 public:
38
39   typedef Toolkit::ScrollConnector::LimitsChangedSignalType LimitsChangedSignalType;
40
41   static const Property::Index SCROLL_POSITION;
42   static const Property::Index OVERSHOOT;
43
44   /**
45    * Create a ScrollConnector.
46    * @return A newly allocated ScrollConnector.
47    */
48   static ScrollConnector* New();
49
50   /**
51    * @copydoc Toolkit::ScrollConnector::SetLimits()
52    */
53   void SetLimits( float min, float max );
54
55   /**
56    * @copydoc Toolkit::ScrollConnector::GetMinLimit()
57    */
58   float GetMinLimit() const
59   {
60     return mMinLimit;
61   }
62
63   /**
64    * @copydoc Toolkit::ScrollConnector::GetMaxLimit()
65    */
66   float GetMaxLimit() const
67   {
68     return mMaxLimit;
69   }
70
71   /**
72    * Signal emitted after the SetLimits() method has been called.
73    */
74   LimitsChangedSignalType& LimitsChangedSignal()
75   {
76     return mLimitsChangedSignal;
77   }
78
79   /**
80    * Retrieve the object which provides the "scroll-position" property.
81    * @return The scroll-position object.
82    */
83   Constrainable GetScrollPositionObject() const
84   {
85     return mScrollPositionObject;
86   }
87
88 private:
89
90   /**
91    * Create a new ScrollConnector.
92    */
93   ScrollConnector();
94
95   /**
96    * Virtual destructor
97    */
98   virtual ~ScrollConnector();
99
100   // Undefined
101   ScrollConnector(const ScrollConnector&);
102
103   // Undefined
104   ScrollConnector& operator=(const ScrollConnector& rhs);
105
106 private:
107
108   Constrainable mScrollPositionObject;
109
110   LimitsChangedSignalType mLimitsChangedSignal;
111
112   float mMinLimit;
113   float mMaxLimit;
114 };
115
116 } // namespace Internal
117
118 inline Internal::ScrollConnector& GetImpl(Dali::Toolkit::ScrollConnector& obj)
119 {
120   DALI_ASSERT_ALWAYS(obj);
121
122   Dali::BaseObject& handle = obj.GetBaseObject();
123
124   return static_cast<Internal::ScrollConnector&>(handle);
125 }
126
127 inline const Internal::ScrollConnector& GetImpl(const Dali::Toolkit::ScrollConnector& obj)
128 {
129   DALI_ASSERT_ALWAYS(obj);
130
131   const Dali::BaseObject& handle = obj.GetBaseObject();
132
133   return static_cast<const Internal::ScrollConnector&>(handle);
134 }
135
136 } // namespace Toolkit
137
138 } // namespace Dali
139
140 #endif // __DALI_TOOLKIT_INTERNAL_SCROLL_CONNECTOR_H__