Add Wayland support.
[platform/core/uifw/dali-toolkit.git] / automated-tests / TET / dali-toolkit-test-utils / toolkit-physical-keyboard.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 #include "toolkit-physical-keyboard.h"
19
20 #include <dali/public-api/common/dali-common.h>
21 #include <dali/public-api/object/base-object.h>
22 #include <dali/public-api/signals/dali-signal-v2.h>
23
24 namespace Dali
25 {
26
27 namespace Internal
28 {
29
30 namespace Adaptor
31 {
32
33 /**
34  * Stub for the PhysicalKeyboard
35  */
36 class PhysicalKeyboard : public BaseObject
37 {
38 public: // Creation & Destruction
39
40   PhysicalKeyboard();
41   PhysicalKeyboard(ToolkitPhysicalKeyboard *toolkitPhysicalKeyboard);
42   ~PhysicalKeyboard();
43   static Dali::PhysicalKeyboard Get();
44
45 public:
46
47   bool IsAttached() const;
48
49 public: // Signals
50
51   Dali::PhysicalKeyboard::Signal& StatusChangedSignal();
52
53 private:
54
55   ToolkitPhysicalKeyboard* mToolkitPhysicalKeyboard;
56   Dali::PhysicalKeyboard::Signal mStatusChangedSignal;
57
58   bool mIsAttached;
59 };
60
61 namespace
62 {
63 PhysicalKeyboard* gPhysicalKeyboard = NULL;
64 }
65
66 PhysicalKeyboard::PhysicalKeyboard()
67 : mToolkitPhysicalKeyboard(NULL),
68   mIsAttached(true)
69 {
70 }
71
72 PhysicalKeyboard::PhysicalKeyboard(ToolkitPhysicalKeyboard *toolkitPhysicalKeyboard)
73 : mToolkitPhysicalKeyboard(toolkitPhysicalKeyboard),
74   mIsAttached(true)
75 {
76 }
77
78 PhysicalKeyboard::~PhysicalKeyboard()
79 {
80 }
81
82 Dali::PhysicalKeyboard PhysicalKeyboard::Get()
83 {
84   DALI_ASSERT_ALWAYS(gPhysicalKeyboard);
85   return Dali::PhysicalKeyboard(gPhysicalKeyboard);
86 }
87
88 bool PhysicalKeyboard::IsAttached() const
89 {
90   return mIsAttached;
91 }
92
93 Dali::PhysicalKeyboard::Signal& PhysicalKeyboard::StatusChangedSignal()
94 {
95   return mStatusChangedSignal;
96 }
97
98 } // namespace Adaptor
99
100 } // namespace Internal
101
102 ////////////////////////////////////////////////////////////////////////////////////////////////////
103
104 ToolkitPhysicalKeyboard::ToolkitPhysicalKeyboard()
105 : mPhysicalKeyboardStub(new Internal::Adaptor::PhysicalKeyboard(this)),
106   mPhysicalKeyboard( mPhysicalKeyboardStub )
107 {
108   Dali::Internal::Adaptor::gPhysicalKeyboard = mPhysicalKeyboardStub;
109 }
110
111 ToolkitPhysicalKeyboard::~ToolkitPhysicalKeyboard()
112 {
113 }
114
115 PhysicalKeyboard ToolkitPhysicalKeyboard::GetPhysicalKeyboard()
116 {
117   return mPhysicalKeyboard;
118 }
119
120 } // namespace Dali