pub struct WindowAffordanceFrame<A = ()> { /* private fields */ }Expand description
Retained frame that paints client chrome and emits provider-neutral actions.
The default logical window id is "window-affordance"; movement, resizing,
and the three chrome controls are enabled. The optional content is placed
below the title bar.
§Examples
use ailloli_ui_widgets::chrome::WindowAffordanceFrame;
let frame: WindowAffordanceFrame<()> = WindowAffordanceFrame::new("Inspector");
let _ = frame;Implementations§
Source§impl<A: 'static> WindowAffordanceFrame<A>
impl<A: 'static> WindowAffordanceFrame<A>
Sourcepub fn height(self, value: impl Into<Length>) -> Self
pub fn height(self, value: impl Into<Length>) -> Self
Sets preferred height from a logical-pixel or length value.
§Examples
use ailloli_ui_widgets::layout::Container;
let widget: Container<()> = Container::new().height(40.0);
let _ = widget;Sourcepub fn min_width(self, value: impl Into<Length>) -> Self
pub fn min_width(self, value: impl Into<Length>) -> Self
Sets the minimum width bound.
§Examples
use ailloli_ui_widgets::layout::Container;
let widget: Container<()> = Container::new().min_width(40.0);
let _ = widget;Sourcepub fn max_width(self, value: impl Into<Length>) -> Self
pub fn max_width(self, value: impl Into<Length>) -> Self
Sets the maximum width bound.
§Examples
use ailloli_ui_widgets::layout::Container;
let widget: Container<()> = Container::new().max_width(320.0);
let _ = widget;Sourcepub fn min_height(self, value: impl Into<Length>) -> Self
pub fn min_height(self, value: impl Into<Length>) -> Self
Sets the minimum height bound.
§Examples
use ailloli_ui_widgets::layout::Container;
let widget: Container<()> = Container::new().min_height(24.0);
let _ = widget;Sourcepub fn max_height(self, value: impl Into<Length>) -> Self
pub fn max_height(self, value: impl Into<Length>) -> Self
Sets the maximum height bound.
§Examples
use ailloli_ui_widgets::layout::Container;
let widget: Container<()> = Container::new().max_height(240.0);
let _ = widget;Sourcepub fn fill(self) -> Self
pub fn fill(self) -> Self
Sets both preferred axes to parent fill.
§Examples
use ailloli_ui_widgets::layout::Container;
let widget: Container<()> = Container::new().fill();
let _ = widget;Sourcepub fn fill_width(self) -> Self
pub fn fill_width(self) -> Self
Sets preferred width to parent fill.
§Examples
use ailloli_ui_widgets::layout::Container;
let widget: Container<()> = Container::new().fill_width();
let _ = widget;Sourcepub fn fill_height(self) -> Self
pub fn fill_height(self) -> Self
Sets preferred height to parent fill.
§Examples
use ailloli_ui_widgets::layout::Container;
let widget: Container<()> = Container::new().fill_height();
let _ = widget;Sourcepub fn margin(self, value: f32) -> Self
pub fn margin(self, value: f32) -> Self
Sets uniform outer margin in logical pixels.
§Examples
use ailloli_ui_widgets::layout::Container;
let widget: Container<()> = Container::new().margin(8.0);
let _ = widget;Sourcepub fn padding(self, value: f32) -> Self
pub fn padding(self, value: f32) -> Self
Sets uniform inner padding in logical pixels.
§Examples
use ailloli_ui_widgets::layout::Container;
let widget: Container<()> = Container::new().padding(8.0);
let _ = widget;Sourcepub fn flex_grow(self) -> Self
pub fn flex_grow(self) -> Self
Sets flex-grow weight to one.
§Examples
use ailloli_ui_widgets::layout::Container;
let widget: Container<()> = Container::new().flex_grow();
let _ = widget;Sourcepub fn flex_grow_by(self, value: f32) -> Self
pub fn flex_grow_by(self, value: f32) -> Self
Sets a dimensionless flex-grow weight.
§Examples
use ailloli_ui_widgets::layout::Container;
let widget: Container<()> = Container::new().flex_grow_by(2.0);
let _ = widget;Sourcepub fn flex_shrink(self, value: f32) -> Self
pub fn flex_shrink(self, value: f32) -> Self
Sets a dimensionless flex-shrink weight.
§Examples
use ailloli_ui_widgets::layout::Container;
let widget: Container<()> = Container::new().flex_shrink(1.0);
let _ = widget;Sourcepub fn flex_basis(self, value: impl Into<Length>) -> Self
pub fn flex_basis(self, value: impl Into<Length>) -> Self
Sets the preferred main-axis flex basis.
§Examples
use ailloli_ui_widgets::layout::Container;
let widget: Container<()> = Container::new().flex_basis(80.0);
let _ = widget;Sourcepub fn align_self(self, value: AlignItems) -> Self
pub fn align_self(self, value: AlignItems) -> Self
Overrides cross-axis alignment for this flex item.
§Examples
use ailloli_ui_core::style::AlignItems;
use ailloli_ui_widgets::layout::Container;
let widget: Container<()> = Container::new().align_self(AlignItems::Center);
let _ = widget;Source§impl<A: 'static> WindowAffordanceFrame<A>
impl<A: 'static> WindowAffordanceFrame<A>
Sourcepub fn new(title: impl Into<String>) -> Self
pub fn new(title: impl Into<String>) -> Self
Creates a default movable and resizable frame with title.
Empty titles are accepted and displayed as empty text.
§Examples
use ailloli_ui_widgets::chrome::WindowAffordanceFrame;
let frame: WindowAffordanceFrame<()> = WindowAffordanceFrame::new("Tools");
let _ = frame;Sourcepub fn logical_window_id(self, value: impl Into<String>) -> Self
pub fn logical_window_id(self, value: impl Into<String>) -> Self
Sets the host logical id used by built-in minimize requests.
§Examples
use ailloli_ui_widgets::chrome::WindowAffordanceFrame;
let frame: WindowAffordanceFrame<()> = WindowAffordanceFrame::new("Tools").logical_window_id("tools");
let _ = frame;Sourcepub fn content(self, content: impl IntoView<A>) -> Self
pub fn content(self, content: impl IntoView<A>) -> Self
Installs the single child view below the title bar.
Repeated calls replace the previous child.
§Examples
use ailloli_ui_widgets::{chrome::WindowAffordanceFrame, text::Text};
let frame: WindowAffordanceFrame<()> = WindowAffordanceFrame::new("Tools").content(Text::new("Body"));
let _ = frame;Sourcepub fn movable(self, value: bool) -> Self
pub fn movable(self, value: bool) -> Self
Enables or disables title-bar move hit testing.
§Examples
use ailloli_ui_widgets::chrome::WindowAffordanceFrame;
let frame: WindowAffordanceFrame<()> = WindowAffordanceFrame::new("Fixed").movable(false);
let _ = frame;Sourcepub fn resizable(self, value: bool) -> Self
pub fn resizable(self, value: bool) -> Self
Enables or disables edge and corner resize hit testing and handles.
§Examples
use ailloli_ui_widgets::chrome::WindowAffordanceFrame;
let frame: WindowAffordanceFrame<()> = WindowAffordanceFrame::new("Fixed").resizable(false);
let _ = frame;Sourcepub fn show_controls(self, value: bool) -> Self
pub fn show_controls(self, value: bool) -> Self
Shows or hides close, minimize, and follow controls.
Hiding controls removes both paint and hit targets.
§Examples
use ailloli_ui_widgets::chrome::WindowAffordanceFrame;
let frame: WindowAffordanceFrame<()> = WindowAffordanceFrame::new("Bare").show_controls(false);
let _ = frame;Sourcepub fn window_affordance_style(self, style: WindowAffordanceStyle) -> Self
pub fn window_affordance_style(self, style: WindowAffordanceStyle) -> Self
Replaces every chrome geometry and color token.
§Examples
use ailloli_ui_widgets::chrome::{WindowAffordanceFrame, WindowAffordanceStyle};
let style = WindowAffordanceStyle { titlebar_height: 42.0, ..Default::default() };
let frame: WindowAffordanceFrame<()> = WindowAffordanceFrame::new("Tools").window_affordance_style(style);
let _ = frame;Sourcepub fn on_affordance(
self,
f: impl Fn(WindowAffordanceEvent) -> A + 'static,
) -> Self
pub fn on_affordance( self, f: impl Fn(WindowAffordanceEvent) -> A + 'static, ) -> Self
Maps each emitted event into an application action.
§Examples
use ailloli_ui_widgets::chrome::{WindowAffordanceEvent, WindowAffordanceFrame};
enum Action { Chrome(WindowAffordanceEvent) }
let frame = WindowAffordanceFrame::new("Tools").on_affordance(Action::Chrome);
let _: WindowAffordanceFrame<Action> = frame;Sourcepub fn on_affordance_ctx(
self,
f: impl Fn(&mut EventCtx<A>, WindowAffordanceEvent) + 'static,
) -> Self
pub fn on_affordance_ctx( self, f: impl Fn(&mut EventCtx<A>, WindowAffordanceEvent) + 'static, ) -> Self
Handles emitted events with mutable runtime event context access.
§Examples
use ailloli_ui_widgets::chrome::WindowAffordanceFrame;
let frame: WindowAffordanceFrame<()> = WindowAffordanceFrame::new("Tools")
.on_affordance_ctx(|_ctx, _event| {});
let _ = frame;Trait Implementations§
Source§impl<A: 'static> IntoView<A> for WindowAffordanceFrame<A>
Converts the builder into its retained frame component.
impl<A: 'static> IntoView<A> for WindowAffordanceFrame<A>
Converts the builder into its retained frame component.