License conversion from Flora to Apache 2.0
[platform/core/uifw/dali-adaptor.git] / adaptors / tizen / internal / common / clipboard-event-notifier-impl.h
1 #ifndef __DALI_INTERNAL_CLIPBOARD_EVENT_NOTIFIER_H__
2 #define __DALI_INTERNAL_CLIPBOARD_EVENT_NOTIFIER_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 <string>
23 #include <dali/public-api/object/base-object.h>
24 #include <dali/public-api/math/vector2.h>
25 #include <dali/public-api/adaptor-framework/common/clipboard-event-notifier.h>
26
27 // INTERNAL INCLUDES
28
29 namespace Dali
30 {
31
32 namespace Internal
33 {
34
35 namespace Adaptor
36 {
37
38 /**
39  * This class listens to Clipboard events.
40  */
41 class ClipboardEventNotifier : public Dali::BaseObject
42 {
43 public:
44
45   typedef Dali::ClipboardEventNotifier::ClipboardEventSignalV2 ClipboardEventSignalV2;
46
47   // Creation
48
49   /**
50    * Create a ClipboardEventNotifier.
51    * @return A newly allocated clipboard-event-notifier.
52    */
53   static Dali::ClipboardEventNotifier New();
54
55   /**
56    * @copydoc Dali::ClipboardEventNotifier::Get()
57    */
58   static Dali::ClipboardEventNotifier Get();
59
60   // Public API
61
62   /**
63    * @copydoc Dali::ClipboardEventNotifier::GetContent() const
64    */
65   const std::string& GetContent() const;
66
67   /**
68    * Sets the selected content.
69    * @param[in] content  A string that represents the content that has been selected.
70    */
71   void SetContent( const std::string& content );
72
73   /**
74    * Clears the stored content.
75    */
76   void ClearContent();
77
78   /**
79    * Called when content is selected in the clipboard.
80    */
81   void EmitContentSelectedSignal();
82
83 public: // Signals
84
85   /**
86    * @copydoc Dali::ClipboardEventNotifier::ContentSelectedSignal
87    */
88   ClipboardEventSignalV2& ContentSelectedSignal()
89   {
90     return mContentSelectedSignalV2;
91   }
92
93 private:
94
95   // Construction & Destruction
96
97   /**
98    * Constructor.
99    */
100   ClipboardEventNotifier();
101
102   /**
103    * Destructor.
104    */
105   virtual ~ClipboardEventNotifier();
106
107   // Undefined
108   ClipboardEventNotifier( const ClipboardEventNotifier& );
109   ClipboardEventNotifier& operator=( ClipboardEventNotifier& );
110
111 private:
112
113   std::string mContent;    ///< The current selected content.
114
115   ClipboardEventSignalV2 mContentSelectedSignalV2;
116
117 public:
118
119   // Helpers for public-api forwarding methods
120
121   inline static Internal::Adaptor::ClipboardEventNotifier& GetImplementation(Dali::ClipboardEventNotifier& detector)
122   {
123     DALI_ASSERT_ALWAYS( detector && "ClipboardEventNotifier handle is empty" );
124
125     BaseObject& handle = detector.GetBaseObject();
126
127     return static_cast<Internal::Adaptor::ClipboardEventNotifier&>(handle);
128   }
129
130   inline static const Internal::Adaptor::ClipboardEventNotifier& GetImplementation(const Dali::ClipboardEventNotifier& detector)
131   {
132     DALI_ASSERT_ALWAYS( detector && "ClipboardEventNotifier handle is empty" );
133
134     const BaseObject& handle = detector.GetBaseObject();
135
136     return static_cast<const Internal::Adaptor::ClipboardEventNotifier&>(handle);
137   }
138
139 };
140
141 } // namespace Adaptor
142
143 } // namespace Internal
144
145 } // namespace Dali
146
147 #endif // __DALI_INTERNAL_CLIPBOARD_EVENT_NOTIFIER_H__