Add LocaleChangedSignal
[platform/core/uifw/dali-adaptor.git] / dali / integration-api / adaptor-framework / adaptor.h
index 834f25c..07e78a6 100644 (file)
@@ -2,7 +2,7 @@
 #define DALI_INTEGRATION_ADAPTOR_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/callback.h>
-#include <dali/public-api/signals/dali-signal.h>
-#include <dali/public-api/math/uint-16-pair.h>
+#include <dali/devel-api/events/touch-point.h>
+#include <dali/integration-api/processor-interface.h>
 #include <dali/public-api/math/rect.h>
+#include <dali/public-api/math/uint-16-pair.h>
 #include <dali/public-api/object/any.h>
-#include <dali/public-api/events/touch-point.h>
-#include <dali/integration-api/processor-interface.h>
+#include <dali/public-api/signals/callback.h>
+#include <dali/public-api/signals/dali-signal.h>
 
 // INTERNAL INCLUDES
+#include <dali/integration-api/adaptor-framework/log-factory-interface.h>
+#include <dali/integration-api/adaptor-framework/trace-factory-interface.h>
 #include <dali/public-api/adaptor-framework/window.h>
-#include <dali/public-api/adaptor-framework/application-configuration.h>
 #include <dali/public-api/dali-adaptor-common.h>
-#include <dali/integration-api/adaptor-framework/log-factory-interface.h>
 
 namespace Dali
 {
-
 class ObjectRegistry;
 class RenderSurfaceInterface;
 
@@ -48,15 +47,14 @@ class SceneHolder;
 
 using SceneHolderList = std::vector<Dali::Integration::SceneHolder>;
 
-
 namespace Internal
 {
 namespace Adaptor
 {
 class GraphicsFactory;
 class Adaptor;
-}
-}
+} // namespace Adaptor
+} // namespace Internal
 
 /**
  * @brief An Adaptor object is used to initialize and control how Dali runs.
@@ -119,9 +117,9 @@ class Adaptor;
 class DALI_ADAPTOR_API Adaptor
 {
 public:
-
-  typedef Signal< void (Adaptor&) > AdaptorSignalType; ///< Generic Type for adaptor signals
-  typedef Signal< void (Dali::Integration::SceneHolder&) > WindowCreatedSignalType;  ///< SceneHolder created signal type
+  typedef Signal<void(Adaptor&)>                        AdaptorSignalType;       ///< Generic Type for adaptor signals
+  typedef Signal<void(Dali::Integration::SceneHolder&)> WindowCreatedSignalType; ///< SceneHolder created signal type
+  typedef Signal<void(std::string)>                     LocaleChangedSignalType; ///< Locale changed signal type
 
   using SurfaceSize = Uint16Pair; ///< Surface size type
 
@@ -132,35 +130,16 @@ public:
    * @param[in] window The window to draw onto
    * @return a reference to the adaptor handle
    */
-  static Adaptor& New( Window window );
-
-  /**
-   * @brief Create a new adaptor using the window.
-   *
-   * @param[in] window The window to draw onto
-   * @param[in] configuration The context loss configuration.
-   * @return a reference to the adaptor handle
-   */
-  static Adaptor& New( Window window, Configuration::ContextLoss configuration );
-
-  /**
-   * @brief Create a new adaptor using render surface.
-   *
-   * @param[in] window The window to draw onto
-   * @param[in] surface The surface to draw onto
-   * @return a reference to the adaptor handle
-   */
-  static Adaptor& New( Window window, const Dali::RenderSurfaceInterface& surface );
+  static Adaptor& New(Window window);
 
   /**
    * @brief Create a new adaptor using render surface.
    *
    * @param[in] window The window to draw onto
    * @param[in] surface The surface to draw onto
-   * @param[in] configuration The context loss configuration.
    * @return a reference to the adaptor handle
    */
-  static Adaptor& New( Window window, const Dali::RenderSurfaceInterface& surface, Configuration::ContextLoss configuration = Configuration::APPLICATION_DOES_NOT_HANDLE_CONTEXT_LOSS);
+  static Adaptor& New(Window window, const Dali::RenderSurfaceInterface& surface);
 
   /**
    * @brief Create a new adaptor using the SceneHolder.
@@ -168,35 +147,16 @@ public:
    * @param[in] sceneHolder The SceneHolder to draw onto
    * @return a reference to the adaptor handle
    */
