[Tizen][AT-SPI] Track application lifecycle
[platform/core/uifw/dali-adaptor.git] / dali / devel-api / adaptor-framework / accessibility-bridge.h
index 1b59436..2ad9d38 100644 (file)
@@ -36,6 +36,7 @@ namespace Dali
 namespace Accessibility
 {
 class Accessible;
+class ProxyAccessible;
 
 /**
  * @brief Base class for different accessibility bridges.
@@ -115,6 +116,8 @@ struct DALI_ADAPTOR_API Bridge
    * that could be read by screen-reader immediately after the navigation context has changed
    * (window activates, popup shows up, tab changes) and before first UI element is highlighted.
    *
+   * @param[in] root The root of the navigation context for which to retrieve the default label.
+   *
    * @return The handler to accessibility object
    * @note This is a Tizen only feature not present in upstream ATSPI.
    * Feature can be enabled/disabled for particular context root object
@@ -122,7 +125,7 @@ struct DALI_ADAPTOR_API Bridge
    * Following strings are valid values for "default_label" attribute: "enabled", "disabled".
    * Any other value will be interpreted as "enabled".
    */
-  virtual Accessible* GetDefaultLabel() const = 0;
+  virtual Accessible* GetDefaultLabel(Accessible* root) const = 0;
 
   /**
    * @brief Sets name of current application which will be visible on accessibility bus.
@@ -157,6 +160,13 @@ struct DALI_ADAPTOR_API Bridge
   virtual Accessible* FindByPath(const std::string& path) const = 0;
 
   /**
+   * @brief Notifies accessibility dbus that window has just been created.
+   *
+   * @param[in] window The window to be created
+   */
+  virtual void WindowCreated(Window window) = 0;
+
+  /**
    * @brief Notifies accessibility dbus that window has just been shown.
    *
    * @param[in] window The window to be shown
@@ -185,6 +195,16 @@ struct DALI_ADAPTOR_API Bridge
   virtual void WindowUnfocused(Window window) = 0;
 
   /**
+   * @brief Tells the bridge that the application is not running
+   */
+  virtual void ApplicationPaused() = 0;
+
+  /**
+   * @brief Tells the bridge that the application is running
+    */
+  virtual void ApplicationResumed() = 0;
+
+  /**
    * @brief Initializes accessibility bus.
    */
   virtual void Initialize() = 0;
@@ -401,6 +421,48 @@ struct DALI_ADAPTOR_API Bridge
   virtual void UnembedSocket(const Address& plug, const Address& socket) = 0;
 
   /**
+   * @brief Calls socket.SetOffset(x, y) via D-Bus.
+   *
+   * The "SetOffset" D-Bus method is a DALi extension. It can be used to inform a DALi widget about
+   * its position on the screen.
+   *
+   * @param[in] socket The socket
+   * @param[in] x Horizontal offset
+   * @param[in] y Vertical offset
+   *
+   * @note Remote object pointed to by 'socket' must implement 'org.a11y.atspi.Socket'.
+   * @see EmbedSocket()
+   * @see SetExtentsOffset()
+   */
+  virtual void SetSocketOffset(ProxyAccessible* socket, std::int32_t x, std::int32_t y) = 0;
+
+  /**
+   * @brief Sets the global extents offset.
+   *
+   * This offset will be added during serialization of GetExtents() return value to D-Bus.
+   * Local calls to GetExtents() are unaffected.
+   *
+   * @param[in] x Horizontal offset
+   * @param[in] y Vertical offset
+   *
+   * @see SetSocketOffset()
+   * @see Dali::Accessibility::Component::GetExtents()
+   */
+  virtual void SetExtentsOffset(std::int32_t x, std::int32_t y) = 0;
+
+  /**
+   * @brief Sets the preferred bus name.
+   *
+   * If the Bridge is enabled, it will immediately release the previous name and request the new one.
+   *
+   * Otherwise, the Bridge will request this name on AT-SPI activation (and release it on deactivation).
+   * It is up to the caller to determine whether a given name will be available in the system.
+   *
+   * @param preferredBusName The preferred bus name
+   */
+  virtual void SetPreferredBusName(std::string_view preferredBusName) = 0;
+
+  /**
    * @brief Returns instance of bridge singleton object.
    *
    * @return The current bridge object
@@ -435,6 +497,16 @@ struct DALI_ADAPTOR_API Bridge
    */
   static void EnableAutoInit();
 
+  /**
+   * @brief Encodes a widget ID as a usable bus name.
+   *
+   * @param widgetInstanceId The instance ID of a widget
+   * @return std::string Encoded bus name
+   *
+   * @see SetPreferredBusName
+   */
+  static std::string MakeBusNameForWidget(std::string_view widgetInstanceId);
+
   static Signal<void()>& EnabledSignal()
   {
     return mEnabledSignal;
@@ -463,6 +535,7 @@ protected:
     Bridge*                               mBridge = nullptr;
     Actor                                 mHighlightActor;
     Actor                                 mCurrentlyHighlightedActor;
+    std::pair<std::int32_t, std::int32_t> mExtentsOffset{0, 0};
   };
   std::shared_ptr<Data> mData;
   friend class Accessible;