d4e36c169d00b70d4efc22f1eb3713e1a684f4bf
[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 Clipboard
35  */
36 class Clipboard : public Dali::BaseObject, public ConnectionTracker
37 {
38 public:
39   struct Impl;
40
41   /**
42    * @copydoc Dali::Clipboard::Get()
43    */
44   static Dali::Clipboard Get();
45
46   /**
47    * @copydoc Dali::Clipboard::IsAvailable()
48    */
49   static bool IsAvailable();
50
51   /**
52    * Constructor
53    * @param[in] impl Clipboard impl.
54    */
55   Clipboard(Impl* impl);
56
57   /**
58    * Destructor
59    */
60   ~Clipboard() override;
61
62   /**
63    * @copydoc Dali::Clipboard::DataSentSignal()
64    */
65   Dali::Clipboard::DataSentSignalType& DataSentSignal();
66
67   /**
68    * @copydoc Dali::Clipboard::DataReceivedSignal()
69    */
70   Dali::Clipboard::DataReceivedSignalType& DataReceivedSignal();
71
72   /**
73    * @copydoc Dali::Clipboard::DataSelectedSignal()
74    */
75   Dali::Clipboard::DataSelectedSignalType& DataSelectedSignal();
76
77   /**
78    * @copydoc Dali::Clipboard::SetData()
79    */
80   bool SetData(const Dali::Clipboard::ClipData& clipData);
81
82   /**
83    * @copydoc Dali::Clipboard::GetData()
84    */
85   uint32_t GetData(const std::string &mimeType);
86
87   /**
88    * @copydoc Dali::Clipboard::NumberOfClipboardItems()
89    */
90   size_t NumberOfItems();
91
92   /**
93    * @copydoc Dali::Clipboard::ShowClipboard()
94    */
95   void ShowClipboard();
96
97   /**
98    * @copydoc Dali::Clipboard::HideClipboard()
99    */
100   void HideClipboard(bool skipFirstHide);
101
102   /**
103   * @copydoc Dali::Clipboard::IsVisible()
104   */
105   bool IsVisible() const;
106
107   /**
108    * This is called after a timeout when no new data event is received for a certain period of time on X.
109    * @return will return false; one-shot timer.
110    */
111   bool OnReceiveData();
112
113 private:
114   // Undefined
115   Clipboard(const Clipboard&);
116   Clipboard& operator=(Clipboard&);
117
118 private:
119   Impl* mImpl;
120
121 public:
122 }; // class Clipboard
123
124 } // namespace Adaptor
125
126 } // namespace Internal
127
128 inline static Internal::Adaptor::Clipboard& GetImplementation(Dali::Clipboard& clipboard)
129 {
130   DALI_ASSERT_ALWAYS(clipboard && "Clipboard handle is empty");
131   BaseObject& handle = clipboard.GetBaseObject();
132   return static_cast<Internal::Adaptor::Clipboard&>(handle);
133 }
134
135 inline static const Internal::Adaptor::Clipboard& GetImplementation(const Dali::Clipboard& clipboard)
136 {
137   DALI_ASSERT_ALWAYS(clipboard && "Clipboard handle is empty");
138   const BaseObject& handle = clipboard.GetBaseObject();
139   return static_cast<const Internal::Adaptor::Clipboard&>(handle);
140 }
141
142 } // namespace Dali
143
144 #endif // DALI_INTERNAL_CLIPBOARD_H