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 virtual Any GetNativeWindow() override;
115 * @copydoc Dali::Internal::Adaptor::WindowBase::GetNativeWindowId()
117 virtual int GetNativeWindowId() override;
120 * @copydoc Dali::Internal::Adaptor::WindowBase::CreateEglWindow()
122 virtual EGLNativeWindowType CreateEglWindow( int width, int height ) override;
125 * @copydoc Dali::Internal::Adaptor::WindowBase::DestroyEglWindow()
127 virtual void DestroyEglWindow() override;
130 * @copydoc Dali::Internal::Adaptor::WindowBase::SetEglWindowRotation()
132 virtual void SetEglWindowRotation( int angle ) override;
135 * @copydoc Dali::Internal::Adaptor::WindowBase::SetEglWindowBufferTransform()
137 virtual void SetEglWindowBufferTransform( int angle ) override;
140 * @copydoc Dali::Internal::Adaptor::WindowBase::SetEglWindowTransform()
142 virtual void SetEglWindowTransform( int angle ) override;
145 * @copydoc Dali::Internal::Adaptor::WindowBase::ResizeEglWindow()
147 virtual void ResizeEglWindow( PositionSize positionSize ) override;
150 * @copydoc Dali::Internal::Adaptor::WindowBase::IsEglWindowRotationSupported()
152 virtual bool IsEglWindowRotationSupported() override;
155 * @copydoc Dali::Internal::Adaptor::WindowBase::Move()
157 virtual void Move( PositionSize positionSize ) override;
160 * @copydoc Dali::Internal::Adaptor::WindowBase::Resize()
162 virtual void Resize( PositionSize positionSize ) override;
165 * @copydoc Dali::Internal::Adaptor::WindowBase::MoveResize()
167 virtual void MoveResize( PositionSize positionSize ) override;
170 * @copydoc Dali::Internal::Adaptor::WindowBase::SetClass()
172 virtual void SetClass( const std::string& name, const std::string& className ) override;
175 * @copydoc Dali::Internal::Adaptor::WindowBase::Raise()
177 virtual void Raise() override;
180 * @copydoc Dali::Internal::Adaptor::WindowBase::Lower()
182 virtual void Lower() override;
185 * @copydoc Dali::Internal::Adaptor::WindowBase::Activate()
187 virtual void Activate() override;
190 * @copydoc Dali::Internal::Adaptor::WindowBase::SetAvailableAnlges()
192 virtual void SetAvailableAnlges( const std::vector< int >& angles ) override;
195 * @copydoc Dali::Internal::Adaptor::WindowBase::SetPreferredAngle()
197 virtual void SetPreferredAngle( int angle ) override;
200 * @copydoc Dali::Internal::Adaptor::WindowBase::SetAcceptFocus()
202 virtual void SetAcceptFocus( bool accept ) override;
205 * @copydoc Dali::Internal::Adaptor::WindowBase::Show()
207 virtual void Show() override;
210 * @copydoc Dali::Internal::Adaptor::WindowBase::Hide()
212 virtual void Hide() override;
215 * @copydoc Dali::Internal::Adaptor::WindowBase::GetSupportedAuxiliaryHintCount()
217 virtual unsigned int GetSupportedAuxiliaryHintCount() const override;
220 * @copydoc Dali::Internal::Adaptor::WindowBase::GetSupportedAuxiliaryHint()
222 virtual std::string GetSupportedAuxiliaryHint( unsigned int index ) const override;
225 * @copydoc Dali::Internal::Adaptor::WindowBase::AddAuxiliaryHint()
227 virtual unsigned int AddAuxiliaryHint( const std::string& hint, const std::string& value ) override;
230 * @copydoc Dali::Internal::Adaptor::WindowBase::RemoveAuxiliaryHint()
232 virtual bool RemoveAuxiliaryHint( unsigned int id ) override;
235 * @copydoc Dali::Internal::Adaptor::WindowBase::SetAuxiliaryHintValue()
237 virtual bool SetAuxiliaryHintValue( unsigned int id, const std::string& value ) override;
240 * @copydoc Dali::Internal::Adaptor::WindowBase::GetAuxiliaryHintValue()
242 virtual std::string GetAuxiliaryHintValue( unsigned int id ) const override;
245 * @copydoc Dali::Internal::Adaptor::WindowBase::GetAuxiliaryHintId()
247 virtual unsigned int GetAuxiliaryHintId( const std::string& hint ) const override;
250 * @copydoc Dali::Internal::Adaptor::WindowBase::SetInputRegion()
252 virtual void SetInputRegion( const Rect< int >& inputRegion ) override;
255 * @copydoc Dali::Internal::Adaptor::WindowBase::SetType()
257 virtual void SetType( Dali::Window::Type type ) override;
260 * @copydoc Dali::Internal::Adaptor::WindowBase::SetNotificationLevel()
262 virtual bool SetNotificationLevel( Dali::Window::NotificationLevel::Type level ) override;
265 * @copydoc Dali::Internal::Adaptor::WindowBase::GetNotificationLevel()
267 virtual Dali::Window::NotificationLevel::Type GetNotificationLevel() const override;
270 * @copydoc Dali::Internal::Adaptor::WindowBase::SetOpaqueState()
272 virtual void SetOpaqueState( bool opaque ) override;
275 * @copydoc Dali::Internal::Adaptor::WindowBase::SetScreenOffMode()
277 virtual bool SetScreenOffMode(Dali::Window::ScreenOffMode::Type screenOffMode) override;
280 * @copydoc Dali::Internal::Adaptor::WindowBase::GetScreenOffMode()
282 virtual Dali::Window::ScreenOffMode::Type GetScreenOffMode() const override;
285 * @copydoc Dali::Internal::Adaptor::WindowBase::SetBrightness()
287 virtual bool SetBrightness( int brightness ) override;
290 * @copydoc Dali::Internal::Adaptor::WindowBase::GetBrightness()
292 virtual int GetBrightness() const override;
295 * @copydoc Dali::Internal::Adaptor::WindowBase::GrabKey()
297 virtual bool GrabKey( Dali::KEY key, KeyGrab::KeyGrabMode grabMode ) override;
300 * @copydoc Dali::Internal::Adaptor::WindowBase::UngrabKey()
302 virtual bool UngrabKey( Dali::KEY key ) override;
305 * @copydoc Dali::Internal::Adaptor::WindowBase::GrabKeyList()
307 virtual 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 virtual bool UngrabKeyList( const Dali::Vector< Dali::KEY >& key, Dali::Vector< bool >& result ) override;
315 * @copydoc Dali::Internal::Adaptor::WindowBase::GetDpi()
317 virtual void GetDpi( unsigned int& dpiHorizontal, unsigned int& dpiVertical ) override;
320 * @copydoc Dali::Internal::Adaptor::WindowBase::GetScreenRotationAngle()
322 virtual int GetScreenRotationAngle() override;
325 * @copydoc Dali::Internal::Adaptor::WindowBase::SetWindowRotationAngle()
327 virtual void SetWindowRotationAngle( int degree ) override;
330 * @copydoc Dali::Internal::Adaptor::WindowBase::WindowRotationCompleted()
332 virtual void WindowRotationCompleted( int degree, int width, int height ) override;
335 * @copydoc Dali::Internal::Adaptor::WindowBase::SetTransparency()
337 virtual void SetTransparency( bool transparent ) override;
340 * @copydoc Dali::Internal::Adaptor::WindowBase::SetParent()
342 virtual void SetParent( WindowBase* parentWinBase ) override;
347 * Second stage initialization
349 void Initialize( PositionSize positionSize, Any surface, bool isTransparent );
352 * @brief Get the surface id if the surface parameter is not empty
353 * @param surface Any containing a surface id, or can be empty
354 * @return surface id, or zero if surface is empty
356 unsigned int GetSurfaceId( Any surface ) const;
359 * @brief Create window
361 void CreateWinWindow( PositionSize positionSize, bool isTransparent );
364 * @brief Sets up an already created window.
366 void SetWinWindow( unsigned int surfaceId );
371 WindowBaseWin(const WindowBaseWin&) = delete;
374 WindowBaseWin& operator=(const WindowBaseWin& rhs) = delete;
377 void EventEntry( TWinEventInfo *event );
380 WinWindowHandle mWin32Window; ///< Native window handle
381 bool mOwnSurface:1; ///< Whether we own the surface (responsible for deleting it)
382 bool mIsTransparent:1; ///< Whether the window is transparent (32 bit or 24 bit)
383 bool mRotationAppSet:1;
385 WindowsPlatformImplementation::WindowImpl mWindowImpl;
388 } // namespace Adaptor
390 } // namespace internal
394 #endif // DALI_INTERNAL_WINDOWSYSTEM_WINDOW_BASE_WIN_H