Skip to main content

ContainerViewMut

Struct ContainerViewMut 

Source
pub struct ContainerViewMut<'a> { /* private fields */ }
Expand description

Mutable view into a container borrowed from a handle.

Methods from Deref<Target = Container>§

Source

pub fn push_clip_rect(&mut self, rect: Recti)

Pushes a new clip rectangle combined with the previous clip.

Source

pub fn pop_clip_rect(&mut self)

Restores the previous clip rectangle from the stack.

Source

pub fn get_clip_rect(&mut self) -> Recti

Returns the active clip rectangle, or an unclipped rect when the stack is empty.

Source

pub fn check_clip(&mut self, r: Recti) -> Clip

Determines whether r is fully visible, partially visible, or completely clipped.

Source

pub fn set_clip(&mut self, rect: Recti)

Adjusts the current clip rectangle.

Source

pub fn set_focus(&mut self, widget_id: Option<WidgetId>)

Manually updates which widget owns focus.

Source

pub fn draw_rect(&mut self, rect: Recti, color: Color)

Records a filled rectangle draw command.

Source

pub fn draw_box(&mut self, r: Recti, color: Color)

Records a rectangle outline.

Source

pub fn draw_text(&mut self, font: FontId, str: &str, pos: Vec2i, color: Color)

Records a text draw command.

Source

pub fn draw_icon(&mut self, id: IconId, rect: Recti, color: Color)

Records an icon draw command.

Source

pub fn draw_slot(&mut self, id: SlotId, rect: Recti, color: Color)

Records a slot draw command.

Source

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.

Source

pub fn text(&mut self, text: &str)

Draws multi-line text within the container without wrapping.

Source

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.

Source

pub fn draw_frame(&mut self, rect: Recti, colorid: ControlColor)

Draws a frame and optional border using the specified color.

Source

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.

Source

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.

Source

pub fn draw_control_text( &mut self, str: &str, rect: Recti, colorid: ControlColor, opt: WidgetOption, )

Draws widget text with the appropriate alignment flags.

Source

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.

Source

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.

Source

pub fn finish(&mut self)

Resets transient per-frame state after widgets have been processed.

Source

pub fn rect(&self) -> Recti

Returns the outer container rectangle.

Source

pub fn set_rect(&mut self, rect: Recti)

Sets the outer container rectangle.

Source

pub fn body(&self) -> Recti

Returns the inner container body rectangle.

Source

pub fn scroll(&self) -> Vec2i

Returns the current scroll offset.

Source

pub fn set_scroll(&mut self, scroll: Vec2i)

Sets the current scroll offset.

Source

pub fn content_size(&self) -> Vec2i

Returns the content size derived from layout traversal.

Source

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.

Source

pub fn treenode<F: FnOnce(&mut Self)>( &mut self, state: &mut Node, f: F, ) -> NodeStateValue

Builds a tree node with automatic indentation while expanded.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

pub fn set_style(&mut self, style: Style)

Replaces the container’s style.

Source

pub fn get_style(&self) -> Style

Returns a copy of the current style.

Source

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.

Source

pub fn button(&mut self, state: &mut Button) -> ResourceState

Draws a button using the provided persistent state.

Source

pub fn list_item(&mut self, state: &mut ListItem) -> ResourceState

Renders a list entry that only highlights while hovered or active.

Source

pub fn list_box(&mut self, state: &mut ListBox) -> ResourceState

Shim for list boxes that only fills on hover or click.

Source

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.

Source

pub fn checkbox(&mut self, state: &mut Checkbox) -> ResourceState

Draws a checkbox labeled with label and toggles state when clicked.

Source

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.

Source

pub fn textbox(&mut self, state: &mut Textbox) -> ResourceState

Draws a textbox using the next available layout cell.

Source

pub fn textarea(&mut self, state: &mut TextArea) -> ResourceState

Draws a multi-line text area using the next available layout cell.

Source

pub fn slider(&mut self, state: &mut Slider) -> ResourceState

Draws a horizontal slider bound to state.

Source

pub fn number(&mut self, state: &mut Number) -> ResourceState

Draws a numeric input that can be edited via keyboard or by dragging.

Trait Implementations§

Source§

impl<'a> Deref for ContainerViewMut<'a>

Source§

type Target = Container

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Self::Target

Dereferences the value.
Source§

impl<'a> DerefMut for ContainerViewMut<'a>

Source§

fn deref_mut(&mut self) -> &mut Self::Target

Mutably dereferences the value.

Auto Trait Implementations§

§

impl<'a> Freeze for ContainerViewMut<'a>

§

impl<'a> !RefUnwindSafe for ContainerViewMut<'a>

§

impl<'a> !Send for ContainerViewMut<'a>

§

impl<'a> !Sync for ContainerViewMut<'a>

§

impl<'a> Unpin for ContainerViewMut<'a>

§

impl<'a> UnsafeUnpin for ContainerViewMut<'a>

§

impl<'a> !UnwindSafe for ContainerViewMut<'a>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.