class EE::UI::UIWidget

Overview

Base class for all UI widgets in the eepp framework. More…

#include <uiwidget.hpp>

class UIWidget: public EE::UI::UINode {
public:
    // construction

    virtual ~UIWidget();

    // methods

    static UIWidget* New();
    static UIWidget* NewWithTag(const std::string& tag);
    virtual Uint32 getType() const;
    virtual bool isType(const Uint32& type) const;
    virtual UINode* setFlags(const Uint32& flags);
    virtual UINode* unsetFlags(const Uint32& flags);
    virtual UIWidget* setAnchors(const Uint32& flags);
    virtual void setTheme(UITheme* Theme);
    virtual UINode* setThemeSkin(const std::string& skinName);
    virtual UINode* setThemeSkin(UITheme* Theme, const std::string& skinName);
    virtual Node* setId(const std::string& id);
    virtual bool acceptsDropOfWidget(const UIWidget* widget);
    UIWidget* acceptsDropOfWidgetInTree(const UIWidget* widget);
    UITooltip* getTooltip();
    void tooltipRemove();
    UIWidget* setTooltipText(const String& text);
    UIWidget* setTooltipTextIfNotEmpty(const String& text);
    String getTooltipText();
    void updateAnchorsDistances();
    const Rectf& getLayoutMargin() const;
    const Rectf& getLayoutPixelsMargin() const;
    UIWidget* setLayoutMargin(const Rectf& margin);
    UIWidget* setLayoutMarginLeft(const Float& marginLeft);
    UIWidget* setLayoutMarginRight(const Float& marginRight);
    UIWidget* setLayoutMarginTop(const Float& marginTop);
    UIWidget* setLayoutMarginBottom(const Float& marginBottom);
    UIWidget* setLayoutPixelsMargin(const Rectf& margin);
    UIWidget* setLayoutPixelsMarginLeft(const Float& marginLeft);
    UIWidget* setLayoutPixelsMarginRight(const Float& marginRight);
    UIWidget* setLayoutPixelsMarginTop(const Float& marginTop);
    UIWidget* setLayoutPixelsMarginBottom(const Float& marginBottom);
    Float getLayoutWeight() const;
    UIWidget* setLayoutWeight(const Float& weight);
    Uint32 getLayoutGravity() const;
    UIWidget* setLayoutGravity(const Uint32& layoutGravity);
    const SizePolicy& getLayoutWidthPolicy() const;
    UIWidget* setLayoutWidthPolicy(const SizePolicy& widthPolicy);
    const SizePolicy& getLayoutHeightPolicy() const;
    UIWidget* setLayoutHeightPolicy(const SizePolicy& heightPolicy);
    UIWidget* setLayoutSizePolicy(const SizePolicy& widthPolicy, const SizePolicy& heightPolicy);
    UIWidget* setLayoutPositionPolicy(const PositionPolicy& layoutPositionPolicy, UIWidget* of);
    UIWidget* getLayoutPositionPolicyWidget() const;
    PositionPolicy getLayoutPositionPolicy() const;
    virtual void loadFromXmlNode(const pugi::xml_node& node);
    void notifyLayoutAttrChange();
    void notifyLayoutAttrChangeParent();
    void setStyleSheetInlineProperty(const std::string& name, const std::string& value, const Uint32& specificity = UINT32_MAX - 1);
    virtual bool applyProperty(const StyleSheetProperty& attribute);
    const Rectf& getPadding() const;
    virtual const Rectf& getPixelsPadding() const;
    UIWidget* setPadding(const Rectf& padding);
    UIWidget* setPaddingLeft(const Float& paddingLeft);
    UIWidget* setPaddingRight(const Float& paddingRight);
    UIWidget* setPaddingTop(const Float& paddingTop);
    UIWidget* setPaddingBottom(const Float& paddingBottom);
    UIWidget* setPaddingPixels(const Rectf& padding);
    UIWidget* setPaddingPixelsLeft(const Float& paddingLeft);
    UIWidget* setPaddingPixelsRight(const Float& paddingRight);
    UIWidget* setPaddingPixelsTop(const Float& paddingTop);
    UIWidget* setPaddingPixelsBottom(const Float& paddingBottom);
    const std::string& getStyleSheetTag() const;
    const std::string& getStyleSheetId() const;
    const std::vector<std::string>& getStyleSheetClasses() const;
    UIWidget* getStyleSheetParentElement() const;
    UIWidget* getStyleSheetPreviousSiblingElement() const;
    UIWidget* getStyleSheetNextSiblingElement() const;
    Uint32 getStyleSheetPseudoClasses() const;
    std::vector<const char*> getStyleSheetPseudoClassesStrings() const;
    UIWidget* resetClass();
    UIWidget* setClass(const std::string& cls);
    UIWidget* setClass(std::string&& cls);
    UIWidget* setClasses(const std::vector<std::string>& classes);
    UIWidget* addClass(const std::string& cls);
    UIWidget* addClasses(const std::vector<std::string>& classes);
    UIWidget* removeClass(const std::string& cls);
    UIWidget* removeClasses(const std::vector<std::string>& classes);
    bool hasClass(const std::string_view& cls) const;
    void toggleClass(const std::string& cls);
    void setElementTag(const std::string& tag);
    const std::vector<std::string>& getClasses() const;
    const std::string& getElementTag() const;
    virtual void pushState(const Uint32& State, bool emitEvent = true);
    virtual void popState(const Uint32& State, bool emitEvent = true);
    UIStyle* getUIStyle() const;
    void reloadStyle(bool reloadChildren = true, bool disableAnimations = false, bool reportStateChange = true, bool forceReApplyProperties = false, bool resetPropertyCache = false);
    void beginAttributesTransaction();
    void endAttributesTransaction();
    const Uint32& getStyleState() const;
    const Uint32& getStylePreviousState() const;
    std::vector<UIWidget*> findAllByClass(const std::string& className);
    std::vector<UIWidget*> findAllByTag(const std::string& tag);
    UIWidget* findByClass(const std::string& className);

    template <typename T>
    T* findByClass(const std::string& className);

    UIWidget* findByTag(const std::string& tag);

    template <typename T>
    T* findByTag(const std::string& tag);

    UIWidget* querySelector(const CSS::StyleSheetSelector& selector);
    UIWidget* querySelector(const std::string& selector);

    template <typename T>
    T* querySelector(const std::string& selector);

