1 #ifndef DALI_TOOLKIT_CONTROL_ACCESSIBLE_H
2 #define DALI_TOOLKIT_CONTROL_ACCESSIBLE_H
5 * Copyright (c) 2023 Samsung Electronics Co., Ltd.
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
22 #include <dali/devel-api/adaptor-framework/accessibility-bridge.h>
23 #include <dali/devel-api/adaptor-framework/accessibility.h>
24 #include <dali/devel-api/adaptor-framework/actor-accessible.h>
25 #include <dali/devel-api/atspi-interfaces/action.h>
26 #include <dali/public-api/object/weak-handle.h>
29 #include <dali-toolkit/public-api/dali-toolkit-common.h>
31 namespace Dali::Toolkit::DevelControl
34 * @brief Represents the Accessible object for Dali::Toolkit::Control and derived classes
36 * You can create a derived class (and override Control::CreateAccessibleObject)
37 * in order to customize Accessibility for a given control.
39 * @see Dali::Accessibility::Accessible
40 * @see Dali::Accessibility::Component
41 * @see Dali::Accessibility::Collection
42 * @see Dali::Accessibility::Action
43 * @see Dali::Accessibility::Value
44 * @see Dali::Accessibility::Text
45 * @see Dali::Accessibility::EditableText
47 struct DALI_TOOLKIT_API ControlAccessible : public Dali::Accessibility::ActorAccessible,
48 public virtual Dali::Accessibility::Action
51 Vector2 mLastPosition{0.0f, 0.0f};
52 Dali::WeakHandle<Dali::Actor> mCurrentHighlightActor;
57 * @brief Register property notification to check highlighted object position
59 void RegisterPositionPropertyNotification();
62 * @brief Remove property notification added by RegisterPropertyNotification
64 void UnregisterPositionPropertyNotification();
67 * @brief Registers PropertySet signal to notify when ACCESSIBILITY_NAME or ACCESSIBILITY_DESCRIPTION is changed.
68 * Note that those two signals only need for highlighted control. So, let us ensure to connect PropertySet signal
69 * only if control has been grabbed.
71 void RegisterPropertySetSignal();
74 * @brief Unregisters PropertySet signal to notify when ACCESSIBILITY_NAME or ACCESSIBILITY_DESCRIPTION is changed.
76 void UnregisterPropertySetSignal();
79 * @brief Check if the actor is showing
80 * @return True if the actor is showing
85 ControlAccessible(Dali::Actor self);
88 * @copydoc Dali::Accessibility::Accessible::GetName()
90 std::string GetName() const override;
93 * @brief Returns the actor's name in the absence of ACCESSIBILITY_NAME property
95 virtual std::string GetNameRaw() const;
98 * @copydoc Dali::Accessibility::Accessible::GetDescription()
100 std::string GetDescription() const override;
103 * @brief Returns the actor's description in the absence of ACCESSIBILITY_DESCRIPTION property
105 virtual std::string GetDescriptionRaw() const;
108 * @copydoc Dali::Accessibility::Accessible::GetRole()
110 Dali::Accessibility::Role GetRole() const override;
113 * @copydoc Dali::Accessibility::Accessible::GetLocalizedRoleName()
115 std::string GetLocalizedRoleName() const override;
118 * @copydoc Dali::Accessibility::Accessible::GetStates()
120 Dali::Accessibility::States GetStates() override;
123 * @copydoc Dali::Accessibility::Accessible::GetAttributes()
125 Dali::Accessibility::Attributes GetAttributes() const override;
128 * @copydoc Dali::Accessibility::Accessible::IsHidden()
130 bool IsHidden() const override;
133 * @copydoc Dali::Accessibility::Component::GrabFocus()
135 bool GrabFocus() override;
138 * @copydoc Dali::Accessibility::Component::GrabHighlight()
140 bool GrabHighlight() override;
143 * @copydoc Dali::Accessibility::Component::ClearHighlight()
145 bool ClearHighlight() override;
148 * @copydoc Dali::Accessibility::Action::GetActionName()
150 std::string GetActionName(size_t index) const override;
153 * @copydoc Dali::Accessibility::Action::GetLocalizedActionName()
155 std::string GetLocalizedActionName(size_t index) const override;
158 * @copydoc Dali::Accessibility::Action::GetActionDescription()
160 std::string GetActionDescription(size_t index) const override;
163 * @copydoc Dali::Accessibility::Action::GetActionCount()
165 size_t GetActionCount() const override;
168 * @copydoc Dali::Accessibility::Action::GetActionKeyBinding()
170 std::string GetActionKeyBinding(size_t index) const override;
173 * @copydoc Dali::Accessibility::Action::DoAction(std::size_t)
175 bool DoAction(size_t index) override;
178 * @copydoc Dali::Accessibility::Action::DoAction(const std::string&)
180 bool DoAction(const std::string& name) override;
183 * @copydoc Dali::Accessibility::Accessible::DoGesture()
185 bool DoGesture(const Dali::Accessibility::GestureInfo& gestureInfo) override;
188 * @copydoc Dali::Accessibility::Accessible::GetRelationSet()
190 std::vector<Dali::Accessibility::Relation> GetRelationSet() override;
193 * @copydoc Dali::Accessibility::Accessible::GetStates()
195 virtual Dali::Accessibility::States CalculateStates();
198 * @brief Makes sure that a given child (descendant) of this container (e.g. ItemView) is visible
199 * @return false if scrolling is not supported or child is already visible
201 virtual bool ScrollToChild(Actor child);
204 * @brief Returns the index of the property that represents this actor's name
206 virtual Dali::Property::Index GetNamePropertyIndex();
209 * @brief Returns the index of the property that represents this actor's description
211 virtual Dali::Property::Index GetDescriptionPropertyIndex();
214 * @brief Sets last object position
215 * @param[in] position Last object position
217 void SetLastPosition(Vector2 position);
220 * @brief Gets last object position
221 * @return The Last object position
223 Vector2 GetLastPosition() const;
226 } // namespace Dali::Toolkit::DevelControl
228 #endif // DALI_TOOLKIT_CONTROL_ACCESSIBLE_H