[Tizen] Add codes for Dali Windows Backend
[platform/core/uifw/dali-adaptor.git] / dali / internal / window-system / windows / window-render-surface-ecore-win.h
1 #ifndef DALI_INTERNAL_ECORE_WIN_WINDOW_RENDER_SURFACE_H
2 #define DALI_INTERNAL_ECORE_WIN_WINDOW_RENDER_SURFACE_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/integration-api/egl-interface.h>
23 #include <dali/internal/window-system/common/window-render-surface.h>
24 #include <dali/internal/window-system/windows/ecore-win-types.h>
25 #include <Win32WindowSystem.h>
26
27 namespace Dali
28 {
29 namespace Internal
30 {
31 namespace Adaptor
32 {
33
34 /**
35  * Ecore Win Window implementation of render surface.
36  */
37 class WindowRenderSurfaceEcoreWin : public WindowRenderSurface
38 {
39 public:
40
41   /**
42     * Uses an Windows surface to render to.
43     * @param [in] positionSize the position and size of the surface
44     * @param [in] surface can be a Windows-window or Windows-pixmap (type must be unsigned int).
45     * @param [in] name optional name of surface passed in
46     * @param [in] className optional class name of the surface passed in
47     * @param [in] isTransparent if it is true, surface has 32 bit color depth, otherwise, 24 bit
48     */
49   WindowRenderSurfaceEcoreWin( Dali::PositionSize positionSize,
50                        Any surface,
51                        const std::string& name,
52                        const std::string& className,
53                        bool isTransparent = false );
54
55   /**
56    * @brief Destructor
57    */
58   virtual ~WindowRenderSurfaceEcoreWin();
59
60 public: // API
61
62   /**
63    * @brief Get window handle
64    * @return the Ecore win window handle
65    */
66   Ecore_Win_Window GetWinWindow();
67
68   /**
69    * Request to approve deiconify operation
70    * If it is requested, it will send ECORE_WIN_ATOM_E_DEICONIFY_APPROVE event to window manager after rendering
71    */
72   void RequestToApproveDeiconify();
73
74 public: // from WindowRenderSurface
75
76   /**
77    * @copydoc Dali::Internal::Adaptor::WindowRenderSurface::GetWindow()
78    */
79   virtual Any GetWindow() override;
80
81   /**
82    * @copydoc Dali::Internal::Adaptor::WindowRenderSurface::Map()
83    */
84   virtual void Map() override;
85
86   /**
87    * @copydoc Dali::Internal::Adaptor::WindowRenderSurface::SetRenderNotification()
88    */
89   virtual void SetRenderNotification( TriggerEventInterface* renderNotification ) override;
90
91   /**
92    * @copydoc Dali::Internal::Adaptor::WindowRenderSurface::SetTransparency()
93    */
94   virtual void SetTransparency( bool transparent ) override;
95
96   /**
97    * @copydoc Dali::Internal::Adaptor::WindowRenderSurface::RequestRotation()
98    */
99   virtual void RequestRotation( int angle, int width, int height ) override;
100
101 public: // from Dali::RenderSurface
102
103   /**
104    * @copydoc Dali::RenderSurface::GetPositionSize()
105    */
106   virtual PositionSize GetPositionSize() const override;
107
108   /**
109    * @copydoc Dali::RenderSurface::GetDpi()
110    */
111   virtual void GetDpi( unsigned int& dpiHorizontal, unsigned int& dpiVertical ) override;
112
113   /**
114    * @copydoc Dali::RenderSurface::InitializeEgl()
115    */
116   virtual void InitializeEgl( EglInterface& egl ) override;
117
118   /**
119    * @copydoc Dali::RenderSurface::CreateEglSurface()
120    */
121   virtual void CreateEglSurface( EglInterface& egl ) override;
122
123   /**
124    * @copydoc Dali::RenderSurface::DestroyEglSurface()
125    */
126   virtual void DestroyEglSurface( EglInterface& egl ) override;
127
128   /**
129    * @copydoc Dali::RenderSurface::ReplaceEGLSurface()
130    */
131   virtual bool ReplaceEGLSurface( EglInterface& egl ) override;
132
133   /**
134    * @copydoc Dali::RenderSurface::MoveResize()
135    */
136   virtual void MoveResize( Dali::PositionSize positionSize) override;
137
138   /**
139    * @copydoc Dali::RenderSurface::SetViewMode()
140    */
141   virtual void SetViewMode( ViewMode viewMode ) override;
142
143   /**
144    * @copydoc Dali::RenderSurface::StartRender()
145    */
146   virtual void StartRender() override;
147
148   /**
149    * @copydoc Dali::RenderSurface::PreRender()
150    */
151   virtual bool PreRender( EglInterface& egl, Integration::GlAbstraction& glAbstraction, bool resizingSurface ) override;
152
153   /**
154    * @copydoc Dali::RenderSurface::PostRender()
155    */
156   virtual void PostRender( EglInterface& egl, Integration::GlAbstraction& glAbstraction, DisplayConnection* displayConnection, bool replacingSurface, bool resizingSurface );
157
158   /**
159    * @copydoc Dali::RenderSurface::StopRender()
160    */
161   virtual void StopRender() override;
162
163   /**
164    * @copydoc Dali::RenderSurface::SetThreadSynchronization
165    */
166   virtual void SetThreadSynchronization( ThreadSynchronizationInterface& threadSynchronization ) override;
167
168   /**
169    * @copydoc Dali::RenderSurface::ReleaseLock()
170    */
171   virtual void ReleaseLock() override;
172
173   /**
174    * @copydoc Dali::RenderSurface::GetSurfaceType()
175    */
176   virtual RenderSurface::Type GetSurfaceType() override;
177
178 private: // from WindowRenderSurface
179
180   /**
181    * @copydoc Dali::Internal::Adaptor::WindowRenderSurface::Initialize()
182    */
183   void Initialize( Any surface ) override;
184
185   /**
186    * @copydoc Dali::Internal::Adaptor::WindowRenderSurface::CreateRenderable()
187    */
188   void CreateRenderable() override;
189
190   /**
191    * @copydoc Dali::Internal::Adaptor::WindowRenderSurface::UseExistingRenderable()
192    */
193   void UseExistingRenderable( unsigned int surfaceId ) override;
194
195 private:
196
197   /**
198    * Get the surface id if the surface parameter is not empty
199    * @param surface Any containing a surface id, or can be empty
200    * @return surface id, or zero if surface is empty
201    */
202   unsigned int GetSurfaceId( Any surface ) const;
203
204 private: // Data
205
206   std::string      mTitle;                  ///< Title of window which shows from "xinfo -topvwins" command
207   std::string      mClassName;              ///< The class name of the window
208   PositionSize     mPosition;               ///< Position
209   ColorDepth       mColorDepth;             ///< Color depth of surface (32 bit or 24 bit)
210   Ecore_Win_Window mWinWindow;              ///< Win-Window
211   bool             mOwnSurface;             ///< Whether we own the surface (responsible for deleting it)
212   bool             mNeedToApproveDeiconify; ///< Whether need to send ECORE_WIN_ATOM_E_DEICONIFY_APPROVE event
213
214 }; // class WindowRenderSurfaceEcoreWin
215
216 } // namespace Adaptor
217
218 } // namespace internal
219
220 } // namespace Dali
221
222 #endif // __DALI_INTERNAL_ECORE_WIN_WINDOW_RENDER_SURFACE_H__