X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dali%2Finternal%2Fadaptor%2Fcommon%2Fapplication-impl.h;h=8e334a7d4cb7ce73f7dbb96f6b253a930f57b418;hb=0611c992765b21bfc0be36074ac3452b3859b28c;hp=2598df7835b327f65034a6414ba2dd44b9a882d7;hpb=0e868c909b523ad581e0107ba56fe01f6a7a447f;p=platform%2Fcore%2Fuifw%2Fdali-adaptor.git diff --git a/dali/internal/adaptor/common/application-impl.h b/dali/internal/adaptor/common/application-impl.h index 2598df7..8e334a7 100644 --- a/dali/internal/adaptor/common/application-impl.h +++ b/dali/internal/adaptor/common/application-impl.h @@ -2,7 +2,7 @@ #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. @@ -64,25 +64,28 @@ typedef IntrusivePtr ApplicationPtr; /** * 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() @@ -152,6 +155,16 @@ public: */ static ApplicationPtr GetPreInitializedApplication(); + /** + * Stores PositionSize of window + */ + void StoreWindowPositionSize(PositionSize positionSize); + + /** + * @copydoc Dali::DevelApplication::GetRenderThreadId() + */ + int32_t GetRenderThreadId() const; + public: // From Framework::Observer /** * Called when the framework is initialised. @@ -174,9 +187,9 @@ public: // From Framework::Observer 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; /** @@ -190,21 +203,26 @@ public: // From Framework::Observer 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; @@ -214,6 +232,52 @@ public: // From Framework::Observer */ 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. @@ -230,6 +294,13 @@ public: */ 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() @@ -272,8 +343,8 @@ public: // Signals } /** - * @copydoc Dali::Application::AppControlSignal() - */ + * @copydoc Dali::Application::AppControlSignal() + */ Dali::Application::AppControlSignalType& AppControlSignal() { return mAppControlSignal; @@ -288,55 +359,126 @@ public: // Signals } /** - * @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(); @@ -355,17 +497,32 @@ protected: */ void QuitFromMainLoop(); + /** + * Changes size of preInitialized window + */ + 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; @@ -386,6 +543,8 @@ private: PositionSize mWindowPositionSize; Launchpad::State mLaunchpadState; bool mUseRemoteSurface; + WindowType mDefaultWindowType; ///< Default window's type. It is used when Application is created. + bool mUseUiThread; SlotDelegate mSlotDelegate;