1 #ifndef __DALI_TOOLKIT_INTERNAL_SCROLL_CONNECTOR_H__
2 #define __DALI_TOOLKIT_INTERNAL_SCROLL_CONNECTOR_H__
5 * Copyright (c) 2014 Samsung Electronics Co., Ltd.
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
11 * http://www.apache.org/licenses/LICENSE-2.0
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.
22 #include <dali/public-api/object/base-object.h>
23 #include <dali/public-api/signals/dali-signal.h>
26 #include <dali-toolkit/public-api/controls/scrollable/scroll-connector.h>
38 * @copydoc Toolkit::ScrollConnector
40 class ScrollConnector : public Dali::BaseObject
44 typedef Toolkit::ScrollConnector::DomainChangedSignalType DomainChangedSignalType;
45 typedef Toolkit::ScrollConnector::ScrollPositionChangedSignalType ScrollPositionChangedSignalType;
47 static const Property::Index SCROLL_POSITION;
48 static const Property::Index OVERSHOOT;
51 * Create a ScrollConnector.
52 * @return A newly allocated ScrollConnector.
54 static ScrollConnector* New();
57 * @copydoc Toolkit::ScrollConnector::SetScrollDomain()
59 void SetScrollDomain( float min, float max, float length );
62 * @copydoc Toolkit::ScrollConnector::GetMinLimit()
64 float GetMinLimit() const
70 * @copydoc Toolkit::ScrollConnector::GetMaxLimit()
72 float GetMaxLimit() const
78 * @copydoc Toolkit::ScrollConnector::GetContentLength()
80 float GetContentLength() const
82 return mContentLength;
86 * @copydoc Toolkit::ScrollConnector::SetScrollPosition()
88 void SetScrollPosition( float position );
91 * @copydoc Toolkit::ScrollConnector::GetScrollPosition()
93 float GetScrollPosition() const
95 return mScrollPositionObject.GetProperty<float>( Toolkit::ScrollConnector::SCROLL_POSITION );
99 * Signal emitted after the SetScrollPosition() method has been called.
101 ScrollPositionChangedSignalType& ScrollPositionChangedSignal()
103 return mScrollPositionChangedSignal;
107 * Signal emitted after the SetScrollDomain() method has been called.
109 DomainChangedSignalType& DomainChangedSignal()
111 return mDomainChangedSignal;
115 * Retrieve the object which provides the "scroll-position" property.
116 * @return The scroll-position object.
118 Handle GetScrollPositionObject() const
120 return mScrollPositionObject;
124 * Connects a callback function with the object's signals.
125 * @param[in] object The object providing the signal.
126 * @param[in] tracker Used to disconnect the signal.
127 * @param[in] signalName The signal to connect to.
128 * @param[in] functor A newly allocated FunctorDelegate.
129 * @return True if the signal was connected.
130 * @post If a signal was connected, ownership of functor was passed to CallbackBase. Otherwise the caller is responsible for deleting the unused functor.
132 static bool DoConnectSignal( BaseObject* object, ConnectionTrackerInterface* tracker, const std::string& signalName, FunctorDelegate* functor );
137 * Create a new ScrollConnector.
144 virtual ~ScrollConnector();
147 ScrollConnector(const ScrollConnector&);
150 ScrollConnector& operator=(const ScrollConnector& rhs);
154 Handle mScrollPositionObject;
156 DomainChangedSignalType mDomainChangedSignal;
157 ScrollPositionChangedSignalType mScrollPositionChangedSignal;
161 float mContentLength;
164 } // namespace Internal
166 inline Internal::ScrollConnector& GetImpl(Dali::Toolkit::ScrollConnector& obj)
168 DALI_ASSERT_ALWAYS(obj);
170 Dali::BaseObject& handle = obj.GetBaseObject();
172 return static_cast<Internal::ScrollConnector&>(handle);
175 inline const Internal::ScrollConnector& GetImpl(const Dali::Toolkit::ScrollConnector& obj)
177 DALI_ASSERT_ALWAYS(obj);
179 const Dali::BaseObject& handle = obj.GetBaseObject();
181 return static_cast<const Internal::ScrollConnector&>(handle);
184 } // namespace Toolkit
188 #endif // __DALI_TOOLKIT_INTERNAL_SCROLL_CONNECTOR_H__