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 const char* const KeyInputFocusManager::SIGNAL_KEY_INPUT_FOCUS_CHANGED = "key-input-focus-changed";
34 const char* const KeyInputFocusManager::SIGNAL_UNHANDLED_KEY_EVENT = "unhandled-key-event";
36 KeyInputFocusManager::KeyInputFocusManager()
40 KeyInputFocusManager::~KeyInputFocusManager()
44 KeyInputFocusManager KeyInputFocusManager::Get()
46 KeyInputFocusManager manager;
48 // Check whether the focus manager is already created
49 SingletonService singletonService( SingletonService::Get() );
50 if ( singletonService )
52 Dali::BaseHandle handle = singletonService.GetSingleton(typeid(KeyInputFocusManager));
55 // If so, downcast the handle of singleton to focus manager
56 manager = KeyInputFocusManager(dynamic_cast<Internal::KeyInputFocusManager*>(handle.GetObjectPtr()));
61 // If not, create the focus manager and register it as a singleton
62 manager = KeyInputFocusManager(new Internal::KeyInputFocusManager());
63 singletonService.Register(typeid(manager), manager);
70 KeyInputFocusManager::KeyInputFocusManager(Internal::KeyInputFocusManager *impl)
75 void KeyInputFocusManager::SetFocus(Control control)
77 GetImpl(*this).SetFocus(control);
80 Control KeyInputFocusManager::GetCurrentFocusControl() const
82 return GetImpl(*this).GetCurrentFocusControl();
85 void KeyInputFocusManager::RemoveFocus(Control control)
87 GetImpl(*this).RemoveFocus(control);
90 bool KeyInputFocusManager::IsKeyboardListener(Control control)
92 return GetImpl(*this).IsKeyboardListener(control);
95 KeyInputFocusManager::KeyInputFocusChangedSignalV2& KeyInputFocusManager::KeyInputFocusChangedSignal()
97 return GetImpl(*this).KeyInputFocusChangedSignal();
100 KeyInputFocusManager::UnhandledKeyEventSignalV2& KeyInputFocusManager::UnhandledKeyEventSignal()
102 return GetImpl(*this).UnhandledKeyEventSignal();
105 } // namespace Toolkit