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