[dali_2.3.42] Merge branch 'devel/master'
[platform/core/uifw/dali-adaptor.git] / dali / devel-api / adaptor-framework / accessibility-bridge.h
index 38ccd70..878a981 100644 (file)
@@ -2,7 +2,7 @@
 #define DALI_ADAPTOR_ACCESSIBILITY_BRIDGE_H
 
 /*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2024 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.
@@ -20,6 +20,7 @@
 
 // EXTERNAL INCLUDES
 #include <dali/public-api/actors/actor.h>
+#include <dali/public-api/events/key-event.h>
 #include <dali/public-api/math/rect.h>
 #include <functional>
 #include <memory>
@@ -62,6 +63,26 @@ struct DALI_ADAPTOR_API Bridge
   virtual ~Bridge() = default;
 
   /**
+   * @brief Adds the accessible object associated with given actorId to the brige.
+   */
+  virtual void AddAccessible(uint32_t actorId, std::shared_ptr<Accessible> accessible) = 0;
+
+  /**
+   * @brief Removed the accessible object associated with given actorId from the brige.
+   */
+  virtual void RemoveAccessible(uint32_t actorId) = 0;
+
+  /**
+   * @brief Gets the accessible object associated with given actor from the brige.
+   */
+  virtual std::shared_ptr<Accessible> GetAccessible(Actor actor) const = 0;
+
+  /**
+   * @brief Returns true if GetChildren should include hidden objects; false otherwise.
+   */
+  virtual bool ShouldIncludeHidden() const = 0;
+
+  /**
    * @brief Gets bus name which bridge is initialized on.
    *
    * @return The bus name
@@ -98,7 +119,7 @@ struct DALI_ADAPTOR_API Bridge
    *
    * @param[in] object The accessible object
    */
-  virtual void RegisterDefaultLabel(Accessible* object) = 0;
+  virtual void RegisterDefaultLabel(std::shared_ptr<Accessible> object) = 0;
 
   /**
    * @brief Removes object from the stack of "default label" sourcing objects.
@@ -107,7 +128,7 @@ struct DALI_ADAPTOR_API Bridge
    *
    * @param[in] object The accessible object
    */
-  virtual void UnregisterDefaultLabel(Accessible* object) = 0;
+  virtual void UnregisterDefaultLabel(std::shared_ptr<Accessible> object) = 0;
 
   /**
    * @brief Gets the top-most object from the stack of "default label" sourcing objects.
@@ -125,7 +146,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(Accessible* root) const = 0;
+  virtual Accessible* GetDefaultLabel(Accessible* root) = 0;
 
   /**
    * @brief Sets name of current application which will be visible on accessibility bus.
@@ -217,6 +238,16 @@ struct DALI_ADAPTOR_API Bridge
   virtual void WindowMaximized(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;
@@ -301,14 +332,14 @@ struct DALI_ADAPTOR_API Bridge
    *
    * @param obj Accessible Object
    */
-  virtual void EmitScrollStarted(Accessible *obj) = 0;
+  virtual void EmitScrollStarted(Accessibleobj) = 0;
 
-    /**
+  /**
    * @brief Emits ScrollFinished event on at-spi bus.
    *
    * @param obj Accessible Object
    */
-  virtual void EmitScrollFinished(Accessible *obj) = 0;
+  virtual void EmitScrollFinished(Accessibleobj) = 0;
 
   /**
    * @brief Emits state-changed event on at-spi bus.
@@ -318,7 +349,7 @@ struct DALI_ADAPTOR_API Bridge
    * @param[in] newValue Whether the state value is changed to new value or not.
    * @param[in] reserved Reserved. (Currently, this argument is not implemented in dali)
    **/
