Supports some tizen window features.
[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::SetAvailableAnlges()
127    */
128   void SetAvailableAnlges(const std::vector<int>& angles) override;
129
130   /**
131    * @copydoc Dali::Internal::Adaptor::WindowBase::SetPreferredAngle()
132    */
133   void SetPreferredAngle(int angle) override;
134
135   /**
136    * @copydoc Dali::Internal::Adaptor::WindowBase::SetAcceptFocus()
137    */
138   void SetAcceptFocus(bool accept) override;
139
140   /**
141    * @copydoc Dali::Internal::Adaptor::WindowBase::Show()
142    */
143   void Show() override;
144
145   /**
146    * @copydoc Dali::Internal::Adaptor::WindowBase::Hide()
147    */
148   void Hide() override;
149
150   /**
151    * @copydoc Dali::Internal::Adaptor::WindowBase::GetSupportedAuxiliaryHintCount()
152    */
153   unsigned int GetSupportedAuxiliaryHintCount() const override;
154
155   /**
156    * @copydoc Dali::Internal::Adaptor::WindowBase::GetSupportedAuxiliaryHint()
157    */
158   std::string GetSupportedAuxiliaryHint(unsigned int index) const override;
159
160   /**
161    * @copydoc Dali::Internal::Adaptor::WindowBase::AddAuxiliaryHint()
162    */
163   unsigned int AddAuxiliaryHint(const std::string& hint, const std::string& value) override;
164
165   /**
166    * @copydoc Dali::Internal::Adaptor::WindowBase::RemoveAuxiliaryHint()
167    */
168   bool RemoveAuxiliaryHint(unsigned int id) override;
169
170   /**
171    * @copydoc Dali::Internal::Adaptor::WindowBase::SetAuxiliaryHintValue()
172    */
173   bool SetAuxiliaryHintValue(unsigned int id, const std::string& value) override;
174
175   /**
176    * @copydoc Dali::Internal::Adaptor::WindowBase::GetAuxiliaryHintValue()
177    */
178   std::string GetAuxiliaryHintValue(unsigned int id) const override;
179
180   /**
181    * @copydoc Dali::Internal::Adaptor::WindowBase::GetAuxiliaryHintId()
182    */
183   unsigned int GetAuxiliaryHintId(const std::string& hint) const override;
184
185   /**
186    * @copydoc Dali::Internal::Adaptor::WindowBase::SetInputRegion()
187    */
188   void SetInputRegion(const Rect<int>& inputRegion) override;
189
190   /**
191    * @copydoc Dali::Internal::Adaptor::WindowBase::SetType()
192    */
193   void SetType(Dali::WindowType type) override;
194
195   /**
196    * @copydoc Dali::Internal::Adaptor::WindowBase::GetType()
197    */
198   Dali::WindowType GetType() const override;
199
200   /**
201    * @copydoc Dali::Internal::Adaptor::WindowBase::SetNotificationLevel()
202    */
203   WindowOperationResult SetNotificationLevel(WindowNotificationLevel level) override;
204
205   /**
206    * @copydoc Dali::Internal::Adaptor::WindowBase::GetNotificationLevel()
207    */
208   WindowNotificationLevel GetNotificationLevel() const override;
209
210   /**
211    * @copydoc Dali::Internal::Adaptor::WindowBase::SetOpaqueState()
212    */
213   void SetOpaqueState(bool opaque) override;
214
215   /**
216    * @copydoc Dali::Internal::Adaptor::WindowBase::SetScreenOffMode()
217    */
218   WindowOperationResult SetScreenOffMode(WindowScreenOffMode screenOffMode) override;
219
220   /**
221    * @copydoc Dali::Internal::Adaptor::WindowBase::GetScreenOffMode()
222    */
223   WindowScreenOffMode GetScreenOffMode() const override;
224
225   /**
226    * @copydoc Dali::Internal::Adaptor::WindowBase::SetBrightness()
227    */
228   WindowOperationResult SetBrightness(int brightness) override;
229
230   /**
231    * @copydoc Dali::Internal::Adaptor::WindowBase::GetBrightness()
232    */
233   int GetBrightness() const override;
234
235   /**
236    * @copydoc Dali::Internal::Adaptor::WindowBase::GrabKey()
237    */
238   bool GrabKey(Dali::KEY key, KeyGrab::KeyGrabMode grabMode) override;
239
240   /**
241    * @copydoc Dali::Internal::Adaptor::WindowBase::UngrabKey()
242    */
243   bool UngrabKey(Dali::KEY key) override;
244
245   /**
246    * @copydoc Dali::Internal::Adaptor::WindowBase::GrabKeyList()
247    */
248   bool GrabKeyList(
249     const Dali::Vector<Dali::KEY>&            key,
250     const Dali::Vector<KeyGrab::KeyGrabMode>& grabMode,
251     Dali::Vector<bool>&                       result) override;
252
253   /**
254    * @copydoc Dali::Internal::Adaptor::WindowBase::UngrabKeyList()
255    */
256   bool UngrabKeyList(
257     const Dali::Vector<Dali::KEY>& key,
258     Dali::Vector<bool>&            result) override;
259
260   /**
261    * @copydoc Dali::Internal::Adaptor::WindowBase::GetDpi()
262    */
263   void GetDpi(unsigned int& dpiHorizontal, unsigned int& dpiVertical) override;
264
265   /**
266    * @copydoc Dali::Internal::Adaptor::WindowBase::GetOrientation()
267    */
268   int GetOrientation() const override;
269
270   /**
271    * @copydoc Dali::Internal::Adaptor::WindowBase::GetScreenRotationAngle()
272    */
273   int GetScreenRotationAngle() override;
274
275   /**
276    * @copydoc Dali::Internal::Adaptor::WindowBase::SetWindowRotationAngle()
277    */
278   void SetWindowRotationAngle(int degree) override;
279
280   /**
281    * @copydoc Dali::Internal::Adaptor::WindowBase::WindowRotationCompleted()
282    */
283   void WindowRotationCompleted(int degree, int width, int height) override;
284
285   /**
286    * @copydoc Dali::Internal::Adaptor::WindowBase::SetTransparency()
287    */
288   void SetTransparency(bool transparent) override;
289
290   /**
291    * @copydoc Dali::Internal::Adaptor::WindowBase::SetParent()
292    */
293   void SetParent(WindowBase* parentWinBase) override;
294
295   /**
296    * @copydoc  Dali::Internal::Adaptor::WindowBase::CreateFrameRenderedSyncFence()
297    */
298   int CreateFrameRenderedSyncFence() override;
299
300   /**
301    * @copydoc  Dali::Internal::Adaptor::WindowBase::CreateFramePresentedSyncFence()
302    */
303   int CreateFramePresentedSyncFence() override;
304
305   /**
306    * @copydoc Dali::Internal::Adaptor::WindowBase::SetPositionSizeWithAngle()
307    */
308   void SetPositionSizeWithAngle(PositionSize positionSize, int angle) override;
309
310   /**
311    * @copydoc Dali::Internal::Adaptor::WindowBase::InitializeIme()
312    */
313   void InitializeIme() override;
314
315   /**
316    * @copydoc Dali::Internal::Adaptor::WindowBase::ImeWindowReadyToRender()
317    */
318   void ImeWindowReadyToRender() override;
319
320   /**
321    * @copydoc Dali::Internal::Adaptor::WindowBase::RequestMoveToServer()
322    */
323   void RequestMoveToServer() override;
324
325   /**
326    * @copydoc Dali::Internal::Adaptor::WindowBase::RequestResizeToServer()
327    */
328   void RequestResizeToServer(WindowResizeDirection direction) override;
329
330   /**
331    * @copydoc Dali::Internal::Adaptor::WindowBase::EnableFloatingMode()
332    */
333   void EnableFloatingMode(bool enable) override;
334
335   /**
336    * @copydoc Dali::Internal::Adaptor::WindowBase::IsFloatingModeEnabled()
337    */
338   bool IsFloatingModeEnabled() const override;
339
340 private:
341   // Undefined
342   WindowBaseCocoa(const WindowBaseCocoa&) = delete;
343
344   // Undefined
345   WindowBaseCocoa& operator=(const WindowBaseCocoa& rhs) = delete;
346
347 private:
348   std::unique_ptr<Impl> mImpl;
349 };
350
351 } // namespace Dali::Internal::Adaptor