[Tizen] ecore-wl2: applying ecore-wl2
[platform/core/uifw/dali-adaptor.git] / dali / internal / window-system / common / display-connection.h
1 #ifndef DALI_INTERNAL_WINDOWSYSTEM_COMMON_DISPLAY_CONNECTION_H
2 #define DALI_INTERNAL_WINDOWSYSTEM_COMMON_DISPLAY_CONNECTION_H
3
4 /*
5  * Copyright (c) 2015 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 // EXTERNAL INCLUDES
22 #include <dali/public-api/object/any.h>
23
24 // INTERNAL INCLUDES
25 #include <dali/devel-api/adaptor-framework/render-surface.h>
26 #include <dali/public-api/adaptor-framework/window.h>
27
28 #include <memory>
29
30 namespace Dali
31 {
32
33 class EglInterface;
34
35 namespace Internal
36 {
37 namespace Adaptor
38 {
39 class DisplayConnection;
40 }
41 }
42
43 class DisplayConnection
44 {
45 public:
46
47   /**
48    * @brief Create an initialized DisplayConnection.
49    *
50    * @return A handle to a newly allocated DisplayConnection resource.
51    */
52   static DisplayConnection* New();
53
54   /**
55    * @brief Create an initialized DisplayConnection.
56    * Native surface will need this instead of DisplayConnection::New()
57    *
58    * @param[in] type Render surface type
59    * @return A handle to a newly allocated DisplayConnection resource.
60    */
61   static DisplayConnection* New( RenderSurface::Type type );
62
63   /**
64    * @brief Create a DisplayConnection handle; this can be initialised with DisplayConnection::New().
65    *
66    * Calling member functions with an uninitialised handle is not allowed.
67    */
68   DisplayConnection();
69
70   /**
71    * @brief Destructor
72    *
73    * This is non-virtual since derived Handle types must not contain data or virtual methods.
74    */
75   ~DisplayConnection();
76
77   /**
78    * @brief Get display
79    *
80    * @return display
81    */
82   Any GetDisplay();
83
84   /**
85    * @brief Get DPI
86    * @param[out] dpiHorizontal set to the horizontal dpi
87    * @param[out] dpiVertical set to the vertical dpi
88    */
89   static void GetDpi(unsigned int& dpiHorizontal, unsigned int& dpiVertical);
90
91   /**
92    * @brief Get DPI
93    * @param [in] handle A pointer to a newly allocated DisplayConnection resource
94    * @param[out] dpiHorizontal set to the horizontal dpi
95    * @param[out] dpiVertical set to the vertical dpi
96    */
97   static void GetDpi(Any nativeWindow, unsigned int& dpiHorizontal, unsigned int& dpiVertical);
98
99   /**
100    * @brief Consumes any possible events on the queue so that there is no leaking between frames
101    */
102   void ConsumeEvents();
103
104   /**
105    * @brief Initialize EGL display
106    *
107    * @param egl implementation to use for the creation
108    */
109   bool InitializeEgl(EglInterface& egl);
110
111 public:
112
113   /**
114    * @brief This constructor is used by DisplayConnection New() methods.
115    *
116    * @param [in] handle A pointer to a newly allocated DisplayConnection resource
117    */
118   explicit DALI_INTERNAL DisplayConnection(Internal::Adaptor::DisplayConnection* impl);
119
120 private:
121
122   std::unique_ptr<Internal::Adaptor::DisplayConnection> mImpl;
123 };
124
125 }
126
127 #endif // DALI_INTERNAL_WINDOWSYSTEM_COMMON_DISPLAY_CONNECTION_H