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