2 * Copyright (c) 2014 Samsung Electronics Co., Ltd.
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
19 #include "keyinput-focus-manager.h"
22 #include <dali/public-api/adaptor-framework/singleton-service.h>
25 #include <dali-toolkit/internal/focus-manager/keyinput-focus-manager-impl.h>
33 KeyInputFocusManager::KeyInputFocusManager()
37 KeyInputFocusManager::~KeyInputFocusManager()
41 KeyInputFocusManager KeyInputFocusManager::Get()
43 KeyInputFocusManager manager;
45 // Check whether the focus manager is already created
46 SingletonService singletonService( SingletonService::Get() );
47 if ( singletonService )
49 Dali::BaseHandle handle = singletonService.GetSingleton(typeid(KeyInputFocusManager));
52 // If so, downcast the handle of singleton to focus manager
53 manager = KeyInputFocusManager(dynamic_cast<Internal::KeyInputFocusManager*>(handle.GetObjectPtr()));
58 // If not, create the focus manager and register it as a singleton
59 manager = KeyInputFocusManager(new Internal::KeyInputFocusManager());
60 singletonService.Register(typeid(manager), manager);
67 KeyInputFocusManager::KeyInputFocusManager(Internal::KeyInputFocusManager *impl)
72 void KeyInputFocusManager::SetFocus(Control control)
74 GetImpl(*this).SetFocus(control);
77 Control KeyInputFocusManager::GetCurrentFocusControl() const
79 return GetImpl(*this).GetCurrentFocusControl();
82 void KeyInputFocusManager::RemoveFocus(Control control)
84 GetImpl(*this).RemoveFocus(control);
87 bool KeyInputFocusManager::IsKeyboardListener(Control control)
89 return GetImpl(*this).IsKeyboardListener(control);
92 KeyInputFocusManager::KeyInputFocusChangedSignalType& KeyInputFocusManager::KeyInputFocusChangedSignal()
94 return GetImpl(*this).KeyInputFocusChangedSignal();
97 KeyInputFocusManager::UnhandledKeyEventSignalType& KeyInputFocusManager::UnhandledKeyEventSignal()
99 return GetImpl(*this).UnhandledKeyEventSignal();
102 } // namespace Toolkit