X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dali%2Finternal%2Faccessibility%2Fbridge%2Fbridge-base.h;h=6c72399f2e10b82b8f7616fadc264bb458016ab4;hb=HEAD;hp=094d2c5febdb25f3c14f243c7618e1d02f857f04;hpb=01d4f2fddcbec7b9c73c2d689e1a8628b36800e1;p=platform%2Fcore%2Fuifw%2Fdali-adaptor.git diff --git a/dali/internal/accessibility/bridge/bridge-base.h b/dali/internal/accessibility/bridge/bridge-base.h index 094d2c5..2cfcab0 100644 --- a/dali/internal/accessibility/bridge/bridge-base.h +++ b/dali/internal/accessibility/bridge/bridge-base.h @@ -2,7 +2,7 @@ #define DALI_INTERNAL_ACCESSIBILITY_BRIDGE_BASE_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. @@ -21,6 +21,7 @@ // EXTERNAL INCLUDES #include #include +#include #include #include #include @@ -109,6 +110,9 @@ public: result = result | child->GetStates(); } + // The Application object should never have the SENSITIVE state + result[Dali::Accessibility::State::SENSITIVE] = false; + return result; } @@ -156,7 +160,7 @@ public: return {}; } - Dali::Actor GetInternalActor() override + Dali::Actor GetInternalActor() const override { return Dali::Actor{}; } @@ -279,8 +283,13 @@ public: */ enum class CoalescableMessages { - BOUNDS_CHANGED, ///< Bounds changed - SET_OFFSET, ///< Set offset + BOUNDS_CHANGED, ///< Bounds changed + SET_OFFSET, ///< Set offset + POST_RENDER, ///< Post render + STATE_CHANGED_BEGIN = 500, ///< State changed (begin of reserved range) + STATE_CHANGED_END = STATE_CHANGED_BEGIN + 99, ///< State changed (end of reserved range) + PROPERTY_CHANGED_BEGIN, ///< Property changed (begin of reserved range) + PROPERTY_CHANGED_END = PROPERTY_CHANGED_BEGIN + 99, ///< Property changed (end of reserved range) }; // Custom specialization of std::hash @@ -355,17 +364,17 @@ public: /** * @copydoc Dali::Accessibility::Bridge::RegisterDefaultLabel() */ - void RegisterDefaultLabel(Dali::Accessibility::Accessible* object) override; + void RegisterDefaultLabel(std::shared_ptr object) override; /** * @copydoc Dali::Accessibility::Bridge::UnregisterDefaultLabel() */ - void UnregisterDefaultLabel(Dali::Accessibility::Accessible* object) override; + void UnregisterDefaultLabel(std::shared_ptr object) override; /** * @copydoc Dali::Accessibility::Bridge::GetDefaultLabel() */ - Dali::Accessibility::Accessible* GetDefaultLabel(Dali::Accessibility::Accessible* root) const override; + Dali::Accessibility::Accessible* GetDefaultLabel(Dali::Accessibility::Accessible* root) override; /** * @copydoc Dali::Accessibility::Bridge::GetApplication() @@ -608,9 +617,13 @@ public: } protected: - mutable ApplicationAccessible mApplication; - std::vector mDefaultLabels; - bool mIsScreenReaderSuppressed = false; + // We use a weak handle in order not to keep a window alive forever if someone forgets to UnregisterDefaultLabel() + using DefaultLabelType = std::pair, std::weak_ptr>; + using DefaultLabelsType = std::list; + + mutable ApplicationAccessible mApplication; + DefaultLabelsType mDefaultLabels; + bool mIsScreenReaderSuppressed = false; private: /** @@ -660,6 +673,19 @@ private: */ CacheElementType CreateCacheElement(Dali::Accessibility::Accessible* item); + /** + * @brief Removes expired elements from the default label collection. + */ + void CompressDefaultLabels(); + + /** + * @brief Gets the window to which this accessible belongs (or an empty handle). + * + * @param accessible The accessible + * @return The window + */ + static Dali::WeakHandle GetWindow(Dali::Accessibility::Accessible* accessible); + protected: BridgeBase(); virtual ~BridgeBase();