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