1 #ifndef DALI_ATSPI_ACCESSIBILITY_H
\r
2 #define DALI_ATSPI_ACCESSIBILITY_H
\r
4 * Copyright (c) 2023 Samsung Electronics Co., Ltd.
\r
6 * Licensed under the Apache License, Version 2.0 (the "License");
\r
7 * you may not use this file except in compliance with the License.
\r
8 * You may obtain a copy of the License at
\r
10 * http://www.apache.org/licenses/LICENSE-2.0
\r
12 * Unless required by applicable law or agreed to in writing, software
\r
13 * distributed under the License is distributed on an "AS IS" BASIS,
\r
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
\r
15 * See the License for the specific language governing permissions and
\r
16 * limitations under the License.
\r
20 // EXTERNAL INCLUDES
\r
22 #include <unordered_map>
\r
25 // INTERNAL INCLUDES
\r
26 #include <dali/devel-api/adaptor-framework/accessibility-bitset.h>
\r
27 #include <dali/public-api/dali-adaptor-common.h>
\r
31 namespace Accessibility
\r
36 * @brief Enumeration describing type of object move relative to the screen. Only outgoing moves are signalled to AT-clients.
\r
38 enum class ScreenRelativeMoveType
\r
40 OUTSIDE = 0, ///< Object moves outside of the screen
\r
41 OUTGOING_TOP_LEFT = 1, ///< Object moves out through the top(or left) side of the screen. Maps to: ATSPI_MOVE_OUTED_TOP_LEFT
\r
42 OUTGOING_BOTTOM_RIGHT = 2, ///< Object moves out through the bottom(or right) side of the screen. Maps to: ATSPI_MOVE_OUTED_BOTTOM_RIGHT
\r
43 INSIDE ///< Object moves into the screen or moves inside the screen
\r
47 * @brief Enumeration describing a relation between accessible objects
\r
48 * 1 to 0..N relation model is supported. By default relation is not symmetrical.
\r
49 * Symmetry must be explicitly maintained.
\r
51 enum class RelationType : uint32_t
\r
53 NULL_OF, ///< Null Relation.
\r
54 LABEL_FOR, ///< Label For.
\r
55 LABELLED_BY, ///< Labelled By.
\r
56 CONTROLLER_FOR, ///< Controller For.
\r
57 CONTROLLED_BY, ///< Controlled By.
\r
58 MEMBER_OF, ///< Member Of.
\r
59 TOOLTIP_FOR, ///< ToolTip For.
\r
60 NODE_CHILD_OF, ///< Node Child Of.
\r
61 NODE_PARENT_OF, ///< Node Parent Of.
\r
62 EXTENDED, ///< Extended.
\r
63 FLOWS_TO, ///< Flows To.
\r
64 FLOWS_FROM, ///< Flows From.
\r
65 SUBWINDOW_OF, ///< Sub Window Of.
\r
66 EMBEDS, ///< Embeds.
\r
67 EMBEDDED_BY, ///< Embedded By.
\r
68 POPUP_FOR, ///< Popup For
\r
69 PARENT_WINDOW_OF, ///< Parent Window Of.
\r
70 DESCRIPTION_FOR, ///< Description For.
\r
71 DESCRIBED_BY, ///< Described By.
\r
72 DETAILS, ///< Details.
\r
73 DETAILS_FOR, ///< Details For.
\r
74 ERROR_MESSAGE, ///< Error Message.
\r
75 ERROR_FOR, ///< Error For.
\r
80 * @brief Enumeration describing if coordinates are relative to screen or window
\r
81 * @see Accessibility::Component::GetExtents
\r
82 * @see Accessibility::Component::IsAccessibleContainingPoint
\r
84 enum class CoordinateType
\r
86 SCREEN, ///< Screen.
\r
91 * @brief Enumeration indicating relative stacking order
\r
92 * ComponentLayer allows to describe visibility of all parts of UI
\r
93 * basing on the concrete stacking order
\r
94 * @see Accessibility::Component::GetLayer
\r
95 * @note currently only ComponentLayer::Window is supported
\r
97 enum class ComponentLayer
\r
99 INVALID, ///< Invalid.
\r
100 BACKGROUND, ///< Background.
\r
101 CANVAS, ///< Canvas.
\r
102 WIDGET, ///< Widget.
\r
105 OVERLAY, ///< Overlay.
\r
106 WINDOW, ///< Window.
\r
111 * @brief Enumeration describing role of the Accessibility object
\r
112 * Object can be described by only one role.
\r
113 * @see Accessibility::Accessible::GetRole
\r
115 enum class Role : uint32_t
\r
174 TABLE_COLUMN_HEADER,
\r
206 INPUT_METHOD_WINDOW,
\r
209 DOCUMENT_SPREADSHEET,
\r
210 DOCUMENT_PRESENTATION,
\r
242 * @brief Enumeration describing states of the Accessibility object
\r
243 * Object can be in many states at the same time.
\r
244 * @see Accessibility::Accessible::GetStates
\r
246 enum class State : uint32_t
\r
279 MANAGES_DESCENDANTS,
\r
285 SUPPORTS_AUTOCOMPLETION,
\r
298 * @brief Enumeration describing change of text object
\r
300 enum class TextChangedState : uint32_t
\r
308 * @brief Enumeration describing change of object property
\r
310 enum class ObjectPropertyChangeEvent
\r
320 * @brief Enumeration describing change of window object
\r
321 * @see Accessibility::Accessible::Emit
\r
323 enum class WindowEvent
\r
348 * @brief Restored window state
\r
349 * @see Accessibility::Accessible::Emit
\r
351 enum class WindowRestoreType
\r
353 RESTORE_FROM_ICONIFY, // The Window is Deiconified.
\r
354 RESTORE_FROM_MAXIMIZE // The Window is Unmaximized.
\r
358 * @brief Enumeration used to acquire bounded text from accessible object having textual content.
\r
359 * @see Accessibility::Text::GetTextAtOffset
\r
360 * @note Currently only TextBoundary::Character is supported
\r
362 enum class TextBoundary : uint32_t
\r
364 CHARACTER, ///> Only one character is acquired.
\r
365 WORD, ///> Not supported.
\r
366 SENTENCE, ///> Not supported.
\r
367 LINE, ///> Not supported.
\r
368 PARAGRAPH, ///> Not supported.
\r
373 * @brief Enumeration describing type of gesture
\r
374 * @see Accessibility::Accessible::DoGesture
\r
376 enum class Gesture : int32_t
\r
380 THREE_FINGER_HOVER,
\r
381 ONE_FINGER_FLICK_LEFT,
\r
382 ONE_FINGER_FLICK_RIGHT,
\r
383 ONE_FINGER_FLICK_UP,
\r
384 ONE_FINGER_FLICK_DOWN,
\r
385 TWO_FINGERS_FLICK_LEFT,
\r
386 TWO_FINGERS_FLICK_RIGHT,
\r
387 TWO_FINGERS_FLICK_UP,
\r
388 TWO_FINGERS_FLICK_DOWN,
\r
389 THREE_FINGERS_FLICK_LEFT,
\r
390 THREE_FINGERS_FLICK_RIGHT,
\r
391 THREE_FINGERS_FLICK_UP,
\r
392 THREE_FINGERS_FLICK_DOWN,
\r
393 ONE_FINGER_SINGLE_TAP,
\r
394 ONE_FINGER_DOUBLE_TAP,
\r
395 ONE_FINGER_TRIPLE_TAP,
\r
396 TWO_FINGERS_SINGLE_TAP,
\r
397 TWO_FINGERS_DOUBLE_TAP,
\r
398 TWO_FINGERS_TRIPLE_TAP,
\r
399 THREE_FINGERS_SINGLE_TAP,
\r
400 THREE_FINGERS_DOUBLE_TAP,
\r
401 THREE_FINGERS_TRIPLE_TAP,
\r
402 ONE_FINGER_FLICK_LEFT_RETURN,
\r
403 ONE_FINGER_FLICK_RIGHT_RETURN,
\r
404 ONE_FINGER_FLICK_UP_RETURN,
\r
405 ONE_FINGER_FLICK_DOWN_RETURN,
\r
406 TWO_FINGERS_FLICK_LEFT_RETURN,
\r
407 TWO_FINGERS_FLICK_RIGHT_RETURN,
\r
408 TWO_FINGERS_FLICK_UP_RETURN,
\r
409 TWO_FINGERS_FLICK_DOWN_RETURN,
\r
410 THREE_FINGERS_FLICK_LEFT_RETURN,
\r
411 THREE_FINGERS_FLICK_RIGHT_RETURN,
\r
412 THREE_FINGERS_FLICK_UP_RETURN,
\r
413 THREE_FINGERS_FLICK_DOWN_RETURN,
\r
414 ONE_FINGER_DOUBLE_TAP_N_HOLD,
\r
415 TWO_FINGERS_DOUBLE_TAP_N_HOLD,
\r
416 THREE_FINGERS_DOUBLE_TAP_N_HOLD,
\r
421 * @brief Enumeration indicating current state of gesture
\r
422 * @see Dali::Accessibility::GestureInfo
\r
424 enum class GestureState : int32_t
\r
433 * @brief Enumeration of ReadingInfoType
\r
435 enum class ReadingInfoType
\r
445 * @brief Enumeration of all AT-SPI interfaces.
\r
447 * @see Dali::Accessibility::Accessible::GetInterfaceName()
\r
448 * @see Dali::Accessibility::AtspiInterfaceType
\r
450 enum class AtspiInterface
\r
458 DEVICE_EVENT_CONTROLLER,
\r
459 DEVICE_EVENT_LISTENER,
\r
483 * @brief Enumeration of all AT-SPI events.
\r
485 enum class AtspiEvent
\r
492 VISIBLE_DATA_CHANGED,
\r
495 ACTIVE_DESCENDANT_CHANGED,
\r
502 TEXT_BOUNDS_CHANGED,
\r
503 TEXT_SELECTION_CHANGED,
\r
505 TEXT_ATTRIBUTES_CHANGED,
\r
507 ATTRIBUTES_CHANGED,
\r
515 using AtspiInterfaces = EnumBitSet<AtspiInterface, AtspiInterface::MAX_COUNT>;
\r
516 using AtspiEvents = EnumBitSet<AtspiEvent, AtspiEvent::MAX_COUNT>;
\r
517 using ReadingInfoTypes = EnumBitSet<ReadingInfoType, ReadingInfoType::MAX_COUNT>;
\r
518 using States = EnumBitSet<State, State::MAX_COUNT>;
\r
519 using Attributes = std::unordered_map<std::string, std::string>;
\r
524 * AT-SPI interfaces exposed as native C++ types should specialize this like so:
\r
527 * struct AtspiInterfaceTypeHelper<AtspiInterface::ACCESSIBLE>
\r
529 * using Type = Dali::Accessibility::Accessible;
\r
532 template<AtspiInterface I>
\r
533 struct AtspiInterfaceTypeHelper; // no default definition
\r
535 } // namespace Internal
\r
538 * @brief Resolves to the native C++ type that represents the given AT-SPI interface.
\r
540 * For example, @code AtspiInterfaceType<AtspiInterface::ACCESSIBLE> @endcode is the same as
\r
541 * @code Dali::Accessibility::Accessible @endcode. Not all AT-SPI interfaces have native C++
\r
542 * representations (in which case, such an expression will not compile).
\r
544 * @tparam I Enumeration value indicating the requested AT-SPI interface.
\r
546 template<AtspiInterface I>
\r
547 using AtspiInterfaceType = typename Internal::AtspiInterfaceTypeHelper<I>::Type;
\r
550 * @brief Class representing unique object address on accessibility bus
\r
551 * @see Dali::Accessibility::Accessible::GetAddress
\r
553 class DALI_ADAPTOR_API Address
\r
556 Address() = default;
\r
558 Address(std::string bus, std::string path)
\r
559 : mBus(std::move(bus)),
\r
560 mPath(std::move(path))
\r
564 explicit operator bool() const
\r
566 return !mPath.empty();
\r
569 std::string ToString() const
\r
571 return *this ? mBus + ":" + mPath : "::null";
\r
574 const std::string& GetBus() const;
\r
576 const std::string& GetPath() const
\r
581 bool operator==(const Address& a) const
\r
583 return mBus == a.mBus && mPath == a.mPath;
\r
586 bool operator!=(const Address& a) const
\r
588 return !(*this == a);
\r
592 mutable std::string mBus, mPath;
\r
596 * @brief Enumeration describing type of key event
\r
597 * @see Adaptor::AccessibilityObserver::OnAccessibleKeyEvent
\r
599 enum class KeyEventType
\r
606 * @brief Enumeration with human readable values describing state of event
\r
607 * @see Dali::Accessibility::Bridge::Emit
\r
609 enum class Consumed
\r
616 * @brief Helper class representing two dimensional point with integer coordinates
\r
618 struct DALI_ADAPTOR_API Point
\r
625 Point(int x, int y)
\r
631 bool operator==(Point p) const
\r
633 return x == p.x && y == p.y;
\r
635 bool operator!=(Point p) const
\r
637 return !(*this == p);
\r
642 * @brief Helper class representing size of rectangle object with usage of two integer values
\r
644 struct DALI_ADAPTOR_API Size
\r
657 bool operator==(Size p) const
\r
659 return width == p.width && height == p.height;
\r
662 bool operator!=(Size p) const
\r
664 return !(*this == p);
\r
669 * @brief Helper class used to store data related with Accessibility::Text interface
\r
670 * @see Dali::Accessibility::Text::GetTextAtOffset
\r
671 * @see Dali::Accessibility::Text::GetRangeOfSelection
\r
673 struct DALI_ADAPTOR_API Range
\r
675 int32_t startOffset = 0;
\r
676 int32_t endOffset = 0;
\r
677 std::string content;
\r
681 Range(size_t start, size_t end)
\r
682 : startOffset(start),
\r
687 Range(size_t start, size_t end, std::string content)
\r
688 : startOffset(start),
\r
696 * @brief Structure containing all values needed to invoke Accessible::DoGesture
\r
697 * type : numerated gesture type
\r
698 * startPositionX, startPositionY : point where gesture begins
\r
699 * endPositionX, endPositionY : point where gesture ends
\r
700 * state : enumerated state of gesture
\r
701 * eventTime : time when event occured
\r
702 * @see Dali::Accessibility::Accessible::DoGesture
\r
704 struct DALI_ADAPTOR_API GestureInfo
\r
706 GestureInfo() = default;
\r
707 GestureInfo(Gesture type, int32_t startPositionX, int32_t endPositionX, int32_t startPositionY, int32_t endPositionY, GestureState state, uint32_t eventTime)
\r
709 startPointX(startPositionX),
\r
710 endPointX(endPositionX),
\r
711 startPointY(startPositionY),
\r
712 endPointY(endPositionY),
\r
714 eventTime(eventTime)
\r
719 int32_t startPointX{};
\r
720 int32_t endPointX{};
\r
721 int32_t startPointY{};
\r
722 int32_t endPointY{};
\r
723 GestureState state{};
\r
724 uint32_t eventTime{};
\r
728 * @brief Class representing accessibility relations
\r
730 * Class connecting one source object with multiple target objects with usage
\r
731 * of specific relation type.
\r
733 * A remote target object (i.e. one belonging to a different process) can be
\r
734 * represented in terms of a ProxyAccessible.
\r
736 * @see Dali::Accessibility::Accessible::Accessible
\r
737 * @see Dali::Accessibility::Accessible::RelationType
\r
739 struct DALI_ADAPTOR_API Relation
\r
741 Relation(RelationType relationType, const std::vector<Accessible*>& targets)
\r
742 : mRelationType(relationType),
\r
747 RelationType mRelationType;
\r
748 std::vector<Accessible*> mTargets;
\r
751 } // namespace Accessibility
\r
752 } // namespace Dali
\r
754 #endif // DALI_ATSPI_ACCESSIBILITY_H
\r