Merge "[3.0] Modify iconify part for wayland" into tizen
[platform/core/uifw/dali-adaptor.git] / adaptors / common / application-impl.h
index 7dc75f6..68de173 100644 (file)
@@ -2,7 +2,7 @@
 #define __DALI_INTERNAL_APPLICATION_H__
 
 /*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2016 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.
  */
 
 // EXTERNAL INCLUDES
-#include <boost/bind.hpp>
-#include <boost/function.hpp>
-#include <boost/thread.hpp>
-
 #include <dali/public-api/math/rect.h>
 #include <dali/public-api/object/base-object.h>
 
@@ -32,6 +28,7 @@
 
 #include <framework.h>
 #include <window-impl.h>
+#include <base/environment-options.h>
 
 namespace Dali
 {
@@ -57,28 +54,20 @@ typedef IntrusivePtr<Application> ApplicationPtr;
 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
+   * 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]  name        A name of application
-   * @param[in]  baseLayout  The base layout that the application has been written for
+   * @param[in]  stylesheet  The path to user defined theme file
    * @param[in]  windowMode  A member of Dali::Application::WINDOW_MODE
+   * @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 );
-
-  /**
-   * Destructor
-   */
-  virtual ~Application();
+  static ApplicationPtr New( int* argc, char **argv[], const std::string& stylesheet,
+    WINDOW_MODE windowMode, Framework::Type applicationType );
 
 public:
 
@@ -100,7 +89,7 @@ public:
   /**
    * @copydoc Dali::Application::AddIdle()
    */
-  bool AddIdle(boost::function<void(void)> callBack);
+  bool AddIdle( CallbackBase* callback );
 
   /**
    * @copydoc Dali::Application::GetAdaptor();
@@ -113,16 +102,6 @@ public:
   Dali::Window GetWindow();
 
   /**
-   * @copydoc Dali::Application::GetTheme();
-   */
-  const std::string& GetTheme();
-
-  /**
-   * @copydoc Dali::Application::SetTheme();
-   */
-  void SetTheme(const std::string& themeFilePath);
-
-  /**
    * @copydoc Dali::Application::ReplaceWindow();
    */
   void ReplaceWindow(PositionSize windowPosition, const std::string& name);
@@ -172,6 +151,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();
@@ -181,6 +166,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:
 
   /**
@@ -217,6 +217,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; }
@@ -226,13 +231,42 @@ 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
+   */
+  Application( int* argc, char **argv[], const std::string& stylesheet,
+      WINDOW_MODE windowMode, Framework::Type applicationType );
+
+  /**
+   * Destructor
+   */
+  virtual ~Application();
 
   // Undefined
   Application(const Application&);
   Application& operator=(Application&);
 
-private:
   /**
    * Creates the window
    */
@@ -256,7 +290,11 @@ private:
   AppSignalType                           mResumeSignal;
   AppSignalType                           mResetSignal;
   AppSignalType                           mResizeSignal;
+  AppControlSignalType                    mAppControlSignal;
   AppSignalType                           mLanguageChangedSignal;
+  AppSignalType                           mRegionChangedSignal;
+  AppSignalType                           mBatteryLowSignal;
+  AppSignalType                           mMemoryLowSignal;
 
   EventLoop*                            mEventLoop;
   Framework*                            mFramework;
@@ -269,9 +307,8 @@ private:
   Dali::Window                          mWindow;
   Dali::Application::WINDOW_MODE        mWindowMode;
   std::string                           mName;
-
-  bool                                  mInitialized;
-  DeviceLayout                          mBaseLayout;
+  std::string                           mStylesheet;
+  EnvironmentOptions                    mEnvironmentOptions;
 
   SlotDelegate< Application >           mSlotDelegate;
 };