pub struct ContainerViewMut<'a> { /* private fields */ }Expand description
Mutable view into a container borrowed from a handle.
Methods from Deref<Target = Container>§
Sourcepub fn push_clip_rect(&mut self, rect: Recti)
pub fn push_clip_rect(&mut self, rect: Recti)
Pushes a new clip rectangle combined with the previous clip.
Sourcepub fn pop_clip_rect(&mut self)
pub fn pop_clip_rect(&mut self)
Restores the previous clip rectangle from the stack.
Sourcepub fn get_clip_rect(&mut self) -> Recti
pub fn get_clip_rect(&mut self) -> Recti
Returns the active clip rectangle, or an unclipped rect when the stack is empty.
Sourcepub fn check_clip(&mut self, r: Recti) -> Clip
pub fn check_clip(&mut self, r: Recti) -> Clip
Determines whether r is fully visible, partially visible, or completely clipped.
Sourcepub fn set_focus(&mut self, widget_id: Option<WidgetId>)
pub fn set_focus(&mut self, widget_id: Option<WidgetId>)
Manually updates which widget owns focus.
Sourcepub fn draw_rect(&mut self, rect: Recti, color: Color)
pub fn draw_rect(&mut self, rect: Recti, color: Color)
Records a filled rectangle draw command.
Sourcepub fn draw_text(&mut self, font: FontId, str: &str, pos: Vec2i, color: Color)
pub fn draw_text(&mut self, font: FontId, str: &str, pos: Vec2i, color: Color)
Records a text draw command.
Sourcepub fn draw_icon(&mut self, id: IconId, rect: Recti, color: Color)
pub fn draw_icon(&mut self, id: IconId, rect: Recti, color: Color)
Records an icon draw command.
Sourcepub fn draw_slot(&mut self, id: SlotId, rect: Recti, color: Color)
pub fn draw_slot(&mut self, id: SlotId, rect: Recti, color: Color)
Records a slot draw command.
Sourcepub fn draw_slot_with_function(
&mut self,
id: SlotId,
rect: Recti,
color: Color,
f: Rc<dyn Fn(usize, usize) -> Color4b>,
)
pub fn draw_slot_with_function( &mut self, id: SlotId, rect: Recti, color: Color, f: Rc<dyn Fn(usize, usize) -> Color4b>, )
Records a slot redraw that uses a callback to fill pixels.
Sourcepub fn text(&mut self, text: &str)
pub fn text(&mut self, text: &str)
Draws multi-line text within the container without wrapping.
Sourcepub fn text_with_wrap(&mut self, text: &str, wrap: TextWrap)
pub fn text_with_wrap(&mut self, text: &str, wrap: TextWrap)
Draws multi-line text within the container using the provided wrapping mode. The block is rendered inside an internal column with zero spacing so consecutive lines sit back-to-back while the outer widget spacing/padding remains intact.
Sourcepub fn draw_frame(&mut self, rect: Recti, colorid: ControlColor)
pub fn draw_frame(&mut self, rect: Recti, colorid: ControlColor)
Draws a frame and optional border using the specified color.
Sourcepub fn draw_widget_frame(
&mut self,
widget_id: WidgetId,
rect: Recti,
colorid: ControlColor,
opt: WidgetOption,
)
pub fn draw_widget_frame( &mut self, widget_id: WidgetId, rect: Recti, colorid: ControlColor, opt: WidgetOption, )
Draws a widget background, applying hover/focus accents when needed.
Sourcepub fn draw_container_frame(
&mut self,
widget_id: WidgetId,
rect: Recti,
colorid: ControlColor,
opt: ContainerOption,
)
pub fn draw_container_frame( &mut self, widget_id: WidgetId, rect: Recti, colorid: ControlColor, opt: ContainerOption, )
Draws a container frame, skipping rendering when the option disables it.
Sourcepub fn draw_control_text(
&mut self,
str: &str,
rect: Recti,
colorid: ControlColor,
opt: WidgetOption,
)
pub fn draw_control_text( &mut self, str: &str, rect: Recti, colorid: ControlColor, opt: WidgetOption, )
Draws widget text with the appropriate alignment flags.
Sourcepub fn mouse_over(&mut self, rect: Recti, in_hover_root: bool) -> bool
pub fn mouse_over(&mut self, rect: Recti, in_hover_root: bool) -> bool
Returns true if the cursor is inside rect and the container owns the hover root.
Sourcepub fn update_control<W: Widget>(
&mut self,
widget_id: WidgetId,
rect: Recti,
state: &W,
) -> ControlState
pub fn update_control<W: Widget>( &mut self, widget_id: WidgetId, rect: Recti, state: &W, ) -> ControlState
Updates hover/focus state for the widget described by widget_id and optionally consumes scroll.
Sourcepub fn set_scroll(&mut self, scroll: Vec2i)
pub fn set_scroll(&mut self, scroll: Vec2i)
Sets the current scroll offset.
Sourcepub fn content_size(&self) -> Vec2i
pub fn content_size(&self) -> Vec2i
Returns the content size derived from layout traversal.
Sourcepub fn header<F: FnOnce(&mut Self)>(
&mut self,
state: &mut Node,
f: F,
) -> NodeStateValue
pub fn header<F: FnOnce(&mut Self)>( &mut self, state: &mut Node, f: F, ) -> NodeStateValue
Builds a collapsible header row that executes f when expanded.
Sourcepub fn treenode<F: FnOnce(&mut Self)>(
&mut self,
state: &mut Node,
f: F,
) -> NodeStateValue
pub fn treenode<F: FnOnce(&mut Self)>( &mut self, state: &mut Node, f: F, ) -> NodeStateValue
Builds a tree node with automatic indentation while expanded.
Sourcepub fn push_container_body(
&mut self,
body: Recti,
_opt: ContainerOption,
bopt: WidgetBehaviourOption,
)
pub fn push_container_body( &mut self, body: Recti, _opt: ContainerOption, bopt: WidgetBehaviourOption, )
Configures layout state for the container’s client area, handling scrollbars when necessary.
Sourcepub fn panel<F: FnOnce(&mut ContainerHandle)>(
&mut self,
panel: &mut ContainerHandle,
opt: ContainerOption,
bopt: WidgetBehaviourOption,
f: F,
)
pub fn panel<F: FnOnce(&mut ContainerHandle)>( &mut self, panel: &mut ContainerHandle, opt: ContainerOption, bopt: WidgetBehaviourOption, f: F, )
Embeds another container handle inside the current layout.
Sourcepub fn with_row<F: FnOnce(&mut Self)>(
&mut self,
widths: &[SizePolicy],
height: SizePolicy,
f: F,
)
pub fn with_row<F: FnOnce(&mut Self)>( &mut self, widths: &[SizePolicy], height: SizePolicy, f: F, )
Temporarily overrides the row definition and restores it after f executes.
Sourcepub fn stack<F: FnOnce(&mut Self)>(&mut self, height: SizePolicy, f: F)
pub fn stack<F: FnOnce(&mut Self)>(&mut self, height: SizePolicy, f: F)
Temporarily uses a vertical stack flow and restores the previous flow after f executes.
Each next_cell/widget call in the scope gets a dedicated row using height.
Width defaults to Remainder(0) so cells fill available horizontal space.
Sourcepub fn stack_direction<F: FnOnce(&mut Self)>(
&mut self,
height: SizePolicy,
direction: StackDirection,
f: F,
)
pub fn stack_direction<F: FnOnce(&mut Self)>( &mut self, height: SizePolicy, direction: StackDirection, f: F, )
Same as Container::stack, but controls whether items are emitted top-down or bottom-up.
Sourcepub fn stack_with_width<F: FnOnce(&mut Self)>(
&mut self,
width: SizePolicy,
height: SizePolicy,
f: F,
)
pub fn stack_with_width<F: FnOnce(&mut Self)>( &mut self, width: SizePolicy, height: SizePolicy, f: F, )
Same as Container::stack, but allows overriding the stack cell width policy.
Sourcepub fn stack_with_width_direction<F: FnOnce(&mut Self)>(
&mut self,
width: SizePolicy,
height: SizePolicy,
direction: StackDirection,
f: F,
)
pub fn stack_with_width_direction<F: FnOnce(&mut Self)>( &mut self, width: SizePolicy, height: SizePolicy, direction: StackDirection, f: F, )
Same as Container::stack_with_width, but controls whether items are emitted top-down or bottom-up.
Sourcepub fn column<F: FnOnce(&mut Self)>(&mut self, f: F)
pub fn column<F: FnOnce(&mut Self)>(&mut self, f: F)
Creates a nested column scope where each call to next_cell yields a single column.
Sourcepub fn next_cell(&mut self) -> Recti
pub fn next_cell(&mut self) -> Recti
Returns the next raw layout cell rectangle.
Unlike widget helper methods (button, textbox, etc.), this does not consult
a widget’s preferred_size; it uses only the current row/column policies.
Sourcepub fn label(&mut self, text: &str)
pub fn label(&mut self, text: &str)
Displays static text using the default text color.
This helper uses intrinsic text metrics to request a preferred cell size.
Draws a button using the provided persistent state.
Sourcepub fn list_item(&mut self, state: &mut ListItem) -> ResourceState
pub fn list_item(&mut self, state: &mut ListItem) -> ResourceState
Renders a list entry that only highlights while hovered or active.
Sourcepub fn list_box(&mut self, state: &mut ListBox) -> ResourceState
pub fn list_box(&mut self, state: &mut ListBox) -> ResourceState
Shim for list boxes that only fills on hover or click.
Sourcepub fn combo_box<S: AsRef<str>>(
&mut self,
state: &mut Combo,
items: &[S],
) -> (Recti, bool, ResourceState)
pub fn combo_box<S: AsRef<str>>( &mut self, state: &mut Combo, items: &[S], ) -> (Recti, bool, ResourceState)
Draws the combo box header, clamps the selected index, and returns the popup anchor.
The caller is responsible for opening the popup and updating state.selected from its list.
Sourcepub fn checkbox(&mut self, state: &mut Checkbox) -> ResourceState
pub fn checkbox(&mut self, state: &mut Checkbox) -> ResourceState
Draws a checkbox labeled with label and toggles state when clicked.
Sourcepub fn custom_render_widget<F: FnMut(Dimensioni, &CustomRenderArgs) + 'static>(
&mut self,
state: &mut Custom,
f: F,
)
pub fn custom_render_widget<F: FnMut(Dimensioni, &CustomRenderArgs) + 'static>( &mut self, state: &mut Custom, f: F, )
Allocates a widget cell from Custom state preferred size and hands rendering control to user code.
Sourcepub fn textbox(&mut self, state: &mut Textbox) -> ResourceState
pub fn textbox(&mut self, state: &mut Textbox) -> ResourceState
Draws a textbox using the next available layout cell.
Sourcepub fn textarea(&mut self, state: &mut TextArea) -> ResourceState
pub fn textarea(&mut self, state: &mut TextArea) -> ResourceState
Draws a multi-line text area using the next available layout cell.
Sourcepub fn slider(&mut self, state: &mut Slider) -> ResourceState
pub fn slider(&mut self, state: &mut Slider) -> ResourceState
Draws a horizontal slider bound to state.
Sourcepub fn number(&mut self, state: &mut Number) -> ResourceState
pub fn number(&mut self, state: &mut Number) -> ResourceState
Draws a numeric input that can be edited via keyboard or by dragging.