Split dali-toolkit into Base & Optional
[platform/core/uifw/dali-toolkit.git] / base / 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::DomainChangedSignalType DomainChangedSignalType;
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::SetScrollDomain()
52    */
53   void SetScrollDomain( float min, float max, float length );
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    * @copydoc Toolkit::ScrollConnector::GetContentLength()
73    */
74   float GetContentLength() const
75   {
76     return mContentLength;
77   }
78
79   /**
80    * Signal emitted after the SetScrollDomain() method has been called.
81    */
82   DomainChangedSignalType& DomainChangedSignal()
83   {
84     return mDomainChangedSignal;
85   }
86
87   /**
88    * Retrieve the object which provides the "scroll-position" property.
89    * @return The scroll-position object.
90    */
91   Constrainable GetScrollPositionObject() const
92   {
93     return mScrollPositionObject;
94   }
95
96 private:
97
98   /**
99    * Create a new ScrollConnector.
100    */
101   ScrollConnector();
102
103   /**
104    * Virtual destructor
105    */
106   virtual ~ScrollConnector();
107
108   // Undefined
109   ScrollConnector(const ScrollConnector&);
110
111   // Undefined
112   ScrollConnector& operator=(const ScrollConnector& rhs);
113
114 private:
115
116   Constrainable mScrollPositionObject;
117
118   DomainChangedSignalType mDomainChangedSignal;
119
120   float mMinLimit;
121   float mMaxLimit;
122   float mContentLength;
123 };
124
125 } // namespace Internal
126
127 inline Internal::ScrollConnector& GetImpl(Dali::Toolkit::ScrollConnector& obj)
128 {
129   DALI_ASSERT_ALWAYS(obj);
130
131   Dali::BaseObject& handle = obj.GetBaseObject();
132
133   return static_cast<Internal::ScrollConnector&>(handle);
134 }
135
136 inline const Internal::ScrollConnector& GetImpl(const Dali::Toolkit::ScrollConnector& obj)
137 {
138   DALI_ASSERT_ALWAYS(obj);
139
140   const Dali::BaseObject& handle = obj.GetBaseObject();
141
142   return static_cast<const Internal::ScrollConnector&>(handle);
143 }
144
145 } // namespace Toolkit
146
147 } // namespace Dali
148
149 #endif // __DALI_TOOLKIT_INTERNAL_SCROLL_CONNECTOR_H__