    std::vector<UIWidget*> querySelectorAll(const CSS::StyleSheetSelector& selector);
    std::vector<UIWidget*> querySelectorAll(const std::string& selector);
    std::string getPropertyString(const std::string& property) const;
    virtual std::string getPropertyString(const PropertyDefinition* propertyDef, const Uint32& propertyIndex = 0) const;
    virtual std::vector<PropertyId> getPropertiesImplemented() const;
    bool isSceneNodeLoading() const;
    void reportStyleStateChangeRecursive(bool disableAnimations = false, bool forceReApplyStyles = false);
    UITooltip* createTooltip();
    bool isTabStop() const;
    void setTabStop();
    void unsetTabStop();
    bool isTabFocusable() const;
    void setTabFocusable();
    void unsetTabFocusable();
    UIWidget* getPrevTabWidget() const;
    UIWidget* getNextTabWidget() const;
    bool hasPseudoClass(const std::string& pseudoCls) const;
    bool isTooltipEnabled() const;
    void setTooltipEnabled(bool enabled);
    UIWidget* getPrevWidget() const;
    UIWidget* getNextWidget() const;
    String getTranslatorString(const std::string& str);
    String getTranslatorString(const std::string& str, const String& defaultValue);
    String i18n(const std::string& str);
    String i18n(const std::string& str, const String& defaultValue);
};

Inherited Members

