#[repr(C)]pub struct TransientWindowConfig {
pub size: OptionLogicalSize,
pub anchor: TransientAnchor,
pub dismiss: TransientDismiss,
pub tearoff: TransientTearoff,
pub dock: TransientDock,
pub material: WindowBackgroundMaterial,
pub open: bool,
pub torn: bool,
}Expand description
The inline configuration of a NodeType::TransientWindow.
Copy and small on purpose: it rides inside NodeType the way
GeolocationProbeConfig does, so opening a popup needs no allocation and
NodeType (48 bytes, set by its largest payload) does not grow.
Fields§
§size: OptionLogicalSizeExplicit size, or None to size the window to its content - the
common case, and the reason a colour picker never has to guess how tall
its own panel is.
OptionLogicalSize, the #[repr(C, u8)] option, NOT Option<_>: this
struct rides inside NodeType, which rides inside every Dom the C ABI
passes by value, and a Rust Option has no stable layout - clippy’s
improper_ctypes_definitions flagged every extern "C" fn -> Dom in
the tree the moment a plain Option went in here.
anchor: TransientAnchorWhich edge of the anchor (the node’s parent) it opens from.
dismiss: TransientDismissWhat closes it.
tearoff: TransientTearoffWhether the user may drag the window OUT of its anchor into a free
toplevel that is still the same DOM subtree (see TransientTearoff).
dock: TransientDockPopup at an anchor edge (the default), or inline content of its
parent / drop zone that can be torn off and dropped elsewhere
(dock="inline", see TransientDock).
material: WindowBackgroundMaterialThe popup window’s background material (material="transparent"):
Transparent gives the window per-pixel alpha, and its shape follows
what the content paints - rounded corners are real corners, a
pointer arrow is part of the window, a click beside it falls through.
A clip mask on the node (set_clip_mask, the same mask any DOM node
can carry) implies Transparent: the mask IS the window’s shape.
open: boolThe ONLY thing an application toggles. true materialises the subtree
as a window; false tears it down and drops it from layout entirely.
torn: boolThe app’s word on whether the window is currently torn off. Like
open, this is a REQUEST the engine follows on every change: flipping
it true tears the window off at its anchor position, flipping it
false docks it. In between, the user’s own drags win - a palette the
user parked by the document does not snap back on the next layout
just because the app still says torn="false". The app learns about
user tear-offs through ComponentEventFilter::TornOff / Docked.
Implementations§
Source§impl TransientWindowConfig
impl TransientWindowConfig
pub const fn with_anchor(self, anchor: TransientAnchor) -> Self
pub const fn with_dismiss(self, dismiss: TransientDismiss) -> Self
pub const fn with_size(self, size: LogicalSize) -> Self
pub const fn with_tearoff(self, tearoff: TransientTearoff) -> Self
pub const fn with_torn(self, torn: bool) -> Self
pub const fn with_material(self, material: WindowBackgroundMaterial) -> Self
pub const fn with_dock(self, dock: TransientDock) -> Self
Source§impl TransientWindowConfig
impl TransientWindowConfig
Sourcepub fn apply_attr(&mut self, key: &str, value: &str) -> bool
pub fn apply_attr(&mut self, key: &str, value: &str) -> bool
Apply one XML/HTML attribute. Returns true if the key was one of ours.
size="WxH" in logical px; anything else for a known key degrades to
the default rather than erroring - a typo must not make a popup refuse
to open. Unknown keys return false so the caller can treat them as
ordinary attributes (id, class, …).
Trait Implementations§
Source§impl Clone for TransientWindowConfig
impl Clone for TransientWindowConfig
Source§fn clone(&self) -> TransientWindowConfig
fn clone(&self) -> TransientWindowConfig
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more