Use text inside widget for embedding and identifying widget, which is the default implementation
| 19 | |
| 20 | ///Use text inside widget for embedding and identifying widget, which is the default implementation |
| 21 | class Widget : Serializable, public HashNode { |
| 22 | public: |
| 23 | /// Use text inside widget for embedding and identifying widget, which is the default implementation. |
| 24 | /// \param parent |
| 25 | /// \param element |
| 26 | Widget(std::shared_ptr<Widget> parent, const ElementPtr &element); |
| 27 | |
| 28 | std::shared_ptr<Widget> getParent() const { return this->_parent; } |
| 29 | |
| 30 | std::shared_ptr<Rect> getBounds() const { return this->_bounds; } |
| 31 | |
| 32 | std::set<ActionType> getActions() const { return this->_actions; } |
| 33 | |
| 34 | std::string getText() const { return this->_text; } |
| 35 | |
| 36 | bool getEnabled() const { return this->_enabled; } |
| 37 | |
| 38 | bool hasOperate(OperateType opt) const { return this->_operateMask & opt; } |
| 39 | |
| 40 | bool hasAction() const { return !this->_actions.empty(); } |
| 41 | |
| 42 | bool isEditable() const; |
| 43 | |
| 44 | uintptr_t hash() const override; |
| 45 | |
| 46 | std::string toString() const override; |
| 47 | |
| 48 | std::string buildFullXpath() const; |
| 49 | |
| 50 | virtual void clearDetails(); |
| 51 | |
| 52 | void fillDetails(const std::shared_ptr<Widget> ©); |
| 53 | |
| 54 | virtual ~Widget(); |
| 55 | |
| 56 | |
| 57 | protected: |
| 58 | Widget(); |
| 59 | |
| 60 | void enableOperate(OperateType opt) { this->_operateMask |= opt; } |
| 61 | |
| 62 | void initFormElement(const ElementPtr &element); |
| 63 | |
| 64 | uintptr_t _hashcode{}; |
| 65 | std::shared_ptr<Widget> _parent; |
| 66 | std::string _text; |
| 67 | int _index{}; |
| 68 | std::string _clazz; |
| 69 | std::string _resourceID; |
| 70 | bool _enabled{}; |
| 71 | bool _isEditable{}; |
| 72 | int _operateMask{OperateType::None}; |
| 73 | private: |
| 74 | std::string toXPath() const; |
| 75 | |
| 76 | RectPtr _bounds; |
| 77 | std::string _contextDesc; |
| 78 | std::set<ActionType> _actions; |