[AT-SPI] Add Accessible::IsHighlighted() 56/309956/1
authorArtur Świgoń <a.swigon@samsung.com>
Thu, 18 Apr 2024 09:23:30 +0000 (11:23 +0200)
committerArtur Świgoń <a.swigon@samsung.com>
Thu, 18 Apr 2024 09:33:27 +0000 (11:33 +0200)
This helper allows to simplify multiple comparisons of Self() to
GetCurrentlyHighlightedActor() to simply checking IsHighlighted().

Change-Id: I61354dc7b0cec90facdc4005ae0b6063697c8fc5

dali/devel-api/adaptor-framework/accessibility.cpp
dali/devel-api/adaptor-framework/actor-accessible.cpp
dali/devel-api/adaptor-framework/actor-accessible.h
dali/devel-api/adaptor-framework/proxy-accessible.h
dali/devel-api/atspi-interfaces/accessible.h
dali/internal/accessibility/bridge/bridge-base.h

index 8b7a10ff2697d4657e6dbe834012371e1f890e61..f69c96cdc768806952b25f6658ba5a8ad6cb10ac 100644 (file)
@@ -306,6 +306,13 @@ void Accessible::SetCurrentlyHighlightedActor(Dali::Actor actor)
   }
 }
 
+bool Accessible::IsHighlighted() const
+{
+  Dali::Actor self = GetInternalActor();
+
+  return self && self == GetCurrentlyHighlightedActor();
+}
+
 Dali::Actor Accessible::GetHighlightActor()
 {
   return IsUp() ? Bridge::GetCurrentBridge()->mData->mHighlightActor : Dali::Actor{};
@@ -412,15 +419,14 @@ public:
       return false;
     }
 
-    auto self = Self();
-    if(self != GetCurrentlyHighlightedActor())
+    if(!IsHighlighted())
     {
       return false;
     }
 
     SetCurrentlyHighlightedActor({});
 
-    auto                             window     = Dali::DevelWindow::Get(self);
+    auto                             window     = Dali::DevelWindow::Get(Self());
     Dali::Internal::Adaptor::Window& windowImpl = Dali::GetImplementation(window);
     windowImpl.EmitAccessibilityHighlightSignal(false);
 
index 6f940a77666ecad7cbb7c580e9ddc01c42912a28..9a82d1387c7d52399e0ede2860fb79d9a4d2568c 100644 (file)
@@ -108,7 +108,7 @@ std::size_t ActorAccessible::GetIndexInParent()
   throw std::domain_error{"actor is not a child of its parent"};
 }
 
-Dali::Actor ActorAccessible::GetInternalActor()
+Dali::Actor ActorAccessible::GetInternalActor() const
 {
   return Self();
 }
index 1cf3812463b26778bc6cd4724aa5b8edf96330cb..c885e6d3fd8fa40bf4e3f0cc66231a54b1054f41 100644 (file)
@@ -77,7 +77,7 @@ public:
   /**
    * @copydoc Dali::Accessibility::Accessible::GetInternalActor()
    */
-  Dali::Actor GetInternalActor() final;
+  Dali::Actor GetInternalActor() const final;
 
   /**
    * @copydoc Dali::Accessibility::Component::GetLayer()
index 33e6b1bf0bbf29d24b582f7f8bb47e4b1574ee18..35aaf45ab4b3d54f99c180966f23d7be096e1eab 100644 (file)
@@ -129,7 +129,7 @@ public:
     return {};
   }
 
-  Dali::Actor GetInternalActor() override
+  Dali::Actor GetInternalActor() const override
   {
     return Dali::Actor{};
   }
index ae97750a223add05d9ef30fc2ae8473c61815c46..f34f9e3a38e106f66320efa9a8d6991bb5f41c3e 100644 (file)
@@ -282,6 +282,13 @@ public:
    */
   virtual bool IsProxy() const;
 
+  /**
+   * @brief Checks if this is highlighted
+   *
+   * @return True if highlighted, false otherwise
+   */
+  bool IsHighlighted() const;
+
   /**
    * @brief Gets unique address on accessibility bus.
    *
@@ -325,7 +332,7 @@ public:
    *
    * @return The internal Actor
    */
-  virtual Dali::Actor GetInternalActor() = 0;
+  virtual Dali::Actor GetInternalActor() const = 0;
 
   /**
    * @brief Sets whether to listen for post render callback.
index ab797232c59e810ef60a7da37e140add6324fc06..20d7589c430075975974f7fcb2418110f2a41d9f 100644 (file)
@@ -160,7 +160,7 @@ public:
     return {};
   }
 
-  Dali::Actor GetInternalActor() override
+  Dali::Actor GetInternalActor() const override
   {
     return Dali::Actor{};
   }