Merge "Ensure join of font thread" into devel/master
[platform/core/uifw/dali-adaptor.git] / dali / internal / clipboard / common / clipboard-impl.h
1 #ifndef DALI_INTERNAL_CLIPBOARD_H
2 #define DALI_INTERNAL_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/object/base-object.h>
23
24 // INTERNAL INCLUDES
25 #include <dali/devel-api/adaptor-framework/clipboard.h>
26
27 namespace Dali
28 {
29 namespace Internal
30 {
31 namespace Adaptor
32 {
33 /**
34  * Implementation of the Clip Board
35  */
36
37 class Clipboard : public Dali::BaseObject
38 {
39 public:
40   // Hide the specific windowing system
41   struct Impl;
42
43   /**
44    * @copydoc Dali::Clipboard::Get()
45    */
46   static Dali::Clipboard Get();
47
48   /**
49    * @copydoc Dali::Clipboard::IsAvailable()
50    */
51   static bool IsAvailable();
52
53   /**
54    * Constructor
55    * @param[in] impl Some data from a specific windowing system.
56    */
57   Clipboard(Impl* impl);
58
59   /**
60    * Destructor
61    */
62   ~Clipboard() override;
63
64   /**
65    * @copydoc Dali::Clipboard::SetItem()
66    */
67   bool SetItem(const std::string& itemData);
68
69   /**
70    * @copydoc Dali::Clipboard::RequestItem()
71    */
72   void RequestItem();
73
74   /**
75    * @copydoc Dali::Clipboard::NumberOfClipboardItems()
76    */
77   unsigned int NumberOfItems();
78
79   /**
80    * @copydoc Dali::Clipboard::ShowClipboard()
81    */
82   void ShowClipboard();
83
84   /**
85    * @copydoc Dali::Clipboard::HideClipboard()
86    */
87   void HideClipboard(bool skipFirstHide);
88
89   /**
90   * @copydoc Dali::Clipboard::IsVisible()
91   */
92   bool IsVisible() const;
93
94   /**
95   * @brief sending buffered data
96   *
97   * @param[in] event information pointer
98   */
99   void ExcuteSend(void* event);
100
101   /**
102   * @brief receiving buffered data
103   *
104   * @param[in] event information pointer
105   * @param[out] data The buffer pointer for receive data
106   * @param[out] length The buffer length for receive data
107   */
108   void ExcuteReceive(void* event, char*& data, int& length);
109
110 private:
111   // Undefined
112   Clipboard(const Clipboard&);
113   Clipboard& operator=(Clipboard&);
114
115 private:
116   Impl* mImpl;
117
118 public:
119 }; // class clipboard
120
121 } // namespace Adaptor
122
123 } // namespace Internal
124
125 inline static Internal::Adaptor::Clipboard& GetImplementation(Dali::Clipboard& clipboard)
126 {
127   DALI_ASSERT_ALWAYS(clipboard && "Clipboard handle is empty");
128   BaseObject& handle = clipboard.GetBaseObject();
129   return static_cast<Internal::Adaptor::Clipboard&>(handle);
130 }
131
132 inline static const Internal::Adaptor::Clipboard& GetImplementation(const Dali::Clipboard& clipboard)
133 {
134   DALI_ASSERT_ALWAYS(clipboard && "Clipboard handle is empty");
135   const BaseObject& handle = clipboard.GetBaseObject();
136   return static_cast<const Internal::Adaptor::Clipboard&>(handle);
137 }
138
139 } // namespace Dali
140
141 #endif // DALI_INTERNAL_CLIPBOARD_H