1 #ifndef DALI_INTERNAL_WINDOWSYSTEM_WINDOW_BASE_WIN_H
2 #define DALI_INTERNAL_WINDOWSYSTEM_WINDOW_BASE_WIN_H
5 * Copyright (c) 2018 Samsung Electronics Co., Ltd.
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
11 * http://www.apache.org/licenses/LICENSE-2.0
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.
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>
34 class WindowRenderSurface;
35 class WindowRenderSurfaceWin;
38 * WindowBaseWin class provides an WindowBase Win32 implementation.
40 class WindowBaseWin : public WindowBase
47 WindowBaseWin( PositionSize positionSize, Any surface, bool isTransparent );
52 virtual ~WindowBaseWin();
57 * Called when the window receives a delete request
59 void OnDeleteRequest();
62 * @brief Called when the window gains focus.
64 void OnFocusIn( int type, TWinEventInfo *event );
67 * @brief Called when the window loses focus.
69 void OnFocusOut( int type, TWinEventInfo *event );
72 * @brief Called when the window is damaged.
74 void OnWindowDamaged( int type, TWinEventInfo *event );
77 * @brief Called when a touch down is received.
79 void OnMouseButtonDown( int type, TWinEventInfo *event );
82 * @brief Called when a touch up is received.
84 void OnMouseButtonUp( int type, TWinEventInfo *event );
87 * @brief Called when a touch motion is received.
89 void OnMouseButtonMove( int type, TWinEventInfo *event );
92 * @brief Called when a mouse wheel is received.
94 void OnMouseWheel( int type, TWinEventInfo *event );
97 * @brief Called when a key down is received.
99 void OnKeyDown( int type, TWinEventInfo *event );
102 * @brief Called when a key up is received.
104 void OnKeyUp( int type, TWinEventInfo *event );
110 * @copydoc Dali::Internal::Adaptor::WindowBase::GetNativeWindow()
112 Any GetNativeWindow() override;
115 * @copydoc Dali::Internal::Adaptor::WindowBase::GetNativeWindowId()
117 int GetNativeWindowId() override;
120 * @copydoc Dali::Internal::Adaptor::WindowBase::CreateEglWindow()
122 EGLNativeWindowType CreateEglWindow( int width, int height ) override;
125 * @copydoc Dali::Internal::Adaptor::WindowBase::DestroyEglWindow()
127 void DestroyEglWindow() override;
130 * @copydoc Dali::Internal::Adaptor::WindowBase::SetEglWindowRotation()
132 void SetEglWindowRotation( int angle ) override;
135 * @copydoc Dali::Internal::Adaptor::WindowBase::SetEglWindowBufferTransform()
137 void SetEglWindowBufferTransform( int angle ) override;
140 * @copydoc Dali::Internal::Adaptor::WindowBase::SetEglWindowTransform()
142 void SetEglWindowTransform( int angle ) override;
145 * @copydoc Dali::Internal::Adaptor::WindowBase::ResizeEglWindow()
147 void ResizeEglWindow( PositionSize positionSize ) override;
150 * @copydoc Dali::Internal::Adaptor::WindowBase::IsEglWindowRotationSupported()
152 bool IsEglWindowRotationSupported() override;
155 * @copydoc Dali::Internal::Adaptor::WindowBase::Move()
157 void Move( PositionSize positionSize ) override;
160 * @copydoc Dali::Internal::Adaptor::WindowBase::Resize()
162 void Resize( PositionSize positionSize ) override;
165 * @copydoc Dali::Internal::Adaptor::WindowBase::MoveResize()
167 void MoveResize( PositionSize positionSize ) override;
170 * @copydoc Dali::Internal::Adaptor::WindowBase::SetClass()
172 void SetClass( const std::string& name, const std::string& className ) override;
175 * @copydoc Dali::Internal::Adaptor::WindowBase::Raise()
177 void Raise() override;
180 * @copydoc Dali::Internal::Adaptor::WindowBase::Lower()
182 void Lower() override;
185 * @copydoc Dali::Internal::Adaptor::WindowBase::Activate()
187 void Activate() override;
190 * @copydoc Dali::Internal::Adaptor::WindowBase::SetAvailableAnlges()
192 void SetAvailableAnlges( const std::vector< int >& angles ) override;
195 * @copydoc Dali::Internal::Adaptor::WindowBase::SetPreferredAngle()
197 void SetPreferredAngle( int angle ) override;
200 * @copydoc Dali::Internal::Adaptor::WindowBase::SetAcceptFocus()
202 void SetAcceptFocus( bool accept ) override;
205 * @copydoc Dali::Internal::Adaptor::WindowBase::Show()
207 void Show() override;
210 * @copydoc Dali::Internal::Adaptor::WindowBase::Hide()
212 void Hide() override;
215 * @copydoc Dali::Internal::Adaptor::WindowBase::GetSupportedAuxiliaryHintCount()
217 unsigned int GetSupportedAuxiliaryHintCount() const override;
220 * @copydoc Dali::Internal::Adaptor::WindowBase::GetSupportedAuxiliaryHint()
222 std::string GetSupportedAuxiliaryHint( unsigned int index ) const override;
225 * @copydoc Dali::Internal::Adaptor::WindowBase::AddAuxiliaryHint()
227 unsigned int AddAuxiliaryHint( const std::string& hint, const std::string& value ) override;
230 * @copydoc Dali::Internal::Adaptor::WindowBase::RemoveAuxiliaryHint()
232 bool RemoveAuxiliaryHint( unsigned int id ) override;
235 * @copydoc Dali::Internal::Adaptor::WindowBase::SetAuxiliaryHintValue()
237 bool SetAuxiliaryHintValue( unsigned int id, const std::string& value ) override;
240 * @copydoc Dali::Internal::Adaptor::WindowBase::GetAuxiliaryHintValue()
242 std::string GetAuxiliaryHintValue( unsigned int id ) const override;
245 * @copydoc Dali::Internal::Adaptor::WindowBase::GetAuxiliaryHintId()
247 unsigned int GetAuxiliaryHintId( const std::string& hint ) const override;
250 * @copydoc Dali::Internal::Adaptor::WindowBase::SetInputRegion()
252 void SetInputRegion( const Rect< int >& inputRegion ) override;
255 * @copydoc Dali::Internal::Adaptor::WindowBase::SetType()
257 void SetType( Dali::Window::Type type ) override;
260 * @copydoc Dali::Internal::Adaptor::WindowBase::SetNotificationLevel()
262 bool SetNotificationLevel( Dali::Window::NotificationLevel::Type level ) override;
265 * @copydoc Dali::Internal::Adaptor::WindowBase::GetNotificationLevel()
267 Dali::Window::NotificationLevel::Type GetNotificationLevel() const override;
270 * @copydoc Dali::Internal::Adaptor::WindowBase::SetOpaqueState()
272 void SetOpaqueState( bool opaque ) override;
275 * @copydoc Dali::Internal::Adaptor::WindowBase::SetScreenOffMode()
277 bool SetScreenOffMode(Dali::Window::ScreenOffMode::Type screenOffMode) override;
280 * @copydoc Dali::Internal::Adaptor::WindowBase::GetScreenOffMode()
282 Dali::Window::ScreenOffMode::Type GetScreenOffMode() const override;
285 * @copydoc Dali::Internal::Adaptor::WindowBase::SetBrightness()
287 bool SetBrightness( int brightness ) override;
290 * @copydoc Dali::Internal::Adaptor::WindowBase::GetBrightness()
292 int GetBrightness() const override;
295 * @copydoc Dali::Internal::Adaptor::WindowBase::GrabKey()
297 bool GrabKey( Dali::KEY key, KeyGrab::KeyGrabMode grabMode ) override;
300 * @copydoc Dali::Internal::Adaptor::WindowBase::UngrabKey()
302 bool UngrabKey( Dali::KEY key ) override;
305 * @copydoc Dali::Internal::Adaptor::WindowBase::GrabKeyList()
307 bool GrabKeyList( const Dali::Vector< Dali::KEY >& key, const Dali::Vector< KeyGrab::KeyGrabMode >& grabMode, Dali::Vector< bool >& result ) override;
310 * @copydoc Dali::Internal::Adaptor::WindowBase::UngrabKeyList()
312 bool UngrabKeyList( const Dali::Vector< Dali::KEY >& key, Dali::Vector< bool >& result ) override;
315 * @copydoc Dali::Internal::Adaptor::WindowBase::GetDpi()
317 void GetDpi( unsigned int& dpiHorizontal, unsigned int& dpiVertical ) override;
320 * @copydoc Dali::Internal::Adaptor::WindowBase::GetScreenRotationAngle()
322 int GetScreenRotationAngle() override;
325 * @copydoc Dali::Internal::Adaptor::WindowBase::SetWindowRotationAngle()
327 void SetWindowRotationAngle( int degree ) override;
330 * @copydoc Dali::Internal::Adaptor::WindowBase::GetWindowRotationAngle()
332 virtual void GetWindowRotationAngle() override;
335 * @copydoc Dali::Internal::Adaptor::WindowBase::WindowRotationCompleted()
337 void WindowRotationCompleted( int degree, int width, int height ) override;
340 * @copydoc Dali::Internal::Adaptor::WindowBase::SetTransparency()
342 void SetTransparency( bool transparent ) override;
345 * @brief Return the orientation of the surface.
346 * @return The orientation
348 virtual int GetOrientation() const override;
351 * @copydoc Dali::Internal::Adaptor::WindowBase::SetParent()
353 void SetParent( WindowBase* parentWinBase ) override;
356 * @copydoc Dali::Internal::Adaptor::WindowBase::CreateFrameRenderedSyncFence()
358 int CreateFrameRenderedSyncFence() override;
361 * @copydoc Dali::Internal::Adaptor::WindowBase::CreateFramePresentedSyncFence()
363 int CreateFramePresentedSyncFence() override;
368 * Second stage initialization
370 void Initialize( PositionSize positionSize, Any surface, bool isTransparent );
373 * @brief Get the surface id if the surface parameter is not empty
374 * @param surface Any containing a surface id, or can be empty
375 * @return surface id, or zero if surface is empty
377 uintptr_t GetSurfaceId( Any surface ) const;
380 * @brief Create window
382 void CreateWinWindow( PositionSize positionSize, bool isTransparent );
385 * @brief Sets up an already created window.
387 void SetWinWindow( uintptr_t surfaceId );
392 WindowBaseWin(const WindowBaseWin&) = delete;
395 WindowBaseWin& operator=(const WindowBaseWin& rhs) = delete;
398 void EventEntry( TWinEventInfo *event );
401 WinWindowHandle mWin32Window; ///< Native window handle
402 bool mOwnSurface:1; ///< Whether we own the surface (responsible for deleting it)
403 bool mIsTransparent:1; ///< Whether the window is transparent (32 bit or 24 bit)
404 bool mRotationAppSet:1;
406 WindowsPlatform::WindowImpl mWindowImpl;
409 } // namespace Adaptor
411 } // namespace internal
415 #endif // DALI_INTERNAL_WINDOWSYSTEM_WINDOW_BASE_WIN_H