X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dali%2Fdevel-api%2Fadaptor-framework%2Faccessibility.h;h=f3576c6378a64f1f320e297ef364b233dec53d55;hb=5734a56f829ba245f88184e6bde0be92463ab45f;hp=9be9b95c97b64aa5db8c1efdcc4e4d60971aded7;hpb=d9335fa0ba5472d558fa40ad20af58db76bfbd7a;p=platform%2Fcore%2Fuifw%2Fdali-adaptor.git diff --git a/dali/devel-api/adaptor-framework/accessibility.h b/dali/devel-api/adaptor-framework/accessibility.h index 9be9b95..f3576c6 100644 --- a/dali/devel-api/adaptor-framework/accessibility.h +++ b/dali/devel-api/adaptor-framework/accessibility.h @@ -1,7 +1,7 @@ #ifndef DALI_ATSPI_ACCESSIBILITY_H #define DALI_ATSPI_ACCESSIBILITY_H /* - * Copyright (c) 2019 Samsung Electronics Co., Ltd. + * Copyright (c) 2021 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. @@ -18,28 +18,28 @@ */ // EXTERNAL INCLUDES - -#include -#include -#include -#include -#include #include -#include #include #include -#include -#include -#include -#include // INTERNAL INCLUDES +#include #include namespace Dali { namespace Accessibility { +/** + * @brief Enumeration describing type of object move relative to the screen. Only outgoing moves are signalled to AT-clients. + */ +enum class ScreenRelativeMoveType +{ + OUTSIDE = 0, ///< Object moves outside of the screen + OUTGOING_TOP_LEFT = 1, ///< Object moves out through the top(or left) side of the screen. Maps to: ATSPI_MOVE_OUTED_TOP_LEFT + OUTGOING_BOTTOM_RIGHT = 2, ///< Object moves out through the bottom(or right) side of the screen. Maps to: ATSPI_MOVE_OUTED_BOTTOM_RIGHT + INSIDE ///< Object moves into the screen or moves inside the screen +}; /** * @brief Enumeration describing a relation between accessible objects @@ -48,41 +48,41 @@ namespace Accessibility */ enum class RelationType : uint32_t { - NULL_OF, ///< Null Relation. - LABEL_FOR, ///< Label For. - LABELLED_BY, ///< Labelled By. - CONTROLLER_FOR, ///< Controller For. - CONTROLLED_BY, ///< Controlled By. - MEMBER_OF, ///< Member Of. - TOOLTIP_FOR, ///< ToolTip For. - NODE_CHILD_OF, ///< Node Child Of. - NODE_PARENT_OF, ///< Node Parent Of. - EXTENDED, ///< Extended. - FLOWS_TO, ///< Flows To. - FLOWS_FROM, ///< Flows From. - SUBWINDOW_OF, ///< Sub Window Of. - EMBEDS, ///< Embeds. - EMBEDDED_BY, ///< Embedded By. - POPUP_FOR, ///< Popup For + NULL_OF, ///< Null Relation. + LABEL_FOR, ///< Label For. + LABELLED_BY, ///< Labelled By. + CONTROLLER_FOR, ///< Controller For. + CONTROLLED_BY, ///< Controlled By. + MEMBER_OF, ///< Member Of. + TOOLTIP_FOR, ///< ToolTip For. + NODE_CHILD_OF, ///< Node Child Of. + NODE_PARENT_OF, ///< Node Parent Of. + EXTENDED, ///< Extended. + FLOWS_TO, ///< Flows To. + FLOWS_FROM, ///< Flows From. + SUBWINDOW_OF, ///< Sub Window Of. + EMBEDS, ///< Embeds. + EMBEDDED_BY, ///< Embedded By. + POPUP_FOR, ///< Popup For PARENT_WINDOW_OF, ///< Parent Window Of. - DESCRIPTION_FOR, ///< Description For. - DESCRIBED_BY, ///< Described By. - DETAILS, ///< Details. - DETAILS_FOR, ///< Details For. - ERROR_MESSAGE, ///< Error Message. - ERROR_FOR, ///< Error For. + DESCRIPTION_FOR, ///< Description For. + DESCRIBED_BY, ///< Described By. + DETAILS, ///< Details. + DETAILS_FOR, ///< Details For. + ERROR_MESSAGE, ///< Error Message. + ERROR_FOR, ///< Error For. MAX_COUNT }; /** * @brief Enumeration describing if coordinates are relative to screen or window * @see Accessibility::Component::GetExtents - * @see Accessibility::Component::Contains + * @see Accessibility::Component::IsAccessibleContainingPoint */ -enum class CoordType +enum class CoordinateType { SCREEN, ///< Screen. - WINDOW ///< Window. + WINDOW ///< Window. }; /** @@ -94,14 +94,14 @@ enum class CoordType */ enum class ComponentLayer { - INVALID, ///< Invalid. + INVALID, ///< Invalid. BACKGROUND, ///< Background. - CANVAS, ///< Canvas. - WIDGET, ///< Widget. - MDI, ///< MDI. - POPUP, ///< Popup. - OVERLAY, ///< Overlay. - WINDOW, ///< Window. + CANVAS, ///< Canvas. + WIDGET, ///< Widget. + MDI, ///< MDI. + POPUP, ///< Popup. + OVERLAY, ///< Overlay. + WINDOW, ///< Window. MAX_COUNT }; @@ -297,8 +297,8 @@ enum class State : uint32_t */ enum class TextChangedState : uint32_t { - INSERT, - DELETE, + INSERTED, + DELETED, MAX_COUNT }; @@ -349,9 +349,9 @@ enum class WindowEvent enum class TextBoundary : uint32_t { CHARACTER, ///> Only one character is acquired. - WORD, ///> Not supported. - SENTENCE, ///> Not supported. - LINE, ///> Not supported. + WORD, ///> Not supported. + SENTENCE, ///> Not supported. + LINE, ///> Not supported. PARAGRAPH, ///> Not supported. MAX_COUNT }; @@ -424,196 +424,112 @@ enum class ReadingInfoType NAME, ROLE, DESCRIPTION, - STATE + STATE, + MAX_COUNT }; /** - * @brief Helper class for storing values treated as bit sets - * This class provides all bitset-like methods for bitset size larger, than long long int - * @see Dali::Accessibility::Accessible::GetStates - * @see Dali::Accessibility::Accessible::GetRoles + * @brief Enumeration of all AT-SPI interfaces. + * + * @see Dali::Accessibility::Accessible::GetInterfaceName() + * @see Dali::Accessibility::AtspiInterfaceType */ -template < size_t I, typename S > -class DALI_ADAPTOR_API BitSets +enum class AtspiInterface { - std::array< uint32_t, I > data; - - void _set() - { - } - - static constexpr bool _accepts() - { - return true; - } - - template < typename T > static constexpr bool _accepts() - { - return std::is_enum< T >::value; - } - - template < typename T, typename T2, typename ... ARGS > static constexpr bool _accepts() - { - return std::is_enum< T >::value && _accepts< T2, ARGS... >(); - } - - template < typename T, typename ... ARGS > void _set(T t, ARGS ... args) - { - (*this)[t] = true; - _set(args...); - } -public: - BitSets() - { - for( auto& u : data ) - { - u = 0; - } - } - BitSets(const BitSets&) = default; - BitSets(BitSets&&) = default; - - template < typename T, typename ... ARGS, typename std::enable_if< _accepts< T, ARGS... >() >::type * = nullptr >BitSets( T t, ARGS ... args ) - { - for( auto& u : data ) - u = 0; - _set( t, args... ); - } - - explicit BitSets( std::array< uint32_t, I > d ) - { - for( auto i = 0u; i < I; ++i ) - { - data[i] = d[i]; - } - } - - explicit BitSets( std::array< int32_t, I > d ) - { - for( auto i = 0u; i < I; ++i ) - { - data[i] = static_cast( d[i] ); - } - } - - BitSets& operator = (const BitSets&) = default; - BitSets& operator = (BitSets&&) = default; - - struct reference - { - std::array< uint32_t, I >& data; - size_t pos; - - reference& operator=( reference r ) - { - (*this) = static_cast( r ); - return *this; - } - - reference& operator=( bool v ) - { - if( v ) - { - data[pos / 32] |= 1 << (pos & 31); - } - else - { - data[pos / 32] &= ~(1 << (pos & 31)); - } - return *this; - } - - operator bool() const - { - auto i = static_cast( pos ); - return (data[i / 32] & (1 << (i & 31))) != 0; - } - }; - - reference operator[]( S index ) - { - return { data, static_cast( index ) }; - } - - bool operator[]( S index ) const - { - auto i = static_cast( index ); - return ( data[i / 32] & ( 1 << (i & 31) ) ) != 0; - } - - std::array< uint32_t, I > GetRawData() const - { - return data; - } - - BitSets operator|( BitSets b ) const - { - BitSets r; - for( auto i = 0u; i < I; ++i ) - { - r.data[i] = data[i] | b.data[i]; - } - return r; - } - - BitSets operator^( BitSets b ) const - { - BitSets r; - for( auto i = 0u; i < I; ++i ) - { - r.data[i] = data[i] ^ b.data[i]; - } - return r; - } - - BitSets operator&( BitSets b ) const - { - BitSets r; - for( auto i = 0u; i < I; ++i ) - { - r.data[i] = data[i] & b.data[i]; - } - return r; - } + ACCESSIBLE, + ACTION, + APPLICATION, + CACHE, + COLLECTION, + COMPONENT, + DEVICE_EVENT_CONTROLLER, + DEVICE_EVENT_LISTENER, + DOCUMENT, + EDITABLE_TEXT, + EVENT_DOCUMENT, + EVENT_FOCUS, + EVENT_KEYBOARD, + EVENT_MOUSE, + EVENT_OBJECT, + EVENT_TERMINAL, + EVENT_WINDOW, + HYPERLINK, + HYPERTEXT, + IMAGE, + REGISTRY, + SELECTION, + SOCKET, + TABLE, + TABLE_CELL, + TEXT, + VALUE, + MAX_COUNT +}; - bool operator==( BitSets b ) const - { - for( auto i = 0u; i < I; ++i ) - { - if( data[i] != b.data[i] ) - { - return false; - } - } - return true; - } +/** + * @brief Enumeration of all AT-SPI events. + */ +enum class AtspiEvent +{ + PROPERTY_CHANGED, + BOUNDS_CHANGED, + LINK_SELECTED, + STATE_CHANGED, + CHILDREN_CHANGED, + VISIBLE_DATA_CHANGED, + SELECTION_CHANGED, + MODEL_CHANGED, + ACTIVE_DESCENDANT_CHANGED, + ROW_INSERTED, + ROW_REORDERED, + ROW_DELETED, + COLUMN_INSERTED, + COLUMN_REORDERED, + COLUMN_DELETED, + TEXT_BOUNDS_CHANGED, + TEXT_SELECTION_CHANGED, + TEXT_CHANGED, + TEXT_ATTRIBUTES_CHANGED, + TEXT_CARET_MOVED, + ATTRIBUTES_CHANGED, + MOVED_OUT, + WINDOW_CHANGED, + MAX_COUNT +}; - bool operator!=(BitSets b) const - { - return !((*this) == b); - } +using AtspiInterfaces = EnumBitSet; +using AtspiEvents = EnumBitSet; +using ReadingInfoTypes = EnumBitSet; +using States = EnumBitSet; +using Attributes = std::unordered_map; - explicit operator bool() const - { - for( auto& u : data ) - { - if( u ) - { - return true; - } - } - return false; - } +namespace Internal +{ +/* + * AT-SPI interfaces exposed as native C++ types should specialize this like so: + * + * template<> + * struct AtspiInterfaceTypeHelper + * { + * using Type = Dali::Accessibility::Accessible; + * }; + */ +template +struct AtspiInterfaceTypeHelper; // no default definition - size_t size() const - { - return I; - } -}; +} // namespace Internal -using ReadingInfoTypes = BitSets<1, ReadingInfoType>; -using States = BitSets< 2, State >; -using Attributes = std::unordered_map< std::string, std::string >; +/** + * @brief Resolves to the native C++ type that represents the given AT-SPI interface. + * + * For example, @code AtspiInterfaceType @endcode is the same as + * @code Dali::Accessibility::Accessible @endcode. Not all AT-SPI interfaces have native C++ + * representations (in which case, such an expression will not compile). + * + * @tparam I Enumeration value indicating the requested AT-SPI interface. + */ +template +using AtspiInterfaceType = typename Internal::AtspiInterfaceTypeHelper::Type; /** * @brief Class representing unique object address on accessibility bus @@ -624,7 +540,7 @@ class DALI_ADAPTOR_API Address public: Address() = default; - Address( std::string bus, std::string path ) + Address(std::string bus, std::string path) : mBus(std::move(bus)), mPath(std::move(path)) { @@ -647,12 +563,12 @@ public: return mPath; } - bool operator == ( const Address& a ) const + bool operator==(const Address& a) const { return mBus == a.mBus && mPath == a.mPath; } - bool operator != ( const Address& a ) const + bool operator!=(const Address& a) const { return !(*this == a); } @@ -691,7 +607,7 @@ struct DALI_ADAPTOR_API Point Point() = default; - Point( int x, int y ) + Point(int x, int y) : x(x), y(y) { @@ -712,7 +628,7 @@ struct DALI_ADAPTOR_API Point */ struct DALI_ADAPTOR_API Size { - int width = 0; + int width = 0; int height = 0; Size() = default; @@ -723,12 +639,12 @@ struct DALI_ADAPTOR_API Size { } - bool operator==( Size p ) const + bool operator==(Size p) const { return width == p.width && height == p.height; } - bool operator!=( Size p ) const + bool operator!=(Size p) const { return !(*this == p); } @@ -737,12 +653,12 @@ struct DALI_ADAPTOR_API Size /** * @brief Helper class used to store data related with Accessibility::Text interface * @see Dali::Accessibility::Text::GetTextAtOffset - * @see Dali::Accessibility::Text::GetSelection + * @see Dali::Accessibility::Text::GetRangeOfSelection */ struct DALI_ADAPTOR_API Range { - int32_t startOffset = 0; - int32_t endOffset = 0; + int32_t startOffset = 0; + int32_t endOffset = 0; std::string content; Range() = default; @@ -764,8 +680,8 @@ struct DALI_ADAPTOR_API Range /** * @brief Structure containing all values needed to invoke Accessible::DoGesture * type : numerated gesture type - * xBeg, yBeg : point where gesture begins - * xEnd, yEnd : point where gesture ends + * startPositionX, startPositionY : point where gesture begins + * endPositionX, endPositionY : point where gesture ends * state : enumerated state of gesture * eventTime : time when event occured * @see Dali::Accessibility::Accessible::DoGesture @@ -773,24 +689,24 @@ struct DALI_ADAPTOR_API Range struct DALI_ADAPTOR_API GestureInfo { GestureInfo() = default; - GestureInfo(Gesture type, int32_t xBeg, int32_t xEnd, int32_t yBeg, int32_t yEnd, GestureState state, uint32_t eventTime) + GestureInfo(Gesture type, int32_t startPositionX, int32_t endPositionX, int32_t startPositionY, int32_t endPositionY, GestureState state, uint32_t eventTime) : type(type), - xBeg(xBeg), - xEnd(xEnd), - yBeg(yBeg), - yEnd(yEnd), + startPointX(startPositionX), + endPointX(endPositionX), + startPointY(startPositionY), + endPointY(endPositionY), state(state), eventTime(eventTime) { } - Gesture type{}; - int32_t xBeg{}; - int32_t xEnd{}; - int32_t yBeg{}; - int32_t yEnd{}; + Gesture type{}; + int32_t startPointX{}; + int32_t endPointX{}; + int32_t startPointY{}; + int32_t endPointY{}; GestureState state{}; - uint32_t eventTime{}; + uint32_t eventTime{}; }; /** @@ -803,14 +719,14 @@ struct DALI_ADAPTOR_API GestureInfo */ struct DALI_ADAPTOR_API Relation { -Relation(RelationType relationType, std::vector
targets) -: relationType(relationType), - targets(targets) -{ -} + Relation(RelationType relationType, std::vector
targets) + : relationType(relationType), + targets(targets) + { + } -RelationType relationType; -std::vector
targets; + RelationType relationType; + std::vector
targets; }; } // namespace Accessibility