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.
21 #include <physical-keyboard-impl.h>
24 #include <singleton-service-impl.h>
35 Dali::PhysicalKeyboard PhysicalKeyboard::New()
37 Dali::PhysicalKeyboard keyboardHandle;
39 Dali::SingletonService service( SingletonService::Get() );
42 keyboardHandle = Dali::PhysicalKeyboard( new PhysicalKeyboard() );
43 service.Register( typeid( keyboardHandle ), keyboardHandle );
46 return keyboardHandle;
49 Dali::PhysicalKeyboard PhysicalKeyboard::Get()
51 Dali::PhysicalKeyboard keyboardHandle;
53 Dali::SingletonService service = SingletonService::Get();
56 BaseHandle handle = service.GetSingleton( typeid( Dali::PhysicalKeyboard ) );
59 // If so, downcast the handle of singleton to focus manager
60 keyboardHandle = Dali::PhysicalKeyboard( dynamic_cast< PhysicalKeyboard* >( handle.GetObjectPtr() ) );
64 return keyboardHandle;
67 bool PhysicalKeyboard::IsAttached() const
72 void PhysicalKeyboard::KeyReceived( bool fromPhysicalKeyboard )
74 if ( mAttached != fromPhysicalKeyboard )
76 mAttached = fromPhysicalKeyboard;
78 Dali::PhysicalKeyboard handle( this );
79 mStatusChangedSignal.Emit( handle );
83 PhysicalKeyboard::~PhysicalKeyboard()
87 PhysicalKeyboard::PhysicalKeyboard()