Pulp 1.88.0
Cross-platform audio plugin framework
Loading...
Searching...
No Matches
overlay_dismissal.hpp
Go to the documentation of this file.
1#pragma once
2
33
34#include <pulp/view/view.hpp>
35
36#include <cstdint>
37
38namespace pulp::view {
39
40// ── An overlay's anchor: the trigger that opened it ─────────────────────────
41//
42// A press on an overlay's own anchor while it is open means "close it", exactly
43// like a press outside it or Escape: the overlay is dismissed and the press is
44// spent on the close, so the trigger's handler cannot run on the same press and
45// open it again. That is what makes a dropdown button TOGGLE. A press on a
46// DIFFERENT trigger still switches menus in one press
47// (`OverlayDismissalPolicy::trigger_press_passes_through`).
48//
49// Most overlays never declare one. `route_press_to_active_overlay` records the
50// `View::overlay_trigger()` each press is delivered to
51// (`RootInteractionState::pending_overlay_opener`), and a claim that follows
52// adopts it, which covers every press-opened `@pulp/react`, web-compat, and
53// imported popover. Declare it with `View::set_overlay_anchor` when the
54// overlay opens some other way — from the keyboard, from a timer — or when its
55// opener is not marked as a trigger; an explicit anchor is never replaced by
56// the recorded one. The press's NEAREST trigger decides: a trigger between the
57// hit view and the anchor means that nearer trigger, not the anchor.
58
78
101
138
143
161
177
183 View* target = nullptr;
187 bool blocked = false;
196 View* overlay = nullptr;
197};
198
230
235 bool handled = false;
238 bool overlay_dismissed = false;
239};
240
252
266
291 std::uint16_t modifiers = 0,
292 bool is_repeat = false);
293
317
318} // namespace pulp::view
Definition view.hpp:73
Hover-cursor tracking for platform window hosts.
Definition fwd.hpp:27
void set_overlay_dismissal_policy(const OverlayDismissalPolicy &policy)
Replace the active policy. Call from application setup, not mid-gesture.
bool root_overlay_owns_keyboard(View &root)
Whether an overlay under root is the kind that should own the keyboard.
@ none
Definition appearance_defects.hpp:53
PassivePointerRoute route_passive_pointer(View &root, Point root_pt)
Resolve a passive pointer input through the root's open overlays.
OverlayPressRouting
What consulting the generalized overlay slot decided about a press.
Definition overlay_dismissal.hpp:60
@ dismissed
The press landed outside the overlay, so it was dismissed.
Definition overlay_dismissal.hpp:76
@ not_hittable
The press landed inside the overlay's rect, but the overlay's own visible / enabled / hit-testable / ...
Definition overlay_dismissal.hpp:72
@ no_overlay
Nothing claimed the root's overlay slot; the caller proceeds normally.
Definition overlay_dismissal.hpp:62
@ routed
The press landed inside the overlay and resolved to a view in its subtree.
Definition overlay_dismissal.hpp:67
OverlayEscapeResult
What an Escape keypress dismissed, in the order the policy tries them.
Definition overlay_dismissal.hpp:254
@ overlay
The generalized overlay slot was dismissed, firing on_overlay_dismissed so React state can flip setOp...
Definition overlay_dismissal.hpp:264
@ modal
A ModalOverlay in the tree consumed Escape through its own handler.
Definition overlay_dismissal.hpp:259
@ combo_popup
An open native ComboBox dropdown was closed.
Definition overlay_dismissal.hpp:261
OverlayEscapeResult route_escape_to_active_overlay(View &root, std::uint16_t modifiers=0, bool is_repeat=false)
Dismiss the topmost thing Escape should close under root.
const OverlayDismissalPolicy & overlay_dismissal_policy()
The active policy. Reading is cheap and allocation-free.
View * hover_target_at(View &root, Point root_pt)
The view a HOVER at root_pt lands on: the deepest hit inside the topmost open overlay that contains t...
OverlayPressTarget route_press_to_active_overlay(View &root, Point root_pt)
Consult root's generalized overlay slot for a press at root_pt.
ContextPressResult route_context_press(View &root, Point root_pt)
Route a context (right-button) press at root_pt, consulting the generalized overlay slot first.
What a context (right-button) press resolved to.
Definition overlay_dismissal.hpp:232
bool handled
A view claimed the context menu, so the host must not fall through to the platform's own menu.
Definition overlay_dismissal.hpp:235
bool overlay_dismissed
The press dismissed an open overlay, so the host must repaint even when nothing claimed a context men...
Definition overlay_dismissal.hpp:238
Tunable defaults for the dismissal policy.
Definition overlay_dismissal.hpp:105
bool passive_input_outside_overlay_blocked
While any shown overlay is open, a PASSIVE pointer input — a wheel or two-finger scroll,...
Definition overlay_dismissal.hpp:136
bool trigger_press_passes_through
A press that dismisses an open overlay is delivered to the control under it when that control is a DI...
Definition overlay_dismissal.hpp:123
Definition overlay_dismissal.hpp:79
bool trigger_closed
The press landed on the anchor of an overlay it dismissed — the button that opened that dropdown — so...
Definition overlay_dismissal.hpp:99
View * target
Non-null only when routing == OverlayPressRouting::routed.
Definition overlay_dismissal.hpp:82
OverlayPressRouting routing
Definition overlay_dismissal.hpp:80
bool consume_press
True when an outside press dismissed an overlay that opted to consume that initiating pointer sequenc...
Definition overlay_dismissal.hpp:93
Where a PASSIVE pointer input — a wheel / two-finger scroll, a trackpad magnify or rotate — at root_p...
Definition overlay_dismissal.hpp:180
View * overlay
The open overlay target was resolved inside, or nullptr when the ordinary tree answered.
Definition overlay_dismissal.hpp:196
View * target
The view to deliver to, or nullptr when nothing is under the point.
Definition overlay_dismissal.hpp:183
bool blocked
The input must be dropped: an open overlay owns the screen and the point is outside every overlay tha...
Definition overlay_dismissal.hpp:187
Definition geometry.hpp:20