1 #include "AccessibleNode.h"
10 AccessibleNode::~AccessibleNode()
14 AccessibleNode::AccessibleNode()
15 : mText{""}, mPkg{""}, mRole{""}, mRes{""}, mType{""}, mStyle{""},
16 mBoundingBox{0,0,0,0}, mSupportingIfaces(0), mFeatureProperty(0)
20 void AccessibleNode::print(int depth, int maxDepth)
22 if (maxDepth <= 0 || depth > maxDepth) return;
25 auto children = this->getChildren();
26 for ( auto &child : children ) {
27 if (child) child->print(depth +1, maxDepth);
31 void AccessibleNode::print(int d)
34 LOG_F(INFO, "%s - %p(%s) / pkg:%s, text:%s",
35 std::string(d, ' ').c_str(), getRawHandler(), getText().c_str(),
36 getPkg().c_str(), getText().c_str());
39 bool AccessibleNode::isSupporting(AccessibleNodeInterface thisIface) const
41 return (mSupportingIfaces & static_cast<int>(thisIface)) != 0;
44 bool AccessibleNode::hasFeatureProperty(NodeFeatureProperties prop) const
46 return (mFeatureProperty & static_cast<int>(prop)) != 0;
49 void AccessibleNode::setFeatureProperty(NodeFeatureProperties prop, bool has)
52 mFeatureProperty |= static_cast<int>(prop);
54 mFeatureProperty &= ~static_cast<int>(prop);
58 std::string AccessibleNode::getText() const
63 std::string AccessibleNode::getPkg() const
68 std::string AccessibleNode::getRes() const
73 std::string AccessibleNode::getRole() const
78 std::string AccessibleNode::getType() const
83 std::string AccessibleNode::getStyle() const
88 Rect<int> AccessibleNode::getBoundingBox() const
93 bool AccessibleNode::isCheckable() const
95 return hasFeatureProperty(NodeFeatureProperties::CHECKABLE);
98 bool AccessibleNode::isChecked() const
100 return hasFeatureProperty(NodeFeatureProperties::CHECKED);
103 bool AccessibleNode::isClickable() const
105 return hasFeatureProperty(NodeFeatureProperties::CLICKABLE);
108 bool AccessibleNode::isEnabled() const
110 return hasFeatureProperty(NodeFeatureProperties::ENABLED);
113 bool AccessibleNode::isFocusable() const
115 return hasFeatureProperty(NodeFeatureProperties::FOCUSABLE);
118 bool AccessibleNode::isFocused() const
120 return hasFeatureProperty(NodeFeatureProperties::FOCUSED);
123 bool AccessibleNode::isLongClickable() const
125 return hasFeatureProperty(NodeFeatureProperties::LONGCLICKABLE);
128 bool AccessibleNode::isScrollable() const
130 return hasFeatureProperty(NodeFeatureProperties::SCROLLABLE);
133 bool AccessibleNode::isSelectable() const
135 return hasFeatureProperty(NodeFeatureProperties::SELECTABLE);
138 bool AccessibleNode::isSelected() const
140 return hasFeatureProperty(NodeFeatureProperties::SELECTED);
143 bool AccessibleNode::isVisible() const
145 return hasFeatureProperty(NodeFeatureProperties::VISIBLE);
148 bool AccessibleNode::isShowing() const
150 return hasFeatureProperty(NodeFeatureProperties::SHOWING);
153 bool AccessibleNode::isActive() const
155 return hasFeatureProperty(NodeFeatureProperties::ACTIVE);