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