Revert "[Tizen] Add GlWindow"
[platform/core/uifw/dali-adaptor.git] / dali / internal / offscreen / common / offscreen-application-impl.h
1 #ifndef DALI_INTERNAL_OFFSCREEN_APPLICATION_IMPL_H
2 #define DALI_INTERNAL_OFFSCREEN_APPLICATION_IMPL_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 <memory>
23 #include <dali/public-api/common/intrusive-ptr.h>
24 #include <dali/public-api/object/base-object.h>
25
26 // INTERNAL INCLUDES
27 #include <dali/devel-api/adaptor-framework/offscreen-application.h>
28 #include <dali/devel-api/adaptor-framework/offscreen-window.h>
29 #include <dali/integration-api/adaptor-framework/scene-holder-impl.h>
30
31 namespace Dali
32 {
33 class Adaptor;
34
35 namespace Internal
36 {
37
38 /**
39  * Implementation of the OffscreenApplication class.
40  */
41 class OffscreenApplication : public BaseObject
42 {
43 public:
44
45   using OffscreenApplicationSignalType = Dali::OffscreenApplication::OffscreenApplicationSignalType;
46
47   /**
48    * @brief Create a new OffscreenApplication
49    * @param[in] width The width of the default OffscreenWindow
50    * @param[in] height The height of the default OffscreenWindow
51    * @param[in] surface The native surface handle to create the default OffscreenWindow
52    * @param[in] isTranslucent Whether the OffscreenWindow is translucent or not
53    * @param[in] renderMode The RenderMode of the OffscreenApplication
54    */
55   static IntrusivePtr<OffscreenApplication> New( uint16_t width, uint16_t height, Dali::Any surface, bool isTranslucent, Dali::OffscreenApplication::RenderMode renderMode);
56
57 public:
58
59   /**
60    * Destructor
61    */
62   virtual ~OffscreenApplication() = default;
63
64   /**
65    * @copydoc Dali::OffscreenApplication::Start()
66    */
67   void Start();
68
69   /**
70    * @copydoc Dali::OffscreenApplication::Stop()
71    */
72   void Stop();
73
74   /**
75    * @copydoc Dali::OffscreenApplication::GetDefaultWindow()
76    */
77   Dali::OffscreenWindow GetWindow();
78
79   /**
80    * @copydoc Dali::OffscreenApplication::RenderOnce()
81    */
82   void RenderOnce();
83
84 public:  // Signals
85
86   /**
87    * @copydoc Dali::OffscreenApplication::InitSignal()
88    */
89   OffscreenApplicationSignalType& InitSignal()
90   {
91     return mInitSignal;
92   }
93
94   /**
95    * @copydoc Dali::OffscreenApplication::TerminateSignal()
96    */
97   OffscreenApplicationSignalType& TerminateSignal()
98   {
99     return mTerminateSignal;
100   }
101
102 private:
103   /**
104    * Private constructor
105    * @param[in] width The width of the OffscreenWindow
106    * @param[in] height The height of the OffscreenApplication
107    * @param[in] surface The native surface handle to create the default OffscreenWindow
108    * @param[in] isTranslucent Whether the OffscreenWindow is translucent or not
109    * @param[in] renderMode The RenderMode of the OffscreenApplication
110    */
111   OffscreenApplication( uint16_t width, uint16_t height, Dali::Any surface, bool isTranslucent, Dali::OffscreenApplication::RenderMode renderMode );
112
113   // Undefined
114   OffscreenApplication( const OffscreenApplication& );
115   OffscreenApplication& operator=( OffscreenApplication& );
116
117 private:
118   std::unique_ptr< Dali::Adaptor >          mAdaptor;
119   Dali::OffscreenWindow                     mDefaultWindow;
120
121   OffscreenApplicationSignalType              mInitSignal;
122   OffscreenApplicationSignalType              mTerminateSignal;
123 };
124
125 inline OffscreenApplication& GetImplementation( Dali::OffscreenApplication& offscreenApplication )
126 {
127   DALI_ASSERT_ALWAYS( offscreenApplication && "OffscreenApplication handle is empty" );
128
129   BaseObject& handle = offscreenApplication.GetBaseObject();
130
131   return static_cast<OffscreenApplication&>( handle );
132 }
133
134 inline const OffscreenApplication& GetImplementation( const Dali::OffscreenApplication& offscreenApplication )
135 {
136   DALI_ASSERT_ALWAYS( offscreenApplication && "OffscreenApplication handle is empty" );
137
138   const BaseObject& handle = offscreenApplication.GetBaseObject();
139
140   return static_cast<const OffscreenApplication&>( handle );
141 }
142
143 } // namespace Internal
144
145 } // namespace Dali
146
147 #endif // DALI_INTERNAL_OFFSCREEN_APPLICATION_IMPL_H