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