1 #ifndef DALI_INTERNAL_OFFSCREEN_APPLICATION_IMPL_H
2 #define DALI_INTERNAL_OFFSCREEN_APPLICATION_IMPL_H
5 * Copyright (c) 2020 Samsung Electronics Co., Ltd.
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
11 * http://www.apache.org/licenses/LICENSE-2.0
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.
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>
30 #include <dali/devel-api/adaptor-framework/offscreen-application.h>
31 #include <dali/devel-api/adaptor-framework/offscreen-window.h>
42 * Implementation of the OffscreenApplication class.
44 class OffscreenApplication : public BaseObject,
45 public ConnectionTracker
49 typedef Dali::OffscreenApplication::OffscreenApplicationSignalType OffscreenApplicationSignalType;
52 * @brief Create a new OffscreenApplication
53 * @param[in] width The width of the default OffscreenWindow
54 * @param[in] height The height of the default OffscreenWindow
55 * @param[in] surface The native surface handle to create the default OffscreenWindow
56 * @param[in] isTranslucent Whether the OffscreenWindow is translucent or not
58 static IntrusivePtr<OffscreenApplication> New( uint16_t width, uint16_t height, Dali::Any surface, bool isTranslucent);
63 * @copydoc Dali::OffscreenApplication::Start()
68 * @copydoc Dali::OffscreenApplication::Stop()
73 * @copydoc Dali::OffscreenApplication::GetDefaultWindow()
75 Dali::OffscreenWindow GetWindow();
78 * @copydoc Dali::OffscreenApplication::InitSignal()
80 OffscreenApplicationSignalType& InitSignal()
86 * @copydoc Dali::OffscreenApplication::TerminateSignal()
88 OffscreenApplicationSignalType& TerminateSignal()
90 return mTerminateSignal;
95 * All methods here are for the internal use
105 * @brief This is for internal use to get notified before InitSignal() emits
107 OffscreenApplicationSignalType& PreInitSignal()
109 return mPreInitSignal;
113 * @brief Get OffscreenApplication's current state
117 const State GetState() const
123 * @bried Get currently working Adaptor. It can be null.
125 Dali::Adaptor* GetAdaptor();
129 * Private constructor
130 * @param[in] width The width of the OffscreenWindow
131 * @param[in] height The height of the OffscreenApplication
132 * @param[in] surface The native surface handle to create the default OffscreenWindow
133 * @param[in] isTranslucent Whether the OffscreenWindow is translucent or not
135 OffscreenApplication( uint16_t width, uint16_t height, Dali::Any surface, bool isTranslucent );
141 virtual ~OffscreenApplication();
144 OffscreenApplication( const OffscreenApplication& );
145 OffscreenApplication& operator=( OffscreenApplication& );
148 Dali::Adaptor* mAdaptor;
149 Dali::OffscreenWindow mDefaultWindow;
151 OffscreenApplicationSignalType mPreInitSignal;
152 OffscreenApplicationSignalType mInitSignal;
153 OffscreenApplicationSignalType mTerminateSignal;
158 inline OffscreenApplication& GetImplementation( Dali::OffscreenApplication& offscreenApplication )
160 DALI_ASSERT_ALWAYS( offscreenApplication && "OffscreenApplication handle is empty" );
162 BaseObject& handle = offscreenApplication.GetBaseObject();
164 return static_cast<OffscreenApplication&>( handle );
167 inline const OffscreenApplication& GetImplementation( const Dali::OffscreenApplication& offscreenApplication )
169 DALI_ASSERT_ALWAYS( offscreenApplication && "OffscreenApplication handle is empty" );
171 const BaseObject& handle = offscreenApplication.GetBaseObject();
173 return static_cast<const OffscreenApplication&>( handle );
176 } // namespace Internal
180 #endif // DALI_INTERNAL_OFFSCREEN_APPLICATION_IMPL_H