45616f4395d49aa00d494010ade5b4249eb7ef7a
[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 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
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
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
21 // INTERNAL INCLUDES
22 #include <dali-toolkit/public-api/controls/scrollable/scroll-connector.h>
23
24 namespace Dali
25 {
26
27 namespace Toolkit
28 {
29
30 namespace Internal
31 {
32
33 /**
34  * @copydoc Toolkit::ScrollConnector
35  */
36 class ScrollConnector : public Dali::BaseObject
37 {
38 public:
39
40   typedef Toolkit::ScrollConnector::DomainChangedSignalType DomainChangedSignalType;
41
42   static const Property::Index SCROLL_POSITION;
43   static const Property::Index OVERSHOOT;
44
45   /**
46    * Create a ScrollConnector.
47    * @return A newly allocated ScrollConnector.
48    */
49   static ScrollConnector* New();
50
51   /**
52    * @copydoc Toolkit::ScrollConnector::SetScrollDomain()
53    */
54   void SetScrollDomain( float min, float max, float length );
55
56   /**
57    * @copydoc Toolkit::ScrollConnector::GetMinLimit()
58    */
59   float GetMinLimit() const
60   {
61     return mMinLimit;
62   }
63
64   /**
65    * @copydoc Toolkit::ScrollConnector::GetMaxLimit()
66    */
67   float GetMaxLimit() const
68   {
69     return mMaxLimit;
70   }
71
72   /**
73    * @copydoc Toolkit::ScrollConnector::GetContentLength()
74    */
75   float GetContentLength() const
76   {
77     return mContentLength;
78   }
79
80   /**
81    * Signal emitted after the SetScrollDomain() method has been called.
82    */
83   DomainChangedSignalType& DomainChangedSignal()
84   {
85     return mDomainChangedSignal;
86   }
87
88   /**
89    * Retrieve the object which provides the "scroll-position" property.
90    * @return The scroll-position object.
91    */
92   Constrainable GetScrollPositionObject() const
93   {
94     return mScrollPositionObject;
95   }
96
97 private:
98
99   /**
100    * Create a new ScrollConnector.
101    */
102   ScrollConnector();
103
104   /**
105    * Virtual destructor
106    */
107   virtual ~ScrollConnector();
108
109   // Undefined
110   ScrollConnector(const ScrollConnector&);
111
112   // Undefined
113   ScrollConnector& operator=(const ScrollConnector& rhs);
114
115 private:
116
117   Constrainable mScrollPositionObject;
118
119   DomainChangedSignalType mDomainChangedSignal;
120
121   float mMinLimit;
122   float mMaxLimit;
123   float mContentLength;
124 };
125
126 } // namespace Internal
127
128 inline Internal::ScrollConnector& GetImpl(Dali::Toolkit::ScrollConnector& obj)
129 {
130   DALI_ASSERT_ALWAYS(obj);
131
132   Dali::BaseObject& handle = obj.GetBaseObject();
133
134   return static_cast<Internal::ScrollConnector&>(handle);
135 }
136
137 inline const Internal::ScrollConnector& GetImpl(const Dali::Toolkit::ScrollConnector& obj)
138 {
139   DALI_ASSERT_ALWAYS(obj);
140
141   const Dali::BaseObject& handle = obj.GetBaseObject();
142
143   return static_cast<const Internal::ScrollConnector&>(handle);
144 }
145
146 } // namespace Toolkit
147
148 } // namespace Dali
149
150 #endif // __DALI_TOOLKIT_INTERNAL_SCROLL_CONNECTOR_H__