protected:
struct Data
{
- std::unordered_set<Accessible*> mKnownObjects;
- std::string mBusName;
- Bridge* mBridge = nullptr;
- Actor mHighlightActor;
- Actor mCurrentlyHighlightedActor;
+ std::unordered_set<const Accessible*> mKnownObjects;
+ std::string mBusName;
+ Bridge* mBridge = nullptr;
+ Actor mHighlightActor;
+ Actor mCurrentlyHighlightedActor;
};
std::shared_ptr<Data> mData;
friend class Accessible;
*
* @param[in] object The accessible object
**/
- void RegisterOnBridge(Accessible* object);
+ void RegisterOnBridge(const Accessible* object);
/**
* @brief Tells bridge, that given object is considered root (doesn't have any parents).
#include <dali/public-api/object/type-info.h>
#include <dali/public-api/object/type-registry-helper.h>
#include <dali/public-api/object/weak-handle.h>
+#include <string_view>
+#include <unordered_map>
// INTERNAL INCLUDES
#include <dali/devel-api/adaptor-framework/accessibility-bridge.h>
return mBus.empty() && Bridge::GetCurrentBridge() ? Bridge::GetCurrentBridge()->GetBusName() : mBus;
}
-std::string EmptyAccessibleWithAddress::GetRoleName()
-{
- return "";
-}
-
-std::string Accessible::GetLocalizedRoleName()
+std::string Accessible::GetLocalizedRoleName() const
{
return GetRoleName();
}
-std::string Accessible::GetRoleName()
+std::string Accessible::GetRoleName() const
{
- switch(GetRole())
+ static const std::unordered_map<Role, std::string_view> roleMap{
+ {Role::INVALID, "invalid"},
+ {Role::ACCELERATOR_LABEL, "accelerator label"},
+ {Role::ALERT, "alert"},
+ {Role::ANIMATION, "animation"},
+ {Role::ARROW, "arrow"},
+ {Role::CALENDAR, "calendar"},
+ {Role::CANVAS, "canvas"},
+ {Role::CHECK_BOX, "check box"},
+ {Role::CHECK_MENU_ITEM, "check menu item"},
+ {Role::COLOR_CHOOSER, "color chooser"},
+ {Role::COLUMN_HEADER, "column header"},
+ {Role::COMBO_BOX, "combo box"},
+ {Role::DATE_EDITOR, "date editor"},
+ {Role::DESKTOP_ICON, "desktop icon"},
+ {Role::DESKTOP_FRAME, "desktop frame"},
+ {Role::DIAL, "dial"},
+ {Role::DIALOG, "dialog"},
+ {Role::DIRECTORY_PANE, "directory pane"},
+ {Role::DRAWING_AREA, "drawing area"},
+ {Role::FILE_CHOOSER, "file chooser"},
+ {Role::FILLER, "filler"},
+ {Role::FOCUS_TRAVERSABLE, "focus traversable"},
+ {Role::FONT_CHOOSER, "font chooser"},
+ {Role::FRAME, "frame"},
+ {Role::GLASS_PANE, "glass pane"},
+ {Role::HTML_CONTAINER, "html container"},
+ {Role::ICON, "icon"},
+ {Role::IMAGE, "image"},
+ {Role::INTERNAL_FRAME, "internal frame"},
+ {Role::LABEL, "label"},
+ {Role::LAYERED_PANE, "layered pane"},
+ {Role::LIST, "list"},
+ {Role::LIST_ITEM, "list item"},
+ {Role::MENU, "menu"},
+ {Role::MENU_BAR, "menu bar"},
+ {Role::MENU_ITEM, "menu item"},
+ {Role::OPTION_PANE, "option pane"},
+ {Role::PAGE_TAB, "page tab"},
+ {Role::PAGE_TAB_LIST, "page tab list"},
+ {Role::PANEL, "panel"},
+ {Role::PASSWORD_TEXT, "password text"},
+ {Role::POPUP_MENU, "popup menu"},
+ {Role::PROGRESS_BAR, "progress bar"},
+ {Role::PUSH_BUTTON, "push button"},
+ {Role::RADIO_BUTTON, "radio button"},
+ {Role::RADIO_MENU_ITEM, "radio menu item"},
+ {Role::ROOT_PANE, "root pane"},
+ {Role::ROW_HEADER, "row header"},
+ {Role::SCROLL_BAR, "scroll bar"},
+ {Role::SCROLL_PANE, "scroll pane"},
+ {Role::SEPARATOR, "separator"},
+ {Role::SLIDER, "slider"},
+ {Role::SPIN_BUTTON, "spin button"},
+ {Role::SPLIT_PANE, "split pane"},
+ {Role::STATUS_BAR, "status bar"},
+ {Role::TABLE, "table"},
+ {Role::TABLE_CELL, "table cell"},
+ {Role::TABLE_COLUMN_HEADER, "table column header"},
+ {Role::TABLE_ROW_HEADER, "table row header"},
+ {Role::TEAROFF_MENU_ITEM, "tearoff menu item"},
+ {Role::TERMINAL, "terminal"},
+ {Role::TEXT, "text"},
+ {Role::TOGGLE_BUTTON, "toggle button"},
+ {Role::TOOL_BAR, "tool bar"},
+ {Role::TOOL_TIP, "tool tip"},
+ {Role::TREE, "tree"},
+ {Role::TREE_TABLE, "tree table"},
+ {Role::UNKNOWN, "unknown"},
+ {Role::VIEWPORT, "viewport"},
+ {Role::WINDOW, "window"},
+ {Role::EXTENDED, "extended"},
+ {Role::HEADER, "header"},
+ {Role::FOOTER, "footer"},
+ {Role::PARAGRAPH, "paragraph"},
+ {Role::RULER, "ruler"},
+ {Role::APPLICATION, "application"},
+ {Role::AUTOCOMPLETE, "autocomplete"},
+ {Role::EDITBAR, "edit bar"},
+ {Role::EMBEDDED, "embedded"},
+ {Role::ENTRY, "entry"},
+ {Role::CHART, "chart"},
+ {Role::CAPTION, "caution"},
+ {Role::DOCUMENT_FRAME, "document frame"},
+ {Role::HEADING, "heading"},
+ {Role::PAGE, "page"},
+ {Role::SECTION, "section"},
+ {Role::REDUNDANT_OBJECT, "redundant object"},
+ {Role::FORM, "form"},
+ {Role::LINK, "link"},
+ {Role::INPUT_METHOD_WINDOW, "input method window"},
+ {Role::TABLE_ROW, "table row"},
+ {Role::TREE_ITEM, "tree item"},
+ {Role::DOCUMENT_SPREADSHEET, "document spreadsheet"},
+ {Role::DOCUMENT_PRESENTATION, "document presentation"},
+ {Role::DOCUMENT_TEXT, "document text"},
+ {Role::DOCUMENT_WEB, "document web"},
+ {Role::DOCUMENT_EMAIL, "document email"},
+ {Role::COMMENT, "comment"},
+ {Role::LIST_BOX, "list box"},
+ {Role::GROUPING, "grouping"},
+ {Role::IMAGE_MAP, "image map"},
+ {Role::NOTIFICATION, "notification"},
+ {Role::INFO_BAR, "info bar"},
+ {Role::LEVEL_BAR, "level bar"},
+ {Role::TITLE_BAR, "title bar"},
+ {Role::BLOCK_QUOTE, "block quote"},
+ {Role::AUDIO, "audio"},
+ {Role::VIDEO, "video"},
+ {Role::DEFINITION, "definition"},
+ {Role::ARTICLE, "article"},
+ {Role::LANDMARK, "landmark"},
+ {Role::LOG, "log"},
+ {Role::MARQUEE, "marquee"},
+ {Role::MATH, "math"},
+ {Role::RATING, "rating"},
+ {Role::TIMER, "timer"},
+ {Role::STATIC, "static"},
+ {Role::MATH_FRACTION, "math fraction"},
+ {Role::MATH_ROOT, "math root"},
+ {Role::SUBSCRIPT, "subscript"},
+ {Role::SUPERSCRIPT, "superscript"},
+ };
+
+ auto it = roleMap.find(GetRole());
+
+ if(it == roleMap.end())
{
- case Role::INVALID:
- {
- return "invalid";
- }
- case Role::ACCELERATOR_LABEL:
- {
- return "accelerator label";
- }
- case Role::ALERT:
- {
- return "alert";
- }
- case Role::ANIMATION:
- {
- return "animation";
- }
- case Role::ARROW:
- {
- return "arrow";
- }
- case Role::CALENDAR:
- {
- return "calendar";
- }
- case Role::CANVAS:
- {
- return "canvas";
- }
- case Role::CHECK_BOX:
- {
- return "check box";
- }
- case Role::CHECK_MENU_ITEM:
- {
- return "check menu item";
- }
- case Role::COLOR_CHOOSER:
- {
- return "color chooser";
- }
- case Role::COLUMN_HEADER:
- {
- return "column header";
- }
- case Role::COMBO_BOX:
- {
- return "combo box";
- }
- case Role::DATE_EDITOR:
- {
- return "date editor";
- }
- case Role::DESKTOP_ICON:
- {
- return "desktop icon";
- }
- case Role::DESKTOP_FRAME:
- {
- return "desktop frame";
- }
- case Role::DIAL:
- {
- return "dial";
- }
- case Role::DIALOG:
- {
- return "dialog";
- }
- case Role::DIRECTORY_PANE:
- {
- return "directory pane";
- }
- case Role::DRAWING_AREA:
- {
- return "drawing area";
- }
- case Role::FILE_CHOOSER:
- {
- return "file chooser";
- }
- case Role::FILLER:
- {
- return "filler";
- }
- case Role::FOCUS_TRAVERSABLE:
- {
- return "focus traversable";
- }
- case Role::FONT_CHOOSER:
- {
- return "font chooser";
- }
- case Role::FRAME:
- {
- return "frame";
- }
- case Role::GLASS_PANE:
- {
- return "glass pane";
- }
- case Role::HTML_CONTAINER:
- {
- return "html container";
- }
- case Role::ICON:
- {
- return "icon";
- }
- case Role::IMAGE:
- {
- return "image";
- }
- case Role::INTERNAL_FRAME:
- {
- return "internal frame";
- }
- case Role::LABEL:
- {
- return "label";
- }
- case Role::LAYERED_PANE:
- {
- return "layered pane";
- }
- case Role::LIST:
- {
- return "list";
- }
- case Role::LIST_ITEM:
- {
- return "list item";
- }
- case Role::MENU:
- {
- return "menu";
- }
- case Role::MENU_BAR:
- {
- return "menu bar";
- }
- case Role::MENU_ITEM:
- {
- return "menu item";
- }
- case Role::OPTION_PANE:
- {
- return "option pane";
- }
- case Role::PAGE_TAB:
- {
- return "page tab";
- }
- case Role::PAGE_TAB_LIST:
- {
- return "page tab list";
- }
- case Role::PANEL:
- {
- return "panel";
- }
- case Role::PASSWORD_TEXT:
- {
- return "password text";
- }
- case Role::POPUP_MENU:
- {
- return "popup menu";
- }
- case Role::PROGRESS_BAR:
- {
- return "progress bar";
- }
- case Role::PUSH_BUTTON:
- {
- return "push button";
- }
- case Role::RADIO_BUTTON:
- {
- return "radio button";
- }
- case Role::RADIO_MENU_ITEM:
- {
- return "radio menu item";
- }
- case Role::ROOT_PANE:
- {
- return "root pane";
- }
- case Role::ROW_HEADER:
- {
- return "row header";
- }
- case Role::SCROLL_BAR:
- {
- return "scroll bar";
- }
- case Role::SCROLL_PANE:
- {
- return "scroll pane";
- }
- case Role::SEPARATOR:
- {
- return "separator";
- }
- case Role::SLIDER:
- {
- return "slider";
- }
- case Role::SPIN_BUTTON:
- {
- return "spin button";
- }
- case Role::SPLIT_PANE:
- {
- return "split pane";
- }
- case Role::STATUS_BAR:
- {
- return "status bar";
- }
- case Role::TABLE:
- {
- return "table";
- }
- case Role::TABLE_CELL:
- {
- return "table cell";
- }
- case Role::TABLE_COLUMN_HEADER:
- {
- return "table column header";
- }
- case Role::TABLE_ROW_HEADER:
- {
- return "table row header";
- }
- case Role::TEAROFF_MENU_ITEM:
- {
- return "tearoff menu item";
- }
- case Role::TERMINAL:
- {
- return "terminal";
- }
- case Role::TEXT:
- {
- return "text";
- }
- case Role::TOGGLE_BUTTON:
- {
- return "toggle button";
- }
- case Role::TOOL_BAR:
- {
- return "tool bar";
- }
- case Role::TOOL_TIP:
- {
- return "tool tip";
- }
- case Role::TREE:
- {
- return "tree";
- }
- case Role::TREE_TABLE:
- {
- return "tree table";
- }
- case Role::UNKNOWN:
- {
- return "unknown";
- }
- case Role::VIEWPORT:
- {
- return "viewport";
- }
- case Role::WINDOW:
- {
- return "window";
- }
- case Role::EXTENDED:
- {
- return "extended";
- }
- case Role::HEADER:
- {
- return "header";
- }
- case Role::FOOTER:
- {
- return "footer";
- }
- case Role::PARAGRAPH:
- {
- return "paragraph";
- }
- case Role::RULER:
- {
- return "ruler";
- }
- case Role::APPLICATION:
- {
- return "application";
- }
- case Role::AUTOCOMPLETE:
- {
- return "autocomplete";
- }
- case Role::EDITBAR:
- {
- return "edit bar";
- }
- case Role::EMBEDDED:
- {
- return "embedded";
- }
- case Role::ENTRY:
- {
- return "entry";
- }
- case Role::CHART:
- {
- return "chart";
- }
- case Role::CAPTION:
- {
- return "caution";
- }
- case Role::DOCUMENT_FRAME:
- {
- return "document frame";
- }
- case Role::HEADING:
- {
- return "heading";
- }
- case Role::PAGE:
- {
- return "page";
- }
- case Role::SECTION:
- {
- return "section";
- }
- case Role::REDUNDANT_OBJECT:
- {
- return "redundant object";
- }
- case Role::FORM:
- {
- return "form";
- }
- case Role::LINK:
- {
- return "link";
- }
- case Role::INPUT_METHOD_WINDOW:
- {
- return "input method window";
- }
- case Role::TABLE_ROW:
- {
- return "table row";
- }
- case Role::TREE_ITEM:
- {
- return "tree item";
- }
- case Role::DOCUMENT_SPREADSHEET:
- {
- return "document spreadsheet";
- }
- case Role::DOCUMENT_PRESENTATION:
- {
- return "document presentation";
- }
- case Role::DOCUMENT_TEXT:
- {
- return "document text";
- }
- case Role::DOCUMENT_WEB:
- {
- return "document web";
- }
- case Role::DOCUMENT_EMAIL:
- {
- return "document email";
- }
- case Role::COMMENT:
- {
- return "comment";
- }
- case Role::LIST_BOX:
- {
- return "list box";
- }
- case Role::GROUPING:
- {
- return "grouping";
- }
- case Role::IMAGE_MAP:
- {
- return "image map";
- }
- case Role::NOTIFICATION:
- {
- return "notification";
- }
- case Role::INFO_BAR:
- {
- return "info bar";
- }
- case Role::LEVEL_BAR:
- {
- return "level bar";
- }
- case Role::TITLE_BAR:
- {
- return "title bar";
- }
- case Role::BLOCK_QUOTE:
- {
- return "block quote";
- }
- case Role::AUDIO:
- {
- return "audio";
- }
- case Role::VIDEO:
- {
- return "video";
- }
- case Role::DEFINITION:
- {
- return "definition";
- }
- case Role::ARTICLE:
- {
- return "article";
- }
- case Role::LANDMARK:
- {
- return "landmark";
- }
- case Role::LOG:
- {
- return "log";
- }
- case Role::MARQUEE:
- {
- return "marquee";
- }
- case Role::MATH:
- {
- return "math";
- }
- case Role::RATING:
- {
- return "rating";
- }
- case Role::TIMER:
- {
- return "timer";
- }
- case Role::STATIC:
- {
- return "static";
- }
- case Role::MATH_FRACTION:
- {
- return "math fraction";
- }
- case Role::MATH_ROOT:
- {
- return "math root";
- }
- case Role::SUBSCRIPT:
- {
- return "subscript";
- }
- case Role::SUPERSCRIPT:
- {
- return "superscript";
- }
- case Role::MAX_COUNT:
- {
- break;
- }
+ return {};
}
- return "";
+
+ return std::string{it->second};
}
Dali::Actor Accessible::GetCurrentlyHighlightedActor()
Dali::WeakHandle<Dali::Actor> mSelf;
bool mRoot = false;
- Dali::Actor Self()
+ Dali::Actor Self() const
{
auto handle = mSelf.GetHandle();
{
}
- Dali::Rect<> GetExtents(Dali::Accessibility::CoordinateType type) override
+ Dali::Rect<> GetExtents(Dali::Accessibility::CoordinateType type) const override
{
Dali::Actor actor = Self();
Vector2 screenPosition = actor.GetProperty(Actor::Property::SCREEN_POSITION).Get<Vector2>();
}
else // Dali::Accessibility::CoordinateType::SCREEN
{
- auto window = Dali::DevelWindow::Get(actor);
+ auto window = Dali::DevelWindow::Get(actor);
auto windowPosition = window.GetPosition();
return {position.x + windowPosition.GetX(), position.y + windowPosition.GetY(), size.x, size.y};
}
}
- Dali::Accessibility::ComponentLayer GetLayer() override
+ Dali::Accessibility::ComponentLayer GetLayer() const override
{
return Dali::Accessibility::ComponentLayer::WINDOW;
}
- int16_t GetMdiZOrder() override
+ int16_t GetMdiZOrder() const override
{
return 0;
}
- double GetAlpha() override
+ double GetAlpha() const override
{
return 0;
}
return false;
}
- bool IsScrollable() override
+ bool IsScrollable() const override
{
return false;
}
- std::string GetName() override
+ std::string GetName() const override
{
return Self().GetProperty<std::string>(Dali::Actor::Property::NAME);
}
- std::string GetDescription() override
+ std::string GetDescription() const override
{
return "";
}
return Get(Self().GetParent());
}
- size_t GetChildCount() override
+ size_t GetChildCount() const override
{
return static_cast<size_t>(Self().GetChildCount());
}
throw std::domain_error{"actor is not a child of it's parent"};
}
- Role GetRole() override
+ Role GetRole() const override
{
return mRoot ? Role::WINDOW : Role::REDUNDANT_OBJECT;
}
States state;
if(mRoot)
{
- auto window = Dali::DevelWindow::Get(Self());
- auto visible = window.IsVisible();
+ auto window = Dali::DevelWindow::Get(Self());
+ auto visible = window.IsVisible();
state[State::ENABLED] = true;
state[State::SENSITIVE] = true;
state[State::SHOWING] = visible;
}
else
{
- auto parentState = GetParent()->GetStates();
+ auto parentState = GetParent()->GetStates();
state[State::SHOWING] = parentState[State::SHOWING];
state[State::VISIBLE] = parentState[State::VISIBLE];
}
return state;
}
- Attributes GetAttributes() override
+ Attributes GetAttributes() const override
{
Dali::TypeInfo type;
Self().GetTypeInfo(type);
- return
- {
+ return {
{"class", type.GetName()},
};
}
/**
* @brief The minimalistic, always empty Accessible object with settable address.
*
- * For those situations, where you want to return address in different bridge
- * (embedding for example), but the object itself ain't planned to be used otherwise.
- * This object has null parent, no children, empty name and so on
+ * To be used as a proxy object, in those situations where you want to return an address in
+ * a different bridge (embedding for example), but the object itself isn't planned to be used
+ * otherwise. This object has no parent, no children, an empty name and so on.
*/
-class DALI_ADAPTOR_API EmptyAccessibleWithAddress : public virtual Accessible
+class DALI_ADAPTOR_API ProxyAccessible : public virtual Accessible
{
public:
- EmptyAccessibleWithAddress() = default;
+ ProxyAccessible() = default;
- EmptyAccessibleWithAddress(Address address)
+ ProxyAccessible(Address address)
: mAddress(std::move(address))
{
}
this->mAddress = std::move(address);
}
- std::string GetName() override
+ std::string GetName() const override
{
return "";
}
- std::string GetDescription() override
+ std::string GetDescription() const override
{
return "";
}
return nullptr;
}
- size_t GetChildCount() override
+ size_t GetChildCount() const override
{
return 0;
}
return static_cast<size_t>(-1);
}
- Role GetRole() override
+ Role GetRole() const override
{
return {};
}
- std::string GetRoleName() override;
+ std::string GetRoleName() const override
+ {
+ return {};
+ }
States GetStates() override
{
return {};
}
- Attributes GetAttributes() override
+ Attributes GetAttributes() const override
{
return {};
}
- Address GetAddress() override
+ Address GetAddress() const override
{
return mAddress;
}
#include <dali/public-api/actors/actor.h>
#include <dali/public-api/math/rect.h>
#include <dali/public-api/object/object-registry.h>
+#include <cstdint>
#include <string>
#include <vector>
class DALI_ADAPTOR_API Accessible
{
public:
- virtual ~Accessible();
+ virtual ~Accessible() noexcept;
using utf8_t = unsigned char;
*
* @note Word boundaries are returned as non-zero values in table breaks, which must be of size at least length.
*/
- void FindWordSeparationsUtf8(const utf8_t* string, size_t length, const char* language, char* breaks);
+ static void FindWordSeparationsUtf8(const utf8_t* string, std::size_t length, const char* language, char* breaks);
/**
* @brief Calculates and finds line boundaries in given utf8 text.
*
* @note Line boundaries are returned as non-zero values in table breaks, which must be of size at least length.
*/
- void FindLineSeparationsUtf8(const utf8_t* string, size_t length, const char* language, char* breaks);
+ static void FindLineSeparationsUtf8(const utf8_t* string, std::size_t length, const char* language, char* breaks);
/**
* @brief Helper function for emiting active-descendant-changed event.
*
* @return The string with name
*/
- virtual std::string GetName() = 0;
+ virtual std::string GetName() const = 0;
/**
* @brief Gets accessibility description.
*
* @return The string with description
*/
- virtual std::string GetDescription() = 0;
+ virtual std::string GetDescription() const = 0;
/**
* @brief Gets parent.
*
* @return The number of children
*/
- virtual size_t GetChildCount() = 0;
+ virtual std::size_t GetChildCount() const = 0;
/**
* @brief Gets collection with all children.
*
* @return The child object
*/
- virtual Accessible* GetChildAtIndex(size_t index) = 0;
+ virtual Accessible* GetChildAtIndex(std::size_t index) = 0;
/**
* @brief Gets index that current object has in its parent's children collection.
*
* @return The index of the current object
*/
- virtual size_t GetIndexInParent() = 0;
+ virtual std::size_t GetIndexInParent() = 0;
/**
* @brief Gets accessibility role.
*
* @see Dali::Accessibility::Role
*/
- virtual Role GetRole() = 0;
+ virtual Role GetRole() const = 0;
/**
* @brief Gets name of accessibility role.
* @see Dali::Accessibility::Role
* @see Accessibility::Accessible::GetRole
*/
- virtual std::string GetRoleName();
+ virtual std::string GetRoleName() const;
/**
* @brief Gets localized name of accessibility role.
*
* @note translation is not supported in this version
*/
- virtual std::string GetLocalizedRoleName();
+ virtual std::string GetLocalizedRoleName() const;
/**
* @brief Gets accessibility states.
*
* @return The map of attributes and their values
*/
- virtual Attributes GetAttributes() = 0;
+ virtual Attributes GetAttributes() const = 0;
/**
* @brief Checks if this is proxy.
*
* @return True if this is proxy
*/
- virtual bool IsProxy();
+ virtual bool IsProxy() const;
/**
* @brief Gets unique address on accessibility bus.
*
* @see Dali::Accessibility::Address
*/
- virtual Address GetAddress();
+ virtual Address GetAddress() const;
/**
* @brief Deputes an object to perform provided gesture.
*
* @return The collection of strings with implemented interfaces
*/
- std::vector<std::string> GetInterfaces();
+ std::vector<std::string> GetInterfaces() const;
/**
* @brief Checks if object is on root level.
Accessible(Accessible&&) = delete;
Accessible& operator=(const Accessible&) = delete;
Accessible& operator=(Accessible&&) = delete;
- std::shared_ptr<Bridge::Data> GetBridgeData();
+ std::shared_ptr<Bridge::Data> GetBridgeData() const;
public:
/**
private:
friend class Bridge;
- std::weak_ptr<Bridge::Data> mBridgeData;
- bool mIsOnRootLevel = false;
+ mutable std::weak_ptr<Bridge::Data> mBridgeData;
+ bool mIsOnRootLevel = false;
}; // Accessible class
*
* @return The string with name of action
*/
- virtual std::string GetActionName(size_t index) = 0;
+ virtual std::string GetActionName(std::size_t index) const = 0;
/**
* @brief Gets translated name of action with given index.
*
* @note The translation is not supported in this version
*/
- virtual std::string GetLocalizedActionName(size_t index) = 0;
+ virtual std::string GetLocalizedActionName(std::size_t index) const = 0;
/**
* @brief Gets description of action with given index.
*
* @return The string with description of action
*/
- virtual std::string GetActionDescription(size_t index) = 0;
+ virtual std::string GetActionDescription(std::size_t index) const = 0;
/**
* @brief Gets key code binded to action with given index.
*
* @return The string with key name
*/
- virtual std::string GetActionKeyBinding(size_t index) = 0;
+ virtual std::string GetActionKeyBinding(std::size_t index) const = 0;
/**
* @brief Gets number of provided actions.
*
* @return The number of actions
*/
- virtual size_t GetActionCount() = 0;
+ virtual std::size_t GetActionCount() const = 0;
/**
* @brief Performs an action with given index.
*
* @return true on success, false otherwise
*/
- virtual bool DoAction(size_t index) = 0;
+ virtual bool DoAction(std::size_t index) = 0;
/**
* @brief Performs an action with given name.
*
* @return String with name
*/
- virtual std::string GetToolkitName() = 0;
+ virtual std::string GetToolkitName() const = 0;
/**
* @brief Gets version of graphic user interface framework used by an application.
*
* @return String with version
*/
- virtual std::string GetVersion() = 0;
+ virtual std::string GetVersion() const = 0;
};
} // namespace Dali::Accessibility
*/
class DALI_ADAPTOR_API Collection : public virtual Accessible
{
-public:
};
} // namespace Dali::Accessibility
*
* @see Dali::Rect
*/
- virtual Rect<> GetExtents(CoordinateType type) = 0;
+ virtual Rect<> GetExtents(CoordinateType type) const = 0;
/**
* @brief Gets layer current object is localized on.
*
* @see Dali::Accessibility::ComponentLayer
*/
- virtual ComponentLayer GetLayer() = 0;
+ virtual ComponentLayer GetLayer() const = 0;
/**
* @brief Gets value of z-order.
* which in short means that many stacked windows can be displayed within a single application.
* In such model, the concept of z-order of UI element became important to deal with element overlapping.
*/
- virtual int16_t GetMdiZOrder() = 0;
+ virtual int16_t GetMdiZOrder() const = 0;
/**
* @brief Sets current object as "focused".
*
* @return The alpha channel value in range [0.0, 1.0]
*/
- virtual double GetAlpha() = 0;
+ virtual double GetAlpha() const = 0;
/**
* @brief Sets current object as "highlighted".
*
* @see Dali:Accessibility::State
*/
- virtual bool IsScrollable();
+ virtual bool IsScrollable() const;
/**
* @brief Gets Accessible object containing given point.
* @remarks This method is `Contains` in DBus method.
* @see Dali::Accessibility::Point
*/
- virtual bool IsAccessibleContainingPoint(Point point, CoordinateType type);
+ virtual bool IsAccessibleContainingPoint(Point point, CoordinateType type) const;
};
} // namespace Dali::Accessibility
// INTERNAL INCLUDES
#include <dali/devel-api/atspi-interfaces/accessible.h>
+#include <dali/devel-api/atspi-interfaces/text.h>
namespace Dali::Accessibility
{
*
* @see Dali::Accessibility::EditableText
*/
-class DALI_ADAPTOR_API EditableText : public virtual Accessible
+class DALI_ADAPTOR_API EditableText : public virtual Accessible, public virtual Text
{
public:
/**
*
* @return true on success, false otherwise
*/
- virtual bool CopyText(size_t startPosition, size_t endPosition) = 0;
+ virtual bool CopyText(std::size_t startPosition, std::size_t endPosition) = 0;
/**
* @brief Cuts text in range to system clipboard.
*
* @return true on success, false otherwise
*/
- virtual bool CutText(size_t startPosition, size_t endPosition) = 0;
+ virtual bool CutText(std::size_t startPosition, std::size_t endPosition) = 0;
/**
* @brief Deletes text in range.
*
* @return true on success, false otherwise
*/
- virtual bool DeleteText(size_t startPosition, size_t endPosition) = 0;
+ virtual bool DeleteText(std::size_t startPosition, std::size_t endPosition) = 0;
/**
* @brief Inserts text at startPosition.
*
* @return true on success, false otherwise
*/
- virtual bool InsertText(size_t startPosition, std::string text) = 0;
+ virtual bool InsertText(std::size_t startPosition, std::string text) = 0;
/**
* @brief Replaces text with content.
*
* @return The 0-based index of hyperlink's last character + 1, in its originating hypertext.
*/
- virtual int32_t GetEndIndex() const = 0;
+ virtual std::int32_t GetEndIndex() const = 0;
/**
* @brief Gets the index of character in originating hypertext at which this hyperlink starts.
*
* @return The 0-based index of hyperlink's first character, in its originating hypertext.
*/
- virtual int32_t GetStartIndex() const = 0;
+ virtual std::int32_t GetStartIndex() const = 0;
/**
* @brief Gets the total number of anchors which this hyperlink has. Though, typical hyperlinks will have only one anchor.
*
* @return The number of anchors.
*/
- virtual int32_t GetAnchorCount() const = 0;
+ virtual std::int32_t GetAnchorCount() const = 0;
/**
* @brief Gets the object associated with a particular hyperlink's anchor.
*
* @return The handle to accessible object.
*/
- virtual Accessible* GetAnchorAccessible(int32_t anchorIndex) const = 0;
+ virtual Accessible* GetAnchorAccessible(std::int32_t anchorIndex) const = 0;
/**
* @brief Gets the URI associated with a particular hyperlink's anchor.
*
* @return The string containing URI.
*/
- virtual std::string GetAnchorUri(int32_t anchorIndex) const = 0;
+ virtual std::string GetAnchorUri(std::int32_t anchorIndex) const = 0;
/**
* @brief Tells whether this hyperlink object is still valid with respect to its originating hypertext object.
*
* @return Handle to hyperlink object at a specified index in hyperlink collection of hypertext.
*/
- virtual Hyperlink* GetLink(int32_t linkIndex) const = 0;
+ virtual Hyperlink* GetLink(std::int32_t linkIndex) const = 0;
/**
* @brief Gets the index in hyperlink collection occupied by hyperlink which spans over a specified character offset in this hypertext.
*
* @return The value of 0-based index in hyperlink collection (-1 if there is no hyperlink at the specified character offset).
*/
- virtual int32_t GetLinkIndex(int32_t characterOffset) const = 0;
+ virtual std::int32_t GetLinkIndex(std::int32_t characterOffset) const = 0;
/**
* @brief Gets number of hyperlinks stored in this hypertext.
*
* @return The number of hyperlinks (zero if none or -1 if the number cannot be determined)
*/
- virtual int32_t GetLinkCount() const = 0;
+ virtual std::int32_t GetLinkCount() const = 0;
};
} // namespace Dali::Accessibility
*
* @return The number of selected children (zero if none)
*/
- virtual int GetSelectedChildrenCount() = 0;
+ virtual int GetSelectedChildrenCount() const = 0;
/**
* @brief Gets a specific selected child.
*
* @return true if given child is selected, false otherwise
*/
- virtual bool IsChildSelected(int childIndex) = 0;
+ virtual bool IsChildSelected(int childIndex) const = 0;
/**
* @brief Selects all children.
*
* @return The substring of stored text
*/
- virtual std::string GetText(size_t startOffset, size_t endOffset) = 0;
+ virtual std::string GetText(std::size_t startOffset, std::size_t endOffset) const = 0;
/**
* @brief Gets number of all stored characters.
* @return The number of characters
* @remarks This method is `CharacterCount` in DBus method.
*/
- virtual size_t GetCharacterCount() = 0;
+ virtual std::size_t GetCharacterCount() const = 0;
/**
* @brief Gets the cursor offset.
* @return Value of cursor offset
* @remarks This method is `CaretOffset` in DBus method.
*/
- virtual size_t GetCursorOffset() = 0;
+ virtual std::size_t GetCursorOffset() const = 0;
/**
* @brief Sets the cursor offset.
* @return True if successful
* @remarks This method is `SetCaretOffset` in DBus method.
*/
- virtual bool SetCursorOffset(size_t offset) = 0;
+ virtual bool SetCursorOffset(std::size_t offset) = 0;
/**
* @brief Gets substring of stored text truncated in concrete gradation.
*
* @see Dali::Accessibility::Range
*/
- virtual Range GetTextAtOffset(size_t offset, TextBoundary boundary) = 0;
+ virtual Range GetTextAtOffset(std::size_t offset, TextBoundary boundary) const = 0;
/**
* @brief Gets selected text.
* @remarks This method is `GetSelection` in DBus method.
* @see Dali::Accessibility::Range
*/
- virtual Range GetRangeOfSelection(size_t selectionIndex) = 0;
+ virtual Range GetRangeOfSelection(std::size_t selectionIndex) const = 0;
/**
* @brief Removes the whole selection.
*
* @return bool on success, false otherwise
*/
- virtual bool RemoveSelection(size_t selectionIndex) = 0;
+ virtual bool RemoveSelection(std::size_t selectionIndex) = 0;
/**
* @brief Sets selected text.
* @return true on success, false otherwise
* @remarks This method is `SetSelection` in DBus method.
*/
- virtual bool SetRangeOfSelection(size_t selectionIndex, size_t startOffset, size_t endOffset) = 0;
+ virtual bool SetRangeOfSelection(std::size_t selectionIndex, std::size_t startOffset, std::size_t endOffset) = 0;
};
} // namespace Dali::Accessibility
*
* @return The minimum value
*/
- virtual double GetMinimum() = 0;
+ virtual double GetMinimum() const = 0;
/**
* @brief Gets the current value.
*
* @return The current value
*/
- virtual double GetCurrent() = 0;
+ virtual double GetCurrent() const = 0;
/**
* @brief Gets the highest possible value.
*
* @return The highest value.
*/
- virtual double GetMaximum() = 0;
+ virtual double GetMaximum() const = 0;
/**
* @brief Sets the current value.
*
* @return The lowest increment
*/
- virtual double GetMinimumIncrement() = 0;
+ virtual double GetMinimumIncrement() const = 0;
};
} // namespace Dali::Accessibility
using namespace Dali::Accessibility;
-std::vector<std::string> Accessible::GetInterfaces()
+std::vector<std::string> Accessible::GetInterfaces() const
{
std::vector<std::string> tmp;
tmp.push_back(AtspiDbusInterfaceAccessible);
- if(dynamic_cast<Collection*>(this))
+ if(dynamic_cast<const Collection*>(this))
{
tmp.push_back(AtspiDbusInterfaceCollection);
}
- if(dynamic_cast<Text*>(this))
+ if(dynamic_cast<const Text*>(this))
{
tmp.push_back(AtspiDbusInterfaceText);
}
- if(dynamic_cast<EditableText*>(this))
+ if(dynamic_cast<const EditableText*>(this))
{
tmp.push_back(AtspiDbusInterfaceEditableText);
}
- if(dynamic_cast<Value*>(this))
+ if(dynamic_cast<const Value*>(this))
{
tmp.push_back(AtspiDbusInterfaceValue);
}
- if(dynamic_cast<Component*>(this))
+ if(dynamic_cast<const Component*>(this))
{
tmp.push_back(AtspiDbusInterfaceComponent);
}
- if(auto action = dynamic_cast<Action*>(this))
+ if(auto action = dynamic_cast<const Action*>(this))
{
if(action->GetActionCount() > 0)
{
tmp.push_back(AtspiDbusInterfaceAction);
}
}
- if(dynamic_cast<Selection*>(this))
+ if(dynamic_cast<const Selection*>(this))
{
tmp.push_back(AtspiDbusInterfaceSelection);
}
- if(dynamic_cast<Hypertext*>(this))
+ if(dynamic_cast<const Hypertext*>(this))
{
tmp.push_back(AtspiDbusInterfaceHypertext);
}
- if(dynamic_cast<Hyperlink*>(this))
+ if(dynamic_cast<const Hyperlink*>(this))
{
tmp.push_back(AtspiDbusInterfaceHyperlink);
}
{
}
-Accessible::~Accessible()
+Accessible::~Accessible() noexcept
{
auto handle = mBridgeData.lock();
if(handle)
return tmp;
}
-std::shared_ptr<Bridge::Data> Accessible::GetBridgeData()
+std::shared_ptr<Bridge::Data> Accessible::GetBridgeData() const
{
auto handle = mBridgeData.lock();
if(!handle)
return handle;
}
-Address Accessible::GetAddress()
+Address Accessible::GetAddress() const
{
auto handle = mBridgeData.lock();
if(!handle)
return {handle ? handle->mBusName : "", tmp.str()};
}
-void Bridge::RegisterOnBridge(Accessible* object)
+void Bridge::RegisterOnBridge(const Accessible* object)
{
assert(!object->mBridgeData.lock() || object->mBridgeData.lock() == mData);
if(!object->mBridgeData.lock())
}
}
-bool Accessible::IsProxy()
+bool Accessible::IsProxy() const
{
return false;
}
#include <dali/internal/accessibility/bridge/accessibility-common.h>
/**
- * @brief The AppAccessible class is to define Accessibility Application.
+ * @brief The ApplicationAccessible class is to define Accessibility Application.
*/
-class AppAccessible : public virtual Dali::Accessibility::Accessible, public virtual Dali::Accessibility::Collection, public virtual Dali::Accessibility::Application
+class ApplicationAccessible : public virtual Dali::Accessibility::Accessible, public virtual Dali::Accessibility::Collection, public virtual Dali::Accessibility::Application
{
public:
- Dali::Accessibility::EmptyAccessibleWithAddress mParent;
- std::vector<Dali::Accessibility::Accessible*> mChildren;
- std::vector<Dali::Window> mWindows;
- std::string mName;
+ Dali::Accessibility::ProxyAccessible mParent;
+ std::vector<Dali::Accessibility::Accessible*> mChildren;
+ std::vector<Dali::Window> mWindows;
+ std::string mName;
- std::string GetName() override
+ std::string GetName() const override
{
return mName;
}
- std::string GetDescription() override
+ std::string GetDescription() const override
{
return "";
}
return &mParent;
}
- size_t GetChildCount() override
+ size_t GetChildCount() const override
{
return mChildren.size();
}
throw std::domain_error{"can't call GetIndexInParent on application object"};
}
- Dali::Accessibility::Role GetRole() override
+ Dali::Accessibility::Role GetRole() const override
{
return Dali::Accessibility::Role::APPLICATION;
}
return {};
}
- Dali::Accessibility::Attributes GetAttributes() override
+ Dali::Accessibility::Attributes GetAttributes() const override
{
return {};
}
return Dali::Actor{};
}
- Dali::Accessibility::Address GetAddress() override
+ Dali::Accessibility::Address GetAddress() const override
{
return {"", "root"};
}
- std::string GetToolkitName() override
+ std::string GetToolkitName() const override
{
return {"dali"};
}
- std::string GetVersion() override
+ std::string GetVersion() const override
{
return std::to_string(Dali::ADAPTOR_MAJOR_VERSION) + "." + std::to_string(Dali::ADAPTOR_MINOR_VERSION);
}
}
protected:
- mutable AppAccessible mApplication;
+ mutable ApplicationAccessible mApplication;
std::vector<Dali::Accessibility::Accessible*> mDefaultLabels;
bool mIsScreenReaderSuppressed = false;
using namespace Dali::Accessibility;
-bool Component::IsAccessibleContainingPoint(Point point, Dali::Accessibility::CoordinateType type)
+bool Component::IsAccessibleContainingPoint(Point point, Dali::Accessibility::CoordinateType type) const
{
auto extents = GetExtents(type);
return point.x >= extents.x && point.y >= extents.y && point.x <= extents.x + extents.width && point.y <= extents.y + extents.height;
return nullptr;
}
-bool Component::IsScrollable()
+bool Component::IsScrollable() const
{
return false;
}
{
}
-Accessibility::Accessible::~Accessible()
+Accessibility::Accessible::~Accessible() noexcept
{
}
return {};
}
-Accessibility::Address Accessibility::Accessible::GetAddress()
+Accessibility::Address Accessibility::Accessible::GetAddress() const
{
return {};
}
-std::shared_ptr<Accessibility::Bridge::Data> Accessibility::Accessible::GetBridgeData()
+std::shared_ptr<Accessibility::Bridge::Data> Accessibility::Accessible::GetBridgeData() const
{
return {};
}
-bool Accessibility::Accessible::IsProxy()
+bool Accessibility::Accessible::IsProxy() const
{
return false;
}
-bool Accessibility::Component::IsScrollable()
+bool Accessibility::Component::IsScrollable() const
{
return false;
}
-bool Accessibility::Component::IsAccessibleContainingPoint(Point point, CoordinateType type)
+bool Accessibility::Component::IsAccessibleContainingPoint(Point point, CoordinateType type) const
{
return false;
}