Allow to use LifecycleController for OffscreenApplication
[platform/core/uifw/dali-adaptor.git] / dali / devel-api / adaptor-framework / offscreen-application.h
index 47d297f..5634a61 100644 (file)
@@ -2,7 +2,7 @@
 #define DALI_OFFSCREEN_APPLICATION_H
 
 /*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2023 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 <dali/public-api/signals/dali-signal.h>
 #include <dali/public-api/object/any.h>
 #include <dali/public-api/object/base-handle.h>
+#include <dali/public-api/signals/dali-signal.h>
+
+// INTERNAL INCLUDES
+#include <dali/public-api/dali-adaptor-common.h>
 
 namespace Dali
 {
-
 /**
  * @addtogroup dali_adaptor_framework
  * @{
@@ -42,24 +44,21 @@ class OffscreenApplication;
  * @brief Appliations can draw UI on offscreen surface with the OffscreenApplication.
  * When you use a OffscreenApplication, you don't have to create a Window.
  */
-class DALI_IMPORT_API OffscreenApplication : public Dali::BaseHandle
+class DALI_ADAPTOR_API OffscreenApplication : public Dali::BaseHandle
 {
-
 public:
+  using OffscreenApplicationSignalType = Signal<void(void)>;
 
   /**
    * @brief Enumeration for the render mode
    */
   enum class RenderMode
   {
-    AUTO,         // Scene is rendered automatically
-    MANUAL        // Scene is rendered by RenderOnce()
+    AUTO,  // Scene is rendered automatically
+    MANUAL // Scene is rendered by RenderOnce()
   };
 
-  typedef Signal<void (void)> OffscreenApplicationSignalType;
-
 public:
-
   /**
    * @brief This is the constructor of OffscreenApplication
    *
@@ -68,8 +67,7 @@ public:
    * @param[in] isTranslucent Whether the OffscreenWindow is translucent or not
    * @param[in] renderMode The RenderMode of the OffscreenApplication
    */
-  static OffscreenApplication New( uint16_t width, uint16_t height, bool isTranslucent,
-                                   RenderMode renderMode = RenderMode::AUTO );
+  static OffscreenApplication New(uint16_t width, uint16_t height, bool isTranslucent, RenderMode renderMode = RenderMode::AUTO);
 
   /**
    * @brief This is the constructor of OffscreenApplication
@@ -77,7 +75,7 @@ public:
    * @param[in] surface The native surface handle to create the OffscreenWindow
    * @param[in] renderMode The RenderMode of the OffscreenApplication
    */
-  static OffscreenApplication New( Dali::Any surface, RenderMode renderMode = RenderMode::AUTO );
+  static OffscreenApplication New(Dali::Any surface, RenderMode renderMode = RenderMode::AUTO);
 
   /**
    * @brief Constructs an empty handle
@@ -86,13 +84,18 @@ public:
 
   /**
    * @brief Copy constructor
+   *
+   * @param [in] offscreenApplication A reference to the copied handle
    */
-  OffscreenApplication( const OffscreenApplication& offscreenApplication );
+  OffscreenApplication(const OffscreenApplication& offscreenApplication);
 
   /**
    * @brief Assignment operator
+   *
+   * @param [in] offscreenApplication A reference to the copied handle
+   * @return A reference to this
    */
-  OffscreenApplication& operator=( const OffscreenApplication& offscreenApplication );
+  OffscreenApplication& operator=(const OffscreenApplication& offscreenApplication);
 
   /**
    * @brief Destructor
@@ -100,21 +103,19 @@ public:
   ~OffscreenApplication();
 
 public:
-
   /**
-   * @brief Starts the OffscreenApplication (rendering, event handling, etc)
+   * @brief This starts the application.
    */
-  void Start();
+  void MainLoop();
 
   /**
-   * @brief Stops the OffscreenApplication
+   * @brief This quits the application.
    */
-  void Stop();
-
+  void Quit();
 
   /**
-   * @brief Get the default Window handle
-   * @return The default Window
+   * @brief Get the default OffscreenWindow handle
+   * @return The default OffscreenWindow
    */
   OffscreenWindow GetWindow();
 
@@ -123,8 +124,13 @@ public:
    */
   void RenderOnce();
 
-public:  // Signals
+  /**
+   * @brief Gets the context of the framwork
+   * @return Platform dependent context handle
+   */
+  Any GetFrameworkContext() const;
 
+public: // Signals
   /**
    * @brief Signal to notify the client when the application is ready to be initialized
    *
@@ -132,27 +138,54 @@ public:  // Signals
    *
    * @return The signal
    */
- OffscreenApplicationSignalType& InitSignal();
 OffscreenApplicationSignalType& InitSignal();
 
   /**
    * @brief Signal to notify the user when the application is about to be terminated
    *
    * @return The signal
    */
- OffscreenApplicationSignalType& TerminateSignal();
+  OffscreenApplicationSignalType& TerminateSignal();
+
+  /**
+   * @brief Signal to notify the user when the application is about to be paused
+   *
+   * @return The signal
+   */
+  OffscreenApplicationSignalType& PauseSignal();
+
+  /**
+   * @brief Signal to notify the user when the application is about to be resumed
+   *
+   * @return The signal
+   */
+  OffscreenApplicationSignalType& ResumeSignal();
+
+  /**
+   * @brief Signal to notify the user when the application is about to be reinitialized
+   *
+   * @return The signal
+   */
+  OffscreenApplicationSignalType& ResetSignal();
+
+  /**
+   * @brief Signal to notify the user when the application is about to be language is changed on the device.
+   *
+   * @return The signal
+   */
+  OffscreenApplicationSignalType& LanguageChangedSignal();
 
 public: // Not intended for application developers
   /**
    * @brief Internal constructor
    */
-  explicit DALI_INTERNAL OffscreenApplication( Internal::OffscreenApplication* offscreenApplication );
-
+  explicit DALI_INTERNAL OffscreenApplication(Internal::OffscreenApplication* offscreenApplication);
 };
 
 /**
  * @}
  */
 
-}  // namespace Dali
+} // namespace Dali
 
 #endif // DALI_OFFSCREEN_APPLICATION_H