Generated reference › API — ICoreEssentials/UI/Backends/Web/Graphics
kind: generated#api#icoreessentials-ui-backends-web-graphics

API — ICoreEssentials/UI/Backends/Web/Graphics

The public contract of 5 header(s) under ICoreEssentials/UI/Backends/Web/Graphics — 6 class/struct definition(s), 85 declaration(s). Each section shows the header's banner and its public (and protected-virtual) surface exactly as the file writes it.

ICoreWebGraphicsView.h#

ICoreEssentials/UI/Backends/Web/Graphics/ICoreWebGraphicsView.h

Web backend, WB4.1/WB4.2 -- ported from UI/Backends/Gtk4/Graphics/ICoreGtk4GraphicsView.h onto ICoreWebNode and the Canvas2D painter. That file's comments are the reasons for this one's behaviour and are not repeated here (one fact, one place); a behaviour change belongs in both.

ICoreWebViewBackdrop#

ICoreWebGraphicsView.h:19 · struct · 0 declaration(s)

struct ICoreWebViewBackdrop {
public:
    double red = 0.0, green = 0.0, blue = 0.0, alpha = 0.0;
};
};

ICoreWebGraphicsView#

ICoreWebGraphicsView.h:23 · class · pImpl · 52 declaration(s)

class ICoreWebGraphicsView {
public:
    ICoreWebGraphicsView();
    ~ICoreWebGraphicsView();

    ICoreWebGraphicsView(const ICoreWebGraphicsView&) = delete;
    ICoreWebGraphicsView& operator=(const ICoreWebGraphicsView&) = delete;

    ICoreWebNode& area();
    const ICoreWebNode& area() const;

    void setScene(ICoreWebItemScene* scene);
    [[nodiscard]] ICoreWebItemScene* scene() const;

    void setZoom(double zoom);
    [[nodiscard]] double zoom() const;

    void scaleBy(double factor);

    void scaleByAnchoredAt(double factor, double viewX, double viewY);

    void setZoomAnchoredUnderPointer(bool anchored);
    [[nodiscard]] bool isZoomAnchoredUnderPointer() const;

    [[nodiscard]] bool lastPointerViewPos(double& viewX, double& viewY) const;

    void setScroll(double x, double y);
    [[nodiscard]] double horizontalScroll() const;
    [[nodiscard]] double verticalScroll() const;

    void scrollRange(double& minX, double& maxX, double& minY, double& maxY) const;

    [[nodiscard]] ICoreSceneTransform viewTransform() const;

    [[nodiscard]] ICoreScenePoint mapToScene(double viewX, double viewY) const;
    [[nodiscard]] ICoreScenePoint mapFromScene(const ICoreScenePoint& scenePoint) const;
    [[nodiscard]] ICoreSceneRect mapToScene(const ICoreSceneRect& viewRect) const;
    [[nodiscard]] ICoreSceneRect mapFromScene(const ICoreSceneRect& sceneRect) const;

    void centerOn(const ICoreScenePoint& scenePoint);

    void viewportSize(double& width, double& height) const;

    void setAntialiased(bool antialiased);
    [[nodiscard]] bool isAntialiased() const;

    void setBackdrop(const ICoreWebViewBackdrop& backdrop);
    [[nodiscard]] ICoreWebViewBackdrop backdrop() const;

    // `canvas` is the Canvas2D handle a painter's nativeState() answers, already
    // in the view's own space; 0 settles the overlays and draws nothing.
    int draw(int canvas, double width, double height) const;
    int draw(int canvas, const ICoreSceneRect& damagedViewRect) const;

    void drawOrderForViewRect(const ICoreSceneRect& damagedViewRect,
                              std::vector<ICoreSceneDrawCommand>& out) const;

    // The control keeps its size in item units and is drawn with the item's
    // scale (ICoreWebNode::setContentScale); a rotation is not carried.
    void setItemOverlay(const ICoreSceneItemId& item, ICoreWebNode* control);
    void removeItemOverlay(const ICoreSceneItemId& item);
    [[nodiscard]] int overlayCount() const;

    void syncOverlays();

    static void setOverlayResolveHook(std::function<void()> hook);

