X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=adaptors%2Fcommon%2Fapplication-impl.h;h=621facce51d9bc2082b4f97653c786c3360c4f5f;hb=787c0eb5ca9bf5449a31cf1f50e920bc451bee6a;hp=919a7e38e0721264345729b5998ba517afd8dd2c;hpb=a8ec2e4ca7ab1c9aa3d639630ff7d3e1be58de95;p=platform%2Fcore%2Fuifw%2Fdali-adaptor.git diff --git a/adaptors/common/application-impl.h b/adaptors/common/application-impl.h index 919a7e3..621facc 100644 --- a/adaptors/common/application-impl.h +++ b/adaptors/common/application-impl.h @@ -2,7 +2,7 @@ #define __DALI_INTERNAL_APPLICATION_H__ /* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. + * Copyright (c) 2017 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. @@ -28,6 +28,7 @@ #include #include +#include namespace Dali { @@ -39,6 +40,22 @@ namespace Internal namespace Adaptor { + +namespace Launchpad +{ + +/** + * @brief Launchpad is used to improve application launch performance. + * When an application is pre-initialized, so files are preloaded, some functions are initialized and a window is made in advance. + */ +enum State +{ + NONE, ///< The default state + PRE_INITIALIZED ///< Application is pre-initialized. +}; + +} // namespace Launchpad + class CommandLineOptions; class EventLoop; @@ -55,26 +72,25 @@ class Application : public BaseObject, public Framework::Observer public: typedef Dali::Application::AppSignalType AppSignalType; + typedef Dali::Application::AppControlSignalType AppControlSignalType; + typedef Dali::Application::WINDOW_MODE WINDOW_MODE; /** - * Constructor - * @param[in] app The public instance of the Application - * @param[in] argc A pointer to the number of arguments - * @param[in] argv A pointer to the argument list - * @param[in] name A name of application - * @param[in] baseLayout The base layout that the application has been written for - * @param[in] windowMode A member of Dali::Application::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 */ - static ApplicationPtr New(int* argc, char **argv[], const std::string& name, - const DeviceLayout& baseLayout, - Dali::Application::WINDOW_MODE windowMode); - - Application( int* argc, char **argv[], const std::string& name, const DeviceLayout& baseLayout, Dali::Application::WINDOW_MODE windowMode ); + static ApplicationPtr New( int* argc, char **argv[], const std::string& stylesheet, + WINDOW_MODE windowMode, const PositionSize& positionSize, Framework::Type applicationType ); /** - * Destructor + * @copydoc Dali::DevelApplication::PreInitialize() */ - virtual ~Application(); + static void PreInitialize( int* argc, char** argv[] ); public: @@ -109,19 +125,21 @@ public: Dali::Window GetWindow(); /** - * @copydoc Dali::Application::GetTheme(); + * @copydoc Dali::Application::ReplaceWindow(); */ - const std::string& GetTheme(); + void ReplaceWindow( const PositionSize& positionSize, const std::string& name); /** - * @copydoc Dali::Application::SetTheme(); + * @copydoc Dali::Application::GetResourcePath(); */ - void SetTheme(const std::string& themeFilePath); + static std::string GetResourcePath(); /** - * @copydoc Dali::Application::ReplaceWindow(); + * Retrieves the pre-initialized application. + * + * @return A pointer to the pre-initialized application */ - void ReplaceWindow(PositionSize windowPosition, const std::string& name); + static ApplicationPtr GetPreInitializedApplication(); public: // Stereoscopy @@ -145,6 +163,38 @@ public: // Stereoscopy */ float GetStereoBase() const; +public: // Lifecycle functionality + + /** + * Called when OnInit is called or the framework is initialised. + */ + void DoInit(); + + /** + * Called after OnInit is called or the framework is started. + */ + void DoStart(); + + /** + * Called when OnTerminate is called or the framework is terminated. + */ + void DoTerminate(); + + /** + * Called when OnPause is called or the framework is paused. + */ + void DoPause(); + + /** + * Called when OnResume is called or the framework resumes from a paused state. + */ + void DoResume(); + + /** + * Called when OnLanguageChanged is called or the framework informs the application that the language of the device has changed. + */ + void DoLanguageChange(); + public: // From Framework::Observer /** @@ -168,6 +218,12 @@ public: // From Framework::Observer virtual void OnResume(); /** + * Called when the framework received AppControlSignal. + * @param[in] The bundle data of AppControl event. + */ + virtual void OnAppControl(void *data); + + /** * Called when the framework informs the application that it should reset itself. */ virtual void OnReset(); @@ -177,6 +233,21 @@ public: // From Framework::Observer */ virtual void OnLanguageChanged(); + /** + * Called when the framework informs the application that the region of the device has changed. + */ + virtual void OnRegionChanged(); + + /** + * Called when the framework informs the application that the battery level of the device is low. + */ + virtual void OnBatteryLow(); + + /** + * Called when the framework informs the application that the memory level of the device is low. + */ + virtual void OnMemoryLow(); + public: /** @@ -185,6 +256,13 @@ public: */ void OnResize(Dali::Adaptor& adaptor); + /** + * Sets a user defined theme file. + * This should be called before initialization. + * @param[in] stylesheet The path to user defined theme file + */ + void SetStyleSheet( const std::string& stylesheet ); + public: // Signals /** @@ -213,6 +291,11 @@ public: // Signals Dali::Application::AppSignalType& ResetSignal() { return mResetSignal; } /** + * @copydoc Dali::Application::AppControlSignal() + */ + Dali::Application::AppControlSignalType& AppControlSignal() { return mAppControlSignal; } + + /** * @copydoc Dali::Application::ResizeSignal() */ Dali::Application::AppSignalType& ResizeSignal() { return mResizeSignal; } @@ -222,13 +305,44 @@ public: // Signals */ Dali::Application::AppSignalType& LanguageChangedSignal() { return mLanguageChangedSignal; } -private: + /** + * @copydoc Dali::Application::RegionChangedSignal() + */ + Dali::Application::AppSignalType& RegionChangedSignal() { return mRegionChangedSignal; } + + /** + * @copydoc Dali::Application::BatteryLowSignal() + */ + Dali::Application::AppSignalType& BatteryLowSignal() { return mBatteryLowSignal; } + + /** + * @copydoc Dali::Application::MemoryLowSignal() + */ + Dali::Application::AppSignalType& MemoryLowSignal() { return mMemoryLowSignal; } + +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 + */ + Application( int* argc, char **argv[], const std::string& stylesheet, + WINDOW_MODE windowMode, const PositionSize& positionSize, Framework::Type applicationType ); + + /** + * Destructor + */ + virtual ~Application(); // Undefined Application(const Application&); Application& operator=(Application&); -private: /** * Creates the window */ @@ -252,7 +366,11 @@ private: AppSignalType mResumeSignal; AppSignalType mResetSignal; AppSignalType mResizeSignal; + AppControlSignalType mAppControlSignal; AppSignalType mLanguageChangedSignal; + AppSignalType mRegionChangedSignal; + AppSignalType mBatteryLowSignal; + AppSignalType mMemoryLowSignal; EventLoop* mEventLoop; Framework* mFramework; @@ -265,11 +383,15 @@ private: Dali::Window mWindow; Dali::Application::WINDOW_MODE mWindowMode; std::string mName; - - bool mInitialized; - DeviceLayout mBaseLayout; + std::string mStylesheet; + EnvironmentOptions mEnvironmentOptions; + PositionSize mWindowPositionSize; + Launchpad::State mLaunchpadState; + bool mUseRemoteSurface; SlotDelegate< Application > mSlotDelegate; + + static ApplicationPtr gPreInitializedApplication; }; inline Application& GetImplementation(Dali::Application& application)