public:
    // typedefs

    typedef std::function<void(const Event*)> EventCallback;
    typedef std::function<void(const Event*)> EventCallback;

    // methods

    virtual void setPosition(const Vector2f& position);
    virtual void setRotation(float angle);
    virtual void setScale(float factorX, float factorY);
    virtual void setScale(const Vector2f& factors);
    virtual void setScaleOrigin(float x, float y);
    virtual void setScaleOrigin(const Vector2f& origin);
    virtual void setRotationOrigin(float x, float y);
    virtual void setRotationOrigin(const Vector2f& origin);
    virtual const Vector2f& getRotationOrigin() const;
    virtual const Vector2f& getPosition() const;
    virtual const float& getRotation() const;
    virtual const Vector2f& getScale() const;
    virtual const Vector2f& getScaleOrigin() const;
    void move(float offsetX, float offsetY);
    void move(const Vector2f& offset);
    void rotate(float angle);
    void scale(float factorX, float factorY);
    void scale(const Vector2f& factor);
    const Transform& getTransform() const;
    const Transform& getInverseTransform() const;
    static Node* New();
    virtual void worldToNodeTranslation(Vector2f& position) const;
    virtual void nodeToWorldTranslation(Vector2f& position) const;
    virtual void worldToNode(Vector2i& pos) const;
    virtual void nodeToWorld(Vector2i& pos) const;
    virtual void worldToNode(Vector2f& pos) const;
    virtual void nodeToWorld(Vector2f& pos) const;
    virtual Uint32 getType() const;
    virtual bool isType(const Uint32& type) const;
    void messagePost(const NodeMessage* Msg);
    virtual void setPosition(const Vector2f& Pos);
    virtual Node* setPosition(const Float& x, const Float& y);
    virtual Node* setSize(const Sizef& size);
    Node* setSize(const Float& Width, const Float& Height);
    virtual const Sizef& getSize() const;
    const Sizef& getPixelsSize() const;
    Node* setVisible(const bool& visible, bool emitEventNotification = true);
    Node* setChildrenVisibility(bool visible, bool emitEventNotification = true);
    bool isVisible() const;
    bool hasVisibility() const;
    Node* setEnabled(const bool& enabled);
    bool isEnabled() const;
    bool isDisabled() const;
    Node* getParent() const;
    Node* setParent(Node* parent);
    virtual void close();
    virtual void draw();
    virtual void update(const Time& time);
    virtual void scheduledUpdate(const Time& time);
    Node* getNextNode() const;
    Node* getPrevNode() const;
    Node* getNextNodeLoop() const;
    Node* setData(const UintPtr& data);
    const UintPtr& getData() const;
    Node* setBlendMode(const BlendMode& blend);
    const BlendMode& getBlendMode() const;
    Node* toFront();
    Node* toBack();
    void toPosition(const Uint32& position);
    const Uint32& getNodeFlags() const;
    void setNodeFlags(const Uint32& flags);
    bool isSceneNode() const;
    bool isUISceneNode() const;
    bool isUINode() const;
    bool isWidget() const;
    bool isWindow() const;
    bool isLayout() const;
    bool isClipped() const;
    bool isRotated() const;
    bool isScaled() const;
    bool isFrameBuffer() const;
    bool isMouseOver() const;
    bool isMouseOverMeOrChildren() const;
    bool isMeOrParentTreeVisible() const;
    bool isMeOrParentTreeRotated() const;
    bool isMeOrParentTreeScaled() const;
    bool isMeOrParentTreeScaledOrRotated() const;
    bool isMeOrParentTreeScaledOrRotatedOrFrameBuffer() const;
    Uint32 addEventListener(const Uint32& eventType, const EventCallback& callback);
    Uint32 on(const Uint32& eventType, const EventCallback& callback);
    Uint32 onClick(const std::function<void(const MouseEvent*)>& callback, const MouseButton& button = MouseButton::EE_BUTTON_LEFT);
    Uint32 onDoubleClick(const std::function<void(const MouseEvent*)>& callback, const MouseButton& button = MouseButton::EE_BUTTON_LEFT);
    void removeEventsOfType(const Uint32& eventType);
    void removeEventListener(const Uint32& callbackId);
    void removeEventListener(const std::vector<Uint32>& callbacksIds);
    void clearEventListener();
    Node* getFirstChild() const;
    Node* getLastChild() const;
    const Polygon2f& getWorldPolygon();
    const Rectf& getWorldBounds();
    bool isParentOf(const Node* node) const;
    void sendEvent(const Event* Event);
    void sendMouseEvent(const Uint32& Event, const Vector2i& position, const Uint32& flags);
    void sendCommonEvent(const Uint32& Event);
    void sendTextEvent(const Uint32& event, const std::string& text);
    void closeAllChildren();
    const std::string& getId() const;
    virtual Node* setId(const std::string& id);
    const String::HashType& getIdHash() const;
    Node* find(const std::string& id) const;
    Node* hasChild(const std::string& id) const;

    template <typename T>
    T* find(const std::string& id) const;

    template <typename T>
    T* bind(const std::string& id, T*& node);

    template <typename T>
    T* asType();

    template <typename T>
    const T* asConstType() const;

    Node* findByType(const Uint32& type) const;

    template <typename T>
    T* findByType(const Uint32& type) const;

    template <typename T>
    T* bindByType(const Uint32& type, T*& node);

    std::vector<Node*> findAllByType(const Uint32& type) const;

    template <typename T>
    std::vector<T*> findAllByType(const Uint32& type) const;

    bool inNodeTree(Node* node) const;
    bool isReverseDraw() const;
    void setReverseDraw(bool reverseDraw);
    void invalidateDraw();
    virtual void setRotation(float angle);
    void setRotation(const Float& angle, const OriginPoint& center);
    const OriginPoint& getRotationOriginPoint() const;
    void setRotationOriginPoint(const OriginPoint& center);
    void setRotationOriginPointPixels(const OriginPoint& center);
    void setRotationOriginPointX(const std::string& xEq);
    void setRotationOriginPointY(const std::string& yEq);
    Vector2f getRotationCenter() const;
    void setScale(const Float& scale);
    virtual void setScale(const Vector2f& scale);
    void setScale(const Vector2f& scale, const OriginPoint& center);
    void setScale(const Float& scale, const OriginPoint& center);
    const OriginPoint& getScaleOriginPoint() const;
    void setScaleOriginPoint(const OriginPoint& center);
    void setScaleOriginPointPixels(const OriginPoint& center);
    void setScaleOriginPointX(const std::string& xEq);
    void setScaleOriginPointY(const std::string& yEq);
    Vector2f getScaleCenter() const;
    virtual void setScale(float factorX, float factorY);
    virtual void setScaleOrigin(float x, float y);
    virtual void setRotationOrigin(float x, float y);
    const Float& getAlpha() const;
    virtual void setAlpha(const Float& alpha);
    virtual void setChildrenAlpha(const Float& alpha);
    ActionManager* getActionManager() const;
    Node* runAction(Action* action);
    bool removeAction(Action* action);
    bool removeActions(const std::vector<Action*>& actions);
    bool removeActionsByTag(const Action::UniqueID& tag);
    std::vector<Action*> getActions();
    std::vector<Action*> getActionsByTag(const Action::UniqueID& tag);
    void clearActions();
    Transform getLocalTransform() const;
    Transform getGlobalTransform() const;
    Transform getNodeToWorldTransform() const;
    Transform getWorldToNodeTransform() const;
    Vector2f convertToNodeSpace(const Vector2f& worldPoint) const;
    Vector2f convertToWorldSpace(const Vector2f& nodePoint) const;
    Rectf getLocalBounds() const;
    bool hasFocus() const;
    bool hasFocusWithin() const;
    virtual Node* setFocus(NodeFocusReason reason = NodeFocusReason::Unknown);
    Node* getFirstWidget() const;
    Node* getParentWidget() const;
    void enableReportSizeChangeToChildren();
    void disableReportSizeChangeToChildren();
    bool reportSizeChangeToChildren() const;
    Node* centerHorizontal();
    Node* centerVertical();
    Node* center();
    Node* clipEnable();
    Node* clipDisable();
    void writeNodeFlag(const Uint32& Flag, const Uint32& Val);
    SceneNode* getSceneNode() const;
    EventDispatcher* getEventDispatcher() const;
    virtual bool isDrawInvalidator() const;
    bool invalidated() const;
    virtual void invalidate(Node* invalidator);
    Uint32 getChildCount() const;
    Uint32 getChildOfTypeCount(const Uint32& type) const;
    Node* getChildAt(Uint32 index) const;
    Uint32 getNodeIndex() const;
    Uint32 getNodeOfTypeIndex() const;
    void runOnMainThread(Actions::Runnable::RunnableFunc runnable, const Time& delay = Seconds(0), const Action::UniqueID& uniqueIdentifier = 0);
    bool ensureMainThread(Actions::Runnable::RunnableFunc runnable, const Action::UniqueID& uniqueIdentifier = 0);
    void setTimeout(Actions::Runnable::RunnableFunc runnable, const Time& delay = Seconds(0), const Action::UniqueID& uniqueIdentifier = 0);
    void setInterval(Actions::Runnable::RunnableFunc runnable, const Time& interval, const Action::UniqueID& uniqueIdentifier = 0);
    void debounce(Actions::Runnable::RunnableFunc runnable, const Time& delay, const Action::UniqueID& uniqueIdentifier);
    bool isChild(Node* child) const;
    bool inParentTreeOf(Node* child) const;
    bool inParentTreeOfType(Uint32 type) const;
    Node* getParentOfType(Uint32 type) const;
    void setLoadingState(bool loading);
    bool isLoadingState() const;
    virtual void onIdChange();
    bool isClosing() const;
    bool isClosingChildren() const;
    virtual Node* overFind(const Vector2f& Point);
    void detach();
    void forEachNode(std::function<void(Node*)> func);
    void forEachChild(std::function<void(Node*)> func);
    virtual void nodeDraw();
    Uint32 forceKeyDown(const KeyEvent& event);
    Uint32 foceKeyUp(const KeyEvent& event);
    Uint32 forceTextInput(const TextInputEvent& Event);
    const Vector2f& getScreenPos() const;
    Rectf getScreenRect() const;
    bool hasEventsOfType(const Uint32& eventType) const;
    static UINode* New();
    virtual void worldToNodeTranslation(Vector2f& position) const;
    virtual void nodeToWorldTranslation(Vector2f& position) const;
    virtual void worldToNode(Vector2i& pos) const;
    virtual void nodeToWorld(Vector2i& pos) const;
    virtual void worldToNode(Vector2f& pos) const;
    virtual void nodeToWorld(Vector2f& pos) const;
    virtual Uint32 getType() const;
    virtual bool isType(const Uint32& type) const;
    virtual void setPosition(const Vector2f& Pos);
    virtual Node* setPosition(const Float& x, const Float& y);
    UINode* setPixelsPosition(const Vector2f& position);
    UINode* setPixelsPosition(const Float& x, const Float& y);
    virtual const Vector2f& getPosition() const;
    const Vector2f& getPixelsPosition() const;
    virtual Node* setSize(const Sizef& size);
    virtual Node* setSize(const Float& Width, const Float& Height);
    UINode* setPixelsSize(const Sizef& size);
    UINode* setPixelsSize(const Float& x, const Float& y);
    virtual const Sizef& getSize() const;
    Rect getRect() const;
    Rectf getRectBox() const;
    virtual void draw();
    Uint32 getHorizontalAlign() const;
    UINode* setHorizontalAlign(Uint32 halign);
    Uint32 getVerticalAlign() const;
    UINode* setVerticalAlign(Uint32 valign);
    UINode* setGravity(Uint32 hvalign);
    UINodeDrawable* setBackgroundFillEnabled(bool enabled);
    UINode* setBackgroundDrawable(Drawable* drawable, bool ownIt = false, int index = 0);
    UINode* setBackgroundDrawable(const std::string& drawable, int index);
    UINode* setBackgroundColor(const Color& color);
    UINode* setBackgroundTint(const Color& color, int index);
    UINode* setBackgroundPositionX(const std::string& positionX, int index = 0);
    UINode* setBackgroundPositionY(const std::string& positionY, int index = 0);
    UINode* setBackgroundRepeat(const std::string& repeatRule, int index = 0);
    UINode* setBackgroundSize(const std::string& size, int index = 0);
    Color getBackgroundColor() const;
    Color getBackgroundTint(int index = 0) const;
    UINode* setBorderRadius(const unsigned int& corners);
    UINode* setTopLeftRadius(const std::string& radius);
    UINode* setTopRightRadius(const std::string& radius);
    UINode* setBottomLeftRadius(const std::string& radius);
    UINode* setBottomRightRadius(const std::string& radius);
    Uint32 getBorderRadius() const;
    UINodeDrawable* setForegroundFillEnabled(bool enabled);
    UINode* setForegroundDrawable(Drawable* drawable, bool ownIt = false, int index = 0);
    UINode* setForegroundDrawable(const std::string& drawable, int index = 0);
    Color getForegroundColor() const;
    Color getForegroundTint(int index) const;
    UINode* setForegroundColor(const Color& color);
    UINode* setForegroundTint(const Color& color, int index);
    UINode* setForegroundPositionX(const std::string& positionX, int index = 0);
    UINode* setForegroundPositionY(const std::string& positionY, int index = 0);
    UINode* setForegroundRepeat(const std::string& repeatRule, int index = 0);
    UINode* setForegroundSize(const std::string& size, int index = 0);
    UINode* setForegroundRadius(const unsigned int& corners);
    Uint32 getForegroundRadius() const;
    UIBorderDrawable* setBorderEnabled(bool enabled) const;
    UINode* setBorderColor(const Color& color);
    Color getBorderColor();
    UINode* setBorderWidth(const unsigned int& width);
    Float getBorderWidth() const;
    const Uint32& getFlags() const;
    virtual UINode* setFlags(const Uint32& flags);
    virtual UINode* unsetFlags(const Uint32& flags);
    virtual UINode* resetFlags(Uint32 newFlags = 0);
    UINodeDrawable* getBackground() const;
    bool hasBackground() const;
    UINodeDrawable* getForeground() const;
    bool hasForeground() const;
    UIBorderDrawable* getBorder() const;
    void setThemeByName(const std::string& Theme);
    virtual void setTheme(UITheme* Theme);
    virtual UINode* setThemeSkin(UITheme* Theme, const std::string& skinName);
    virtual UINode* setThemeSkin(const std::string& skinName);
    void setThemeToChildren(UITheme* Theme);
    UISkin* getSkin() const;
    virtual UINode* setSkin(const UISkin& Skin);
    UINode* setSkin(UISkin* skin);
    UINode* setSkinColor(const Color& color);
    const Color& getSkinColor() const;
    void removeSkin();
    virtual void pushState(const Uint32& State, bool emitEvent = true);
    virtual void popState(const Uint32& State, bool emitEvent = true);
    Sizef getSkinSize(const Uint32& state = UIState::StateFlagNormal) const;
    void applyDefaultTheme();
    Node* getWindowContainer() const;
    bool isTabFocusable() const;
    bool isDragging() const;
    void setDragging(bool dragging, bool emitDropEvent = true);
    void startDragging(const Vector2f& position);
    bool ownsChildPosition() const;
    const Vector2f& getDragPoint() const;
    void setDragPoint(const Vector2f& Point);
    bool isDragEnabled() const;
    void setDragEnabled(const bool& enable);
    void setDragButton(const Uint32& Button);
    const Uint32& getDragButton() const;
    virtual Node* setFocus(NodeFocusReason reason = NodeFocusReason::Unknown);
    Float getPropertyRelativeTargetContainerLength(const CSS::PropertyRelativeTarget& relativeTarget, const Float& defaultValue = 0, const Uint32& propertyIndex = 0) const;
    virtual Float convertLength(const CSS::StyleSheetLength& length, const Float& containerLength) const;
    Float convertLengthAsDp(const CSS::StyleSheetLength& length, const Float& containerLength) const;
    Float lengthFromValue(const std::string& value, const CSS::PropertyRelativeTarget& relativeTarget, const Float& defaultValue = 0, const Uint32& propertyIndex = 0) const;
    Float lengthFromValue(const CSS::StyleSheetProperty& property, const Float& defaultValue = 0);
    Float lengthFromValueAsDp(const std::string& value, const CSS::PropertyRelativeTarget& relativeTarget, const Float& defaultValue = 0, const Uint32& propertyIndex = 0) const;
    Float lengthFromValueAsDp(const CSS::StyleSheetProperty& property, const Float& defaultValue = 0) const;
    UISceneNode* getUISceneNode() const;
    Input* getInput() const;
    void setMinWidth(const Float& width);
    void setMinHeight(const Float& height);
    void setMinSize(const Sizef& size);
    const Sizef& getCurMinSize() const;
    Rectf getLocalDpBounds() const;
    virtual void nodeDraw();
    void clearForeground();
    void clearBackground();
    const ClipType& getClipType() const;
    UINode* setClipType(const ClipType& clipType);
    bool hasBorder() const;
    virtual const Rectf& getPixelsPadding() const;
    const std::string& getMinWidthEq() const;
    void setMinSizeEq(const std::string& minWidthEq, const std::string& minHeightEq);
    void setMinWidthEq(const std::string& minWidthEq);
    const std::string& getMinHeightEq() const;
    void setMinHeightEq(const std::string& minHeightEq);
    const std::string& getMaxWidthEq() const;
    void setMaxSizeEq(const std::string& maxWidthEq, const std::string& maxHeightEq);
    void setMaxWidthEq(const std::string& maxWidthEq);
    const std::string& getMaxHeightEq() const;
    void setMaxHeightEq(const std::string& maxHeightEq);
    Sizef getMinSize() const;
    Sizef getMaxSize() const;
    Sizef getMinSizePx() const;
    Sizef getMaxSizePx() const;
    Sizef fitMinMaxSizeDp(const Sizef& size) const;
    Sizef fitMinMaxSizePx(const Sizef& size) const;
    virtual bool isScrollable() const;