    bool overlayPlacementForTest(const ICoreSceneItemId& item,
                                 ICoreSceneRect& frame, bool& shown) const;

    bool overlayScaleForTest(const ICoreSceneItemId& item, double& scale) const;

    static ICoreWebGraphicsView* viewShowing(const ICoreWebItemScene* scene);

    static bool isLive(const ICoreWebGraphicsView* view);

    int flushDirtyRegion();

    void flushedRectsForTest(std::vector<ICoreSceneRect>& out) const;
    [[nodiscard]] int flushCountForTest() const;

    [[nodiscard]] double dirtyFringeInViewPixels() const;

    void deliverMouseMove(double viewX, double viewY, ICoreMouseButtons buttons,
                          ICoreKeyModifiers modifiers);
    void deliverMousePress(double viewX, double viewY, ICoreMouseButton button,
                           ICoreKeyModifiers modifiers, int pressCount);
    void deliverMouseRelease(double viewX, double viewY, ICoreMouseButton button,
                             ICoreKeyModifiers modifiers);

    void deliverWheel(double viewX, double viewY, double deltaX, double deltaY,
                      ICoreKeyModifiers modifiers);

    void deliverPointerLeft();

    void setWheelZooms(bool zooms);
    [[nodiscard]] bool wheelZooms() const;

    void setHoverChangedHook(std::function<void(const ICoreSceneHoverChange&)> hook);
    void setPressedHook(std::function<void(const ICoreScenePressResult&,
                                           const ICoreScenePoint&)> hook);
    void setDraggedHook(std::function<void(const ICoreSceneDragResult&,
                                           const ICoreScenePoint&)> hook);
    void setReleasedHook(std::function<void(const ICoreSceneReleaseResult&,
                                            const ICoreScenePoint&)> hook);

    [[nodiscard]] int itemsPaintedForTest() const;
    void resetItemsPaintedForTest();

    [[nodiscard]] int pointerEventsDeliveredForTest() const;
    void resetPointerEventsDeliveredForTest();

private:
    class Impl;                    // the two-line residue; state lives here
    std::unique_ptr<Impl> impl;
};

ICoreWebItemAccess.h#

ICoreEssentials/UI/Backends/Web/Graphics/ICoreWebItemAccess.h

Web backend, WB4.1/WB4.2 -- ported from UI/Backends/Gtk4/Graphics/ICoreGtk4ItemAccess.h onto ICoreWebNode and the Canvas2D painter. That file's comments are the reasons for this one's behaviour and are not repeated here (one fact, one place); a behaviour change belongs in both.

Declares no class of its own — see the file.

ICoreWebItemScene.h#

ICoreEssentials/UI/Backends/Web/Graphics/ICoreWebItemScene.h

Web backend, WB4.1/WB4.2 -- ported from UI/Backends/Gtk4/Graphics/ICoreGtk4ItemScene.h onto ICoreWebNode and the Canvas2D painter. That file's comments are the reasons for this one's behaviour and are not repeated here (one fact, one place); a behaviour change belongs in both.

ICoreWebItemVisual#

ICoreWebItemScene.h:23 · struct · 0 declaration(s)

struct ICoreWebItemVisual {
public:
    bool hasFill = false;
    int fillR = 0, fillG = 0, fillB = 0, fillA = 255;

    bool hasBorder = false;
    int borderR = 0, borderG = 0, borderB = 0, borderA = 255;

    double borderWidth = 2.0;
    double cornerRadius = 5.0;
};
};

ICoreWebItemScene#

ICoreWebItemScene.h:38 · class · pImpl · 15 declaration(s)

class ICoreWebItemScene {
public:
    ICoreWebItemScene();
    ~ICoreWebItemScene();

    ICoreWebItemScene(const ICoreWebItemScene&) = delete;
    ICoreWebItemScene& operator=(const ICoreWebItemScene&) = delete;

    ICoreScene& scene();
    const ICoreScene& scene() const;

    void bind(const ICoreSceneItemId& id,
              ICoreWebItemVisualFn visual,
              ICoreWebItemContentFn content);

