Revert to tizen branch.
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / public-api / controls / control.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/public-api/controls/control.h>
20
21 // INTERNAL INCLUDES
22 #include <dali-toolkit/public-api/controls/control-impl.h>
23
24 namespace Dali
25 {
26
27 namespace Toolkit
28 {
29
30 Control Control::New()
31 {
32   return Internal::Control::New();
33 }
34
35 Control::Control()
36 {
37 }
38
39 Control::Control(const Control& uiControl)
40 : CustomActor( uiControl ? static_cast< const Internal::Control& >( uiControl.GetImplementation() ).GetOwner() : NULL)
41 {
42 }
43
44 Control::~Control()
45 {
46 }
47
48 Control& Control::operator=( const Control& handle )
49 {
50   if( &handle != this )
51   {
52     CustomActor::operator=( handle );
53   }
54   return *this;
55 }
56
57 Control Control::DownCast( BaseHandle handle )
58 {
59   return DownCast< Control, Internal::Control >(handle);
60 }
61
62 Internal::Control& Control::GetImplementation()
63 {
64   return static_cast<Internal::Control&>(CustomActor::GetImplementation());
65 }
66
67 const Internal::Control& Control::GetImplementation() const
68 {
69   return static_cast<const Internal::Control&>(CustomActor::GetImplementation());
70 }
71
72 void Control::SetKeyInputFocus()
73 {
74   GetImplementation().SetKeyInputFocus();
75 }
76
77 bool Control::HasKeyInputFocus()
78 {
79   return GetImplementation().HasKeyInputFocus();
80 }
81
82 void Control::ClearKeyInputFocus()
83 {
84   GetImplementation().ClearKeyInputFocus();
85 }
86
87 PinchGestureDetector Control::GetPinchGestureDetector() const
88 {
89   return GetImplementation().GetPinchGestureDetector();
90 }
91
92 PanGestureDetector Control::GetPanGestureDetector() const
93 {
94   return GetImplementation().GetPanGestureDetector();
95 }
96
97 TapGestureDetector Control::GetTapGestureDetector() const
98 {
99   return GetImplementation().GetTapGestureDetector();
100 }
101
102 LongPressGestureDetector Control::GetLongPressGestureDetector() const
103 {
104   return GetImplementation().GetLongPressGestureDetector();
105 }
106
107 void Control::SetStyleName( const std::string& styleName )
108 {
109   GetImplementation().SetStyleName( styleName );
110 }
111
112 const std::string& Control::GetStyleName() const
113 {
114   return GetImplementation().GetStyleName();
115 }
116
117 void Control::SetBackgroundColor( const Vector4& color )
118 {
119   GetImplementation().SetBackgroundColor( color );
120 }
121
122 Vector4 Control::GetBackgroundColor() const
123 {
124   return GetImplementation().GetBackgroundColor();
125 }
126
127 void Control::SetBackgroundImage( Image image )
128 {
129   GetImplementation().SetBackgroundImage( image );
130 }
131
132 void Control::ClearBackground()
133 {
134   GetImplementation().ClearBackground();
135 }
136
137 Actor Control::GetBackgroundActor() const
138 {
139   return GetImplementation().GetBackgroundActor();
140 }
141
142 Control::KeyEventSignalType& Control::KeyEventSignal()
143 {
144   return GetImplementation().KeyEventSignal();
145 }
146
147 Control::Control(Internal::Control& implementation)
148 : CustomActor(implementation)
149 {
150 }
151
152 Control::Control(Dali::Internal::CustomActor* internal)
153 : CustomActor(internal)
154 {
155   VerifyCustomActorPointer<Internal::Control>(internal);
156 }
157
158 } // namespace Toolkit
159
160 } // namespace Dali