Provide object to connect scrollable containers & scroll-bars etc.
[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
43   /**
44    * Create a ScrollConnector.
45    * @return A newly allocated ScrollConnector.
46    */
47   static ScrollConnector* New();
48
49   /**
50    * @copydoc Toolkit::ScrollConnector::SetLimits()
51    */
52   void SetLimits( float min, float max );
53
54   /**
55    * @copydoc Toolkit::ScrollConnector::GetMinLimit()
56    */
57   float GetMinLimit() const
58   {
59     return mMinLimit;
60   }
61
62   /**
63    * @copydoc Toolkit::ScrollConnector::GetMaxLimit()
64    */
65   float GetMaxLimit() const
66   {
67     return mMaxLimit;
68   }
69
70   /**
71    * Signal emitted after the SetLimits() method has been called.
72    */
73   LimitsChangedSignalType& LimitsChangedSignal()
74   {
75     return mLimitsChangedSignal;
76   }
77
78   /**
79    * Retrieve the object which provides the "scroll-position" property.
80    * @return The scroll-position object.
81    */
82   Constrainable GetScrollPositionObject() const
83   {
84     return mScrollPositionObject;
85   }
86
87 private:
88
89   /**
90    * Create a new ScrollConnector.
91    */
92   ScrollConnector();
93
94   /**
95    * Virtual destructor
96    */
97   virtual ~ScrollConnector();
98
99   // Undefined
100   ScrollConnector(const ScrollConnector&);
101
102   // Undefined
103   ScrollConnector& operator=(const ScrollConnector& rhs);
104
105 private:
106
107   Constrainable mScrollPositionObject;
108
109   LimitsChangedSignalType mLimitsChangedSignal;
110
111   float mMinLimit;
112   float mMaxLimit;
113 };
114
115 } // namespace Internal
116
117 inline Internal::ScrollConnector& GetImpl(Dali::Toolkit::ScrollConnector& obj)
118 {
119   DALI_ASSERT_ALWAYS(obj);
120
121   Dali::BaseObject& handle = obj.GetBaseObject();
122
123   return static_cast<Internal::ScrollConnector&>(handle);
124 }
125
126 inline const Internal::ScrollConnector& GetImpl(const Dali::Toolkit::ScrollConnector& obj)
127 {
128   DALI_ASSERT_ALWAYS(obj);
129
130   const Dali::BaseObject& handle = obj.GetBaseObject();
131
132   return static_cast<const Internal::ScrollConnector&>(handle);
133 }
134
135 } // namespace Toolkit
136
137 } // namespace Dali
138
139 #endif // __DALI_TOOLKIT_INTERNAL_SCROLL_CONNECTOR_H__