#define DALI_INTERNAL_APPLICATION_H
/*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2022 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
/**
* Implementation of the Application class.
*/
-class Application : public BaseObject, public Framework::Observer
+class Application : public BaseObject, public Framework::Observer, public Framework::TaskObserver
{
public:
- typedef Dali::Application::LowBatterySignalType LowBatterySignalType;
- typedef Dali::Application::LowMemorySignalType LowMemorySignalType;
- typedef Dali::Application::AppSignalType AppSignalType;
- typedef Dali::Application::AppControlSignalType AppControlSignalType;
- typedef Dali::Application::WINDOW_MODE WINDOW_MODE;
+ typedef Dali::Application::LowBatterySignalType LowBatterySignalType;
+ typedef Dali::Application::LowMemorySignalType LowMemorySignalType;
+ typedef Dali::Application::DeviceOrientationChangedSignalType DeviceOrientationChangedSignalType;
+ typedef Dali::Application::AppSignalType AppSignalType;
+ typedef Dali::Application::AppControlSignalType AppControlSignalType;
+ typedef Dali::Application::WINDOW_MODE WINDOW_MODE;
/**
* Create a new application
- * @param[in] argc A pointer to the number of arguments
- * @param[in] argv A pointer to the argument list
- * @param[in] stylesheet The path to user defined theme file
- * @param[in] windowMode A member of Dali::Application::WINDOW_MODE
- * @param[in] positionSize A position and a size of the window
- * @param[in] applicationType A member of Dali::Framework::Type
+ * @param[in] argc A pointer to the number of arguments
+ * @param[in] argv A pointer to the argument list
+ * @param[in] stylesheet The path to user defined theme file
+ * @param[in] windowMode A member of Dali::Application::WINDOW_MODE
+ * @param[in] positionSize A position and a size of the window
+ * @param[in] applicationType A member of Dali::Framework::Type
+ * @param[in] type It is window type for default window.
+ * @param[in] useUiThread True if the application would create a UI thread
*/
- static ApplicationPtr New(int* argc, char** argv[], const std::string& stylesheet, WINDOW_MODE windowMode, const PositionSize& positionSize, Framework::Type applicationType);
+ static ApplicationPtr New(int* argc, char** argv[], const std::string& stylesheet, WINDOW_MODE windowMode, const PositionSize& positionSize, Framework::Type applicationType, WindowType type, bool useUiThread);
/**
* @copydoc Dali::DevelApplication::PreInitialize()
*/
void StoreWindowPositionSize(PositionSize positionSize);
+ /**
+ * @copydoc Dali::DevelApplication::GetRenderThreadId()
+ */
+ int32_t GetRenderThreadId() const;
+
public: // From Framework::Observer
/**
* Called when the framework is initialised.
void OnResume() override;
/**
- * Called when the framework received AppControlSignal.
- * @param[in] The bundle data of AppControl event.
- */
+ * Called when the framework received AppControlSignal.
+ * @param[in] The bundle data of AppControl event.
+ */
void OnAppControl(void* data) override;
/**
void OnLanguageChanged() override;
/**
- * Called when the framework informs the application that the region of the device has changed.
- */
+ * Called when the framework informs the application that the region of the device has changed.
+ */
void OnRegionChanged() override;
/**
- * Called when the framework informs the application that the battery level of the device is low.
- */
+ * Called when the framework informs the application that the battery level of the device is low.
+ */
void OnBatteryLow(Dali::DeviceStatus::Battery::Status status) override;
/**
- * Called when the framework informs the application that the memory level of the device is low.
- */
+ * Called when the framework informs the application that the memory level of the device is low.
+ */
void OnMemoryLow(Dali::DeviceStatus::Memory::Status status) override;
/**
+ * Called when the framework informs the application that device orientation is changed.
+ */
+ void OnDeviceOrientationChanged(Dali::DeviceStatus::Orientation::Status status) override;
+
+ /**
* Called when the framework informs the application that the platform surface is created.
*/
void OnSurfaceCreated(Any newSurface) override;
*/
void OnSurfaceDestroyed(Any newSurface) override;
+public: // From Framework::TaskObserver
+ /**
+ * Called when the framework is initialised.
+ */
+ void OnTaskInit() override;
+
+ /**
+ * Called when the framework is terminated.
+ */
+ void OnTaskTerminate() override;
+
+ /**
+ * Called when the framework received AppControlSignal.
+ * @param[in] The bundle data of AppControl event.
+ */
+ void OnTaskAppControl(void* data) override;
+
+ /**
+ * Called when the framework informs the application that the language of the device has changed.
+ */
+ void OnTaskLanguageChanged() override;
+
+ /**
+ * Called when the framework informs the application that the region of the device has changed.
+ */
+ void OnTaskRegionChanged() override;
+
+ /**
+ * Called when the framework informs the application that the battery level of the device is low.
+ */
+ void OnTaskBatteryLow(Dali::DeviceStatus::Battery::Status status) override;
+
+ /**
+ * Called when the framework informs the application that the memory level of the device is low.
+ */
+ void OnTaskMemoryLow(Dali::DeviceStatus::Memory::Status status) override;
+
+ /**
+ * Called when the framework informs the application that the device orientation is changed.
+ *
+ * Device orientation changed event is from Application Framework(Sensor Framework), it means it is system event.
+ * If UIThreading is enable, DALI application has the main thread and UI thread.
+ * This event is emitted in main thread, then it is posted to the UI thread in this callback function.
+ */
+ void OnTaskDeviceOrientationChanged(Dali::DeviceStatus::Orientation::Status status) override;
+
public:
/**
* Sets a user defined theme file.
*/
void SetCommandLineOptions(int* argc, char** argv[]);
+ /**
+ * Sets default window type.
+ * This is used in case of the preinitialized application.
+ * @param[in] type the window type for default window
+ */
+ void SetDefaultWindowType(WindowType type);
+
public: // Signals
/**
* @copydoc Dali::Application::InitSignal()
}
/**
- * @copydoc Dali::Application::AppControlSignal()
- */
+ * @copydoc Dali::Application::AppControlSignal()
+ */
Dali::Application::AppControlSignalType& AppControlSignal()
{
return mAppControlSignal;
}
/**
- * @copydoc Dali::Application::RegionChangedSignal()
- */
+ * @copydoc Dali::Application::RegionChangedSignal()
+ */
Dali::Application::AppSignalType& RegionChangedSignal()
{
return mRegionChangedSignal;
}
/**
- * @copydoc Dali::Application::LowBatterySignal()
- */
+ * @copydoc Dali::Application::LowBatterySignal()
+ */
Dali::Application::LowBatterySignalType& LowBatterySignal()
{
return mLowBatterySignal;
}
/**
- * @copydoc Dali::Application:::LowMemorySignal()
- */
+ * @copydoc Dali::Application:::LowMemorySignal()
+ */
Dali::Application::LowMemorySignalType& LowMemorySignal()
{
return mLowMemorySignal;
}
- // Temporary to test GFXApi
- Graphics::Controller& GetController();
+ /**
+ * @copydoc Dali::Application:::DeviceOrientationChangedSignalType()
+ */
+ Dali::Application::DeviceOrientationChangedSignalType& DeviceOrientationChangedSignal()
+ {
+ return mDeviceOrientationChangedSignal;
+ }
+
+ /**
+ * @copydoc Dali::Application::TaskInitSignal()
+ */
+ Dali::Application::AppSignalType& TaskInitSignal()
+ {
+ return mTaskInitSignal;
+ }
+
+ /**
+ * @copydoc Dali::Application::TaskTerminateSignal()
+ */
+ Dali::Application::AppSignalType& TaskTerminateSignal()
+ {
+ return mTaskTerminateSignal;
+ }
+
+ /**
+ * @copydoc Dali::Application::TaskAppControlSignal()
+ */
+ Dali::Application::AppControlSignalType& TaskAppControlSignal()
+ {
+ return mTaskAppControlSignal;
+ }
+
+ /**
+ * @copydoc Dali::Application::TaskLanguageChangedSignal()
+ */
+ Dali::Application::AppSignalType& TaskLanguageChangedSignal()
+ {
+ return mTaskLanguageChangedSignal;
+ }
+
+ /**
+ * @copydoc Dali::Application::TaskRegionChangedSignal()
+ */
+ Dali::Application::AppSignalType& TaskRegionChangedSignal()
+ {
+ return mTaskRegionChangedSignal;
+ }
+
+ /**
+ * @copydoc Dali::Application::TaskLowBatterySignal()
+ */
+ Dali::Application::LowBatterySignalType& TaskLowBatterySignal()
+ {
+ return mTaskLowBatterySignal;
+ }
+
+ /**
+ * @copydoc Dali::Application::TaskLowMemorySignal()
+ */
+ Dali::Application::LowMemorySignalType& TaskLowMemorySignal()
+ {
+ return mTaskLowMemorySignal;
+ }
+
+ /**
+ * @copydoc Dali::Application::TaskDeviceOrientationChangedSignal()
+ */
+ Dali::Application::DeviceOrientationChangedSignalType& TaskDeviceOrientationChangedSignal()
+ {
+ return mTaskDeviceOrientationChangedSignal;
+ }
protected:
/**
* Private Constructor
- * @param[in] argc A pointer to the number of arguments
- * @param[in] argv A pointer to the argument list
- * @param[in] stylesheet The path to user defined theme file
- * @param[in] windowMode A member of Dali::Application::WINDOW_MODE
- * @param[in] positionSize A position and a size of the window
- * @param[in] applicationType A member of Dali::Framework::Type
+ * @param[in] argc A pointer to the number of arguments
+ * @param[in] argv A pointer to the argument list
+ * @param[in] stylesheet The path to user defined theme file
+ * @param[in] windowMode A member of Dali::Application::WINDOW_MODE
+ * @param[in] positionSize A position and a size of the window
+ * @param[in] applicationType A member of Dali::Framework::Type
+ * @param[in] type The default window's type.
+ * @param[in] useUiThread True if the application would create UI thread
*/
- Application(int* argc, char** argv[], const std::string& stylesheet, WINDOW_MODE windowMode, const PositionSize& positionSize, Framework::Type applicationType);
+ Application(int* argc, char** argv[], const std::string& stylesheet, WINDOW_MODE windowMode, const PositionSize& positionSize, Framework::Type applicationType, WindowType type, bool useUiThread);
/**
* Destructor
*/
- ~Application() override;
+ virtual ~Application() override;
// Undefined
Application(const Application&);
Application& operator=(Application&);
/**
- * Creates the window
+ * Creates the default window
*/
void CreateWindow();
void ChangePreInitializedWindowSize();
private:
- AppSignalType mInitSignal;
- AppSignalType mTerminateSignal;
- AppSignalType mPauseSignal;
- AppSignalType mResumeSignal;
- AppSignalType mResetSignal;
- AppControlSignalType mAppControlSignal;
- AppSignalType mLanguageChangedSignal;
- AppSignalType mRegionChangedSignal;
- LowBatterySignalType mLowBatterySignal;
- LowMemorySignalType mLowMemorySignal;
+ AppSignalType mInitSignal;
+ AppSignalType mTerminateSignal;
+ AppSignalType mPauseSignal;
+ AppSignalType mResumeSignal;
+ AppSignalType mResetSignal;
+ AppControlSignalType mAppControlSignal;
+ AppSignalType mLanguageChangedSignal;
+ AppSignalType mRegionChangedSignal;
+ LowBatterySignalType mLowBatterySignal;
+ LowMemorySignalType mLowMemorySignal;
+ DeviceOrientationChangedSignalType mDeviceOrientationChangedSignal;
+
+ AppSignalType mTaskInitSignal;
+ AppSignalType mTaskTerminateSignal;
+ AppControlSignalType mTaskAppControlSignal;
+ AppSignalType mTaskLanguageChangedSignal;
+ AppSignalType mTaskRegionChangedSignal;
+ LowBatterySignalType mTaskLowBatterySignal;
+ LowMemorySignalType mTaskLowMemorySignal;
+ DeviceOrientationChangedSignalType mTaskDeviceOrientationChangedSignal;
EventLoop* mEventLoop;
Framework* mFramework;
PositionSize mWindowPositionSize;
Launchpad::State mLaunchpadState;
bool mUseRemoteSurface;
+ WindowType mDefaultWindowType; ///< Default window's type. It is used when Application is created.
+ bool mUseUiThread;
SlotDelegate<Application> mSlotDelegate;