Revert "[Tizen] Sync for libds"
[platform/core/uifw/dali-adaptor.git] / dali / devel-api / adaptor-framework / offscreen-application.h
1 #ifndef DALI_OFFSCREEN_APPLICATION_H
2 #define DALI_OFFSCREEN_APPLICATION_H
3
4 /*
5  * Copyright (c) 2020 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 #include <dali/public-api/object/base-handle.h>
24 #include <dali/public-api/signals/dali-signal.h>
25
26 namespace Dali
27 {
28 /**
29  * @addtogroup dali_adaptor_framework
30  * @{
31  */
32
33 class OffscreenWindow;
34
35 namespace Internal
36 {
37 class OffscreenApplication;
38 }
39
40 /**
41  * @brief Appliations can draw UI on offscreen surface with the OffscreenApplication.
42  * When you use a OffscreenApplication, you don't have to create a Window.
43  */
44 class DALI_IMPORT_API OffscreenApplication : public Dali::BaseHandle
45 {
46 public:
47   using OffscreenApplicationSignalType = Signal<void(void)>;
48
49   /**
50    * @brief Enumeration for the render mode
51    */
52   enum class RenderMode
53   {
54     AUTO,  // Scene is rendered automatically
55     MANUAL // Scene is rendered by RenderOnce()
56   };
57
58 public:
59   /**
60    * @brief This is the constructor of OffscreenApplication
61    *
62    * @param[in] width The initial width of the default OffscreenWindow
63    * @param[in] height The initial height of the default OffscreenWindow
64    * @param[in] isTranslucent Whether the OffscreenWindow is translucent or not
65    * @param[in] renderMode The RenderMode of the OffscreenApplication
66    */
67   static OffscreenApplication New(uint16_t width, uint16_t height, bool isTranslucent, RenderMode renderMode = RenderMode::AUTO);
68
69   /**
70    * @brief This is the constructor of OffscreenApplication
71    *
72    * @param[in] surface The native surface handle to create the OffscreenWindow
73    * @param[in] renderMode The RenderMode of the OffscreenApplication
74    */
75   static OffscreenApplication New(Dali::Any surface, RenderMode renderMode = RenderMode::AUTO);
76
77   /**
78    * @brief Constructs an empty handle
79    */
80   OffscreenApplication();
81
82   /**
83    * @brief Copy constructor
84    *
85    * @param [in] offscreenApplication A reference to the copied handle
86    */
87   OffscreenApplication(const OffscreenApplication& offscreenApplication);
88
89   /**
90    * @brief Assignment operator
91    *
92    * @param [in] offscreenApplication A reference to the copied handle
93    * @return A reference to this
94    */
95   OffscreenApplication& operator=(const OffscreenApplication& offscreenApplication);
96
97   /**
98    * @brief Destructor
99    */
100   ~OffscreenApplication();
101
102 public:
103   /**
104    * @brief Starts the OffscreenApplication (rendering, event handling, etc)
105    */
106   void Start();
107
108   /**
109    * @brief Stops the OffscreenApplication
110    */
111   void Stop();
112
113   /**
114    * @brief Get the default OffscreenWindow handle
115    * @return The default OffscreenWindow
116    */
117   OffscreenWindow GetWindow();
118
119   /**
120    * @brief Renders once more even if we're paused
121    */
122   void RenderOnce();
123
124 public: // Signals
125         /**
126    * @brief Signal to notify the client when the application is ready to be initialized
127    *
128    * @note OffscreenApplication::Start() should be called to be initialized
129    *
130    * @return The signal
131    */
132   OffscreenApplicationSignalType& InitSignal();
133
134   /**
135    * @brief Signal to notify the user when the application is about to be terminated
136    *
137    * @return The signal
138    */
139   OffscreenApplicationSignalType& TerminateSignal();
140
141 public: // Not intended for application developers
142   /**
143    * @brief Internal constructor
144    */
145   explicit DALI_INTERNAL OffscreenApplication(Internal::OffscreenApplication* offscreenApplication);
146 };
147
148 /**
149  * @}
150  */
151
152 } // namespace Dali
153
154 #endif // DALI_OFFSCREEN_APPLICATION_H