Scrollview Ensure Overshoot is shown even if Y ruler is the same as Scrollview height
[platform/core/uifw/dali-toolkit.git] / base / dali-toolkit / public-api / focus-manager / keyinput-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 "keyinput-focus-manager.h"
21
22 // EXTERNAL INCLUDES
23
24 // INTERNAL INCLUDES
25
26 #include <dali-toolkit/internal/focus-manager/keyinput-focus-manager-impl.h>
27
28 namespace Dali
29 {
30
31 namespace Toolkit
32 {
33
34 const char* const KeyInputFocusManager::SIGNAL_KEY_INPUT_FOCUS_CHANGED = "key-input-focus-changed";
35 const char* const KeyInputFocusManager::SIGNAL_UNHANDLED_KEY_EVENT = "unhandled-key-event";
36
37 KeyInputFocusManager::KeyInputFocusManager()
38 {
39 }
40
41 KeyInputFocusManager::~KeyInputFocusManager()
42 {
43 }
44
45 KeyInputFocusManager KeyInputFocusManager::Get()
46 {
47   KeyInputFocusManager 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(KeyInputFocusManager));
52   if(handle)
53   {
54     // If so, downcast the handle of singleton to focus manager
55     manager = KeyInputFocusManager(dynamic_cast<Internal::KeyInputFocusManager*>(handle.GetObjectPtr()));
56   }
57
58   if(!manager)
59   {
60     // If not, create the focus manager and register it as a singleton
61     manager = KeyInputFocusManager(new Internal::KeyInputFocusManager());
62     adaptor.RegisterSingleton(typeid(manager), manager);
63   }
64
65   return manager;
66 }
67
68 KeyInputFocusManager::KeyInputFocusManager(Internal::KeyInputFocusManager *impl)
69   : BaseHandle(impl)
70 {
71 }
72
73 void KeyInputFocusManager::SetFocus(Control control)
74 {
75   GetImpl(*this).SetFocus(control);
76 }
77
78 Control KeyInputFocusManager::GetCurrentFocusControl() const
79 {
80   return GetImpl(*this).GetCurrentFocusControl();
81 }
82
83 void KeyInputFocusManager::RemoveFocus(Control control)
84 {
85   GetImpl(*this).RemoveFocus(control);
86 }
87
88 bool KeyInputFocusManager::IsKeyboardListener(Control control)
89 {
90   return GetImpl(*this).IsKeyboardListener(control);
91 }
92
93 KeyInputFocusManager::KeyInputFocusChangedSignalV2& KeyInputFocusManager::KeyInputFocusChangedSignal()
94 {
95   return GetImpl(*this).KeyInputFocusChangedSignal();
96 }
97
98 KeyInputFocusManager::UnhandledKeyEventSignalV2& KeyInputFocusManager::UnhandledKeyEventSignal()
99 {
100   return GetImpl(*this).UnhandledKeyEventSignal();
101 }
102
103 } // namespace Toolkit
104
105 } // namespace Dali
106