Detailed Documentation

Base class for all UI widgets in the eepp framework.

UIWidget provides the core functionality for building graphical user interface elements. It serves as the foundation for all GUI components including text views, buttons, input fields, and containers. The class integrates with the CSS styling system, supports layout management, and handles user interactions.

Typical usage: Derive from UIWidget to create custom widgets or use built-in derived classes like UITextView, UIPushButton, etc.

See also:

UITextView

UIPushButton

UITextInput

Methods

static UIWidget* New()

Creates a new UIWidget with default tag “widget”.

This is the primary factory method for creating UIWidget instances.

Returns:

Pointer to the newly created UIWidget instance.

See also:

NewWithTag

static UIWidget* NewWithTag(const std::string& tag)

Creates a new UIWidget with a specific CSS tag.

The tag parameter sets the CSS element tag which can be used for styling with CSS selectors. This is useful when you need to apply specific styles to certain widget types.

Parameters:

tag

The CSS element tag for the widget.

Returns:

Pointer to the newly created UIWidget instance.

See also:

New

virtual Uint32 getType() const

Gets the widget type identifier.

Returns a unique type identifier for this widget class.

Returns:

The widget type as a Uint32.

virtual bool isType(const Uint32& type) const

Checks if the widget is of a specific type.

Determines whether this widget is of the specified type or derived from it.

Parameters:

type

The type identifier to check.

Returns:

True if the widget is of the specified type, false otherwise.

virtual UINode* setFlags(const Uint32& flags)

Sets multiple flags on the widget.

