Remove deprecated SetRemoveTime API
[platform/core/uifw/dali-toolkit.git] / base / dali-toolkit / public-api / focus-manager / focus-manager.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
20 #include <dali-toolkit/public-api/focus-manager/focus-manager.h>
21
22 // EXTERNAL INCLUDES
23
24 // INTERNAL INCLUDES
25
26 #include <dali-toolkit/internal/focus-manager/focus-manager-impl.h>
27
28 namespace Dali
29 {
30
31 namespace Toolkit
32 {
33
34 const char* const FocusManager::SIGNAL_FOCUS_CHANGED = "focus-changed";
35 const char* const FocusManager::SIGNAL_FOCUS_OVERSHOT = "focus-overshot";
36 const char* const FocusManager::SIGNAL_FOCUSED_ACTOR_ACTIVATED = "focused-actor-activated";
37
38 FocusManager::FocusManager()
39 {
40 }
41
42 FocusManager::~FocusManager()
43 {
44 }
45
46 FocusManager FocusManager::Get()
47 {
48   FocusManager manager;
49
50   // Check whether the focus manager is already created
51   SingletonService singletonService( SingletonService::Get() );
52   if ( singletonService )
53   {
54     Dali::BaseHandle handle = singletonService.GetSingleton(typeid(FocusManager));
55     if(handle)
56     {
57       // If so, downcast the handle of singleton to focus manager
58       manager = FocusManager(dynamic_cast<Internal::FocusManager*>(handle.GetObjectPtr()));
59     }
60
61     if(!manager)
62     {
63       // If not, create the focus manager and register it as a singleton
64       manager = FocusManager(new Internal::FocusManager());
65       singletonService.Register(typeid(manager), manager);
66     }
67   }
68
69   return manager;
70 }
71
72 FocusManager::FocusManager(Internal::FocusManager *impl)
73   : BaseHandle(impl)
74 {
75 }
76
77 void FocusManager::SetAccessibilityAttribute(Actor actor, AccessibilityAttribute type, const std::string& text)
78 {
79   GetImpl(*this).SetAccessibilityAttribute(actor, type, text);
80 }
81
82 std::string FocusManager::GetAccessibilityAttribute(Actor actor, AccessibilityAttribute type) const
83 {
84   return GetImpl(*this).GetAccessibilityAttribute(actor, type);
85 }
86
87 void FocusManager::SetFocusOrder(Actor actor, const unsigned int order)
88 {
89   GetImpl(*this).SetFocusOrder(actor, order);
90 }
91
92 unsigned int FocusManager::GetFocusOrder(Actor actor) const
93 {
94   return GetImpl(*this).GetFocusOrder(actor);
95 }
96
97 unsigned int FocusManager::GenerateNewFocusOrder() const
98 {
99   return GetImpl(*this).GenerateNewFocusOrder();
100 }
101
102 Actor FocusManager::GetActorByFocusOrder(const unsigned int order)
103 {
104   return GetImpl(*this).GetActorByFocusOrder(order);
105 }
106
107 bool FocusManager::SetCurrentFocusActor(Actor actor)
108 {
109   return GetImpl(*this).SetCurrentFocusActor(actor);
110 }
111
112 Actor FocusManager::GetCurrentFocusActor()
113 {
114   return GetImpl(*this).GetCurrentFocusActor();
115 }
116
117 Actor FocusManager::GetCurrentFocusGroup()
118 {
119   return GetImpl(*this).GetCurrentFocusGroup();
120 }
121
122 unsigned int FocusManager::GetCurrentFocusOrder()
123 {
124   return GetImpl(*this).GetCurrentFocusOrder();
125 }
126
127 bool FocusManager::MoveFocusForward()
128 {
129   return GetImpl(*this).MoveFocusForward();
130 }
131
132 bool FocusManager::MoveFocusBackward()
133 {
134   return GetImpl(*this).MoveFocusBackward();
135 }
136
137 void FocusManager::ClearFocus()
138 {
139   GetImpl(*this).ClearFocus();
140 }
141
142 void FocusManager::Reset()
143 {
144   GetImpl(*this).Reset();
145 }
146
147 void FocusManager::SetFocusGroup(Actor actor, bool isFocusGroup)
148 {
149   GetImpl(*this).SetFocusGroup(actor, isFocusGroup);
150 }
151
152 bool FocusManager::IsFocusGroup(Actor actor) const
153 {
154   return GetImpl(*this).IsFocusGroup(actor);
155 }
156
157 void FocusManager::SetGroupMode(bool enabled)
158 {
159   GetImpl(*this).SetGroupMode(enabled);
160 }
161
162 bool FocusManager::GetGroupMode() const
163 {
164   return GetImpl(*this).GetGroupMode();
165 }
166
167 void FocusManager::SetWrapMode(bool wrapped)
168 {
169   GetImpl(*this).SetWrapMode(wrapped);
170 }
171
172 bool FocusManager::GetWrapMode() const
173 {
174   return GetImpl(*this).GetWrapMode();
175 }
176
177 void FocusManager::SetFocusIndicatorActor(Actor indicator)
178 {
179   GetImpl(*this).SetFocusIndicatorActor(indicator);
180 }
181
182 Actor FocusManager::GetFocusIndicatorActor()
183 {
184   return GetImpl(*this).GetFocusIndicatorActor();
185 }
186
187 Actor FocusManager::GetFocusGroup(Actor actor)
188 {
189   return GetImpl(*this).GetFocusGroup(actor);
190 }
191
192 FocusManager::FocusChangedSignalV2& FocusManager::FocusChangedSignal()
193 {
194   return GetImpl(*this).FocusChangedSignal();
195 }
196
197 FocusManager::FocusOvershotSignalV2& FocusManager::FocusOvershotSignal()
198 {
199   return GetImpl(*this).FocusOvershotSignal();
200 }
201
202 FocusManager::FocusedActorActivatedSignalV2& FocusManager::FocusedActorActivatedSignal()
203 {
204   return GetImpl(*this).FocusedActorActivatedSignal();
205 }
206
207 } // namespace Toolkit
208
209 } // namespace Dali