    void unbind(const ICoreSceneItemId& id);
    bool isBound(const ICoreSceneItemId& id) const;
    unsigned int boundCount() const;

    void reconcileBounds();

    // `canvas` is the Canvas2D handle a painter's nativeState() answers.
    int draw(int canvas) const;

    bool drawCommand(const ICoreSceneDrawCommand& command, int canvas) const;

    void setDamagedHook(std::function<void()> hook);
    void notifyDamaged() const;

    [[nodiscard]] std::weak_ptr<const int> lifetime() const;

private:
    class Impl;                    // the two-line residue; state lives here
    std::unique_ptr<Impl> impl;
};

File-scope declarations#

using ICoreWebItemVisualFn = std::function<ICoreWebItemVisual()>;

using ICoreWebItemContentFn = std::function<void(ICorePainter&)>;

ICoreWebSceneNode.h#

ICoreEssentials/UI/Backends/Web/Graphics/ICoreWebSceneNode.h

Web backend, WB4.1/WB4.2 -- ported from UI/Backends/Gtk4/Graphics/ICoreGtk4SceneNode.h onto ICoreWebNode and the Canvas2D painter. That file's comments are the reasons for this one's behaviour and are not repeated here (one fact, one place); a behaviour change belongs in both.

ICoreWebScenePointerEvent#

ICoreWebSceneNode.h:32 · struct · 0 declaration(s)

struct ICoreWebScenePointerEvent {
public:
    ICoreWebScenePointerKind kind = ICoreWebScenePointerKind::Pressed;

    ICoreScenePoint scenePoint;    // ICoreMouseEvent::scenePos
    ICoreScenePoint itemPoint;     // the item's OWN coordinates -- ::pos
    ICoreScenePoint globalPoint;   // toplevel space, this backend's "screen"

    ICoreMouseButton button = ICoreMouseButton::None;
    ICoreMouseButtons buttons = 0;
    ICoreKeyModifiers modifiers = 0;

    double deltaX = 0.0;
    double deltaY = 0.0;
};
};

ICoreWebSceneNode#

ICoreWebSceneNode.h:47 · struct · 18 declaration(s)

struct ICoreWebSceneNode {
public:
    ICoreWebSceneNode() = default;
    virtual ~ICoreWebSceneNode();

    ICoreWebSceneNode(const ICoreWebSceneNode&) = delete;
    ICoreWebSceneNode& operator=(const ICoreWebSceneNode&) = delete;

    ICoreWebItemScene* host = nullptr;
    ICoreSceneItemId id;

    ICoreSignalScope themeScope;

    ICoreWebSceneNode* parent = nullptr;
    std::vector<ICoreWebSceneNode*> children;

    void attachTo(ICoreWebItemScene* newHost, ICoreWebSceneNode* parentNode);

    void detachFromScene();
    void detachSubtree();

    void detachFromParent();

    void setParentNode(ICoreWebSceneNode* newParent);

    void teardownNode();

    virtual ICoreGraphicsObject* asGraphicsObject();

    virtual ICoreGraphicsText* asGraphicsText();

    virtual bool cursorShape(ICoreCursorShape& shapeOut) const;

    virtual bool deliverPointerEvent(const ICoreWebScenePointerEvent& event);

    virtual void reconcileBounds();

    void markDirty();

protected:
    virtual void pushAll() = 0;

    virtual void bindSelf() = 0;
};
};

File-scope declarations#

enum class ICoreWebScenePointerKind {
    Pressed,
    Moved,           // a move with a grab open -- ICoreGraphicsObject::mouseMoved
    Released,
    DoubleClicked,
    PointerEntered,
    PointerMoved,    // a HOVER move over the item already hovered
    PointerLeft,

    WheelScrolled
};

ICoreWebSceneRender.h#

ICoreEssentials/UI/Backends/Web/Graphics/ICoreWebSceneRender.h

Web backend, WB4.1/WB4.2 -- ported from UI/Backends/Gtk4/Graphics/ICoreGtk4SceneRender.h onto ICoreWebNode and the Canvas2D painter. That file's comments are the reasons for this one's behaviour and are not repeated here (one fact, one place); a behaviour change belongs in both.

Declares no class of its own — see the file.