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::ShowIndicator()
172 virtual void ShowIndicator( Dali::Window::IndicatorVisibleMode visibleMode, Dali::Window::IndicatorBgOpacity opacityMode ) override;
175 * @copydoc Dali::Internal::Adaptor::WindowBase::SetIndicatorProperties()
177 virtual void SetIndicatorProperties( bool isShow, Dali::Window::WindowOrientation lastOrientation ) override;
180 * @copydoc Dali::Internal::Adaptor::WindowBase::IndicatorTypeChanged()
182 virtual void IndicatorTypeChanged( IndicatorInterface::Type type ) override;
185 * @copydoc Dali::Internal::Adaptor::WindowBase::SetClass()
187 virtual void SetClass( const std::string& name, const std::string& className ) override;
190 * @copydoc Dali::Internal::Adaptor::WindowBase::Raise()
192 virtual void Raise() override;
195 * @copydoc Dali::Internal::Adaptor::WindowBase::Lower()
197 virtual void Lower() override;
200 * @copydoc Dali::Internal::Adaptor::WindowBase::Activate()
202 virtual void Activate() override;
205 * @copydoc Dali::Internal::Adaptor::WindowBase::SetAvailableOrientations()
207 virtual void SetAvailableOrientations( const std::vector< Dali::Window::WindowOrientation >& orientations ) override;
210 * @copydoc Dali::Internal::Adaptor::WindowBase::SetPreferredOrientation()
212 virtual void SetPreferredOrientation( Dali::Window::WindowOrientation orientation ) override;
215 * @copydoc Dali::Internal::Adaptor::WindowBase::SetAcceptFocus()
217 virtual void SetAcceptFocus( bool accept ) override;
220 * @copydoc Dali::Internal::Adaptor::WindowBase::Show()
222 virtual void Show() override;
225 * @copydoc Dali::Internal::Adaptor::WindowBase::Hide()
227 virtual void Hide() override;
230 * @copydoc Dali::Internal::Adaptor::WindowBase::GetSupportedAuxiliaryHintCount()
232 virtual unsigned int GetSupportedAuxiliaryHintCount() const override;
235 * @copydoc Dali::Internal::Adaptor::WindowBase::GetSupportedAuxiliaryHint()
237 virtual std::string GetSupportedAuxiliaryHint( unsigned int index ) const override;
240 * @copydoc Dali::Internal::Adaptor::WindowBase::AddAuxiliaryHint()
242 virtual unsigned int AddAuxiliaryHint( const std::string& hint, const std::string& value ) override;
245 * @copydoc Dali::Internal::Adaptor::WindowBase::RemoveAuxiliaryHint()
247 virtual bool RemoveAuxiliaryHint( unsigned int id ) override;
250 * @copydoc Dali::Internal::Adaptor::WindowBase::SetAuxiliaryHintValue()
252 virtual bool SetAuxiliaryHintValue( unsigned int id, const std::string& value ) override;
255 * @copydoc Dali::Internal::Adaptor::WindowBase::GetAuxiliaryHintValue()
257 virtual std::string GetAuxiliaryHintValue( unsigned int id ) const override;
260 * @copydoc Dali::Internal::Adaptor::WindowBase::GetAuxiliaryHintId()
262 virtual unsigned int GetAuxiliaryHintId( const std::string& hint ) const override;
265 * @copydoc Dali::Internal::Adaptor::WindowBase::SetInputRegion()
267 virtual void SetInputRegion( const Rect< int >& inputRegion ) override;
270 * @copydoc Dali::Internal::Adaptor::WindowBase::SetType()
272 virtual void SetType( Dali::Window::Type type ) override;
275 * @copydoc Dali::Internal::Adaptor::WindowBase::SetNotificationLevel()
277 virtual bool SetNotificationLevel( Dali::Window::NotificationLevel::Type level ) override;
280 * @copydoc Dali::Internal::Adaptor::WindowBase::GetNotificationLevel()
282 virtual Dali::Window::NotificationLevel::Type GetNotificationLevel() const override;
285 * @copydoc Dali::Internal::Adaptor::WindowBase::SetOpaqueState()
287 virtual void SetOpaqueState( bool opaque ) override;
290 * @copydoc Dali::Internal::Adaptor::WindowBase::SetScreenOffMode()
292 virtual bool SetScreenOffMode(Dali::Window::ScreenOffMode::Type screenOffMode) override;
295 * @copydoc Dali::Internal::Adaptor::WindowBase::GetScreenOffMode()
297 virtual Dali::Window::ScreenOffMode::Type GetScreenOffMode() const override;
300 * @copydoc Dali::Internal::Adaptor::WindowBase::SetBrightness()
302 virtual bool SetBrightness( int brightness ) override;
305 * @copydoc Dali::Internal::Adaptor::WindowBase::GetBrightness()
307 virtual int GetBrightness() const override;
310 * @copydoc Dali::Internal::Adaptor::WindowBase::GrabKey()
312 virtual bool GrabKey( Dali::KEY key, KeyGrab::KeyGrabMode grabMode ) override;
315 * @copydoc Dali::Internal::Adaptor::WindowBase::UngrabKey()
317 virtual bool UngrabKey( Dali::KEY key ) override;
320 * @copydoc Dali::Internal::Adaptor::WindowBase::GrabKeyList()
322 virtual bool GrabKeyList( const Dali::Vector< Dali::KEY >& key, const Dali::Vector< KeyGrab::KeyGrabMode >& grabMode, Dali::Vector< bool >& result ) override;
325 * @copydoc Dali::Internal::Adaptor::WindowBase::UngrabKeyList()
327 virtual bool UngrabKeyList( const Dali::Vector< Dali::KEY >& key, Dali::Vector< bool >& result ) override;
330 * @copydoc Dali::Internal::Adaptor::WindowBase::GetDpi()
332 virtual void GetDpi( unsigned int& dpiHorizontal, unsigned int& dpiVertical ) override;
335 * @copydoc Dali::Internal::Adaptor::WindowBase::GetScreenRotationAngle()
337 virtual int GetScreenRotationAngle() override;
340 * @copydoc Dali::Internal::Adaptor::WindowBase::SetWindowRotationAngle()
342 virtual void SetWindowRotationAngle( int degree ) override;
345 * @copydoc Dali::Internal::Adaptor::WindowBase::WindowRotationCompleted()
347 virtual void WindowRotationCompleted( int degree, int width, int height ) override;
350 * @copydoc Dali::Internal::Adaptor::WindowBase::SetTransparency()
352 virtual void SetTransparency( bool transparent ) override;
357 * Second stage initialization
359 void Initialize( PositionSize positionSize, Any surface, bool isTransparent );
362 * @brief Get the surface id if the surface parameter is not empty
363 * @param surface Any containing a surface id, or can be empty
364 * @return surface id, or zero if surface is empty
366 unsigned int GetSurfaceId( Any surface ) const;
369 * @brief Create window
371 void CreateWinWindow( PositionSize positionSize, bool isTransparent );
376 WindowBaseWin(const WindowBaseWin&) = delete;
379 WindowBaseWin& operator=(const WindowBaseWin& rhs) = delete;
382 void EventEntry( TWinEventInfo *event );
385 WinWindowHandle mWin32Window; ///< Native window handle
386 bool mOwnSurface:1; ///< Whether we own the surface (responsible for deleting it)
387 bool mIsTransparent:1; ///< Whether the window is transparent (32 bit or 24 bit)
388 bool mRotationAppSet:1;
391 } // namespace Adaptor
393 } // namespace internal
397 #endif // DALI_INTERNAL_WINDOWSYSTEM_WINDOW_BASE_WIN_H