Merge "TextLayout - Use one method to do the single line or multi-line layout." into...
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / public-api / focus-manager / keyinput-focus-manager.cpp
index 470977a..ca6a3d0 100644 (file)
@@ -1,27 +1,27 @@
-//
-// Copyright (c) 2014 Samsung Electronics Co., Ltd.
-//
-// Licensed under the Flora License, Version 1.0 (the License);
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//     http://floralicense.org/license/
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an AS IS BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
 
 // CLASS HEADER
-
 #include "keyinput-focus-manager.h"
 
 // EXTERNAL INCLUDES
+#include <dali/public-api/adaptor-framework/singleton-service.h>
 
 // INTERNAL INCLUDES
-
 #include <dali-toolkit/internal/focus-manager/keyinput-focus-manager-impl.h>
 
 namespace Dali
@@ -30,9 +30,6 @@ namespace Dali
 namespace Toolkit
 {
 
-const char* const KeyInputFocusManager::SIGNAL_KEY_INPUT_FOCUS_CHANGED = "key-input-focus-changed";
-const char* const KeyInputFocusManager::SIGNAL_UNHANDLED_KEY_EVENT = "unhandled-key-event";
-
 KeyInputFocusManager::KeyInputFocusManager()
 {
 }
@@ -46,19 +43,22 @@ KeyInputFocusManager KeyInputFocusManager::Get()
   KeyInputFocusManager manager;
 
   // Check whether the focus manager is already created
-  Dali::Adaptor& adaptor = Dali::Adaptor::Get();
-  Dali::BaseHandle handle = adaptor.GetSingleton(typeid(KeyInputFocusManager));
-  if(handle)
-  {
-    // If so, downcast the handle of singleton to focus manager
-    manager = KeyInputFocusManager(dynamic_cast<Internal::KeyInputFocusManager*>(handle.GetObjectPtr()));
-  }
-
-  if(!manager)
+  SingletonService singletonService( SingletonService::Get() );
+  if ( singletonService )
   {
-    // If not, create the focus manager and register it as a singleton
-    manager = KeyInputFocusManager(new Internal::KeyInputFocusManager());
-    adaptor.RegisterSingleton(typeid(manager), manager);
+    Dali::BaseHandle handle = singletonService.GetSingleton(typeid(KeyInputFocusManager));
+    if(handle)
+    {
+      // If so, downcast the handle of singleton to focus manager
+      manager = KeyInputFocusManager(dynamic_cast<Internal::KeyInputFocusManager*>(handle.GetObjectPtr()));
+    }
+
+    if(!manager)
+    {
+      // If not, create the focus manager and register it as a singleton
+      manager = KeyInputFocusManager(new Internal::KeyInputFocusManager());
+      singletonService.Register(typeid(manager), manager);
+    }
   }
 
   return manager;
@@ -89,12 +89,12 @@ bool KeyInputFocusManager::IsKeyboardListener(Control control)
   return GetImpl(*this).IsKeyboardListener(control);
 }
 
-KeyInputFocusManager::KeyInputFocusChangedSignalV2& KeyInputFocusManager::KeyInputFocusChangedSignal()
+KeyInputFocusManager::KeyInputFocusChangedSignalType& KeyInputFocusManager::KeyInputFocusChangedSignal()
 {
   return GetImpl(*this).KeyInputFocusChangedSignal();
 }
 
-KeyInputFocusManager::UnhandledKeyEventSignalV2& KeyInputFocusManager::UnhandledKeyEventSignal()
+KeyInputFocusManager::UnhandledKeyEventSignalType& KeyInputFocusManager::UnhandledKeyEventSignal()
 {
   return GetImpl(*this).UnhandledKeyEventSignal();
 }