Struct widgetry::Widget [−][src]
pub struct Widget { pub(crate) widget: Box<dyn WidgetImpl>, layout: LayoutStyle, pub(crate) rect: ScreenRectangle, bg: Option<Drawable>, bg_batch: Option<GeomBatch>, id: Option<String>, }
Fields
widget: Box<dyn WidgetImpl>
layout: LayoutStyle
rect: ScreenRectangle
bg: Option<Drawable>
bg_batch: Option<GeomBatch>
id: Option<String>
Implementations
This one is really weird. percent_width should be LESS than the max_size_percent given to the overall Panel, otherwise weird things happen. Only makes sense for rows/columns.
Like flex_wrap, but doesn’t horizontally space out widgets on the same row.
Only for rows/columns. Used to force table columns to line up.
Needed for force_width.
Callers have to adjust padding too, probably
Things like padding don’t work on many widgets, so just make a convenient way to wrap in a row/column first
This doesn’t count against the entire container
pub fn dropdown<T: 'static + PartialEq + Clone + Debug, I: AsRef<str>>(
ctx: &EventCtx<'_>,
label: I,
default_value: T,
choices: Vec<Choice<T>>
) -> Widget
Creates a row with the specified widgets. No margins or other layouting is applied.
Creates a row with the specified widgets. Every member gets a default horizontal margin.
Creates a row with the specified widgets, with a spacing
sized margin between members
Creates a column with the specified widgets. No margins or other layouting is applied.
Creates a column with the specified widgets, with a spacing
sized margin between members
Creates a column with the specified widgets. Every member gets a default vertical margin.
Auto Trait Implementations
impl !RefUnwindSafe for Widget
impl !UnwindSafe for Widget
Blanket Implementations
Mutably borrows from an owned value. Read more
impl<T> Downcast for T where
T: Any,
impl<T> Downcast for T where
T: Any,
Convert Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
. Read more
pub fn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
pub fn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
Convert Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
. Read more
Convert &Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s. Read more
pub fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
pub fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert &mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s. Read more
type Output = T
type Output = T
Should always be Self