pub struct FlexColumn {
pub gap: f64,
pub inner_padding: Insets,
pub background: Color,
pub use_panel_bg: bool,
pub fit_width: bool,
pub top_anchor: bool,
/* private fields */
}Expand description
Stacks children top-to-bottom (first child = visually topmost).
Fields§
§gap: f64§inner_padding: Insets§background: Color§use_panel_bg: boolWhen true, paint background using ctx.visuals().panel_fill
regardless of the stored background colour.
fit_width: boolWhen true, layout reports the column’s natural content
width (max over children, + horizontal padding) instead of the
full available.width. Used by auto-sized ancestors that
want the column to shrink-to-content rather than stretch.
Off by default for backward compatibility.
top_anchor: boolWhen true, children are anchored to the TOP of the column’s
inner area, with any extra height appearing as whitespace at
the BOTTOM. Off by default — legacy callers (e.g. ScrollView
content) rely on the natural-anchored layout where children
occupy the BOTTOM of their slot when oversized.
Implementations§
Source§impl FlexColumn
impl FlexColumn
pub fn new() -> Self
pub fn with_gap(self, gap: f64) -> Self
pub fn with_padding(self, p: f64) -> Self
pub fn with_inner_padding(self, p: Insets) -> Self
pub fn with_background(self, c: Color) -> Self
Sourcepub fn with_panel_bg(self) -> Self
pub fn with_panel_bg(self) -> Self
Use ctx.visuals().panel_fill as background instead of the stored color.
Sourcepub fn with_fit_width(self, fit: bool) -> Self
pub fn with_fit_width(self, fit: bool) -> Self
Opt into content-fit width — layout reports the widest
child’s natural width (+ horizontal padding) instead of the
full available width. Required when this column is the
content of an auto-sized Window; without it, wrapped Labels
claim the full available width and the window grows to the
canvas. Matches egui’s per-column shrink-to-content option.
Sourcepub fn with_top_anchor(self, on: bool) -> Self
pub fn with_top_anchor(self, on: bool) -> Self
Anchor children to the TOP of the inner area rather than the
bottom of the natural content extent. Default is bottom (the
classic Y-up “natural-anchored” placement) so callers like
ScrollView whose layout pass uses available.height ≈ ∞
keep working — they need cursor_y to be derived from natural
extent, not from the supplied (huge) available. Opt in for
containers placed inside a Resize widget or other oversized
slot where you want the visible content to start at the top
of the frame and any extra space to appear below.
pub fn with_margin(self, m: Insets) -> Self
pub fn with_h_anchor(self, h: HAnchor) -> Self
pub fn with_v_anchor(self, v: VAnchor) -> Self
pub fn with_min_size(self, s: Size) -> Self
pub fn with_max_size(self, s: Size) -> Self
Trait Implementations§
Source§impl Default for FlexColumn
impl Default for FlexColumn
Source§impl Widget for FlexColumn
impl Widget for FlexColumn
Source§fn type_name(&self) -> &'static str
fn type_name(&self) -> &'static str
Source§fn set_bounds(&mut self, b: Rect)
fn set_bounds(&mut self, b: Rect)
Source§fn children_mut(&mut self) -> &mut Vec<Box<dyn Widget>>
fn children_mut(&mut self) -> &mut Vec<Box<dyn Widget>>
Source§fn widget_base(&self) -> Option<&WidgetBase>
fn widget_base(&self) -> Option<&WidgetBase>
WidgetBase. Read moreSource§fn widget_base_mut(&mut self) -> Option<&mut WidgetBase>
fn widget_base_mut(&mut self) -> Option<&mut WidgetBase>
widget_base. Read moreSource§fn padding(&self) -> Insets
fn padding(&self) -> Insets
Insets::ZERO. Read moreSource§fn h_anchor(&self) -> HAnchor
fn h_anchor(&self) -> HAnchor
HAnchor::FIT (take natural content width).Source§fn v_anchor(&self) -> VAnchor
fn v_anchor(&self) -> VAnchor
VAnchor::FIT (take natural content height).Source§fn measure_min_height(&self, available_w: f64) -> f64
fn measure_min_height(&self, available_w: f64) -> f64
available_w for width. Read moreSource§fn layout(&mut self, available: Size) -> Size
fn layout(&mut self, available: Size) -> Size
Source§fn paint(&mut self, ctx: &mut dyn DrawCtx)
fn paint(&mut self, ctx: &mut dyn DrawCtx)
ctx. Read moreSource§fn on_event(&mut self, _: &Event) -> EventResult
fn on_event(&mut self, _: &Event) -> EventResult
EventResult::Consumed to stop bubbling. Read moreSource§fn hit_test(&self, local_pos: Point) -> bool
fn hit_test(&self, local_pos: Point) -> bool
true if local_pos (in this widget’s local coordinates) falls
inside this widget’s interactive area. Default: axis-aligned rect test.Source§fn claims_pointer_exclusively(&self, _local_pos: Point) -> bool
fn claims_pointer_exclusively(&self, _local_pos: Point) -> bool
true, hit_test_subtree stops recursing into this widget’s
children and returns this widget as the hit target. Used for floating
overlays (e.g. a scrollbar painted above its content) that must claim
the pointer before children that happen to share the same pixels.
Default: false.Source§fn hit_test_global_overlay(&self, _local_pos: Point) -> bool
fn hit_test_global_overlay(&self, _local_pos: Point) -> bool
local_pos hits an app-level overlay owned by this
widget. Unlike normal hit testing, ancestors may be missed because the
overlay is painted outside their bounds.Source§fn has_active_modal(&self) -> bool
fn has_active_modal(&self) -> bool
Source§fn on_unconsumed_key(
&mut self,
_key: &Key,
_modifiers: Modifiers,
) -> EventResult
fn on_unconsumed_key( &mut self, _key: &Key, _modifiers: Modifiers, ) -> EventResult
Source§fn is_focusable(&self) -> bool
fn is_focusable(&self) -> bool
Source§fn id(&self) -> Option<&str>
fn id(&self) -> Option<&str>
Source§fn is_visible(&self) -> bool
fn is_visible(&self) -> bool
false to suppress painting this widget and all its children.
The widget’s own paint() will not be called. Default: true.Source§fn properties(&self) -> Vec<(&'static str, String)>
fn properties(&self) -> Vec<(&'static str, String)>
Source§fn set_label_color(&mut self, _color: Color)
fn set_label_color(&mut self, _color: Color)
Label), update its foreground
colour. Default is a no-op. Composite widgets call this on their
children to retint labels without rebuilding them — used by Button
when toggling between active (white text on accent) and inactive
(theme text on subtle bg) appearances.Source§fn set_label_text(&mut self, _text: &str)
fn set_label_text(&mut self, _text: &str)
Label), update its
displayed text. Default is a no-op. Composite widgets that
own a Label child use this to push live values (e.g. an FPS
counter) into the child without bypassing the standard
backbuffered glyph cache — calling this on a Label only
invalidates the cache when the text actually changed.Source§fn as_reflect(&self) -> Option<&dyn Reflect>
fn as_reflect(&self) -> Option<&dyn Reflect>
Source§fn as_reflect_mut(&mut self) -> Option<&mut dyn Reflect>
fn as_reflect_mut(&mut self) -> Option<&mut dyn Reflect>
as_reflect. Used by the
inspector to write edits back into the live widget.Source§fn has_backbuffer(&self) -> bool
fn has_backbuffer(&self) -> bool
Source§fn compositing_layer(&mut self) -> Option<CompositingLayer>
fn compositing_layer(&mut self) -> Option<CompositingLayer>
Source§fn backbuffer_spec(&mut self) -> BackbufferSpec
fn backbuffer_spec(&mut self) -> BackbufferSpec
Source§fn backbuffer_state_mut(&mut self) -> Option<&mut BackbufferState>
fn backbuffer_state_mut(&mut self) -> Option<&mut BackbufferState>
BackbufferSpec other than BackbufferKind::None.Source§fn mark_dirty(&mut self)
fn mark_dirty(&mut self)
Source§fn backbuffer_cache_mut(&mut self) -> Option<&mut BackbufferCache>
fn backbuffer_cache_mut(&mut self) -> Option<&mut BackbufferCache>
Source§fn backbuffer_mode(&self) -> BackbufferMode
fn backbuffer_mode(&self) -> BackbufferMode
backbuffer_cache_mut] returns Some. Default
BackbufferMode::Rgba — correct for any widget.
Opt into BackbufferMode::LcdCoverage only when the widget
paints opaque content covering its full bounds.Source§fn contributes_children_to_inspector(&self) -> bool
fn contributes_children_to_inspector(&self) -> bool
Source§fn show_in_inspector(&self) -> bool
fn show_in_inspector(&self) -> bool
false to hide this widget (and its subtree) from the inspector
node snapshot entirely. Intended for zero-size utility widgets such
as layout-time watchers / tickers / invisible composers — they bloat
the inspector tree without providing user-relevant information and,
at scale, can make the inspector’s per-frame tree rebuild expensive.Source§fn lcd_preference(&self) -> Option<bool>
fn lcd_preference(&self) -> Option<bool>
Source§fn paint_overlay(&mut self, _ctx: &mut dyn DrawCtx)
fn paint_overlay(&mut self, _ctx: &mut dyn DrawCtx)
Source§fn finish_paint(&mut self, _ctx: &mut dyn DrawCtx)
fn finish_paint(&mut self, _ctx: &mut dyn DrawCtx)
paint, child painting, and optional overlay painting. Read moreSource§fn paint_global_overlay(&mut self, _ctx: &mut dyn DrawCtx)
fn paint_global_overlay(&mut self, _ctx: &mut dyn DrawCtx)
Source§fn clip_children_rect(&self) -> Option<(f64, f64, f64, f64)>
fn clip_children_rect(&self) -> Option<(f64, f64, f64, f64)>
paint_subtree applies this clip before recursing into
children, then restores the previous clip state afterward. The clip does
not affect paint_overlay, which runs after the clip is removed. Read moreSource§fn enforce_integer_bounds(&self) -> bool
fn enforce_integer_bounds(&self) -> bool
paint_subtree should snap this widget’s incoming
translation to the physical pixel grid. Read moreSource§fn take_raise_request(&mut self) -> bool
fn take_raise_request(&mut self) -> bool
crate::widgets::Stack) call this on each
child at the start of layout(). A widget that returns true is
moved to the END of its parent’s child list — painted last, i.e.
raised to the top of the z-order. take_ semantics: the call is
also expected to clear the request so the child doesn’t keep
getting raised every frame. Read moreSource§fn needs_draw(&self) -> bool
fn needs_draw(&self) -> bool
true if this widget, or any visible descendant, has an ongoing
draw need that should keep the host drawing. Read moreSource§fn next_draw_deadline(&self) -> Option<Instant>
fn next_draw_deadline(&self) -> Option<Instant>
None = no scheduled wake.
The host loop turns a Some(t) into ControlFlow::WaitUntil(t) so
e.g. a cursor blink fires without continuous polling. Read moreAuto Trait Implementations§
impl Freeze for FlexColumn
impl !RefUnwindSafe for FlexColumn
impl !Send for FlexColumn
impl !Sync for FlexColumn
impl Unpin for FlexColumn
impl UnsafeUnpin for FlexColumn
impl !UnwindSafe for FlexColumn
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
Source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
ReadEndian::read_from_little_endian().