Implemented scroll bar control
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / internal / controls / scroll-component / scroll-component-impl.cpp
1 //
2 // Copyright (c) 2014 Samsung Electronics Co., Ltd.
3 //
4 // Licensed under the Flora License, Version 1.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://floralicense.org/license/
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 // CLASS HEADER
18 #include <dali-toolkit/internal/controls/scroll-component/scroll-component-impl.h>
19 #include <dali-toolkit/internal/controls/scroll-component/scroll-bar-internal.h>
20
21 namespace Dali
22 {
23
24 namespace Toolkit
25 {
26
27 namespace Internal
28 {
29
30 namespace
31 {
32 BaseHandle Create()
33 {
34   // empty handle as we cannot create ScrollComponent
35   return Toolkit::ScrollComponent::New();
36 }
37
38 TypeRegistration mType( typeid(Toolkit::ScrollComponent), typeid(Toolkit::Control), Create );
39
40 }
41
42 ScrollComponent::ScrollComponent()
43 : ControlImpl(true/*requires touch*/)
44 {
45
46 }
47
48 ScrollComponent::~ScrollComponent()
49 {
50 }
51
52 Toolkit::ScrollComponent ScrollComponent::New(Toolkit::Scrollable& scrollable, Toolkit::Scrollable::ScrollComponentType type)
53 {
54   Toolkit::ScrollComponent instance;
55
56   switch(type)
57   {
58     case Toolkit::Scrollable::VerticalScrollBar:
59     {
60       instance = static_cast<Toolkit::ScrollComponent>(Toolkit::ScrollBarInternal::New(scrollable, true));
61       break;
62     }
63     case Toolkit::Scrollable::HorizontalScrollBar:
64     {
65       instance = static_cast<Toolkit::ScrollComponent>(Toolkit::ScrollBarInternal::New(scrollable, false));
66       break;
67     }
68     default:
69     {
70       DALI_ASSERT_ALWAYS(true && "Unrecognized component type");
71     }
72   }
73
74   return instance;
75 }
76
77
78 } // namespace Internal
79
80 } // namespace Toolkit
81
82 } // namespace Dali