1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
//! Programmatic open for the select family (backlog 0296): command-
//! summoned pickers (`/theme`, `/model` typed into a composer) need to
//! open a face's popup WITHOUT a trigger-row gesture. [`SelectHandle`]
//! is that verb — a cloneable handle an app keeps next to the face it
//! built:
//!
//! ```ignore
//! let picker = SelectHandle::new();
//! Select::new(theme_options)
//! .value(theme_ix)
//! .handle(&picker)
//! .view(cx);
//! // later, in a command handler:
//! if !picker.open() { /* face unmounted / not painted yet / disabled */ }
//! ```
//!
//! ## The anchor contract (honesty note)
//!
//! A popup needs an anchor rect; gestures capture it from
//! `EventCtx::current_rect`, which does not exist outside dispatch. A
//! programmatic open anchors at the trigger's LAST-PAINTED rect,
//! recorded by the face's draw pass. Consequences, deliberate and
//! documented rather than papered over:
//!
//! - **One frame after mount**: a face that has never painted has no
//! rect — `open()` returns `false`. Mount-then-open flows should open
//! on the frame after the face first renders (e.g. from a one-shot
//! `reactive::after(Duration::ZERO, ..)` posted when the face mounts).
//! - **Same-turn layout moves**: `open()` called before this frame's
//! layout re-solve anchors at the previous frame's rect. Popups
//! already dismiss on viewport resize (`DismissReason::Resize`), and
//! an anchor one frame stale on an unmoved trigger is exact.
//!
//! Disposal safety: the wiring dies with the face's scope (dyn_view
//! regeneration, unmount) — `open()` on a dead face returns `false`,
//! never panics, never opens a popup over a stale tree. A handle wired
//! by a NEWER build of the same face wins over the dying wire (the
//! generation guard below), so dyn_view regenerations rewire cleanly in
//! either disposal order. One face per handle: a second `.handle(&h)`
//! wire simply replaces the first.
//!
//! OWNER: SELECT (0500 family).
use ;
use Rc;
use crateRect;
use crateScope;
/// What a wired face gives the handle: "open now if you can; report
/// whether the popup is open after the attempt".
type OpenFn = ;
/// Cloneable programmatic-open handle for `Select` / `Combobox` /
/// `MultiSelect` (backlog 0296). Build one, pass it to a face via
/// `.handle(&h)`, call [`SelectHandle::open`] from command handlers or
/// shortcuts. See the module docs for the anchor contract.
/// Shared face plumbing: the cell a face's outer element writes its
/// rect into at draw time — the last-laid-out rect programmatic opens
/// anchor at (`None` until the first paint).
pub