pub struct Container(/* private fields */);Expand description
A layout host: flexbox (column by default) or grid.
Implementations§
Source§impl Container
impl Container
pub fn new() -> Container
pub fn children(self, children: impl Children) -> Container
pub fn child(self, child: impl View) -> Container
Sourcepub fn file_drop(self, drop: impl IntoValue<FileDrop>) -> Container
pub fn file_drop(self, drop: impl IntoValue<FileDrop>) -> Container
Takes the files and folders drop says when they’re dropped on it
from the platform’s file manager, and gives them to on_drop. The
platform shows it’ll copy them while they’re over it; on_drop_hover
says when, for the app’s own highlight. Dragging isn’t reachable
from the keyboard or assistive technology: offer another way (an
open dialog) too.
Sourcepub fn on_drop(self, handler: impl Fn(Vec<PathBuf>) + 'static) -> Container
pub fn on_drop(self, handler: impl Fn(Vec<PathBuf>) + 'static) -> Container
The files and folders dropped on it that it takes (file_drop).
Sourcepub fn on_drop_hover(self, handler: impl Fn(bool) + 'static) -> Container
pub fn on_drop_hover(self, handler: impl Fn(bool) + 'static) -> Container
Whether files it takes are over it (file_drop).
Sourcepub fn on_hover(self, handler: impl Fn(bool) + 'static) -> Container
pub fn on_hover(self, handler: impl Fn(bool) + 'static) -> Container
Called with true when the pointer comes over it, or over anything
inside it, and false when it leaves, as the platform tracks it:
to show a row’s buttons while it’s hovered. Keyboards and
assistive technology never hover, so whatever it shows must be
reachable another way too (a context menu, a selected row’s
toolbar).
Sourcepub fn on_double_click(self, handler: impl Fn() + 'static) -> Container
pub fn on_double_click(self, handler: impl Fn() + 'static) -> Container
Called when it’s double-clicked, or anything inside it that isn’t a control, as the platform counts a double click: to rename what a row shows in place. Keyboards and assistive technology don’t double-click, so what it does must be reachable another way too (a context menu, a button).
Sourcepub fn on_key(
self,
key: impl Into<Shortcut>,
handler: impl Fn() + 'static,
) -> Container
pub fn on_key( self, key: impl Into<Shortcut>, handler: impl Fn() + 'static, ) -> Container
Runs handler when key is pressed while it, or a control
inside it, has keyboard focus, and the focused control doesn’t use
the key itself: Space for a preview, Delete for Move to Trash.
A key goes to the nearest node around the focused control that
takes it. Nothing shows keys taken this way, so give the command a
menu item or a button too, and pick the keys the platform’s own apps
use (platform!).
Column::new().on_key(Shortcut::primary(Key::Backspace), trash)pub fn flex_direction( self, direction: impl IntoValue<FlexDirection>, ) -> Container
pub fn row_gap(self, gap: impl IntoValue<Length>) -> Container
pub fn column_gap(self, gap: impl IntoValue<Length>) -> Container
Sourcepub fn align(self, align: impl IntoValue<Align>) -> Container
pub fn align(self, align: impl IntoValue<Align>) -> Container
Cross-axis alignment of children (align-items).
Sourcepub fn justify(self, justify: impl IntoValue<Justify>) -> Container
pub fn justify(self, justify: impl IntoValue<Justify>) -> Container
Main-axis distribution of children (justify-content).
pub fn wrap(self) -> Container
Trait Implementations§
Source§impl ElementBuilder for Container
impl ElementBuilder for Container
fn element(&mut self) -> &mut Element
Source§fn style(self, f: impl FnOnce(&mut Style)) -> Self
fn style(self, f: impl FnOnce(&mut Style)) -> Self
Source§fn style_with(self, f: impl Fn(&mut Style) + 'static) -> Self
fn style_with(self, f: impl Fn(&mut Style) + 'static) -> Self
f re-runs whenever the
signals it reads change, and must set every field it cares about.fn width(self, value: impl IntoValue<Length>) -> Self
fn height(self, value: impl IntoValue<Length>) -> Self
fn min_width(self, value: impl IntoValue<Length>) -> Self
fn min_height(self, value: impl IntoValue<Length>) -> Self
fn max_width(self, value: impl IntoValue<Length>) -> Self
fn max_height(self, value: impl IntoValue<Length>) -> Self
fn aspect_ratio(self, value: impl IntoValue<f32>) -> Self
fn padding(self, value: impl IntoValue<Length>) -> Self
fn padding_x(self, value: impl IntoValue<Length>) -> Self
fn padding_y(self, value: impl IntoValue<Length>) -> Self
fn padding_start(self, value: impl IntoValue<Length>) -> Self
fn padding_end(self, value: impl IntoValue<Length>) -> Self
fn padding_top(self, value: impl IntoValue<Length>) -> Self
fn padding_bottom(self, value: impl IntoValue<Length>) -> Self
fn margin(self, value: impl IntoValue<Length>) -> Self
fn margin_x(self, value: impl IntoValue<Length>) -> Self
fn margin_y(self, value: impl IntoValue<Length>) -> Self
fn margin_start(self, value: impl IntoValue<Length>) -> Self
fn margin_end(self, value: impl IntoValue<Length>) -> Self
fn margin_top(self, value: impl IntoValue<Length>) -> Self
fn margin_bottom(self, value: impl IntoValue<Length>) -> Self
fn grow(self, value: impl IntoValue<f32>) -> Self
fn shrink(self, value: impl IntoValue<f32>) -> Self
fn basis(self, value: impl IntoValue<Length>) -> Self
fn align_self(self, value: impl IntoValue<Align>) -> Self
Source§fn justify_self(self, value: impl IntoValue<Align>) -> Self
fn justify_self(self, value: impl IntoValue<Align>) -> Self
Source§fn top(self, value: impl IntoValue<Length>) -> Self
fn top(self, value: impl IntoValue<Length>) -> Self
absolute()).fn bottom(self, value: impl IntoValue<Length>) -> Self
Source§fn start(self, value: impl IntoValue<Length>) -> Self
fn start(self, value: impl IntoValue<Length>) -> Self
fn end(self, value: impl IntoValue<Length>) -> Self
fn grid_column(self, value: impl IntoValue<GridPlacement>) -> Self
fn grid_row(self, value: impl IntoValue<GridPlacement>) -> Self
fn direction(self, value: impl IntoValue<TextDirection>) -> Self
display the node had.fn size( self, width: impl IntoValue<Length>, height: impl IntoValue<Length>, ) -> Self
Source§fn tooltip(self, text: impl IntoValue<String>) -> Self
fn tooltip(self, text: impl IntoValue<String>) -> Self
entries, and built again whenever what it
reads changes, as Menu::children_with builds its entries.