Dali 3D User Interface Engine
physical-keyboard-impl.cpp
Go to the documentation of this file.
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 // EXTERNAL INCLUDES
19 
20 // CLASS HEADER
21 #include <physical-keyboard-impl.h>
22 
23 // INTERNAL INCLUDES
24 #include <singleton-service-impl.h>
25 
26 namespace Dali
27 {
28 
29 namespace Internal
30 {
31 
32 namespace Adaptor
33 {
34 
36 {
37  Dali::PhysicalKeyboard keyboardHandle;
38 
40  if ( service )
41  {
42  keyboardHandle = Dali::PhysicalKeyboard( new PhysicalKeyboard() );
43  service.Register( typeid( keyboardHandle ), keyboardHandle );
44  }
45 
46  return keyboardHandle;
47 }
48 
50 {
51  Dali::PhysicalKeyboard keyboardHandle;
52 
54  if ( service )
55  {
56  BaseHandle handle = service.GetSingleton( typeid( Dali::PhysicalKeyboard ) );
57  if( handle )
58  {
59  // If so, downcast the handle of singleton to focus manager
60  keyboardHandle = Dali::PhysicalKeyboard( dynamic_cast< PhysicalKeyboard* >( handle.GetObjectPtr() ) );
61  }
62  }
63 
64  return keyboardHandle;
65 }
66 
68 {
69  return mAttached;
70 }
71 
72 void PhysicalKeyboard::KeyReceived( bool fromPhysicalKeyboard )
73 {
74  if ( mAttached != fromPhysicalKeyboard )
75  {
76  mAttached = fromPhysicalKeyboard;
77 
78  Dali::PhysicalKeyboard handle( this );
79  mStatusChangedSignal.Emit( handle );
80  }
81 }
82 
84 {
85 }
86 
88 : mAttached( false )
89 {
90 }
91 
92 } // Adaptor
93 
94 } // Internal
95 
96 } // Dali
Dali Docs Home
Read more about Dali