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