#ifndef DALI_ATSPI_ACCESSIBILITY_H\r
#define DALI_ATSPI_ACCESSIBILITY_H\r
/*\r
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.\r
+ * Copyright (c) 2023 Samsung Electronics Co., Ltd.\r
*\r
* Licensed under the Apache License, Version 2.0 (the "License");\r
* you may not use this file except in compliance with the License.\r
*/\r
\r
// EXTERNAL INCLUDES\r
-\r
-#include <array>\r
-#include <atomic>\r
-#include <bitset>\r
-#include <exception>\r
-#include <functional>\r
-#include <memory>\r
+#include <cstdint>\r
#include <string>\r
-#include <map>\r
#include <unordered_map>\r
#include <vector>\r
-#include <list>\r
-#include <cassert>\r
-#include <sstream>\r
-#include <string.h>\r
\r
// INTERNAL INCLUDES\r
+#include <dali/devel-api/adaptor-framework/accessibility-bitset.h>\r
#include <dali/public-api/dali-adaptor-common.h>\r
\r
namespace Dali\r
{\r
namespace Accessibility\r
{\r
+class Accessible;\r
+\r
+/**\r
+ * @brief Enumeration describing type of object move relative to the screen. Only outgoing moves are signalled to AT-clients.\r
+ */\r
+enum class ScreenRelativeMoveType\r
+{\r
+ OUTSIDE = 0, ///< Object moves outside of the screen\r
+ OUTGOING_TOP_LEFT = 1, ///< Object moves out through the top(or left) side of the screen. Maps to: ATSPI_MOVE_OUTED_TOP_LEFT\r
+ OUTGOING_BOTTOM_RIGHT = 2, ///< Object moves out through the bottom(or right) side of the screen. Maps to: ATSPI_MOVE_OUTED_BOTTOM_RIGHT\r
+ INSIDE ///< Object moves into the screen or moves inside the screen\r
+};\r
\r
/**\r
* @brief Enumeration describing a relation between accessible objects\r
*/\r
enum class RelationType : uint32_t\r
{\r
- NULL_OF, ///< Null Relation.\r
- LABEL_FOR, ///< Label For.\r
- LABELLED_BY, ///< Labelled By.\r
- CONTROLLER_FOR, ///< Controller For.\r
- CONTROLLED_BY, ///< Controlled By.\r
- MEMBER_OF, ///< Member Of.\r
- TOOLTIP_FOR, ///< ToolTip For.\r
- NODE_CHILD_OF, ///< Node Child Of.\r
- NODE_PARENT_OF, ///< Node Parent Of.\r
- EXTENDED, ///< Extended.\r
- FLOWS_TO, ///< Flows To.\r
- FLOWS_FROM, ///< Flows From.\r
- SUBWINDOW_OF, ///< Sub Window Of.\r
- EMBEDS, ///< Embeds.\r
- EMBEDDED_BY, ///< Embedded By.\r
- POPUP_FOR, ///< Popup For\r
+ NULL_OF, ///< Null Relation.\r
+ LABEL_FOR, ///< Label For.\r
+ LABELLED_BY, ///< Labelled By.\r
+ CONTROLLER_FOR, ///< Controller For.\r
+ CONTROLLED_BY, ///< Controlled By.\r
+ MEMBER_OF, ///< Member Of.\r
+ TOOLTIP_FOR, ///< ToolTip For.\r
+ NODE_CHILD_OF, ///< Node Child Of.\r
+ NODE_PARENT_OF, ///< Node Parent Of.\r
+ EXTENDED, ///< Extended.\r
+ FLOWS_TO, ///< Flows To.\r
+ FLOWS_FROM, ///< Flows From.\r
+ SUBWINDOW_OF, ///< Sub Window Of.\r
+ EMBEDS, ///< Embeds.\r
+ EMBEDDED_BY, ///< Embedded By.\r
+ POPUP_FOR, ///< Popup For\r
PARENT_WINDOW_OF, ///< Parent Window Of.\r
- DESCRIPTION_FOR, ///< Description For.\r
- DESCRIBED_BY, ///< Described By.\r
- DETAILS, ///< Details.\r
- DETAILS_FOR, ///< Details For.\r
- ERROR_MESSAGE, ///< Error Message.\r
- ERROR_FOR, ///< Error For.\r
+ DESCRIPTION_FOR, ///< Description For.\r
+ DESCRIBED_BY, ///< Described By.\r
+ DETAILS, ///< Details.\r
+ DETAILS_FOR, ///< Details For.\r
+ ERROR_MESSAGE, ///< Error Message.\r
+ ERROR_FOR, ///< Error For.\r
MAX_COUNT\r
};\r
\r
/**\r
* @brief Enumeration describing if coordinates are relative to screen or window\r
* @see Accessibility::Component::GetExtents\r
- * @see Accessibility::Component::Contains\r
+ * @see Accessibility::Component::IsAccessibleContainingPoint\r
*/\r
-enum class CoordType\r
+enum class CoordinateType\r
{\r
SCREEN, ///< Screen.\r
- WINDOW ///< Window.\r
+ WINDOW ///< Window.\r
};\r
\r
/**\r
*/\r
enum class ComponentLayer\r
{\r
- INVALID, ///< Invalid.\r
+ INVALID, ///< Invalid.\r
BACKGROUND, ///< Background.\r
- CANVAS, ///< Canvas.\r
- WIDGET, ///< Widget.\r
- MDI, ///< MDI.\r
- POPUP, ///< Popup.\r
- OVERLAY, ///< Overlay.\r
- WINDOW, ///< Window.\r
+ CANVAS, ///< Canvas.\r
+ WIDGET, ///< Widget.\r
+ MDI, ///< MDI.\r
+ POPUP, ///< Popup.\r
+ OVERLAY, ///< Overlay.\r
+ WINDOW, ///< Window.\r
MAX_COUNT\r
};\r
\r
SHADE,\r
UU_SHADE,\r
RESTYLE,\r
+ POST_RENDER,\r
+};\r
+\r
+/**\r
+ * @brief Restored window state\r
+ * @see Accessibility::Accessible::Emit\r
+ */\r
+enum class WindowRestoreType\r
+{\r
+ RESTORE_FROM_ICONIFY, // The Window is Deiconified.\r
+ RESTORE_FROM_MAXIMIZE // The Window is Unmaximized.\r
};\r
\r
/**\r
enum class TextBoundary : uint32_t\r
{\r
CHARACTER, ///> Only one character is acquired.\r
- WORD, ///> Not supported.\r
- SENTENCE, ///> Not supported.\r
- LINE, ///> Not supported.\r
+ WORD, ///> Not supported.\r
+ SENTENCE, ///> Not supported.\r
+ LINE, ///> Not supported.\r
PARAGRAPH, ///> Not supported.\r
MAX_COUNT\r
};\r
NAME,\r
ROLE,\r
DESCRIPTION,\r
- STATE\r
+ STATE,\r
+ MAX_COUNT\r
};\r
\r
/**\r
- * @brief Helper class for storing values treated as bit sets\r
- * This class provides all bitset-like methods for bitset size larger, than long long int\r
- * @see Dali::Accessibility::Accessible::GetStates\r
- * @see Dali::Accessibility::Accessible::GetRoles\r
+ * @brief Enumeration of all AT-SPI interfaces.\r
+ *\r
+ * @see Dali::Accessibility::Accessible::GetInterfaceName()\r
+ * @see Dali::Accessibility::AtspiInterfaceType\r
*/\r
-template < size_t I, typename S >\r
-class BitSets\r
+enum class AtspiInterface\r
{\r
- std::array< uint32_t, I > data;\r
-\r
- void _set()\r
- {\r
- }\r
-\r
- static constexpr bool _accepts()\r
- {\r
- return true;\r
- }\r
-\r
- template < typename T > static constexpr bool _accepts()\r
- {\r
- return std::is_enum< T >::value;\r
- }\r
-\r
- template < typename T, typename T2, typename ... ARGS > static constexpr bool _accepts()\r
- {\r
- return std::is_enum< T >::value && _accepts< T2, ARGS... >();\r
- }\r
-\r
- template < typename T, typename ... ARGS > void _set(T t, ARGS ... args)\r
- {\r
- (*this)[t] = true;\r
- _set(args...);\r
- }\r
-public:\r
- BitSets()\r
- {\r
- for( auto& u : data )\r
- {\r
- u = 0;\r
- }\r
- }\r
- BitSets(const BitSets&) = default;\r
- BitSets(BitSets&&) = default;\r
-\r
- template < typename T, typename ... ARGS, typename std::enable_if< _accepts< T, ARGS... >() >::type * = nullptr >BitSets( T t, ARGS ... args )\r
- {\r
- for( auto& u : data )\r
- u = 0;\r
- _set( t, args... );\r
- }\r
-\r
- explicit BitSets( std::array< uint32_t, I > d )\r
- {\r
- for( auto i = 0u; i < I; ++i )\r
- {\r
- data[i] = d[i];\r
- }\r
- }\r
-\r
- explicit BitSets( std::array< int32_t, I > d )\r
- {\r
- for( auto i = 0u; i < I; ++i )\r
- {\r
- data[i] = static_cast<uint32_t>( d[i] );\r
- }\r
- }\r
-\r
- BitSets& operator = (const BitSets&) = default;\r
- BitSets& operator = (BitSets&&) = default;\r
-\r
- struct reference\r
- {\r
- std::array< uint32_t, I >& data;\r
- size_t pos;\r
-\r
- reference& operator=( reference r )\r
- {\r
- (*this) = static_cast<bool>( r );\r
- return *this;\r
- }\r
-\r
- reference& operator=( bool v )\r
- {\r
- if( v )\r
- {\r
- data[pos / 32] |= 1 << (pos & 31);\r
- }\r
- else\r
- {\r
- data[pos / 32] &= ~(1 << (pos & 31));\r
- }\r
- return *this;\r
- }\r
-\r
- operator bool() const\r
- {\r
- auto i = static_cast<size_t>( pos );\r
- return (data[i / 32] & (1 << (i & 31))) != 0;\r
- }\r
- };\r
-\r
- reference operator[]( S index )\r
- {\r
- return { data, static_cast<size_t>( index ) };\r
- }\r
-\r
- bool operator[]( S index ) const\r
- {\r
- auto i = static_cast<size_t>( index );\r
- return ( data[i / 32] & ( 1 << (i & 31) ) ) != 0;\r
- }\r
-\r
- std::array< uint32_t, I > GetRawData() const\r
- {\r
- return data;\r
- }\r
-\r
- BitSets operator|( BitSets b ) const\r
- {\r
- BitSets r;\r
- for( auto i = 0u; i < I; ++i )\r
- {\r
- r.data[i] = data[i] | b.data[i];\r
- }\r
- return r;\r
- }\r
-\r
- BitSets operator^( BitSets b ) const\r
- {\r
- BitSets r;\r
- for( auto i = 0u; i < I; ++i )\r
- {\r
- r.data[i] = data[i] ^ b.data[i];\r
- }\r
- return r;\r
- }\r
-\r
- BitSets operator&( BitSets b ) const\r
- {\r
- BitSets r;\r
- for( auto i = 0u; i < I; ++i )\r
- {\r
- r.data[i] = data[i] & b.data[i];\r
- }\r
- return r;\r
- }\r
+ ACCESSIBLE,\r
+ ACTION,\r
+ APPLICATION,\r
+ CACHE,\r
+ COLLECTION,\r
+ COMPONENT,\r
+ DEVICE_EVENT_CONTROLLER,\r
+ DEVICE_EVENT_LISTENER,\r
+ DOCUMENT,\r
+ EDITABLE_TEXT,\r
+ EVENT_DOCUMENT,\r
+ EVENT_FOCUS,\r
+ EVENT_KEYBOARD,\r
+ EVENT_MOUSE,\r
+ EVENT_OBJECT,\r
+ EVENT_TERMINAL,\r
+ EVENT_WINDOW,\r
+ HYPERLINK,\r
+ HYPERTEXT,\r
+ IMAGE,\r
+ REGISTRY,\r
+ SELECTION,\r
+ SOCKET,\r
+ TABLE,\r
+ TABLE_CELL,\r
+ TEXT,\r
+ VALUE,\r
+ MAX_COUNT\r
+};\r
\r
- bool operator==( BitSets b ) const\r
- {\r
- for( auto i = 0u; i < I; ++i )\r
- {\r
- if( data[i] != b.data[i] )\r
- {\r
- return false;\r
- }\r
- }\r
- return true;\r
- }\r
+/**\r
+ * @brief Enumeration of all AT-SPI events.\r
+ */\r
+enum class AtspiEvent\r
+{\r
+ PROPERTY_CHANGED,\r
+ BOUNDS_CHANGED,\r
+ LINK_SELECTED,\r
+ STATE_CHANGED,\r
+ CHILDREN_CHANGED,\r
+ VISIBLE_DATA_CHANGED,\r
+ SELECTION_CHANGED,\r
+ MODEL_CHANGED,\r
+ ACTIVE_DESCENDANT_CHANGED,\r
+ ROW_INSERTED,\r
+ ROW_REORDERED,\r
+ ROW_DELETED,\r
+ COLUMN_INSERTED,\r
+ COLUMN_REORDERED,\r
+ COLUMN_DELETED,\r
+ TEXT_BOUNDS_CHANGED,\r
+ TEXT_SELECTION_CHANGED,\r
+ TEXT_CHANGED,\r
+ TEXT_ATTRIBUTES_CHANGED,\r
+ TEXT_CARET_MOVED,\r
+ ATTRIBUTES_CHANGED,\r
+ MOVED_OUT,\r
+ WINDOW_CHANGED,\r
+ SCROLL_STARTED,\r
+ SCROLL_FINISHED,\r
+ MAX_COUNT\r
+};\r
\r
- bool operator!=(BitSets b) const\r
- {\r
- return !((*this) == b);\r
- }\r
+using AtspiInterfaces = EnumBitSet<AtspiInterface, AtspiInterface::MAX_COUNT>;\r
+using AtspiEvents = EnumBitSet<AtspiEvent, AtspiEvent::MAX_COUNT>;\r
+using ReadingInfoTypes = EnumBitSet<ReadingInfoType, ReadingInfoType::MAX_COUNT>;\r
+using States = EnumBitSet<State, State::MAX_COUNT>;\r
+using Attributes = std::unordered_map<std::string, std::string>;\r
\r
- explicit operator bool() const\r
- {\r
- for( auto& u : data )\r
- {\r
- if( u )\r
- {\r
- return true;\r
- }\r
- }\r
- return false;\r
- }\r
+namespace Internal\r
+{\r
+/*\r
+ * AT-SPI interfaces exposed as native C++ types should specialize this like so:\r
+ *\r
+ * template<>\r
+ * struct AtspiInterfaceTypeHelper<AtspiInterface::ACCESSIBLE>\r
+ * {\r
+ * using Type = Dali::Accessibility::Accessible;\r
+ * };\r
+ */\r
+template<AtspiInterface I>\r
+struct AtspiInterfaceTypeHelper; // no default definition\r
\r
- size_t size() const\r
- {\r
- return I;\r
- }\r
-};\r
+} // namespace Internal\r
\r
-using ReadingInfoTypes = BitSets<1, ReadingInfoType>;\r
-using States = BitSets< 2, State >;\r
-using Attributes = std::unordered_map< std::string, std::string >;\r
+/**\r
+ * @brief Resolves to the native C++ type that represents the given AT-SPI interface.\r
+ *\r
+ * For example, @code AtspiInterfaceType<AtspiInterface::ACCESSIBLE> @endcode is the same as\r
+ * @code Dali::Accessibility::Accessible @endcode. Not all AT-SPI interfaces have native C++\r
+ * representations (in which case, such an expression will not compile).\r
+ *\r
+ * @tparam I Enumeration value indicating the requested AT-SPI interface.\r
+ */\r
+template<AtspiInterface I>\r
+using AtspiInterfaceType = typename Internal::AtspiInterfaceTypeHelper<I>::Type;\r
\r
/**\r
* @brief Class representing unique object address on accessibility bus\r
public:\r
Address() = default;\r
\r
- Address( std::string bus, std::string path )\r
+ Address(std::string bus, std::string path)\r
: mBus(std::move(bus)),\r
mPath(std::move(path))\r
{\r
return mPath;\r
}\r
\r
- bool operator == ( const Address& a ) const\r
+ bool operator==(const Address& a) const\r
{\r
return mBus == a.mBus && mPath == a.mPath;\r
}\r
\r
- bool operator != ( const Address& a ) const\r
+ bool operator!=(const Address& a) const\r
{\r
return !(*this == a);\r
}\r
};\r
\r
/**\r
- * @brief Enumeration describing type of key event\r
- * @see Adaptor::AccessibilityObserver::OnAccessibleKeyEvent\r
- */\r
-enum class KeyEventType\r
-{\r
- KEY_PRESSED,\r
- KEY_RELEASED,\r
-};\r
-\r
-/**\r
- * @brief Enumeration with human readable values describing state of event\r
- * @see Dali::Accessibility::Bridge::Emit\r
- */\r
-enum class Consumed\r
-{\r
- NO,\r
- YES\r
-};\r
-\r
-/**\r
* @brief Helper class representing two dimensional point with integer coordinates\r
*/\r
struct DALI_ADAPTOR_API Point\r
\r
Point() = default;\r
\r
- Point( int x, int y )\r
+ Point(int x, int y)\r
: x(x),\r
y(y)\r
{\r
*/\r
struct DALI_ADAPTOR_API Size\r
{\r
- int width = 0;\r
+ int width = 0;\r
int height = 0;\r
\r
Size() = default;\r
{\r
}\r
\r
- bool operator==( Size p ) const\r
+ bool operator==(Size p) const\r
{\r
return width == p.width && height == p.height;\r
}\r
\r
- bool operator!=( Size p ) const\r
+ bool operator!=(Size p) const\r
{\r
return !(*this == p);\r
}\r
/**\r
* @brief Helper class used to store data related with Accessibility::Text interface\r
* @see Dali::Accessibility::Text::GetTextAtOffset\r
- * @see Dali::Accessibility::Text::GetSelection\r
+ * @see Dali::Accessibility::Text::GetRangeOfSelection\r
*/\r
struct DALI_ADAPTOR_API Range\r
{\r
- int32_t startOffset = 0;\r
- int32_t endOffset = 0;\r
+ int32_t startOffset = 0;\r
+ int32_t endOffset = 0;\r
std::string content;\r
\r
Range() = default;\r
Range(size_t start, size_t end, std::string content)\r
: startOffset(start),\r
endOffset(end),\r
- content(content)\r
+ content(std::move(content))\r
{\r
}\r
};\r
/**\r
* @brief Structure containing all values needed to invoke Accessible::DoGesture\r
* type : numerated gesture type\r
- * xBeg, yBeg : point where gesture begins\r
- * xEnd, yEnd : point where gesture ends\r
+ * startPositionX, startPositionY : point where gesture begins\r
+ * endPositionX, endPositionY : point where gesture ends\r
* state : enumerated state of gesture\r
* eventTime : time when event occured\r
* @see Dali::Accessibility::Accessible::DoGesture\r
struct DALI_ADAPTOR_API GestureInfo\r
{\r
GestureInfo() = default;\r
- GestureInfo(Gesture type, int32_t xBeg, int32_t xEnd, int32_t yBeg, int32_t yEnd, GestureState state, uint32_t eventTime)\r
+ GestureInfo(Gesture type, int32_t startPositionX, int32_t endPositionX, int32_t startPositionY, int32_t endPositionY, GestureState state, uint32_t eventTime)\r
: type(type),\r
- xBeg(xBeg),\r
- xEnd(xEnd),\r
- yBeg(yBeg),\r
- yEnd(yEnd),\r
+ startPointX(startPositionX),\r
+ endPointX(endPositionX),\r
+ startPointY(startPositionY),\r
+ endPointY(endPositionY),\r
state(state),\r
eventTime(eventTime)\r
{\r
}\r
\r
- Gesture type{};\r
- int32_t xBeg{};\r
- int32_t xEnd{};\r
- int32_t yBeg{};\r
- int32_t yEnd{};\r
+ Gesture type{};\r
+ int32_t startPointX{};\r
+ int32_t endPointX{};\r
+ int32_t startPointY{};\r
+ int32_t endPointY{};\r
GestureState state{};\r
- uint32_t eventTime{};\r
+ uint32_t eventTime{};\r
};\r
\r
/**\r
* @brief Class representing accessibility relations\r
+ *\r
* Class connecting one source object with multiple target objects with usage\r
* of specific relation type.\r
- * @note std::string representing source and targets are string values of Accessibility::Address\r
- * @see Dali::Accessibility::Accessible::Address\r
+ *\r
+ * A remote target object (i.e. one belonging to a different process) can be\r
+ * represented in terms of a ProxyAccessible.\r
+ *\r
+ * @see Dali::Accessibility::Accessible::Accessible\r
* @see Dali::Accessibility::Accessible::RelationType\r
*/\r
struct DALI_ADAPTOR_API Relation\r
{\r
-Relation(RelationType relationType, std::vector<Address> targets)\r
-: relationType(relationType),\r
- targets(targets)\r
-{\r
-}\r
+ Relation(RelationType relationType, const std::vector<Accessible*>& targets)\r
+ : mRelationType(relationType),\r
+ mTargets(targets)\r
+ {\r
+ }\r
\r
-RelationType relationType;\r
-std::vector<Address> targets;\r
+ RelationType mRelationType;\r
+ std::vector<Accessible*> mTargets;\r
};\r
\r
} // namespace Accessibility\r