Move Clipboard to TextClipboard
[platform/core/uifw/dali-adaptor.git] / dali / devel-api / adaptor-framework / text-clipboard-event-notifier.h
1 #ifndef DALI_TEXT_CLIPBOARD_EVENT_NOTIFIER_H
2 #define DALI_TEXT_CLIPBOARD_EVENT_NOTIFIER_H
3
4 /*
5  * Copyright (c) 2023 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-handle.h>
23 #include <dali/public-api/signals/dali-signal.h>
24
25 // INTERNAL INCLUDES
26 #include <dali/public-api/dali-adaptor-common.h>
27
28 namespace Dali
29 {
30 namespace Internal DALI_INTERNAL
31 {
32 namespace Adaptor
33 {
34 class TextClipboardEventNotifier;
35 }
36 } // namespace DALI_INTERNAL
37
38 /**
39  * @brief The TextClipboardEventNotifier provides signals when clipboard events are received from the device.
40  */
41 class DALI_ADAPTOR_API TextClipboardEventNotifier : public BaseHandle
42 {
43 public:
44   // Typedefs
45
46   /**
47    * @brief TextClipboard event
48    */
49   typedef Signal<void(TextClipboardEventNotifier&)> TextClipboardEventSignalType;
50
51   /**
52    * @brief Create an uninitialized handle.
53    *
54    * This can be initialized by getting the notifier from Dali::Adaptor.
55    */
56   TextClipboardEventNotifier();
57
58   /**
59    * @brief Retrieve a handle to the TextClipboardEventNotifier instance.
60    *
61    * @return A handle to the TextClipboardEventNotifier
62    */
63   static TextClipboardEventNotifier Get();
64
65   /**
66    * @brief Destructor
67    *
68    * This is non-virtual since derived Handle types must not contain data or virtual methods.
69    */
70   ~TextClipboardEventNotifier();
71
72   /**
73    * @brief Returns the selected content.
74    * @return A reference to the string representing the selected content.
75    */
76   const std::string& GetContent() const;
77
78   /**
79    * @brief Sets the selected content.
80    * @param[in] content  A string that represents the content that has been selected.
81    */
82   void SetContent(const std::string& content);
83
84   /**
85    * @brief Clears the stored content.
86    */
87   void ClearContent();
88
89   /**
90    * @brief Called when content is selected in the clipboard.
91    */
92   void EmitContentSelectedSignal();
93
94 public: // Signals
95   /**
96    * @brief This is emitted when content is selected from the clipboard.
97    *
98    * A callback of the following type may be connected:
99    * @code
100    *   void YourCallback( TextClipboardEventNotifier& notifier );
101    * @endcode
102    * @return The signal to connect to.
103    */
104   TextClipboardEventSignalType& ContentSelectedSignal();
105
106 public: // Not intended for application developers
107   /**
108    * @brief This constructor is used by TextClipboardEventNotifier::Get().
109    *
110    * @param[in] notifier A pointer to the drag and drop notifier.
111    */
112   explicit DALI_INTERNAL TextClipboardEventNotifier(Internal::Adaptor::TextClipboardEventNotifier* notifier);
113 };
114
115 } // namespace Dali
116
117 #endif // DALI_TEXT_CLIPBOARD_EVENT_NOTIFIER_H