Flags control various widget behaviors and states. Common flags include:

  • UI_ANCHOR_LEFT, UI_ANCHOR_TOP, UI_ANCHOR_RIGHT, UI_ANCHOR_BOTTOM

  • UI_AUTO_SIZE, UI_TAB_FOCUSABLE, UI_TOOLTIP_ENABLED

Parameters:

flags

Bitwise combination of flags to set.

Returns:

Pointer to this widget for method chaining.

See also:

UIFlag

virtual UINode* unsetFlags(const Uint32& flags)

Unsets multiple flags on the widget.

Removes the specified flags from the widget’s current flag set.

Parameters:

flags

Bitwise combination of flags to unset.

Returns:

Pointer to this widget for method chaining.

See also:

UIFlag

virtual UIWidget* setAnchors(const Uint32& flags)

Sets anchor flags for relative positioning.

Anchors control how the widget positions itself relative to its parent. Use combinations of UI_ANCHOR_LEFT, UI_ANCHOR_TOP, UI_ANCHOR_RIGHT, UI_ANCHOR_BOTTOM.

Parameters:

flags

Bitwise combination of anchor flags.

Returns:

Pointer to this widget for method chaining.

virtual void setTheme(UITheme* Theme)

Sets the theme for this widget.

Applies the specified theme to the widget, affecting its visual appearance. The theme controls colors, fonts, borders, and other visual properties.

Parameters:

Theme

Pointer to the UITheme to apply.

virtual UINode* setThemeSkin(const std::string& skinName)

Sets the theme skin for this widget.

Applies a specific skin from the current theme. If no theme is set, the default theme will be used.

Parameters:

skinName

Name of the skin to apply.

Returns:

Pointer to this widget for method chaining.

virtual UINode* setThemeSkin(UITheme* Theme, const std::string& skinName)

Sets the theme skin for this widget with a specific theme.

Applies a specific skin from the specified theme.

Parameters:

Theme

Pointer to the UITheme to use.

skinName

Name of the skin to apply.

Returns:

Pointer to this widget for method chaining.

virtual Node* setId(const std::string& id)

Sets the unique identifier for this widget.

The ID can be used for CSS selection and widget identification.

Parameters:

id

Unique identifier string.

Returns:

Pointer to this widget for method chaining.

virtual bool acceptsDropOfWidget(const UIWidget* widget)

Checks if this widget can accept a dropped widget.

Determines whether another widget can be dropped onto this widget.

Parameters:

widget

The widget to check for drop acceptance.

Returns:

True if the widget can be dropped, false otherwise.

UIWidget* acceptsDropOfWidgetInTree(const UIWidget* widget)

Checks if this widget can accept a dropped widget in its tree.

Recursively checks if this widget or any of its children can accept the specified widget as a drop target.

Parameters:

widget

The widget to check for drop acceptance.

Returns:

Pointer to the widget that accepts the drop, or nullptr if none.

UITooltip* getTooltip()

Gets the tooltip associated with this widget.

Returns the tooltip object if one exists, or nullptr if no tooltip is set.

Returns:

Pointer to the UITooltip object or nullptr.

void tooltipRemove()

Removes the tooltip from this widget.

Detaches and deletes the tooltip object associated with this widget.

UIWidget* setTooltipText(const String& text)

Sets the tooltip text for this widget.

Creates a tooltip if one doesn’t exist and sets its text content.

Parameters:

text

The text to display in the tooltip.

Returns:

Pointer to this widget for method chaining.

UIWidget* setTooltipTextIfNotEmpty(const String& text)

Sets the tooltip text only if the text is not empty.

This is useful for conditional tooltip setting where you only want to set a tooltip if there’s actual content to display.

Parameters:

text

The text to display in the tooltip.

Returns:

Pointer to this widget for method chaining.

String getTooltipText()

Gets the current tooltip text.

Returns the text that will be displayed in the tooltip.

Returns:

The tooltip text string.

void updateAnchorsDistances()

Updates the distances to parent borders for anchoring.

Recalculates the distances from this widget to the borders of its parent widget. This is used for anchor-based positioning.

const Rectf& getLayoutMargin() const

Gets the layout margin in density-independent pixels (dp).

Layout margins define the space around the widget within its parent layout container. These values are in dp to support different screen densities.

Returns:

The layout margin as a Rectf.

const Rectf& getLayoutPixelsMargin() const

Gets the layout margin in actual pixels.

Returns the margin values converted to actual screen pixels.

Returns:

The layout margin in pixels as a Rectf.

UIWidget* setLayoutMargin(const Rectf& margin)

Sets the layout margin for all sides.

Sets the margin around the widget in density-independent pixels (dp).

Parameters:

margin

The margin values for left, top, right, bottom.

Returns:

Pointer to this widget for method chaining.

UIWidget* setLayoutMarginLeft(const Float& marginLeft)

Sets the left layout margin.

Sets the left margin in density-independent pixels (dp).

Parameters:

marginLeft

The left margin value.

Returns:

Pointer to this widget for method chaining.

UIWidget* setLayoutMarginRight(const Float& marginRight)

Sets the right layout margin.

Sets the right margin in density-independent pixels (dp).

Parameters:

marginRight

The right margin value.

Returns:

Pointer to this widget for method chaining.

UIWidget* setLayoutMarginTop(const Float& marginTop)

Sets the top layout margin.

Sets the top margin in density-independent pixels (dp).

Parameters:

marginTop

The top margin value.

Returns:

Pointer to this widget for method chaining.

UIWidget* setLayoutMarginBottom(const Float& marginBottom)

Sets the bottom layout margin.

Sets the bottom margin in density-independent pixels (dp).

Parameters:

marginBottom

The bottom margin value.

Returns:

Pointer to this widget for method chaining.

UIWidget* setLayoutPixelsMargin(const Rectf& margin)

Sets the layout margin for all sides in pixels.

Sets the margin around the widget in actual screen pixels.

Parameters:

margin

The margin values for left, top, right, bottom in pixels.

Returns:

Pointer to this widget for method chaining.

UIWidget* setLayoutPixelsMarginLeft(const Float& marginLeft)

Sets the left margin in pixels.

Sets the left margin in actual screen pixels.

Parameters:

marginLeft

The left margin value in pixels.

Returns:

Pointer to this widget for method chaining.

UIWidget* setLayoutPixelsMarginRight(const Float& marginRight)

Sets the right margin in pixels.

Sets the right margin in actual screen pixels.

Parameters:

marginRight

The right margin value in pixels.

Returns:

Pointer to this widget for method chaining.

UIWidget* setLayoutPixelsMarginTop(const Float& marginTop)

Sets the top margin in pixels.

Sets the top margin in actual screen pixels.

Parameters:

marginTop

The top margin value in pixels.

Returns:

Pointer to this widget for method chaining.

UIWidget* setLayoutPixelsMarginBottom(const Float& marginBottom)

