1 #ifndef DALI_ATSPI_ACCESSIBILITY_H
\r
2 #define DALI_ATSPI_ACCESSIBILITY_H
\r
4 * Copyright (c) 2021 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
34 * @brief Enumeration describing type of object move relative to the screen. Only outgoing moves are signalled to AT-clients.
\r
36 enum class ScreenRelativeMoveType
\r
38 OUTSIDE = 0, ///< Object moves outside of the screen
\r
39 OUTGOING_TOP_LEFT = 1, ///< Object moves out through the top(or left) side of the screen. Maps to: ATSPI_MOVE_OUTED_TOP_LEFT
\r
40 OUTGOING_BOTTOM_RIGHT = 2, ///< Object moves out through the bottom(or right) side of the screen. Maps to: ATSPI_MOVE_OUTED_BOTTOM_RIGHT
\r
41 INSIDE ///< Object moves into the screen or moves inside the screen
\r
45 * @brief Enumeration describing a relation between accessible objects
\r
46 * 1 to 0..N relation model is supported. By default relation is not symmetrical.
\r
47 * Symmetry must be explicitly maintained.
\r
49 enum class RelationType : uint32_t
\r
51 NULL_OF, ///< Null Relation.
\r
52 LABEL_FOR, ///< Label For.
\r
53 LABELLED_BY, ///< Labelled By.
\r
54 CONTROLLER_FOR, ///< Controller For.
\r
55 CONTROLLED_BY, ///< Controlled By.
\r
56 MEMBER_OF, ///< Member Of.
\r
57 TOOLTIP_FOR, ///< ToolTip For.
\r
58 NODE_CHILD_OF, ///< Node Child Of.
\r
59 NODE_PARENT_OF, ///< Node Parent Of.
\r
60 EXTENDED, ///< Extended.
\r
61 FLOWS_TO, ///< Flows To.
\r
62 FLOWS_FROM, ///< Flows From.
\r
63 SUBWINDOW_OF, ///< Sub Window Of.
\r
64 EMBEDS, ///< Embeds.
\r
65 EMBEDDED_BY, ///< Embedded By.
\r
66 POPUP_FOR, ///< Popup For
\r
67 PARENT_WINDOW_OF, ///< Parent Window Of.
\r
68 DESCRIPTION_FOR, ///< Description For.
\r
69 DESCRIBED_BY, ///< Described By.
\r
70 DETAILS, ///< Details.
\r
71 DETAILS_FOR, ///< Details For.
\r
72 ERROR_MESSAGE, ///< Error Message.
\r
73 ERROR_FOR, ///< Error For.
\r
78 * @brief Enumeration describing if coordinates are relative to screen or window
\r
79 * @see Accessibility::Component::GetExtents
\r
80 * @see Accessibility::Component::IsAccessibleContainingPoint
\r
82 enum class CoordinateType
\r
84 SCREEN, ///< Screen.
\r
89 * @brief Enumeration indicating relative stacking order
\r
90 * ComponentLayer allows to describe visibility of all parts of UI
\r
91 * basing on the concrete stacking order
\r
92 * @see Accessibility::Component::GetLayer
\r
93 * @note currently only ComponentLayer::Window is supported
\r
95 enum class ComponentLayer
\r
97 INVALID, ///< Invalid.
\r
98 BACKGROUND, ///< Background.
\r
99 CANVAS, ///< Canvas.
\r
100 WIDGET, ///< Widget.
\r
103 OVERLAY, ///< Overlay.
\r
104 WINDOW, ///< Window.
\r
109 * @brief Enumeration describing role of the Accessibility object
\r
110 * Object can be described by only one role.
\r
111 * @see Accessibility::Accessible::GetRole
\r
113 enum class Role : uint32_t
\r
172 TABLE_COLUMN_HEADER,
\r
204 INPUT_METHOD_WINDOW,
\r
207 DOCUMENT_SPREADSHEET,
\r
208 DOCUMENT_PRESENTATION,
\r
240 * @brief Enumeration describing states of the Accessibility object
\r
241 * Object can be in many states at the same time.
\r
242 * @see Accessibility::Accessible::GetStates
\r
244 enum class State : uint32_t
\r
277 MANAGES_DESCENDANTS,
\r
283 SUPPORTS_AUTOCOMPLETION,
\r
296 * @brief Enumeration describing change of text object
\r
298 enum class TextChangedState : uint32_t
\r
306 * @brief Enumeration describing change of object property
\r
308 enum class ObjectPropertyChangeEvent
\r
318 * @brief Enumeration describing change of window object
\r
319 * @see Accessibility::Accessible::Emit
\r
321 enum class WindowEvent
\r
345 * @brief Enumeration used to acquire bounded text from accessible object having textual content.
\r
346 * @see Accessibility::Text::GetTextAtOffset
\r
347 * @note Currently only TextBoundary::Character is supported
\r
349 enum class TextBoundary : uint32_t
\r
351 CHARACTER, ///> Only one character is acquired.
\r
352 WORD, ///> Not supported.
\r
353 SENTENCE, ///> Not supported.
\r
354 LINE, ///> Not supported.
\r
355 PARAGRAPH, ///> Not supported.
\r
360 * @brief Enumeration describing type of gesture
\r
361 * @see Accessibility::Accessible::DoGesture
\r
363 enum class Gesture : int32_t
\r
367 THREE_FINGER_HOVER,
\r
368 ONE_FINGER_FLICK_LEFT,
\r
369 ONE_FINGER_FLICK_RIGHT,
\r
370 ONE_FINGER_FLICK_UP,
\r
371 ONE_FINGER_FLICK_DOWN,
\r
372 TWO_FINGERS_FLICK_LEFT,
\r
373 TWO_FINGERS_FLICK_RIGHT,
\r
374 TWO_FINGERS_FLICK_UP,
\r
375 TWO_FINGERS_FLICK_DOWN,
\r
376 THREE_FINGERS_FLICK_LEFT,
\r
377 THREE_FINGERS_FLICK_RIGHT,
\r
378 THREE_FINGERS_FLICK_UP,
\r
379 THREE_FINGERS_FLICK_DOWN,
\r
380 ONE_FINGER_SINGLE_TAP,
\r
381 ONE_FINGER_DOUBLE_TAP,
\r
382 ONE_FINGER_TRIPLE_TAP,
\r
383 TWO_FINGERS_SINGLE_TAP,
\r
384 TWO_FINGERS_DOUBLE_TAP,
\r
385 TWO_FINGERS_TRIPLE_TAP,
\r
386 THREE_FINGERS_SINGLE_TAP,
\r
387 THREE_FINGERS_DOUBLE_TAP,
\r
388 THREE_FINGERS_TRIPLE_TAP,
\r
389 ONE_FINGER_FLICK_LEFT_RETURN,
\r
390 ONE_FINGER_FLICK_RIGHT_RETURN,
\r
391 ONE_FINGER_FLICK_UP_RETURN,
\r
392 ONE_FINGER_FLICK_DOWN_RETURN,
\r
393 TWO_FINGERS_FLICK_LEFT_RETURN,
\r
394 TWO_FINGERS_FLICK_RIGHT_RETURN,
\r
395 TWO_FINGERS_FLICK_UP_RETURN,
\r
396 TWO_FINGERS_FLICK_DOWN_RETURN,
\r
397 THREE_FINGERS_FLICK_LEFT_RETURN,
\r
398 THREE_FINGERS_FLICK_RIGHT_RETURN,
\r
399 THREE_FINGERS_FLICK_UP_RETURN,
\r
400 THREE_FINGERS_FLICK_DOWN_RETURN,
\r
401 ONE_FINGER_DOUBLE_TAP_N_HOLD,
\r
402 TWO_FINGERS_DOUBLE_TAP_N_HOLD,
\r
403 THREE_FINGERS_DOUBLE_TAP_N_HOLD,
\r
408 * @brief Enumeration indicating current state of gesture
\r
409 * @see Dali::Accessibility::GestureInfo
\r
411 enum class GestureState : int32_t
\r
420 * @brief Enumeration of ReadingInfoType
\r
422 enum class ReadingInfoType
\r
432 * @brief Enumeration of all AT-SPI interfaces.
\r
434 * @see Dali::Accessibility::Accessible::GetInterfaceName()
\r
435 * @see Dali::Accessibility::AtspiInterfaceType
\r
437 enum class AtspiInterface
\r
445 DEVICE_EVENT_CONTROLLER,
\r
446 DEVICE_EVENT_LISTENER,
\r
470 * @brief Enumeration of all AT-SPI events.
\r
472 enum class AtspiEvent
\r
479 VISIBLE_DATA_CHANGED,
\r
482 ACTIVE_DESCENDANT_CHANGED,
\r
489 TEXT_BOUNDS_CHANGED,
\r
490 TEXT_SELECTION_CHANGED,
\r
492 TEXT_ATTRIBUTES_CHANGED,
\r
494 ATTRIBUTES_CHANGED,
\r
500 using AtspiInterfaces = EnumBitSet<AtspiInterface, AtspiInterface::MAX_COUNT>;
\r
501 using AtspiEvents = EnumBitSet<AtspiEvent, AtspiEvent::MAX_COUNT>;
\r
502 using ReadingInfoTypes = EnumBitSet<ReadingInfoType, ReadingInfoType::MAX_COUNT>;
\r
503 using States = EnumBitSet<State, State::MAX_COUNT>;
\r
504 using Attributes = std::unordered_map<std::string, std::string>;
\r
509 * AT-SPI interfaces exposed as native C++ types should specialize this like so:
\r
512 * struct AtspiInterfaceTypeHelper<AtspiInterface::ACCESSIBLE>
\r
514 * using Type = Dali::Accessibility::Accessible;
\r
517 template<AtspiInterface I>
\r
518 struct AtspiInterfaceTypeHelper; // no default definition
\r
520 } // namespace Internal
\r
523 * @brief Resolves to the native C++ type that represents the given AT-SPI interface.
\r
525 * For example, @code AtspiInterfaceType<AtspiInterface::ACCESSIBLE> @endcode is the same as
\r
526 * @code Dali::Accessibility::Accessible @endcode. Not all AT-SPI interfaces have native C++
\r
527 * representations (in which case, such an expression will not compile).
\r
529 * @tparam I Enumeration value indicating the requested AT-SPI interface.
\r
531 template<AtspiInterface I>
\r
532 using AtspiInterfaceType = typename Internal::AtspiInterfaceTypeHelper<I>::Type;
\r
535 * @brief Class representing unique object address on accessibility bus
\r
536 * @see Dali::Accessibility::Accessible::GetAddress
\r
538 class DALI_ADAPTOR_API Address
\r
541 Address() = default;
\r
543 Address(std::string bus, std::string path)
\r
544 : mBus(std::move(bus)),
\r
545 mPath(std::move(path))
\r
549 explicit operator bool() const
\r
551 return !mPath.empty();
\r
554 std::string ToString() const
\r
556 return *this ? mBus + ":" + mPath : "::null";
\r
559 const std::string& GetBus() const;
\r
561 const std::string& GetPath() const
\r
566 bool operator==(const Address& a) const
\r
568 return mBus == a.mBus && mPath == a.mPath;
\r
571 bool operator!=(const Address& a) const
\r
573 return !(*this == a);
\r
577 mutable std::string mBus, mPath;
\r
581 * @brief Enumeration describing type of key event
\r
582 * @see Adaptor::AccessibilityObserver::OnAccessibleKeyEvent
\r
584 enum class KeyEventType
\r
591 * @brief Enumeration with human readable values describing state of event
\r
592 * @see Dali::Accessibility::Bridge::Emit
\r
594 enum class Consumed
\r
601 * @brief Helper class representing two dimensional point with integer coordinates
\r
603 struct DALI_ADAPTOR_API Point
\r
610 Point(int x, int y)
\r
616 bool operator==(Point p) const
\r
618 return x == p.x && y == p.y;
\r
620 bool operator!=(Point p) const
\r
622 return !(*this == p);
\r
627 * @brief Helper class representing size of rectangle object with usage of two integer values
\r
629 struct DALI_ADAPTOR_API Size
\r
642 bool operator==(Size p) const
\r
644 return width == p.width && height == p.height;
\r
647 bool operator!=(Size p) const
\r
649 return !(*this == p);
\r
654 * @brief Helper class used to store data related with Accessibility::Text interface
\r
655 * @see Dali::Accessibility::Text::GetTextAtOffset
\r
656 * @see Dali::Accessibility::Text::GetRangeOfSelection
\r
658 struct DALI_ADAPTOR_API Range
\r
660 int32_t startOffset = 0;
\r
661 int32_t endOffset = 0;
\r
662 std::string content;
\r
666 Range(size_t start, size_t end)
\r
667 : startOffset(start),
\r
672 Range(size_t start, size_t end, std::string content)
\r
673 : startOffset(start),
\r
681 * @brief Structure containing all values needed to invoke Accessible::DoGesture
\r
682 * type : numerated gesture type
\r
683 * startPositionX, startPositionY : point where gesture begins
\r
684 * endPositionX, endPositionY : point where gesture ends
\r
685 * state : enumerated state of gesture
\r
686 * eventTime : time when event occured
\r
687 * @see Dali::Accessibility::Accessible::DoGesture
\r
689 struct DALI_ADAPTOR_API GestureInfo
\r
691 GestureInfo() = default;
\r
692 GestureInfo(Gesture type, int32_t startPositionX, int32_t endPositionX, int32_t startPositionY, int32_t endPositionY, GestureState state, uint32_t eventTime)
\r
694 startPointX(startPositionX),
\r
695 endPointX(endPositionX),
\r
696 startPointY(startPositionY),
\r
697 endPointY(endPositionY),
\r
699 eventTime(eventTime)
\r
704 int32_t startPointX{};
\r
705 int32_t endPointX{};
\r
706 int32_t startPointY{};
\r
707 int32_t endPointY{};
\r
708 GestureState state{};
\r
709 uint32_t eventTime{};
\r
713 * @brief Class representing accessibility relations
\r
714 * Class connecting one source object with multiple target objects with usage
\r
715 * of specific relation type.
\r
716 * @note std::string representing source and targets are string values of Accessibility::Address
\r
717 * @see Dali::Accessibility::Accessible::Address
\r
718 * @see Dali::Accessibility::Accessible::RelationType
\r
720 struct DALI_ADAPTOR_API Relation
\r
722 Relation(RelationType relationType, std::vector<Address> targets)
\r
723 : relationType(relationType),
\r
728 RelationType relationType;
\r
729 std::vector<Address> targets;
\r
732 } // namespace Accessibility
\r
733 } // namespace Dali
\r
735 #endif // DALI_ATSPI_ACCESSIBILITY_H
\r