License conversion from Flora to Apache 2.0
[platform/core/uifw/dali-adaptor.git] / adaptors / tizen / internal / common / physical-keyboard-impl.h
1 #ifndef __DALI_INTERNAL_PHYSICAL_KEYBOARD_H__
2 #define __DALI_INTERNAL_PHYSICAL_KEYBOARD_H__
3
4 /*
5  * Copyright (c) 2014 Samsung Electronics Co., Ltd.
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  *
19  */
20
21 // EXTERNAL INCLUDES
22 #include <dali/public-api/object/base-object.h>
23
24 // INTERNAL INCLUDES
25 #include <public-api/adaptor-framework/common/physical-keyboard.h>
26
27 namespace Dali
28 {
29
30 namespace Internal
31 {
32
33 namespace Adaptor
34 {
35
36 class PhysicalKeyboard : public BaseObject
37 {
38 public:
39
40   /**
41    * Creates a new instance of the PhysicalKeyboard.
42    */
43   static Dali::PhysicalKeyboard New();
44
45   /**
46    * Gets the singleton instance of the Physical Keyboard.
47    */
48   static Dali::PhysicalKeyboard Get();
49
50   /**
51    * @copydoc Dali::PhysicalKeyboard::IsAttached()
52    */
53   bool IsAttached() const;
54
55   /**
56    * Should be called by the EventHandler when a key is received. If it's received from a physical
57    * keyboard then the parameter should be true.
58    * @param[in]  fromPhysicalKeyboard  true if received from a physical keyboard, false otherwise.
59    */
60   void KeyReceived( bool fromPhysicalKeyboard );
61
62   // Signals
63
64   /**
65    * @copydoc Dali::PhysicalKeyboard::StatusChangedSignal()
66    */
67   Dali::PhysicalKeyboard::Signal& StatusChangedSignal() { return mStatusChangedSignal; }
68
69 protected:
70
71   /**
72    * A reference counted object may only be deleted by calling Unreference()
73    */
74   virtual ~PhysicalKeyboard();
75
76 private:
77
78   // Undefined
79   PhysicalKeyboard( const PhysicalKeyboard& );
80   PhysicalKeyboard& operator=( PhysicalKeyboard& );
81
82   /**
83    * Constructor
84    */
85   PhysicalKeyboard();
86
87 private:
88
89   Dali::PhysicalKeyboard::Signal mStatusChangedSignal; ///< Status changed signal
90   bool mAttached; ///< true if the physical keyboard is attached, false otherwise
91 };
92
93 } // namespace Adaptor
94
95 } // namespace Internal
96
97 // Helpers for public-api forwarding methods
98
99 inline static Internal::Adaptor::PhysicalKeyboard& GetImplementation( PhysicalKeyboard& keyboard )
100 {
101   DALI_ASSERT_ALWAYS( keyboard && "PhysicalKeyboard handle is empty" );
102
103   BaseObject& handle = keyboard.GetBaseObject();
104
105   return static_cast< Internal::Adaptor::PhysicalKeyboard& >( handle );
106 }
107
108 inline static const  Internal::Adaptor::PhysicalKeyboard& GetImplementation( const PhysicalKeyboard& keyboard )
109 {
110   DALI_ASSERT_ALWAYS( keyboard && "PhysicalKeyboard handle is empty" );
111
112   const BaseObject& handle = keyboard.GetBaseObject();
113
114   return static_cast< const Internal::Adaptor::PhysicalKeyboard& >( handle );
115 }
116
117 } // namespace Dali
118
119 #endif // __DALI_INTERNAL_PHYSICAL_KEYBOARD_H__