659e67bdb73fa97b6ab69ddb493aeb5379a67dd0
[platform/core/uifw/dali-toolkit.git] / base / dali-toolkit / internal / controls / scrollable / scroll-connector-impl.cpp
1 /*
2  * Copyright (c) 2014 Samsung Electronics Co., Ltd.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16  */
17
18 // CLASS HEADER
19 #include <dali-toolkit/internal/controls/scrollable/scroll-connector-impl.h>
20
21 // EXTERNAL INCLUDES
22 #include <dali/integration-api/debug.h>
23
24 namespace Dali
25 {
26
27 namespace Toolkit
28 {
29
30 namespace Internal
31 {
32
33 const Property::Index ScrollConnector::SCROLL_POSITION = Dali::PROPERTY_CUSTOM_START_INDEX;
34 const Property::Index ScrollConnector::OVERSHOOT       = Dali::PROPERTY_CUSTOM_START_INDEX + 1;
35
36 ScrollConnector* ScrollConnector::New()
37 {
38   return new ScrollConnector();
39 }
40
41 void ScrollConnector::SetScrollDomain( float min, float max, float length )
42 {
43   mMinLimit = min;
44   mMaxLimit = max;
45   mContentLength = length;
46
47   mDomainChangedSignal.Emit( mMinLimit, mMaxLimit, mContentLength );
48 }
49
50 ScrollConnector::ScrollConnector()
51 : mMinLimit( 0.0f ),
52   mMaxLimit( 0.0f ),
53   mContentLength( 0.0f )
54 {
55   mScrollPositionObject = Constrainable::New();
56
57   mScrollPositionObject.RegisterProperty( Toolkit::ScrollConnector::SCROLL_POSITION_PROPERTY_NAME, 0.0f );
58   mScrollPositionObject.RegisterProperty( Toolkit::ScrollConnector::OVERSHOOT_PROPERTY_NAME, 0.0f );
59 }
60
61 ScrollConnector::~ScrollConnector()
62 {
63 }
64
65 } // namespace Internal
66
67 } // namespace Toolkit
68
69 } // namespace Dali