class EE::UI::UITextSelectionController

Overview

Coordinates document ordering, input, and CSS selection policy across RichText paint owners. More…

#include <uitextselectioncontroller.hpp>

class UITextSelectionController {
public:
    // structs

    struct Point;
    struct SelectedSlice;
    struct Selection;
    struct SelectionSlice;

    // construction

    UITextSelectionController(UIWidget* host = nullptr);
    ~UITextSelectionController();

    // methods

    void setHost(UIWidget* host);
    void setSelectionRoot(UIWidget* root);
    UIWidget* getSelectionRoot() const;
    const Selection& getSelection() const;
    bool isSelecting() const;
    bool hasSelection() const;
    void clear();
    void selectAll();
    void setSelection(Point anchor, Point focus);
    String getSelectionString() const;
    bool copySelection();
    void setLinkResolverCb(std::function<std::string(const std::string&)> cb);
    bool onKeyDown(const KeyEvent& event);
    bool onMouseDown(UIRichText* source, const Vector2i& position, Uint32 flags);
    bool onMouseUp(const Vector2i& position, Uint32 flags);
    bool onMouseDoubleClick(UIRichText* source, const Vector2i& position, Uint32 flags);
    bool onMouseUpMessage(const NodeMessage* message);
    bool showContextMenu(const Vector2i& position, Uint32 flags, const Node* target = nullptr);
    bool consumeSuppressedClick();
    void updateSelectionDrag();
    void onDocumentWillChange();
    void onDocumentChanged();
    void onOwnerWillBeDestroyed(UIRichText* owner);
    void refresh();
};

Detailed Documentation

Coordinates document ordering, input, and CSS selection policy across RichText paint owners. Each owner still handles local character geometry and selection painting.

Methods

void setLinkResolverCb(std::function<std::string(const std::string&)> cb)

Overrides URL resolution for Copy Link. By default, the link’s scene resolves its href.

bool consumeSuppressedClick()

Consumes the pending click from a text drag so a link does not navigate on release.

void onOwnerWillBeDestroyed(UIRichText* owner)

Called before an owner’s RichText member is destroyed.