module pkg::alloy::ui::layerssource
Layers (decisions/F11.md, F11a): element trees of their own
over the window's content, in the order they open: dialogs, popups,
menus, tooltips and toasts. A layer is a host element covering the
window, drawing the scrim of a modal one, holding a panel placed by
the layer's Place around the element its view made. The topmost
takes the pointer first and a modal one keeps the pointer and the
keyboard from what is below it. What a layer's view made belongs to
an owner of the layer's, under the owner of the element whose handler
opened it, and goes when the layer closes.
LayerSlotPopupopen_layerowner_ofwithinlayer_indexlayer_ofclose_atholdspanel_framepress_openedplacedpaintrenewpaintrenew
type LayerSlotsource
exp type LayerSlot = struct
A layer open: its overlay, the owner of what it made, its host and panel, the element given the focus back when it closes, and its anchor's frame as it was last placed by.
Fields
exp overlay: Overlayexp owner: u32exp host: Elementexp panel: u32exp ring: bool = false
interface Popupsource
exp interface Popup
What a widget holding a popup closes once a binding gives it other options: a Select's list, a DatePicker's calendar.
Required functions
fn take_closing(self: &var) -> Option<Layer>;
fn open_layersource
exp fn open_layer(
self ui: &var Ui,
overlay: Overlay,
view: |=| (&var Ui, Layer) -> Element
) -> Layer
fn owner_ofsource
exp fn owner_of(self ui: &Ui, index: u32) -> u32
The owner whose element the node is, the app's when none.
fn withinsource
exp fn within(self ui: &Ui, index: u32, ancestor: u32) -> bool
Whether the node is the other or under it.
fn layer_indexsource
exp fn layer_index(self ui: &Ui, layer: Layer) -> Option<u64>
Where the layer is among those open.
fn layer_ofsource
exp fn layer_of(self ui: &Ui, index: u32) -> Option<u64>
The layer holding the node, none for the content's.
fn close_atsource
exp fn close_at(self ui: &var Ui, k: u64)
Closes the layer at the index, with those opened from what it made,
giving the focus back when it was inside, then calls its on_close.
fn holdssource
exp fn holds(area: &Rect, p: Point) -> bool
Whether the rectangle holds the point.
fn panel_framesource
exp fn panel_frame(self ui: &Ui, k: u64) -> Rect
The panel's frame in the window.
fn press_openedsource
exp fn press_opened(self ui: &var Ui, layer: Layer)
The layer opened in a press's handler, which a drag to one of its items and a release there chooses, as native menus and lists allow.
fn placedsource
exp fn placed(
place: &Place,
size: Extent,
window: Extent,
anchor: Option<Rect>,
direction: LayoutDirection
) -> Point
Where a panel of the size goes in the window, by the place, the anchor's frame and the direction it reads in: on the other side when there is no room, and within the window less its margin. Right to left a panel below or above aligns its right edge with the anchor's, one after it goes to its left, one at a point reaches left of it, and a corner's start is on the right.
fn paintsource
exp fn paint(self h: &LayerHost, look: &Look, paint: &var Paint)
fn renewsource
exp fn renew(self h: &var LayerHost, next: LayerHost) -> Change
fn paintsource
exp fn paint(self p: &Panel, look: &Look, paint: &var Paint)
fn renewsource
exp fn renew(self p: &var Panel, next: Panel) -> Change