Sets the bottom margin in pixels.

Sets the bottom margin in actual screen pixels.

Parameters:

marginBottom

The bottom margin value in pixels.

Returns:

Pointer to this widget for method chaining.

Float getLayoutWeight() const

Gets the layout weight for this widget.

Layout weight determines how much space this widget should take relative to other widgets in a LinearLayout. A weight of 0 means the widget takes only the space it needs.

Returns:

The layout weight as a Float.

UIWidget* setLayoutWeight(const Float& weight)

Sets the layout weight for this widget.

Used in LinearLayout to distribute extra space among widgets.

Parameters:

weight

The layout weight value.

Returns:

Pointer to this widget for method chaining.

Uint32 getLayoutGravity() const

Gets the layout gravity for this widget.

Layout gravity determines how the widget is positioned within its parent layout. Common values include:

Returns:

The layout gravity as a Uint32 bitmask.

UIWidget* setLayoutGravity(const Uint32& layoutGravity)

Sets the layout gravity for this widget.

Controls how the widget is aligned within its parent layout.

Parameters:

layoutGravity

The gravity bitmask.

Returns:

Pointer to this widget for method chaining.

const SizePolicy& getLayoutWidthPolicy() const

Gets the width size policy for this widget.

Size policies control how the widget resizes:

Returns:

The width size policy.

UIWidget* setLayoutWidthPolicy(const SizePolicy& widthPolicy)

Sets the width size policy for this widget.

Controls how the widget’s width is determined.

Parameters:

widthPolicy

The size policy to apply.

Returns:

Pointer to this widget for method chaining.

const SizePolicy& getLayoutHeightPolicy() const

Gets the height size policy for this widget.

Size policies control how the widget resizes:

Returns:

The height size policy.

UIWidget* setLayoutHeightPolicy(const SizePolicy& heightPolicy)

Sets the height size policy for this widget.

Controls how the widget’s height is determined.

Parameters:

heightPolicy

The size policy to apply.

Returns:

Pointer to this widget for method chaining.

UIWidget* setLayoutSizePolicy(const SizePolicy& widthPolicy, const SizePolicy& heightPolicy)

Sets both width and height size policies.

Convenience method to set both size policies at once.

Parameters:

widthPolicy

The width size policy.

heightPolicy

The height size policy.

Returns:

Pointer to this widget for method chaining.

UIWidget* setLayoutPositionPolicy(const PositionPolicy& layoutPositionPolicy, UIWidget* of)

Sets the position policy for relative positioning.

Position policies allow positioning this widget relative to another widget:

  • PositionPolicy::Above, Below, LeftOf, RightOf

  • PositionPolicy::AlignLeft, AlignRight, AlignTop, AlignBottom

  • PositionPolicy::CenterIn

Parameters:

layoutPositionPolicy

The position policy to apply.

of

The reference widget for positioning.

Returns:

Pointer to this widget for method chaining.

UIWidget* getLayoutPositionPolicyWidget() const

Gets the reference widget for position policy.

Returns the widget that this widget is positioned relative to.

Returns:

Pointer to the reference widget or nullptr.

PositionPolicy getLayoutPositionPolicy() const

Gets the current position policy.

Returns the position policy that determines how this widget is positioned relative to another widget.

Returns:

The position policy.

virtual void loadFromXmlNode(const pugi::xml_node& node)

Loads widget configuration from an XML node.

Parses XML configuration to set up the widget’s properties, styles, and layout attributes. This is used for loading UI layouts from XML files.

Parameters:

node

The XML node containing the widget configuration.

void notifyLayoutAttrChange()

Notifies that layout attributes have changed.

Triggers layout recalculation when layout-related properties change. This should be called after modifying layout attributes like margins, padding, size policies, etc.

void notifyLayoutAttrChangeParent()

Notifies parent that layout attributes have changed.

Triggers layout recalculation in the parent widget when this widget’s layout attributes change. This ensures proper layout propagation.

void setStyleSheetInlineProperty(const std::string& name, const std::string& value, const Uint32& specificity = UINT32_MAX - 1)

Sets an inline CSS property.

Applies a CSS property directly to this widget with high specificity. This overrides styles from stylesheets and themes.

Parameters:

name

The CSS property name.

value

The CSS property value.

specificity

The specificity level (default is inline specificity).

virtual bool applyProperty(const StyleSheetProperty& attribute)

Applies a CSS property to this widget.

Applies the specified CSS property to the widget, updating its style and triggering any necessary style changes.

Parameters:

attribute

The CSS property to apply.

Returns:

True if the property was applied successfully, false otherwise.

const Rectf& getPadding() const

Gets the padding in density-independent pixels (dp).

Padding defines the space between the widget’s content and its border. These values are in dp to support different screen densities.

Returns:

The padding as a Rectf.

virtual const Rectf& getPixelsPadding() const

Gets the padding in actual pixels.

Returns the padding values converted to actual screen pixels.

Returns:

The padding in pixels as a Rectf.

UIWidget* setPadding(const Rectf& padding)

Sets the padding for all sides.

Sets the padding around the widget’s content in density-independent pixels (dp).

Parameters:

padding

The padding values for left, top, right, bottom.

Returns:

Pointer to this widget for method chaining.

UIWidget* setPaddingLeft(const Float& paddingLeft)

Sets the left padding.

Sets the left padding in density-independent pixels (dp).

Parameters:

paddingLeft

The left padding value.

Returns:

Pointer to this widget for method chaining.

UIWidget* setPaddingRight(const Float& paddingRight)

Sets the right padding.

Sets the right padding in density-independent pixels (dp).

Parameters:

paddingRight

The right padding value.

Returns:

Pointer to this widget for method chaining.

UIWidget* setPaddingTop(const Float& paddingTop)

Sets the top padding.

Sets the top padding in density-independent pixels (dp).

Parameters:

paddingTop

The top padding value.

Returns:

Pointer to this widget for method chaining.

UIWidget* setPaddingBottom(const Float& paddingBottom)

Sets the bottom padding.

Sets the bottom padding in density-independent pixels (dp).

Parameters:

paddingBottom

The bottom padding value.

Returns:

Pointer to this widget for method chaining.

UIWidget* setPaddingPixels(const Rectf& padding)

Sets the padding for all sides in pixels.

Sets the padding around the widget’s content in actual screen pixels.

Parameters:

padding

The padding values for left, top, right, bottom in pixels.

Returns:

Pointer to this widget for method chaining.

UIWidget* setPaddingPixelsLeft(const Float& paddingLeft)

Sets the left padding in pixels.

Sets the left padding in actual screen pixels.

Parameters:

paddingLeft

The left padding value in pixels.

Returns:

Pointer to this widget for method chaining.

UIWidget* setPaddingPixelsRight(const Float& paddingRight)

Sets the right padding in pixels.

Sets the right padding in actual screen pixels.

Parameters:

paddingRight

The right padding value in pixels.