-  virtual void EmitStateChanged(Accessible* obj, State state, int newValue, int reserved = 0) = 0;
+  virtual void EmitStateChanged(std::shared_ptr<Accessible> obj, State state, int newValue, int reserved = 0) = 0;
 
   /**
    * @brief Emits window event on at-spi bus.
@@ -335,7 +366,7 @@ struct DALI_ADAPTOR_API Bridge
    * @param[in] obj The accessible object
    * @param[in] event Property changed event
    **/
-  virtual void Emit(Accessible* obj, ObjectPropertyChangeEvent event) = 0;
+  virtual void Emit(std::shared_ptr<Accessible> obj, ObjectPropertyChangeEvent event) = 0;
 
   /**
    * @brief Emits bounds-changed event on at-spi bus.
@@ -343,7 +374,7 @@ struct DALI_ADAPTOR_API Bridge
    * @param[in] obj The accessible object
    * @param[in] rect The rectangle for changed bounds
    **/
-  virtual void EmitBoundsChanged(Accessible* obj, Rect<> rect) = 0;
+  virtual void EmitBoundsChanged(std::shared_ptr<Accessible> obj, Rect<> rect) = 0;
 
   /**
    * @brief Emits org.a11y.atspi.Event.Window.PostRender on the AT-SPI bus.
@@ -356,7 +387,7 @@ struct DALI_ADAPTOR_API Bridge
    * The actual number of events emitted during a given time interval may be smaller
    * than the number of calls to this method, but at least one is guaranteed.
    */
-  virtual void EmitPostRender(Accessible *obj) = 0;
+  virtual void EmitPostRender(std::shared_ptr<Accessible> obj) = 0;
 
   /**
    * @brief Emits key event on at-spi bus.
@@ -364,14 +395,11 @@ struct DALI_ADAPTOR_API Bridge
    * Screen-reader might receive this event and reply, that given keycode is consumed. In that case
    * further processing of the keycode should be ignored.
    *
-   * @param[in] type Key event type
-   * @param[in] keyCode Key code
-   * @param[in] keyName Key name
-   * @param[in] timeStamp Time stamp
-   * @param[in] isText Whether it's text or not
-   * @return Whether this event is consumed or not
-   **/
-  virtual Consumed Emit(KeyEventType type, unsigned int keyCode, const std::string& keyName, unsigned int timeStamp, bool isText) = 0;
+   * @param[in] keyEvent The key event
+   * @param[in] callback Notification if the event was consumed
+   * @return true if the event was emitted
+   */
+  virtual bool EmitKeyEvent(Dali::KeyEvent keyEvent, std::function<void(Dali::KeyEvent, bool)> callback) = 0;
 
   /**
    * @brief Reads given text by screen reader
@@ -438,17 +466,6 @@ struct DALI_ADAPTOR_API Bridge
   virtual Address EmbedSocket(const Address& plug, const Address& socket) = 0;
 
   /**
-   * @brief Calls socket.Embedded(plug) via D-Bus.
-   *
-   * The "Embedded" D-Bus method is an ATK extension.
-   * See 'impl_Embedded' in AT_SPI2_ATK/atk-adaptor/adaptors/socket-adaptor.c for more information.
-   *
-   * @param[in] plug The plug
-   * @param[in] socket The socket
-   */
-  virtual void EmbedAtkSocket(const Address& plug, const Address& socket) = 0;
-
-  /**
    * @brief Calls socket.Unmbed(plug) via D-Bus.
    *
    * @param[in] plug The plug
@@ -540,11 +557,12 @@ struct DALI_ADAPTOR_API Bridge
    * @brief Encodes a widget ID as a usable bus name.
    *
    * @param widgetInstanceId The instance ID of a widget
+   * @param widgetProcessId The process ID (PID) of the widget
    * @return std::string Encoded bus name
    *
    * @see SetPreferredBusName
    */
-  static std::string MakeBusNameForWidget(std::string_view widgetInstanceId);
+  static std::string MakeBusNameForWidget(std::string_view widgetInstanceId, int widgetProcessId);
 
   static Signal<void()>& EnabledSignal()
   {