1 #ifndef TOOLKIT_CLIPBOARD_H
2 #define TOOLKIT_CLIPBOARD_H
5 * Copyright (c) 2019 Samsung Electronics Co., Ltd.
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
11 * http://www.apache.org/licenses/LICENSE-2.0
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.
21 #define DALI_CLIPBOARD_H
24 #include <dali/public-api/math/rect.h>
25 #include <dali/public-api/object/base-handle.h>
26 #include <dali/public-api/signals/dali-signal.h>
28 namespace Dali DALI_IMPORT_API
31 namespace Internal DALI_INTERNAL
41 * The Clipboard can operate using various funtion.
42 * Clipboard can manage it's item and set show / hide status.
44 class Clipboard : public BaseHandle
48 * @brief Structure that contains information about the clipboard data information.
52 ClipData(const char* mimeType = nullptr, const char* data = nullptr)
54 this->mimeType = mimeType;
57 void SetMimeType(const char* mimeType)
59 this->mimeType = mimeType;
61 const char* GetMimeType() const
65 void SetData(const char* data)
69 const char* GetData() const
75 const char* mimeType {nullptr}; ///< The mime type of clip data.
76 const char* data {nullptr}; ///< The clip data.
79 /// @brief Data send completed signal.
80 typedef Signal<void(const char*, const char*)> DataSentSignalType;
82 /// @brief Data receive completed signal.
83 typedef Signal<void(uint32_t, const char*, const char*)> DataReceivedSignalType;
87 * Create an uninitialized Clipboard;
88 * this can be initialized with one of the derived Clipboard' New() methods
93 * Non virtual destructor.
98 * This constructor is used by Adaptor::GetClipboard().
99 * @param[in] clipboard A pointer to the clipboard.
101 Clipboard(Internal::Adaptor::Clipboard* clipboard);
104 * Retrieve a handle to the ClipboardEventNotifier instance
105 * @return A handle to the Clipboard
107 static Clipboard Get();
110 * @brief Checks whether the clipboard is available.
111 * @return true, if it is available, false otherwise.
113 static bool IsAvailable();
116 * @brief This signal is emitted when the data send complete.
118 * SetData() opertion does not follow a synchronous call.
119 * It follows the sequence below.
120 * SetData() -> EcoreEventDataSend() -> SendData() -> DataSentSignal() Emit
122 DataSentSignalType& DataSentSignal();
125 * @brief This signal is emitted when the data receive complete.
127 * GetData() opertion does not follow a synchronous call.
128 * It follows the sequence below.
129 * GetData() -> EcoreEventOfferDataReady() -> ReceiveData() -> DataReceivedSignal() Emit
131 DataReceivedSignalType& DataReceivedSignal();
134 * @brief Send the given data to the clipboard.
135 * @param[in] clipData data to send to the clipboard
136 * @return bool true if the internal clipboard sending was successful.
138 bool SetData(const ClipData& clipData);
141 * @brief Request data from the clipboard.
142 * @param[in] mimeType mime type of data to request.
143 * @return uint32_t Returns the data request id.
145 uint32_t GetData(const std::string& mimeType);
148 * @brief Returns the number of item currently in the clipboard.
149 * @return size_t number of clipboard items.
151 size_t NumberOfItems();
154 * Show the clipboard window
156 void ShowClipboard();
159 * Hide the clipboard window
161 void HideClipboard();
164 * @brief Retrieves the clipboard's visibility
165 * @return bool true if the clipboard is visible.
167 bool IsVisible() const;
172 #endif // TOOLKIT_CLIPBOARD_H