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 * @brief Called when the window property is changed.
59 bool OnWindowPropertyChanged( void* data, int type, TWinEventInfo *event );
62 * Called when the window receives a delete request
64 void OnDeleteRequest();
67 * @brief Called when the window gains focus.
69 void OnFocusIn( void* data, int type, TWinEventInfo *event );
72 * @brief Called when the window loses focus.
74 void OnFocusOut( void* data, int type, TWinEventInfo *event );
77 * @brief Called when the window is damaged.
79 void OnWindowDamaged( void* data, int type, TWinEventInfo *event );
82 * @brief Called when a touch down is received.
84 void OnMouseButtonDown( void* data, int type, TWinEventInfo *event );
87 * @brief Called when a touch up is received.
89 void OnMouseButtonUp( void* data, int type, TWinEventInfo *event );
92 * @brief Called when a touch motion is received.
94 void OnMouseButtonMove( void* data, int type, TWinEventInfo *event );
97 * @brief Called when a mouse wheel is received.
99 void OnMouseWheel( void* data, int type, TWinEventInfo *event );
102 * @brief Called when a key down is received.
104 void OnKeyDown( void* data, int type, TWinEventInfo *event );
107 * @brief Called when a key up is received.
109 void OnKeyUp( void* data, int type, TWinEventInfo *event );
112 * @brief Called when the source window notifies us the content in clipboard is selected.
114 void OnSelectionClear( void* data, int type, TWinEventInfo *event );
117 * @brief Called when the source window sends us about the selected content.
119 void OnSelectionNotify( void* data, int type, TWinEventInfo *event );
124 * @copydoc Dali::Internal::Adaptor::WindowBase::GetNativeWindow()
126 virtual Any GetNativeWindow() override;
129 * @copydoc Dali::Internal::Adaptor::WindowBase::GetNativeWindowId()
131 virtual int GetNativeWindowId() override;
134 * @copydoc Dali::Internal::Adaptor::WindowBase::CreateEglWindow()
136 virtual EGLNativeWindowType CreateEglWindow( int width, int height ) override;
139 * @copydoc Dali::Internal::Adaptor::WindowBase::DestroyEglWindow()
141 virtual void DestroyEglWindow() override;
144 * @copydoc Dali::Internal::Adaptor::WindowBase::SetEglWindowRotation()
146 virtual void SetEglWindowRotation( int angle ) override;
149 * @copydoc Dali::Internal::Adaptor::WindowBase::SetEglWindowBufferTransform()
151 virtual void SetEglWindowBufferTransform( int angle ) override;
154 * @copydoc Dali::Internal::Adaptor::WindowBase::SetEglWindowTransform()
156 virtual void SetEglWindowTransform( int angle ) override;
159 * @copydoc Dali::Internal::Adaptor::WindowBase::ResizeEglWindow()
161 virtual void ResizeEglWindow( PositionSize positionSize ) override;
164 * @copydoc Dali::Internal::Adaptor::WindowBase::IsEglWindowRotationSupported()
166 virtual bool IsEglWindowRotationSupported() override;
169 * @copydoc Dali::Internal::Adaptor::WindowBase::Move()
171 virtual void Move( PositionSize positionSize ) override;
174 * @copydoc Dali::Internal::Adaptor::WindowBase::Resize()
176 virtual void Resize( PositionSize positionSize ) override;
179 * @copydoc Dali::Internal::Adaptor::WindowBase::MoveResize()
181 virtual void MoveResize( PositionSize positionSize ) override;
184 * @copydoc Dali::Internal::Adaptor::WindowBase::ShowIndicator()
186 virtual void ShowIndicator( Dali::Window::IndicatorVisibleMode visibleMode, Dali::Window::IndicatorBgOpacity opacityMode ) override;
189 * @copydoc Dali::Internal::Adaptor::WindowBase::SetIndicatorProperties()
191 virtual void SetIndicatorProperties( bool isShow, Dali::Window::WindowOrientation lastOrientation ) override;
194 * @copydoc Dali::Internal::Adaptor::WindowBase::IndicatorTypeChanged()
196 virtual void IndicatorTypeChanged( IndicatorInterface::Type type ) override;
199 * @copydoc Dali::Internal::Adaptor::WindowBase::SetClass()
201 virtual void SetClass( const std::string& name, const std::string& className ) override;
204 * @copydoc Dali::Internal::Adaptor::WindowBase::Raise()
206 virtual void Raise() override;
209 * @copydoc Dali::Internal::Adaptor::WindowBase::Lower()
211 virtual void Lower() override;
214 * @copydoc Dali::Internal::Adaptor::WindowBase::Activate()
216 virtual void Activate() override;
219 * @copydoc Dali::Internal::Adaptor::WindowBase::SetAvailableOrientations()
221 virtual void SetAvailableOrientations( const std::vector< Dali::Window::WindowOrientation >& orientations ) override;
224 * @copydoc Dali::Internal::Adaptor::WindowBase::SetPreferredOrientation()
226 virtual void SetPreferredOrientation( Dali::Window::WindowOrientation orientation ) override;
229 * @copydoc Dali::Internal::Adaptor::WindowBase::SetAcceptFocus()
231 virtual void SetAcceptFocus( bool accept ) override;
234 * @copydoc Dali::Internal::Adaptor::WindowBase::Show()
236 virtual void Show() override;
239 * @copydoc Dali::Internal::Adaptor::WindowBase::Hide()
241 virtual void Hide() override;
244 * @copydoc Dali::Internal::Adaptor::WindowBase::GetSupportedAuxiliaryHintCount()
246 virtual unsigned int GetSupportedAuxiliaryHintCount() const override;
249 * @copydoc Dali::Internal::Adaptor::WindowBase::GetSupportedAuxiliaryHint()
251 virtual std::string GetSupportedAuxiliaryHint( unsigned int index ) const override;
254 * @copydoc Dali::Internal::Adaptor::WindowBase::AddAuxiliaryHint()
256 virtual unsigned int AddAuxiliaryHint( const std::string& hint, const std::string& value ) override;
259 * @copydoc Dali::Internal::Adaptor::WindowBase::RemoveAuxiliaryHint()
261 virtual bool RemoveAuxiliaryHint( unsigned int id ) override;
264 * @copydoc Dali::Internal::Adaptor::WindowBase::SetAuxiliaryHintValue()
266 virtual bool SetAuxiliaryHintValue( unsigned int id, const std::string& value ) override;
269 * @copydoc Dali::Internal::Adaptor::WindowBase::GetAuxiliaryHintValue()
271 virtual std::string GetAuxiliaryHintValue( unsigned int id ) const override;
274 * @copydoc Dali::Internal::Adaptor::WindowBase::GetAuxiliaryHintId()
276 virtual unsigned int GetAuxiliaryHintId( const std::string& hint ) const override;
279 * @copydoc Dali::Internal::Adaptor::WindowBase::SetInputRegion()
281 virtual void SetInputRegion( const Rect< int >& inputRegion ) override;
284 * @copydoc Dali::Internal::Adaptor::WindowBase::SetType()
286 virtual void SetType( Dali::Window::Type type ) override;
289 * @copydoc Dali::Internal::Adaptor::WindowBase::SetNotificationLevel()
291 virtual bool SetNotificationLevel( Dali::Window::NotificationLevel::Type level ) override;
294 * @copydoc Dali::Internal::Adaptor::WindowBase::GetNotificationLevel()
296 virtual Dali::Window::NotificationLevel::Type GetNotificationLevel() const override;
299 * @copydoc Dali::Internal::Adaptor::WindowBase::SetOpaqueState()
301 virtual void SetOpaqueState( bool opaque ) override;
304 * @copydoc Dali::Internal::Adaptor::WindowBase::SetScreenOffMode()
306 virtual bool SetScreenOffMode(Dali::Window::ScreenOffMode::Type screenOffMode) override;
309 * @copydoc Dali::Internal::Adaptor::WindowBase::GetScreenOffMode()
311 virtual Dali::Window::ScreenOffMode::Type GetScreenOffMode() const override;
314 * @copydoc Dali::Internal::Adaptor::WindowBase::SetBrightness()
316 virtual bool SetBrightness( int brightness ) override;
319 * @copydoc Dali::Internal::Adaptor::WindowBase::GetBrightness()
321 virtual int GetBrightness() const override;
324 * @copydoc Dali::Internal::Adaptor::WindowBase::GrabKey()
326 virtual bool GrabKey( Dali::KEY key, KeyGrab::KeyGrabMode grabMode ) override;
329 * @copydoc Dali::Internal::Adaptor::WindowBase::UngrabKey()
331 virtual bool UngrabKey( Dali::KEY key ) override;
334 * @copydoc Dali::Internal::Adaptor::WindowBase::GrabKeyList()
336 virtual bool GrabKeyList( const Dali::Vector< Dali::KEY >& key, const Dali::Vector< KeyGrab::KeyGrabMode >& grabMode, Dali::Vector< bool >& result ) override;
339 * @copydoc Dali::Internal::Adaptor::WindowBase::UngrabKeyList()
341 virtual bool UngrabKeyList( const Dali::Vector< Dali::KEY >& key, Dali::Vector< bool >& result ) override;
344 * @copydoc Dali::Internal::Adaptor::WindowBase::GetDpi()
346 virtual void GetDpi( unsigned int& dpiHorizontal, unsigned int& dpiVertical ) override;
349 * @copydoc Dali::Internal::Adaptor::WindowBase::SetViewMode()
351 virtual void SetViewMode( ViewMode viewMode ) override;
354 * @copydoc Dali::Internal::Adaptor::WindowBase::GetScreenRotationAngle()
356 virtual int GetScreenRotationAngle() override;
359 * @copydoc Dali::Internal::Adaptor::WindowBase::SetWindowRotationAngle()
361 virtual void SetWindowRotationAngle( int degree ) override;
364 * @copydoc Dali::Internal::Adaptor::WindowBase::WindowRotationCompleted()
366 virtual void WindowRotationCompleted( int degree, int width, int height ) override;
369 * @copydoc Dali::Internal::Adaptor::WindowBase::SetTransparency()
371 virtual void SetTransparency( bool transparent ) override;
376 * Second stage initialization
378 void Initialize( PositionSize positionSize, Any surface, bool isTransparent );
381 * @brief Get the surface id if the surface parameter is not empty
382 * @param surface Any containing a surface id, or can be empty
383 * @return surface id, or zero if surface is empty
385 unsigned int GetSurfaceId( Any surface ) const;
388 * @brief Create window
390 void CreateWinWindow( PositionSize positionSize, bool isTransparent );
395 WindowBaseWin(const WindowBaseWin&) = delete;
398 WindowBaseWin& operator=(const WindowBaseWin& rhs) = delete;
402 Dali::Vector< Event_Handler > mEventHandler;
403 Win_Window_Handle mWin32Window; ///< Native window handle
404 bool mOwnSurface:1; ///< Whether we own the surface (responsible for deleting it)
405 bool mIsTransparent; ///< Whether the window is transparent (32 bit or 24 bit)
406 bool mRotationAppSet:1;
409 } // namespace Adaptor
411 } // namespace internal
415 #endif // DALI_INTERNAL_WINDOWSYSTEM_WINDOW_BASE_WIN_H