Returns:

Pointer to this widget for method chaining.

UIWidget* setPaddingPixelsTop(const Float& paddingTop)

Sets the top padding in pixels.

Sets the top padding in actual screen pixels.

Parameters:

paddingTop

The top padding value in pixels.

Returns:

Pointer to this widget for method chaining.

UIWidget* setPaddingPixelsBottom(const Float& paddingBottom)

Sets the bottom padding in pixels.

Sets the bottom padding in actual screen pixels.

Parameters:

paddingBottom

The bottom padding value in pixels.

Returns:

Pointer to this widget for method chaining.

const std::string& getStyleSheetTag() const

Gets the CSS tag for this widget.

Returns the CSS element tag that can be used for styling with CSS selectors.

Returns:

The CSS tag string.

const std::string& getStyleSheetId() const

Gets the CSS ID for this widget.

Returns the CSS ID that can be used for styling with CSS selectors.

Returns:

The CSS ID string.

const std::vector<std::string>& getStyleSheetClasses() const

Gets all CSS classes for this widget.

Returns a vector of all CSS classes applied to this widget.

Returns:

Vector of CSS class strings.

UIWidget* getStyleSheetParentElement() const

Gets the parent element for CSS styling.

Returns the parent widget that serves as the parent element in CSS selector resolution.

Returns:

Pointer to the parent element widget or nullptr.

UIWidget* getStyleSheetPreviousSiblingElement() const

Gets the previous sibling element for CSS styling.

Returns the previous sibling widget in the CSS selector context.

Returns:

Pointer to the previous sibling element widget or nullptr.

UIWidget* getStyleSheetNextSiblingElement() const

Gets the next sibling element for CSS styling.

Returns the next sibling widget in the CSS selector context.

Returns:

Pointer to the next sibling element widget or nullptr.

Uint32 getStyleSheetPseudoClasses() const

Gets the active pseudo-classes for this widget.

Returns a bitmask of active pseudo-classes (hover, focus, active, etc.).

Returns:

Bitmask of active pseudo-classes.

std::vector<const char*> getStyleSheetPseudoClassesStrings() const

Gets the pseudo-classes as string array.

Returns an array of strings representing the active pseudo-classes.

Returns:

Vector of pseudo-class strings.

UIWidget* resetClass()

Resets all CSS classes and removes them.

Clears all CSS classes from this widget.

Returns:

Pointer to this widget for method chaining.

UIWidget* setClass(const std::string& cls)

Sets a single CSS class.

Resets all existing classes and sets the specified class.

Parameters:

cls

The CSS class to set.

Returns:

Pointer to this widget for method chaining.

UIWidget* setClass(std::string&& cls)

Sets a single CSS class (move version).

Resets all existing classes and sets the specified class using move semantics.

Parameters:

cls

The CSS class to set (moved).

Returns:

Pointer to this widget for method chaining.

UIWidget* setClasses(const std::vector<std::string>& classes)

Sets multiple CSS classes.

Resets all existing classes and sets the specified vector of classes.

Parameters:

classes

Vector of CSS classes to set.

Returns:

Pointer to this widget for method chaining.

UIWidget* addClass(const std::string& cls)

Adds a CSS class.

Adds the specified class to the widget’s existing classes.

Parameters:

cls

The CSS class to add.

Returns:

Pointer to this widget for method chaining.

UIWidget* addClasses(const std::vector<std::string>& classes)

Adds multiple CSS classes.

Adds the specified vector of classes to the widget’s existing classes.

Parameters:

classes

Vector of CSS classes to add.

Returns:

Pointer to this widget for method chaining.

UIWidget* removeClass(const std::string& cls)

Removes a CSS class.

Removes the specified class from the widget’s existing classes.

Parameters:

cls

The CSS class to remove.

Returns:

Pointer to this widget for method chaining.

UIWidget* removeClasses(const std::vector<std::string>& classes)

Removes multiple CSS classes.

Removes the specified vector of classes from the widget’s existing classes.

Parameters:

classes

Vector of CSS classes to remove.

Returns:

Pointer to this widget for method chaining.

bool hasClass(const std::string_view& cls) const

Checks if the widget has a specific CSS class.

Determines whether the widget has the specified CSS class.

Parameters:

cls

The CSS class to check.

Returns:

True if the widget has the class, false otherwise.

void toggleClass(const std::string& cls)

Toggles a CSS class.

Adds the class if it doesn’t exist, removes it if it does.

Parameters:

cls

The CSS class to toggle.

void setElementTag(const std::string& tag)

Sets the CSS element tag.

Sets the CSS element tag that can be used for styling with CSS selectors.

Parameters:

tag

The CSS element tag to set.

const std::vector<std::string>& getClasses() const

Gets all CSS classes for this widget.

Returns a vector of all CSS classes applied to this widget.

Returns:

Vector of CSS class strings.

const std::string& getElementTag() const

Gets the CSS element tag.

Returns the CSS element tag that can be used for styling with CSS selectors.

Returns:

The CSS element tag string.

virtual void pushState(const Uint32& State, bool emitEvent = true)

Pushes a state onto the widget’s state stack.

Adds a new state to the widget’s current state stack. This is used to track multiple states (hover, pressed, etc.) that can be combined.

Parameters:

State

The state to push.

emitEvent

Whether to emit a state change event.

virtual void popState(const Uint32& State, bool emitEvent = true)

Pops a state from the widget’s state stack.

Removes a state from the widget’s current state stack. This is used to revert to a previous state.

Parameters:

State

The state to pop.

emitEvent

Whether to emit a state change event.

UIStyle* getUIStyle() const

Gets the UIStyle object for this widget.

Returns the style object that manages CSS properties, animations, and transitions for this widget.

Returns:

Pointer to the UIStyle object.

void reloadStyle(bool reloadChildren = true, bool disableAnimations = false, bool reportStateChange = true, bool forceReApplyProperties = false, bool resetPropertyCache = false)

Reloads the widget’s style.

Forces the widget to reload its style from CSS stylesheets, themes, and inline properties. This is useful when style changes need to be applied immediately.

Parameters:

reloadChildren

Whether to reload styles for child widgets.

disableAnimations

Whether to disable CSS animations during reload.

reportStateChange

Whether to report state changes.

forceReApplyProperties

Whether to force re-application of all properties.

resetPropertyCache

Whether to reset the property cache.

void beginAttributesTransaction()

Begins an attributes transaction.

Starts a transaction for batch attribute changes. This prevents multiple style recalculations during bulk updates.

void endAttributesTransaction()

Ends an attributes transaction.

Ends a transaction and applies all pending attribute changes at once.

const Uint32& getStyleState() const

Gets the current style state.

Returns the current state bitmask (hover, focus, pressed, etc.).

Returns:

Current style state bitmask.

const Uint32& getStylePreviousState() const

Gets the previous style state.

Returns the previous state bitmask before the current state change.

Returns:

