eef4f6ee50fd822acc767aa645d07bdd97c7eec5
[platform/core/uifw/dali-adaptor.git] / dali / internal / window-system / macos / window-base-mac.h
1 #pragma once
2
3 /*
4  * Copyright (c) 2021 Samsung Electronics Co., Ltd.
5  *
6  * Licensed under the Apache License, Version 2.0 (the "License");
7  * you may not use this file except in compliance with the License.
8  * You may obtain a copy of the License at
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  *
18  */
19
20 // INTERNAL INCLUDES
21 #include <dali/internal/window-system/common/window-base.h>
22 #include <memory>
23
24 namespace Dali::Internal::Adaptor
25 {
26 /**
27  * WindowBaseCocoa class provides an WindowBase Win32 implementation.
28  */
29 class WindowBaseCocoa : public WindowBase
30 {
31 public:
32   struct Impl;
33
34   /**
35    * @brief Constructor
36    */
37   WindowBaseCocoa(PositionSize positionSize, Any surface, bool isTransparent);
38
39   /**
40    * @brief Destructor
41    */
42   ~WindowBaseCocoa();
43
44 public:
45   /**
46    * @copydoc Dali::Internal::Adaptor::WindowBase::GetNativeWindow()
47    */
48   Any GetNativeWindow() override;
49
50   /**
51    * @copydoc Dali::Internal::Adaptor::WindowBase::GetNativeWindowId()
52    */
53   int GetNativeWindowId() override;
54
55   /**
56   * @copydoc Dali::Internal::Adaptor::WindowBase::CreateEglWindow()
57    */
58   EGLNativeWindowType CreateEglWindow(int width, int height) override;
59
60   /**
61    * @copydoc Dali::Internal::Adaptor::WindowBase::DestroyEglWindow()
62    */
63   void DestroyEglWindow() override;
64
65   /**
66    * @copydoc Dali::Internal::Adaptor::WindowBase::SetEglWindowRotation()
67    */
68   void SetEglWindowRotation(int angle) override;
69
70   /**
71    * @copydoc Dali::Internal::Adaptor::WindowBase::SetEglWindowBufferTransform()
72    */
73   void SetEglWindowBufferTransform(int angle) override;
74
75   /**
76    * @copydoc Dali::Internal::Adaptor::WindowBase::SetEglWindowTransform()
77    */
78   void SetEglWindowTransform(int angle) override;
79
80   /**
81    * @copydoc Dali::Internal::Adaptor::WindowBase::ResizeEglWindow()
82    */
83   void ResizeEglWindow(PositionSize positionSize) override;
84
85   /**
86    * @copydoc Dali::Internal::Adaptor::WindowBase::IsEglWindowRotationSupported()
87    */
88   bool IsEglWindowRotationSupported() override;
89
90   /**
91    * @copydoc Dali::Internal::Adaptor::WindowBase::Move()
92    */
93   void Move(PositionSize positionSize) override;
94
95   /**
96    * @copydoc Dali::Internal::Adaptor::WindowBase::Resize()
97    */
98   void Resize(PositionSize positionSize) override;
99
100   /**
101    * @copydoc Dali::Internal::Adaptor::WindowBase::MoveResize()
102    */
103   void MoveResize(PositionSize positionSize) override;
104
105   /**
106    * @copydoc Dali::Internal::Adaptor::WindowBase::SetClass()
107    */
108   void SetClass(const std::string& name, const std::string& className) override;
109
110   /**
111    * @copydoc Dali::Internal::Adaptor::WindowBase::Raise()
112    */
113   void Raise() override;
114
115   /**
116    * @copydoc Dali::Internal::Adaptor::WindowBase::Lower()
117    */
118   void Lower() override;
119
120   /**
121    * @copydoc Dali::Internal::Adaptor::WindowBase::Activate()
122    */
123   void Activate() override;
124
125   /**
126    * @copydoc Dali::Internal::Adaptor::WindowBase::Maximize()
127    */
128   void Maximize(bool maximize) override;
129
130   /**
131    * @copydoc Dali::Internal::Adaptor::WindowBase::IsMaximized()
132    */
133   bool IsMaximized() const override;
134
135   /**
136    * @copydoc Dali::Internal::Adaptor::WindowBase::Minimize()
137    */
138   void Minimize(bool minimize) override;
139
140   /**
141    * @copydoc Dali::Internal::Adaptor::WindowBase::IsMinimized()
142    */
143   bool IsMinimized() const override;
144
145   /**
146    * @copydoc Dali::Internal::Adaptor::WindowBase::SetAvailableAnlges()
147    */
148   void SetAvailableAnlges(const std::vector<int>& angles) override;
149
150   /**
151    * @copydoc Dali::Internal::Adaptor::WindowBase::SetPreferredAngle()
152    */
153   void SetPreferredAngle(int angle) override;
154
155   /**
156    * @copydoc Dali::Internal::Adaptor::WindowBase::SetAcceptFocus()
157    */
158   void SetAcceptFocus(bool accept) override;
159
160   /**
161    * @copydoc Dali::Internal::Adaptor::WindowBase::Show()
162    */
163   void Show() override;
164
165   /**
166    * @copydoc Dali::Internal::Adaptor::WindowBase::Hide()
167    */
168   void Hide() override;
169
170   /**
171    * @copydoc Dali::Internal::Adaptor::WindowBase::GetSupportedAuxiliaryHintCount()
172    */
173   unsigned int GetSupportedAuxiliaryHintCount() const override;
174
175   /**
176    * @copydoc Dali::Internal::Adaptor::WindowBase::GetSupportedAuxiliaryHint()
177    */
178   std::string GetSupportedAuxiliaryHint(unsigned int index) const override;
179
180   /**
181    * @copydoc Dali::Internal::Adaptor::WindowBase::AddAuxiliaryHint()
182    */
183   unsigned int AddAuxiliaryHint(const std::string& hint, const std::string& value) override;
184
185   /**
186    * @copydoc Dali::Internal::Adaptor::WindowBase::RemoveAuxiliaryHint()
187    */
188   bool RemoveAuxiliaryHint(unsigned int id) override;
189
190   /**
191    * @copydoc Dali::Internal::Adaptor::WindowBase::SetAuxiliaryHintValue()
192    */
193   bool SetAuxiliaryHintValue(unsigned int id, const std::string& value) override;
194
195   /**
196    * @copydoc Dali::Internal::Adaptor::WindowBase::GetAuxiliaryHintValue()
197    */
198   std::string GetAuxiliaryHintValue(unsigned int id) const override;
199
200   /**
201    * @copydoc Dali::Internal::Adaptor::WindowBase::GetAuxiliaryHintId()
202    */
203   unsigned int GetAuxiliaryHintId(const std::string& hint) const override;
204
205   /**
206    * @copydoc Dali::Internal::Adaptor::WindowBase::SetInputRegion()
207    */
208   void SetInputRegion(const Rect<int>& inputRegion) override;
209
210   /**
211    * @copydoc Dali::Internal::Adaptor::WindowBase::SetType()
212    */
213   void SetType(Dali::WindowType type) override;
214
215   /**
216    * @copydoc Dali::Internal::Adaptor::WindowBase::GetType()
217    */
218   Dali::WindowType GetType() const override;
219
220   /**
221    * @copydoc Dali::Internal::Adaptor::WindowBase::SetNotificationLevel()
222    */
223   WindowOperationResult SetNotificationLevel(WindowNotificationLevel level) override;
224
225   /**
226    * @copydoc Dali::Internal::Adaptor::WindowBase::GetNotificationLevel()
227    */
228   WindowNotificationLevel GetNotificationLevel() const override;
229
230   /**
231    * @copydoc Dali::Internal::Adaptor::WindowBase::SetOpaqueState()
232    */
233   void SetOpaqueState(bool opaque) override;
234
235   /**
236    * @copydoc Dali::Internal::Adaptor::WindowBase::SetScreenOffMode()
237    */
238   WindowOperationResult SetScreenOffMode(WindowScreenOffMode screenOffMode) override;
239
240   /**
241    * @copydoc Dali::Internal::Adaptor::WindowBase::GetScreenOffMode()
242    */
243   WindowScreenOffMode GetScreenOffMode() const override;
244
245   /**
246    * @copydoc Dali::Internal::Adaptor::WindowBase::SetBrightness()
247    */
248   WindowOperationResult SetBrightness(int brightness) override;
249
250   /**
251    * @copydoc Dali::Internal::Adaptor::WindowBase::GetBrightness()
252    */
253   int GetBrightness() const override;
254
255   /**
256    * @copydoc Dali::Internal::Adaptor::WindowBase::GrabKey()
257    */
258   bool GrabKey(Dali::KEY key, KeyGrab::KeyGrabMode grabMode) override;
259
260   /**
261    * @copydoc Dali::Internal::Adaptor::WindowBase::UngrabKey()
262    */
263   bool UngrabKey(Dali::KEY key) override;
264
265   /**
266    * @copydoc Dali::Internal::Adaptor::WindowBase::GrabKeyList()
267    */
268   bool GrabKeyList(
269     const Dali::Vector<Dali::KEY>&            key,
270     const Dali::Vector<KeyGrab::KeyGrabMode>& grabMode,
271     Dali::Vector<bool>&                       result) override;
272
273   /**
274    * @copydoc Dali::Internal::Adaptor::WindowBase::UngrabKeyList()
275    */
276   bool UngrabKeyList(
277     const Dali::Vector<Dali::KEY>& key,
278     Dali::Vector<bool>&            result) override;
279
280   /**
281    * @copydoc Dali::Internal::Adaptor::WindowBase::GetDpi()
282    */
283   void GetDpi(unsigned int& dpiHorizontal, unsigned int& dpiVertical) override;
284
285   /**
286    * @copydoc Dali::Internal::Adaptor::WindowBase::GetOrientation()
287    */
288   int GetOrientation() const override;
289
290   /**
291    * @copydoc Dali::Internal::Adaptor::WindowBase::GetScreenRotationAngle()
292    */
293   int GetScreenRotationAngle() override;
294
295   /**
296    * @copydoc Dali::Internal::Adaptor::WindowBase::SetWindowRotationAngle()
297    */
298   void SetWindowRotationAngle(int degree) override;
299
300   /**
301    * @copydoc Dali::Internal::Adaptor::WindowBase::WindowRotationCompleted()
302    */
303   void WindowRotationCompleted(int degree, int width, int height) override;
304
305   /**
306    * @copydoc Dali::Internal::Adaptor::WindowBase::SetTransparency()
307    */
308   void SetTransparency(bool transparent) override;
309
310   /**
311    * @copydoc Dali::Internal::Adaptor::WindowBase::SetParent()
312    */
313   void SetParent(WindowBase* parentWinBase, bool belowParent) override;
314
315   /**
316    * @copydoc  Dali::Internal::Adaptor::WindowBase::CreateFrameRenderedSyncFence()
317    */
318   int CreateFrameRenderedSyncFence() override;
319
320   /**
321    * @copydoc  Dali::Internal::Adaptor::WindowBase::CreateFramePresentedSyncFence()
322    */
323   int CreateFramePresentedSyncFence() override;
324
325   /**
326    * @copydoc Dali::Internal::Adaptor::WindowBase::SetPositionSizeWithAngle()
327    */
328   void SetPositionSizeWithAngle(PositionSize positionSize, int angle) override;
329
330   /**
331    * @copydoc Dali::Internal::Adaptor::WindowBase::InitializeIme()
332    */
333   void InitializeIme() override;
334
335   /**
336    * @copydoc Dali::Internal::Adaptor::WindowBase::ImeWindowReadyToRender()
337    */
338   void ImeWindowReadyToRender() override;
339
340   /**
341    * @copydoc Dali::Internal::Adaptor::WindowBase::RequestMoveToServer()
342    */
343   void RequestMoveToServer() override;
344
345   /**
346    * @copydoc Dali::Internal::Adaptor::WindowBase::RequestResizeToServer()
347    */
348   void RequestResizeToServer(WindowResizeDirection direction) override;
349
350   /**
351    * @copydoc Dali::Internal::Adaptor::WindowBase::EnableFloatingMode()
352    */
353   void EnableFloatingMode(bool enable) override;
354
355   /**
356    * @copydoc Dali::Internal::Adaptor::WindowBase::IsFloatingModeEnabled()
357    */
358   bool IsFloatingModeEnabled() const override;
359
360   /**
361    * @copydoc Dali::Internal::Adaptor::WindowBase::IncludeInputRegion()
362    */
363   void IncludeInputRegion(const Rect<int>& inputRegion) override;
364
365   /**
366    * @copydoc Dali::Internal::Adaptor::WindowBase::ExcludeInputRegion()
367    */
368   void ExcludeInputRegion(const Rect<int>& inputRegion) override;
369
370 private:
371   // Undefined
372   WindowBaseCocoa(const WindowBaseCocoa&) = delete;
373
374   // Undefined
375   WindowBaseCocoa& operator=(const WindowBaseCocoa& rhs) = delete;
376
377 private:
378   std::unique_ptr<Impl> mImpl;
379 };
380
381 } // namespace Dali::Internal::Adaptor