pub struct Group(/* private fields */);Expand description
A box around related content, as the platform groups it: an NSBox
(its heading inside, at the top), libadwaita’s card under a heading,
a Fluent card under a heading on Windows, a QQC2.GroupBox. The
heading is optional; it names the group to assistive technology.
Its children are laid out as a column’s (gap, and any style), inside
the platform’s border and margins; padding adds to those. Put a Row
or Grid in it for other layouts.
Group::new().title("CD drive").child(
Row::new().gap(Spacing::Md).children((Icon::new(disc), Text::new(title), eject)),
)Implementations§
Source§impl Group
impl Group
pub fn new() -> Group
pub fn children(self, children: impl Children) -> Group
pub fn child(self, child: impl View) -> Group
Sourcepub fn file_drop(self, drop: impl IntoValue<FileDrop>) -> Group
pub fn file_drop(self, drop: impl IntoValue<FileDrop>) -> Group
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) -> Group
pub fn on_drop(self, handler: impl Fn(Vec<PathBuf>) + 'static) -> Group
The files and folders dropped on it that it takes (file_drop).
Sourcepub fn on_drop_hover(self, handler: impl Fn(bool) + 'static) -> Group
pub fn on_drop_hover(self, handler: impl Fn(bool) + 'static) -> Group
Whether files it takes are over it (file_drop).
Sourcepub fn on_hover(self, handler: impl Fn(bool) + 'static) -> Group
pub fn on_hover(self, handler: impl Fn(bool) + 'static) -> Group
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) -> Group
pub fn on_double_click(self, handler: impl Fn() + 'static) -> Group
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_click(self, handler: impl Fn() + 'static) -> Group
pub fn on_click(self, handler: impl Fn() + 'static) -> Group
Called when it’s clicked, or anything inside it that isn’t a
control (a label, an icon): a header that opens its section, as
GTK’s and WinUI’s expanders do. Pointers only, as for
on_double_click: keyboards and assistive technology need a
control inside (the header’s disclosure button).
Sourcepub fn on_key(
self,
key: impl Into<Shortcut>,
handler: impl Fn() + 'static,
) -> Group
pub fn on_key( self, key: impl Into<Shortcut>, handler: impl Fn() + 'static, ) -> Group
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!).
Group::new().on_key(Shortcut::primary(Key::Backspace), trash)Trait Implementations§
Source§impl ElementBuilder for Group
impl ElementBuilder for Group
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.entries each time the platform opens it,
for a menu that depends on what’s selected or under the pointer at
that moment: a table row’s menu acting on the selection. What it
reads is read then, not followed.