Previous style state bitmask.

std::vector<UIWidget*> findAllByClass(const std::string& className)

Finds all widgets by CSS class.

Searches the widget tree for all widgets with the specified CSS class.

Parameters:

className

The CSS class to search for.

Returns:

Vector of matching UIWidget pointers.

std::vector<UIWidget*> findAllByTag(const std::string& tag)

Finds all widgets by CSS tag.

Searches the widget tree for all widgets with the specified CSS tag.

Parameters:

tag

The CSS tag to search for.

Returns:

Vector of matching UIWidget pointers.

UIWidget* findByClass(const std::string& className)

Finds a widget by CSS class.

Searches for the first widget with the specified CSS class.

Parameters:

className

The CSS class to search for.

Returns:

Pointer to the first matching widget or nullptr.

UIWidget* findByTag(const std::string& tag)

Finds a widget by CSS tag.

Searches for the first widget with the specified CSS tag.

Parameters:

tag

The CSS tag to search for.

Returns:

Pointer to the first matching widget or nullptr.

UIWidget* querySelector(const CSS::StyleSheetSelector& selector)

Queries a widget using a CSS selector.

Finds the first widget matching the specified CSS selector.

Parameters:

selector

The CSS selector to use.

Returns:

Pointer to the first matching widget or nullptr.

UIWidget* querySelector(const std::string& selector)

Queries a widget using a CSS selector string.

Finds the first widget matching the specified CSS selector string.

Parameters:

selector

The CSS selector string to use.

Returns:

Pointer to the first matching widget or nullptr.

std::vector<UIWidget*> querySelectorAll(const CSS::StyleSheetSelector& selector)

Queries all widgets using a CSS selector.

Finds all widgets matching the specified CSS selector.

Parameters:

selector

The CSS selector to use.

Returns:

Vector of all matching UIWidget pointers.

std::vector<UIWidget*> querySelectorAll(const std::string& selector)

Queries all widgets using a CSS selector string.

Finds all widgets matching the specified CSS selector string.

Parameters:

selector

The CSS selector string to use.

Returns:

Vector of all matching UIWidget pointers.

std::string getPropertyString(const std::string& property) const

Gets a property value as a string.

Returns the value of the specified CSS property as a string.

Parameters:

property

The CSS property name.

Returns:

The property value as a string.

virtual std::string getPropertyString(const PropertyDefinition* propertyDef, const Uint32& propertyIndex = 0) const

Gets a property value as a string with property definition.

Returns the value of the specified CSS property as a string, using the property definition for proper formatting.

Parameters:

propertyDef

The property definition.

propertyIndex

The property index (for multi-value properties).

Returns:

The property value as a string.

virtual std::vector<PropertyId> getPropertiesImplemented() const

Gets the list of properties implemented by this widget.

Returns a vector of property IDs that this widget implements. This is used for CSS property introspection and validation.

Returns:

Vector of implemented property IDs.

bool isSceneNodeLoading() const

Checks if the scene node is currently loading.

Determines whether the scene node is in the process of loading, which can affect style application and event handling.

Returns:

True if the scene node is loading, false otherwise.

void reportStyleStateChangeRecursive(bool disableAnimations = false, bool forceReApplyStyles = false)

Reports style state change recursively.

Propagates style state changes to this widget and all its children. This is used when style changes need to be applied throughout the widget tree.

Parameters:

disableAnimations

Whether to disable CSS animations during the change.

forceReApplyStyles

Whether to force re-application of all styles.

UITooltip* createTooltip()

Creates a tooltip for this widget.

Creates and returns a tooltip object if one doesn’t already exist.

Returns:

Pointer to the UITooltip object.

bool isTabStop() const

Checks if this widget is a tab stop.

Determines whether this widget can receive focus when the user presses the Tab key to navigate through widgets.

Returns:

True if this widget is a tab stop, false otherwise.

void setTabStop()

Sets this widget as a tab stop.

Makes this widget able to receive focus when the user presses the Tab key.

void unsetTabStop()

Unsets this widget as a tab stop.

Prevents this widget from receiving focus when the user presses the Tab key.

bool isTabFocusable() const

Checks if this widget is tab focusable.

Determines whether this widget can receive focus via tab navigation.

Returns:

True if this widget is tab focusable, false otherwise.

void setTabFocusable()

Sets this widget as tab focusable.

Makes this widget able to receive focus via tab navigation.

void unsetTabFocusable()

Unsets this widget as tab focusable.

Prevents this widget from receiving focus via tab navigation.

UIWidget* getPrevTabWidget() const

Gets the previous widget in tab order.

Returns the widget that comes before this one in the tab navigation sequence.

Returns:

Pointer to the previous tab widget or nullptr.

UIWidget* getNextTabWidget() const

Gets the next widget in tab order.

Returns the widget that comes after this one in the tab navigation sequence.

Returns:

Pointer to the next tab widget or nullptr.

bool hasPseudoClass(const std::string& pseudoCls) const

Checks if this widget has a specific pseudo-class.

Determines whether this widget currently has the specified pseudo-class (e.g., hover, focus, active).

Parameters:

pseudoCls

The pseudo-class to check.

Returns:

True if the widget has the pseudo-class, false otherwise.

bool isTooltipEnabled() const

Checks if the tooltip is enabled for this widget.

Determines whether tooltips are enabled for this widget.

Returns:

True if tooltips are enabled, false otherwise.

void setTooltipEnabled(bool enabled)

Sets whether the tooltip is enabled for this widget.

Enables or disables tooltips for this widget.

Parameters:

enabled

True to enable tooltips, false to disable.

UIWidget* getPrevWidget() const

Gets the previous widget in the widget sequence.

Returns the previous widget in the overall widget sequence (not necessarily tab order).

Returns:

Pointer to the previous widget or nullptr.

UIWidget* getNextWidget() const

Gets the next widget in the widget sequence.

Returns the next widget in the overall widget sequence (not necessarily tab order).

Returns:

Pointer to the next widget or nullptr.

String getTranslatorString(const std::string& str)

Gets a translated string.

Returns the translation for the specified string using the current translation system.

Parameters:

str

The string to translate.

Returns:

The translated string.

String getTranslatorString(const std::string& str, const String& defaultValue)

Gets a translated string with default value.

Returns the translation for the specified string using the current translation system, or returns defaultValue if no translation is found.

Parameters:

str

The string to translate.

defaultValue

The default value to return if translation not found.

Returns:

The translated string or default value.

String i18n(const std::string& str)

Translates a string (shorthand method).

Convenience method for translating strings using the current translation system.

Parameters:

str

The string to translate.

Returns:

The translated string.

String i18n(const std::string& str, const String& defaultValue)

Translates a string with default value (shorthand method).

Convenience method for translating strings using the current translation system, with a default value if no translation is found.

Parameters:

str

The string to translate.

defaultValue

The default value to return if no translation is found.

Returns:

The translated string or default value.