19588c845ab0d4e37adce68e60eaeca8db6cde51
[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 /**
22  * @addtogroup dali_adaptor_framework
23  * @{
24  */
25
26 // EXTERNAL INCLUDES
27 #include <dali/public-api/signals/dali-signal.h>
28 #include <dali/public-api/object/any.h>
29
30 namespace Dali
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 make a Window.
43  */
44 class DALI_IMPORT_API OffscreenApplication : public Dali::BaseHandle
45 {
46 public:
47
48   typedef Signal<void (void)> OffscreenApplicationSignalType;
49
50 public:
51
52   /**
53    * @brief This is the constructor of OffscreenApplication
54    *
55    * @param[in] width The initial width of the default OffscreenWindow
56    * @param[in] height The initial height of the default OffscreenWindow
57    * @param[in] isTranslucent Whether the OffscreenWindow is translucent or not
58    */
59   static OffscreenApplication New( uint16_t width, uint16_t height, bool isTranslucent );
60
61   /**
62    * @brief This is the constructor of OffscreenApplication
63    *
64    * @param[in] surface The native surface handle to create the OffscreenWindow
65    * @param[in] isTranslucent Whether the OffscreenWindow is translucent or not
66    */
67   static OffscreenApplication New( Dali::Any surface, bool isTranslucent );
68
69   /**
70    * @brief Constructs an empty handle
71    */
72  OffscreenApplication();
73
74   /**
75    * @brief Copy constructor
76    */
77  OffscreenApplication( const OffscreenApplication& offscreenApplication );
78
79   /**
80    * @brief Assignment operator
81    */
82  OffscreenApplication& operator=( const OffscreenApplication& offscreenApplication );
83
84   /**
85    * @brief Destructor
86    */
87    ~OffscreenApplication();
88
89 public:
90
91   /**
92    * @brief Runs the OffscreenApplication (rendering, event handling, etc)
93    */
94   void Run();
95
96   /**
97    * @brief Stops the OffscreenApplication
98    */
99   void Stop();
100
101
102   /**
103    * @brief Get the default Window handle
104    * @return The default Window
105    */
106   OffscreenWindow GetWindow();
107
108 public:  // Signals
109
110   /**
111    * @brief Signal to notify the client when the application is ready to be initialized
112    *
113    * @note OffscreenApplication::Run() should be called to be initialized
114    *
115    * @return The signal
116    */
117  OffscreenApplicationSignalType& InitSignal();
118
119   /**
120    * @brief Signal to notify the user when the application is about to be terminated
121    *
122    * @return The signal
123    */
124  OffscreenApplicationSignalType& TerminateSignal();
125
126 public: // Not intended for application developers
127   /**
128    * @brief Internal constructor
129    */
130   explicit DALI_INTERNAL OffscreenApplication( Internal::OffscreenApplication* offscreenApplication );
131
132 };
133
134 /**
135  * @}
136  */
137
138 }  // namespace Dali
139
140 #endif // DALI_OFFSCREEN_APPLICATION_H