X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dali%2Fdevel-api%2Fadaptor-framework%2Faccessibility.h;h=77c7257d2eab91d323dcdc8d83062bb235e408f0;hb=666559e578423c202a1c444391e1a6bf1cf7e5a5;hp=1d4b8e6c48508842e9cfa566e473d13c0cb02fc3;hpb=c00ea42bcb851d820d4a44dec859f304d37e332f;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 1d4b8e6..77c7257 100644 --- a/dali/devel-api/adaptor-framework/accessibility.h +++ b/dali/devel-api/adaptor-framework/accessibility.h @@ -18,29 +18,20 @@ */ // EXTERNAL INCLUDES - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include #include #include #include // INTERNAL INCLUDES +#include #include namespace Dali { namespace Accessibility { +class Accessible; + /** * @brief Enumeration describing type of object move relative to the screen. Only outgoing moves are signalled to AT-clients. */ @@ -435,203 +426,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 -class BitSets +enum class AtspiInterface { - std::array mData; - - void Set() - { - } - - static constexpr bool Accepts() - { - return true; - } - - template - static constexpr bool Accepts() - { - return std::is_enum::value; - } - - template - static constexpr bool Accepts() - { - return std::is_enum::value && Accepts(); - } - - template - void Set(T t, ARGS... args) - { - (*this)[t] = true; - Set(args...); - } - -public: - BitSets() - { - for(auto& u : mData) - { - u = 0; - } - } - BitSets(const BitSets&) = default; - BitSets(BitSets&&) = default; - - template()>::type* = nullptr> - BitSets(T t, ARGS... args) - { - for(auto& u : mData) - { - u = 0; - } - Set(t, args...); - } - - explicit BitSets(std::array d) - { - for(auto i = 0u; i < I; ++i) - { - mData[i] = d[i]; - } - } - - explicit BitSets(std::array d) - { - for(auto i = 0u; i < I; ++i) - { - mData[i] = static_cast(d[i]); - } - } - - BitSets& operator=(const BitSets&) = default; - BitSets& operator=(BitSets&&) = default; - - struct Reference - { - std::array& 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 struct - - Reference operator[](S index) - { - return {mData, static_cast(index)}; - } - - bool operator[](S index) const - { - auto i = static_cast(index); - return (mData[i / 32] & (1 << (i & 31))) != 0; - } - - std::array GetRawData() const - { - return mData; - } - - BitSets operator|(BitSets b) const - { - BitSets r; - for(auto i = 0u; i < I; ++i) - { - r.mData[i] = mData[i] | b.mData[i]; - } - return r; - } - - BitSets operator^(BitSets b) const - { - BitSets r; - for(auto i = 0u; i < I; ++i) - { - r.mData[i] = mData[i] ^ b.mData[i]; - } - return r; - } - - BitSets operator&(BitSets b) const - { - BitSets r; - for(auto i = 0u; i < I; ++i) - { - r.mData[i] = mData[i] & b.mData[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(mData[i] != b.mData[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 : mData) - { - 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; - } -}; // BitSets class +} // namespace Internal -using ReadingInfoTypes = BitSets<1, ReadingInfoType>; -using States = BitSets<2, State>; -using Attributes = std::unordered_map; +/** + * @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 @@ -813,22 +713,26 @@ struct DALI_ADAPTOR_API GestureInfo /** * @brief Class representing accessibility relations + * * Class connecting one source object with multiple target objects with usage * of specific relation type. - * @note std::string representing source and targets are string values of Accessibility::Address - * @see Dali::Accessibility::Accessible::Address + * + * A remote target object (i.e. one belonging to a different process) can be + * represented in terms of a ProxyAccessible. + * + * @see Dali::Accessibility::Accessible::Accessible * @see Dali::Accessibility::Accessible::RelationType */ struct DALI_ADAPTOR_API Relation { - Relation(RelationType relationType, std::vector
targets) - : relationType(relationType), - targets(targets) + Relation(RelationType relationType, const std::vector& targets) + : mRelationType(relationType), + mTargets(targets) { } - RelationType relationType; - std::vector
targets; + RelationType mRelationType; + std::vector mTargets; }; } // namespace Accessibility