Anchored popover with a pointer triangle. More...
#include <pulp/canvas/canvas.hpp>#include <pulp/view/geometry.hpp>#include <pulp/view/view.hpp>#include <functional>#include <memory>Go to the source code of this file.
Classes | |
| struct | pulp::view::CalloutStyle |
| Tunables for the callout geometry. All lengths in the window coordinate space. More... | |
| struct | pulp::view::CalloutPlacement |
| Resolved placement in the window coordinate space. More... | |
| class | pulp::view::AnchoredCallout |
| A view-tree callout: hosts one content child, anchored to a target rect with a pointer triangle, auto-flipping + edge-clamping against a window rect. More... | |
Namespaces | |
| namespace | pulp |
| namespace | pulp::view |
| Hover-cursor tracking for platform window hosts. | |
Enumerations | |
| enum class | pulp::view::CalloutSide { pulp::view::above , pulp::view::below , pulp::view::left_of , pulp::view::right_of } |
| Which side of the anchor the callout BODY sits on. More... | |
Functions | |
| CalloutSide | pulp::view::opposite_side (CalloutSide s) |
| Opposite side, used by the auto-flip. | |
| CalloutPlacement | pulp::view::place_callout (const Rect &anchor, float body_w, float body_h, const Rect &window, CalloutSide preferred, const CalloutStyle &style={}) |
| Place a body_w×body_h callout tethered to anchor, kept inside window. | |
Anchored popover with a pointer triangle.
AnchoredCallout is a floating content box tethered to a target rect (a knob, a button) by a little arrow. It auto-flips to the other side when it would clip the window, clamps itself inside the window edges, and keeps the arrow pointing at the anchor even after the body is clamped.
Named AnchoredCallout to avoid colliding with Pulp's existing CallOutBox in ui_components.hpp, which is a modal message/confirm box with no anchor or arrow — a different primitive, despite the similar name. Pulp also has ContextMenu (a view-tree overlay) and TooltipWindow, but neither gives arbitrary child content an arrowed, edge-aware anchor — that is what AnchoredCallout adds.
The placement math (place_callout) is a pure function of rects + a style, so side selection / edge clamping / arrow tracking are fully unit-testable headlessly; AnchoredCallout is the thin View that hosts content, computes the placement against a window rect, and paints the rounded body + triangle.