Move GetDpi implementation to RenderSurface
[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/integration-api/render-surface.h>
26
27 #include <memory>
28
29 namespace Dali
30 {
31
32 class EglInterface;
33
34 namespace Internal
35 {
36 namespace Adaptor
37 {
38 class DisplayConnection;
39 }
40 }
41
42 class DisplayConnection
43 {
44 public:
45
46   /**
47    * @brief Create an initialized DisplayConnection.
48    *
49    * @return A handle to a newly allocated DisplayConnection resource.
50    */
51   static DisplayConnection* New();
52
53   /**
54    * @brief Create an initialized DisplayConnection.
55    * Native surface will need this instead of DisplayConnection::New()
56    *
57    * @param[in] type Render surface type
58    * @return A handle to a newly allocated DisplayConnection resource.
59    */
60   static DisplayConnection* New( RenderSurface::Type type );
61
62   /**
63    * @brief Create a DisplayConnection handle; this can be initialised with DisplayConnection::New().
64    *
65    * Calling member functions with an uninitialised handle is not allowed.
66    */
67   DisplayConnection();
68
69   /**
70    * @brief Destructor
71    *
72    * This is non-virtual since derived Handle types must not contain data or virtual methods.
73    */
74   ~DisplayConnection();
75
76   /**
77    * @brief Get display
78    *
79    * @return display
80    */
81   Any GetDisplay();
82
83   /**
84    * @brief Consumes any possible events on the queue so that there is no leaking between frames
85    */
86   void ConsumeEvents();
87
88   /**
89    * @brief Initialize EGL display
90    *
91    * @param egl implementation to use for the creation
92    */
93   bool InitializeEgl(EglInterface& egl);
94
95 public:
96
97   /**
98    * @brief This constructor is used by DisplayConnection New() methods.
99    *
100    * @param [in] handle A pointer to a newly allocated DisplayConnection resource
101    */
102   explicit DALI_INTERNAL DisplayConnection(Internal::Adaptor::DisplayConnection* impl);
103
104 private:
105
106   std::unique_ptr<Internal::Adaptor::DisplayConnection> mImpl;
107 };
108
109 }
110
111 #endif // DALI_INTERNAL_WINDOWSYSTEM_COMMON_DISPLAY_CONNECTION_H