943fc27eab7458ca751bf16e3de267025f2e12e6
[platform/core/uifw/dali-adaptor.git] / dali / devel-api / adaptor-framework / text-clipboard.h
1 #ifndef DALI_TEXT_CLIPBOARD_H
2 #define DALI_TEXT_CLIPBOARD_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/math/rect.h>
23 #include <dali/public-api/object/base-handle.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 TextClipboard;
35 }
36 } // namespace DALI_INTERNAL
37
38 /**
39  * @brief Interface to the device's clipboard.
40  *
41  * Clipboard can manage it's item and set show / hide status.
42  */
43
44 class DALI_ADAPTOR_API TextClipboard : public BaseHandle
45 {
46 public:
47   /**
48    * @brief Create an uninitialized Clipboard.
49    *
50    * this can be initialized with one of the derived Clipboard' New() methods
51    */
52   TextClipboard();
53
54   /**
55    * @brief Destructor
56    *
57    * This is non-virtual since derived Handle types must not contain data or virtual methods.
58    */
59   ~TextClipboard();
60
61   /**
62    * @brief This constructor is used by Adaptor::GetClipboard().
63    *
64    * @param[in] clipboard A pointer to the clipboard.
65    */
66   explicit DALI_INTERNAL TextClipboard(Internal::Adaptor::TextClipboard* clipboard);
67
68   /**
69    * @brief Retrieve a handle to the TextClipboardEventNotifier instance.
70    *
71    * @return A handle to the TextClipboard
72    */
73   static TextClipboard Get();
74
75   /**
76    * @brief Checks whether the clipboard is available.
77    *
78    * @return true, if it is available, false otherwise.
79    */
80   static bool IsAvailable();
81
82   /**
83    * @brief Send the given string to the clipboard.
84    *
85    * @param[in] itemData string to send to clip board
86    * @return bool true if the internal clip board sending was successful.
87    */
88   bool SetItem(const std::string& itemData);
89
90   /**
91    * @brief Request clipboard service to retrieve an item
92    *
93    * Calling this method will trigger a signal from the clipboard event notifier.
94    * @see Dali::TextClipboardEventNotifier::ContentSelectedSignal()
95    */
96   void RequestItem();
97
98   /**
99    * @brief Returns the number of item currently in the clipboard.
100    *
101    * @return unsigned int number of clipboard items
102    */
103   unsigned int NumberOfItems();
104
105   /**
106    * @brief Show the clipboard window.
107    */
108   void ShowClipboard();
109
110   /**
111    * @brief Hide the clipboard window.
112    */
113   void HideClipboard();
114
115   /**
116   * @brief Retrieves the clipboard's visibility
117   * @return bool true if the clipboard is visible.
118   */
119   bool IsVisible() const;
120 };
121 } // namespace Dali
122
123 #endif // DALI_TEXT_CLIPBOARD_H