-  static Adaptor& New( Dali::Integration::SceneHolder sceneHolder );
-
-  /**
-   * @brief Create a new adaptor using the SceneHolder.
-   *
-   * @param[in] sceneHolder The SceneHolder to draw onto
-   * @param[in] configuration The context loss configuration.
-   * @return a reference to the adaptor handle
-   */
-  static Adaptor& New( Dali::Integration::SceneHolder sceneHolder, Configuration::ContextLoss configuration );
-
-  /**
-   * @brief Create a new adaptor using render surface.
-   *
-   * @param[in] sceneHolder The SceneHolder to draw onto
-   * @param[in] surface The surface to draw onto
-   * @return a reference to the adaptor handle
-   */
-  static Adaptor& New( Dali::Integration::SceneHolder sceneHolder, const Dali::RenderSurfaceInterface& surface );
+  static Adaptor& New(Dali::Integration::SceneHolder sceneHolder);
 
   /**
    * @brief Create a new adaptor using render surface.
    *
    * @param[in] sceneHolder The SceneHolder to draw onto
    * @param[in] surface The surface to draw onto
-   * @param[in] configuration The context loss configuration.
    * @return a reference to the adaptor handle
    */
-  static Adaptor& New( Dali::Integration::SceneHolder sceneHolder, const Dali::RenderSurfaceInterface& surface, Configuration::ContextLoss configuration = Configuration::APPLICATION_DOES_NOT_HANDLE_CONTEXT_LOSS);
+  static Adaptor& New(Dali::Integration::SceneHolder sceneHolder, const Dali::RenderSurfaceInterface& surface);
 
   /**
    * @brief Virtual Destructor.
@@ -204,7 +164,6 @@ public:
   virtual ~Adaptor();
 
 public:
-
   /**
    * @brief Starts the Adaptor.
    */
@@ -248,14 +207,14 @@ public:
    *
    * @note Ownership of the callback is passed onto this class.
    */
-  bool AddIdle( CallbackBase* callback, bool hasReturnValue );
+  bool AddIdle(CallbackBase* callback, bool hasReturnValue);
 
   /**
    * @brief Adds a new Window instance to the Adaptor
    *
    * @param[in]  childWindow The child window instance
    */
-  bool AddWindow( Dali::Integration::SceneHolder childWindow );
+  bool AddWindow(Dali::Integration::SceneHolder childWindow);
 
   /**
    * @brief Removes a previously added @p callback.
@@ -265,7 +224,7 @@ public:
    *
    * @param[in] callback The callback to be removed.
    */
-  void RemoveIdle( CallbackBase* callback );
+  void RemoveIdle(CallbackBase* callback);
 
   /**
    * @brief Processes the idle callbacks.
@@ -280,7 +239,7 @@ public:
    * @param[in] window The window to replace the surface for
    * @param[in] surface to use
    */
-  void ReplaceSurface( Window window, Dali::RenderSurfaceInterface& surface );
+  void ReplaceSurface(Window window, Dali::RenderSurfaceInterface& surface);
 
   /**
    * @brief Replaces the rendering surface
@@ -288,7 +247,7 @@ public:
    * @param[in] sceneHolder The SceneHolder to replace the surface for
    * @param[in] surface to use
    */
-  void ReplaceSurface( Dali::Integration::SceneHolder sceneHolder, Dali::RenderSurfaceInterface& surface );
+  void ReplaceSurface(Dali::Integration::SceneHolder sceneHolder, Dali::RenderSurfaceInterface& surface);
 
   /**
    * @brief Get the render surface the adaptor is using to render to.
@@ -310,7 +269,7 @@ public:
    * @param[in] actor The actor
    * @return native window handle
    */
-  Any GetNativeWindowHandle( Actor actor );
+  Any GetNativeWindowHandle(Actor actor);
 
   /**
    * @brief Get the native display associated with the graphics backend
@@ -338,7 +297,7 @@ public:
    * 4 - render every fourth vsync frame
    * 8 - render every eighth vsync frame
    */
-  void SetRenderRefreshRate( unsigned int numberOfVSyncsPerRender );
+  void SetRenderRefreshRate(unsigned int numberOfVSyncsPerRender);
 
   /**
    * @brief The callback is called from the Update/Render thread prior to rendering.
@@ -355,7 +314,7 @@ public:
    * @endcode
    * This callback will be called repeatedly as long as it returns true. A return of 0 deletes this callback.
    */
