Fix build error on Windows
[platform/core/uifw/dali-adaptor.git] / dali / internal / window-system / windows / window-base-win.h
1 #ifndef DALI_INTERNAL_WINDOWSYSTEM_WINDOW_BASE_WIN_H
2 #define DALI_INTERNAL_WINDOWSYSTEM_WINDOW_BASE_WIN_H
3
4 /*
5  * Copyright (c) 2018 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 // INTERNAL INCLUDES
22 #include <dali/internal/window-system/common/window-base.h>
23 #include <dali/internal/window-system/windows/platform-implement-win.h>
24 #include <dali/internal/window-system/windows/event-system-win.h>
25
26 namespace Dali
27 {
28 namespace Internal
29 {
30 namespace Adaptor
31 {
32
33 class Window;
34 class WindowRenderSurface;
35 class WindowRenderSurfaceWin;
36
37 /**
38  * WindowBaseWin class provides an WindowBase Win32 implementation.
39  */
40 class WindowBaseWin : public WindowBase
41 {
42 public:
43
44   /**
45    * @brief Constructor
46    */
47   WindowBaseWin( PositionSize positionSize, Any surface, bool isTransparent );
48
49   /**
50    * @brief Destructor
51    */
52   virtual ~WindowBaseWin();
53
54 public:
55
56   /**
57    * Called when the window receives a delete request
58    */
59   void OnDeleteRequest();
60
61   /**
62    * @brief Called when the window gains focus.
63    */
64   void OnFocusIn( int type, TWinEventInfo *event );
65
66   /**
67    * @brief Called when the window loses focus.
68    */
69   void OnFocusOut( int type, TWinEventInfo *event );
70
71   /**
72    * @brief Called when the window is damaged.
73    */
74   void OnWindowDamaged( int type, TWinEventInfo *event );
75
76   /**
77    * @brief Called when a touch down is received.
78    */
79   void OnMouseButtonDown( int type, TWinEventInfo *event );
80
81   /**
82    * @brief Called when a touch up is received.
83    */
84   void OnMouseButtonUp( int type, TWinEventInfo *event );
85
86   /**
87    * @brief Called when a touch motion is received.
88    */
89   void OnMouseButtonMove( int type, TWinEventInfo *event );
90
91   /**
92    * @brief Called when a mouse wheel is received.
93    */
94   void OnMouseWheel( int type, TWinEventInfo *event );
95
96   /**
97    * @brief Called when a key down is received.
98    */
99   void OnKeyDown( int type, TWinEventInfo *event );
100
101   /**
102    * @brief Called when a key up is received.
103    */
104   void OnKeyUp( int type, TWinEventInfo *event );
105
106
107 public:
108
109   /**
110    * @copydoc Dali::Internal::Adaptor::WindowBase::GetNativeWindow()
111    */
112   virtual Any GetNativeWindow() override;
113
114   /**
115    * @copydoc Dali::Internal::Adaptor::WindowBase::GetNativeWindowId()
116    */
117   virtual int GetNativeWindowId() override;
118
119   /**
120    * @copydoc Dali::Internal::Adaptor::WindowBase::CreateEglWindow()
121    */
122   virtual EGLNativeWindowType CreateEglWindow( int width, int height ) override;
123
124   /**
125    * @copydoc Dali::Internal::Adaptor::WindowBase::DestroyEglWindow()
126    */
127   virtual void DestroyEglWindow() override;
128
129   /**
130    * @copydoc Dali::Internal::Adaptor::WindowBase::SetEglWindowRotation()
131    */
132   virtual void SetEglWindowRotation( int angle ) override;
133
134   /**
135    * @copydoc Dali::Internal::Adaptor::WindowBase::SetEglWindowBufferTransform()
136    */
137   virtual void SetEglWindowBufferTransform( int angle ) override;
138
139   /**
140    * @copydoc Dali::Internal::Adaptor::WindowBase::SetEglWindowTransform()
141    */
142   virtual void SetEglWindowTransform( int angle ) override;
143
144   /**
145    * @copydoc Dali::Internal::Adaptor::WindowBase::ResizeEglWindow()
146    */
147   virtual void ResizeEglWindow( PositionSize positionSize ) override;
148
149   /**
150    * @copydoc Dali::Internal::Adaptor::WindowBase::IsEglWindowRotationSupported()
151    */
152   virtual bool IsEglWindowRotationSupported() override;
153
154   /**
155    * @copydoc Dali::Internal::Adaptor::WindowBase::Move()
156    */
157   virtual void Move( PositionSize positionSize ) override;
158
159   /**
160    * @copydoc Dali::Internal::Adaptor::WindowBase::Resize()
161    */
162   virtual void Resize( PositionSize positionSize ) override;
163
164   /**
165    * @copydoc Dali::Internal::Adaptor::WindowBase::MoveResize()
166    */
167   virtual void MoveResize( PositionSize positionSize ) override;
168
169   /**
170    * @copydoc Dali::Internal::Adaptor::WindowBase::SetClass()
171    */
172   virtual void SetClass( const std::string& name, const std::string& className ) override;
173
174   /**
175    * @copydoc Dali::Internal::Adaptor::WindowBase::Raise()
176    */
177   virtual void Raise() override;
178
179   /**
180    * @copydoc Dali::Internal::Adaptor::WindowBase::Lower()
181    */
182   virtual void Lower() override;
183
184   /**
185    * @copydoc Dali::Internal::Adaptor::WindowBase::Activate()
186    */
187   virtual void Activate() override;
188
189   /**
190    * @copydoc Dali::Internal::Adaptor::WindowBase::SetAvailableOrientations()
191    */
192   virtual void SetAvailableOrientations( const std::vector< Dali::Window::WindowOrientation >& orientations ) override;
193
194   /**
195    * @copydoc Dali::Internal::Adaptor::WindowBase::SetPreferredOrientation()
196    */
197   virtual void SetPreferredOrientation( Dali::Window::WindowOrientation orientation ) override;
198
199   /**
200    * @copydoc Dali::Internal::Adaptor::WindowBase::SetAcceptFocus()
201    */
202   virtual void SetAcceptFocus( bool accept ) override;
203
204   /**
205    * @copydoc Dali::Internal::Adaptor::WindowBase::Show()
206    */
207   virtual void Show() override;
208
209   /**
210    * @copydoc Dali::Internal::Adaptor::WindowBase::Hide()
211    */
212   virtual void Hide() override;
213
214   /**
215    * @copydoc Dali::Internal::Adaptor::WindowBase::GetSupportedAuxiliaryHintCount()
216    */
217   virtual unsigned int GetSupportedAuxiliaryHintCount() const override;
218
219   /**
220    * @copydoc Dali::Internal::Adaptor::WindowBase::GetSupportedAuxiliaryHint()
221    */
222   virtual std::string GetSupportedAuxiliaryHint( unsigned int index ) const override;
223
224   /**
225    * @copydoc Dali::Internal::Adaptor::WindowBase::AddAuxiliaryHint()
226    */
227   virtual unsigned int AddAuxiliaryHint( const std::string& hint, const std::string& value ) override;
228
229   /**
230    * @copydoc Dali::Internal::Adaptor::WindowBase::RemoveAuxiliaryHint()
231    */
232   virtual bool RemoveAuxiliaryHint( unsigned int id ) override;
233
234   /**
235    * @copydoc Dali::Internal::Adaptor::WindowBase::SetAuxiliaryHintValue()
236    */
237   virtual bool SetAuxiliaryHintValue( unsigned int id, const std::string& value ) override;
238
239   /**
240    * @copydoc Dali::Internal::Adaptor::WindowBase::GetAuxiliaryHintValue()
241    */
242   virtual std::string GetAuxiliaryHintValue( unsigned int id ) const override;
243
244   /**
245    * @copydoc Dali::Internal::Adaptor::WindowBase::GetAuxiliaryHintId()
246    */
247   virtual unsigned int GetAuxiliaryHintId( const std::string& hint ) const override;
248
249   /**
250    * @copydoc Dali::Internal::Adaptor::WindowBase::SetInputRegion()
251    */
252   virtual void SetInputRegion( const Rect< int >& inputRegion ) override;
253
254   /**
255    * @copydoc Dali::Internal::Adaptor::WindowBase::SetType()
256    */
257   virtual void SetType( Dali::Window::Type type ) override;
258
259   /**
260    * @copydoc Dali::Internal::Adaptor::WindowBase::SetNotificationLevel()
261    */
262   virtual bool SetNotificationLevel( Dali::Window::NotificationLevel::Type level ) override;
263
264   /**
265    * @copydoc Dali::Internal::Adaptor::WindowBase::GetNotificationLevel()
266    */
267   virtual Dali::Window::NotificationLevel::Type GetNotificationLevel() const override;
268
269   /**
270    * @copydoc Dali::Internal::Adaptor::WindowBase::SetOpaqueState()
271    */
272   virtual void SetOpaqueState( bool opaque ) override;
273
274   /**
275    * @copydoc Dali::Internal::Adaptor::WindowBase::SetScreenOffMode()
276    */
277   virtual bool SetScreenOffMode(Dali::Window::ScreenOffMode::Type screenOffMode) override;
278
279   /**
280    * @copydoc Dali::Internal::Adaptor::WindowBase::GetScreenOffMode()
281    */
282   virtual Dali::Window::ScreenOffMode::Type GetScreenOffMode() const override;
283
284   /**
285    * @copydoc Dali::Internal::Adaptor::WindowBase::SetBrightness()
286    */
287   virtual bool SetBrightness( int brightness ) override;
288
289   /**
290    * @copydoc Dali::Internal::Adaptor::WindowBase::GetBrightness()
291    */
292   virtual int GetBrightness() const override;
293
294   /**
295    * @copydoc Dali::Internal::Adaptor::WindowBase::GrabKey()
296    */
297   virtual bool GrabKey( Dali::KEY key, KeyGrab::KeyGrabMode grabMode ) override;
298
299   /**
300    * @copydoc Dali::Internal::Adaptor::WindowBase::UngrabKey()
301    */
302   virtual bool UngrabKey( Dali::KEY key ) override;
303
304   /**
305    * @copydoc Dali::Internal::Adaptor::WindowBase::GrabKeyList()
306    */
307   virtual bool GrabKeyList( const Dali::Vector< Dali::KEY >& key, const Dali::Vector< KeyGrab::KeyGrabMode >& grabMode, Dali::Vector< bool >& result ) override;
308
309   /**
310    * @copydoc Dali::Internal::Adaptor::WindowBase::UngrabKeyList()
311    */
312   virtual bool UngrabKeyList( const Dali::Vector< Dali::KEY >& key, Dali::Vector< bool >& result ) override;
313
314   /**
315    * @copydoc Dali::Internal::Adaptor::WindowBase::GetDpi()
316    */
317   virtual void GetDpi( unsigned int& dpiHorizontal, unsigned int& dpiVertical ) override;
318
319   /**
320    * @copydoc Dali::Internal::Adaptor::WindowBase::GetScreenRotationAngle()
321    */
322   virtual int GetScreenRotationAngle() override;
323
324   /**
325    * @copydoc Dali::Internal::Adaptor::WindowBase::SetWindowRotationAngle()
326    */
327   virtual void SetWindowRotationAngle( int degree ) override;
328
329   /**
330    * @copydoc Dali::Internal::Adaptor::WindowBase::WindowRotationCompleted()
331    */
332   virtual void WindowRotationCompleted( int degree, int width, int height ) override;
333
334   /**
335    * @copydoc Dali::Internal::Adaptor::WindowBase::SetTransparency()
336    */
337   virtual void SetTransparency( bool transparent ) override;
338
339 private:
340
341   /**
342    * Second stage initialization
343    */
344   void Initialize( PositionSize positionSize, Any surface, bool isTransparent );
345
346   /**
347    * @brief Get the surface id if the surface parameter is not empty
348    * @param surface Any containing a surface id, or can be empty
349    * @return surface id, or zero if surface is empty
350    */
351   unsigned int GetSurfaceId( Any surface ) const;
352
353   /**
354    * @brief Create window
355    */
356   void CreateWinWindow( PositionSize positionSize, bool isTransparent );
357
358 private:
359
360   // Undefined
361   WindowBaseWin(const WindowBaseWin&) = delete;
362
363   // Undefined
364   WindowBaseWin& operator=(const WindowBaseWin& rhs) = delete;
365
366 private:
367   void EventEntry( TWinEventInfo *event );
368
369 private:
370   WinWindowHandle                      mWin32Window;        ///< Native window handle
371   bool                                 mOwnSurface:1;       ///< Whether we own the surface (responsible for deleting it)
372   bool                                 mIsTransparent:1;    ///< Whether the window is transparent (32 bit or 24 bit)
373   bool                                 mRotationAppSet:1;
374 };
375
376 } // namespace Adaptor
377
378 } // namespace internal
379
380 } // namespace Dali
381
382 #endif // DALI_INTERNAL_WINDOWSYSTEM_WINDOW_BASE_WIN_H