-  void SetPreRenderCallback( CallbackBase* callback );
+  void SetPreRenderCallback(CallbackBase* callback);
 
   /**
    * @brief Returns a reference to the instance of the adaptor used by the current thread.
@@ -397,21 +356,21 @@ public:
    * @param[in] point touch point
    * @param[in] timeStamp time value of event
    */
-  void FeedTouchPoint( TouchPoint& point, int timeStamp );
+  void FeedTouchPoint(TouchPoint& point, int timeStamp);
 
   /**
    * @brief Feed a wheel event to the adaptor.
    *
    * @param[in]  wheelEvent wheel event
    */
-  void FeedWheelEvent( WheelEvent& wheelEvent );
+  void FeedWheelEvent(WheelEvent& wheelEvent);
 
   /**
    * @brief Feed a key event to the adaptor.
    *
    * @param[in] keyEvent The key event holding the key information.
    */
-  void FeedKeyEvent( KeyEvent& keyEvent );
+  void FeedKeyEvent(KeyEvent& keyEvent);
 
   /**
    * @copydoc Dali::Core::SceneCreated();
@@ -424,7 +383,7 @@ public:
    * @param[in] surface The current render surface
    * @param[in] surfaceSize The new surface size
    */
-  void SurfaceResizePrepare( Dali::RenderSurfaceInterface* surface, SurfaceSize surfaceSize );
+  void SurfaceResizePrepare(Dali::RenderSurfaceInterface* surface, SurfaceSize surfaceSize);
 
   /**
    * @brief Informs ThreadController the surface size has changed.
@@ -432,7 +391,7 @@ public:
    * @param[in] surface The current render surface
    * @param[in] surfaceSize The new surface size
    */
-  void SurfaceResizeComplete( Dali::RenderSurfaceInterface* surface, SurfaceSize surfaceSize );
+  void SurfaceResizeComplete(Dali::RenderSurfaceInterface* surface, SurfaceSize surfaceSize);
 
   /**
    * @brief Renders once more even if we're paused
@@ -441,23 +400,41 @@ public:
   void RenderOnce();
 
   /**
+   * @brief Relayout and ensure all pending operations are flushed to the update thread.
+   */
+  void FlushUpdateMessages();
+
+  /**
+   * @brief Requests a future call to Dali::Integration::Core::ProcessEvents(), when the application is idle.
+   */
+  void RequestProcessEventsOnIdle();
+
+  /**
    * @brief The log factory allows installation of a logger function in worker threads.
    * @return An interface to a logging factory
    */
   const LogFactoryInterface& GetLogFactory();
 
   /**
+   * @brief The trace factory allows installation of a trace function in worker threads.
+   * @return An interface to a tracing factory
+   */
+  const TraceFactoryInterface& GetTraceFactory();
+
+  /**
    * @brief Register a processor implementing the Integration::Processor interface with dali-core.
    * @param[in] processor the Processor to register
+   * @param[in] postProcessor set this processor required to be called after size negotiation. Default is false.
    * @note using this api does not maintain the processor's lifecycle, must be done elsewhere.
    */
-  void RegisterProcessor( Integration::Processor& processor );
+  void RegisterProcessor(Integration::Processor& processor, bool postProcessor = false);
 
   /**
    * @brief Unregister a previously registered processor from dali-core.
    * @param[in] processor the Processor to unregister
+   * @param[in] postProcessor True if the processor to be unregister is for post processor.
    */
-  void UnregisterProcessor( Integration::Processor& processor );
+  void UnregisterProcessor(Integration::Processor& processor, bool postProcessor = false);
 
   /**
    * @brief Get the list of windows created.
@@ -487,8 +464,7 @@ public:
    */
   void OnWindowHidden();
 
-public:  // Signals
-
+public: // Signals
   /**
    * @brief The user should connect to this signal if they need to perform any
    * special activities when the surface Dali is being rendered on is resized.
@@ -511,14 +487,19 @@ public:  // Signals
    */
   WindowCreatedSignalType& WindowCreatedSignal();
 
-private:
+  /**
+   * @brief This signal is emitted when the system locale is changed
+   *
+   * @return The signal to connect to
+   */
+  LocaleChangedSignalType& LocaleChangedSignal();
 
+private:
   // Undefined
   Adaptor(const Adaptor&);
   Adaptor& operator=(Adaptor&);
 
 private:
-
   /**
    * @brief Create an uninitialized Adaptor.
    */