pub struct GridLayout {
pub title: &'static str,
pub version: &'static str,
pub cols: u32,
pub sections: Vec<(u32, &'static str)>,
pub widgets: Vec<GridWidget>,
pub cell_size: f32,
pub width: u32,
pub height: u32,
}Expand description
Grid-based layout for a plugin UI.
Fields§
§title: &'static str§version: &'static str§cols: u32Number of columns in the grid.
sections: Vec<(u32, &'static str)>Section labels positioned above specific rows: (row_index, label).
widgets: Vec<GridWidget>All widgets placed in the grid.
cell_size: f32Cell size in pixels (width and height of one grid cell).
width: u32Computed pixel width.
height: u32Computed pixel height.
Implementations§
Source§impl GridLayout
impl GridLayout
Sourcepub fn build(
title: &'static str,
version: &'static str,
cols: u32,
cell_size: f32,
widgets: Vec<GridWidget>,
breaks: Vec<(usize, &'static str)>,
) -> Self
pub fn build( title: &'static str, version: &'static str, cols: u32, cell_size: f32, widgets: Vec<GridWidget>, breaks: Vec<(usize, &'static str)>, ) -> Self
Build a grid layout from auto-flow widgets and section breaks.
breaks maps widget indices to section labels: when auto-flow reaches
that index, it starts a new row and records the section label above it.
Sourcepub fn compute_size(&self) -> (u32, u32)
pub fn compute_size(&self) -> (u32, u32)
Compute the window size from the grid.
Sourcepub fn auto_flow_with_breaks(&mut self, breaks: &[(usize, &'static str)])
pub fn auto_flow_with_breaks(&mut self, breaks: &[(usize, &'static str)])
Auto-flow placement with section breaks.
Each break is (widget_index, label): when the cursor reaches that
widget index, it advances to the next row and records a section label.
Trait Implementations§
Source§impl Clone for GridLayout
impl Clone for GridLayout
Source§fn clone(&self) -> GridLayout
fn clone(&self) -> GridLayout
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for GridLayout
impl Debug for GridLayout
Source§impl From<PluginLayout> for GridLayout
impl From<PluginLayout> for GridLayout
Source§fn from(pl: PluginLayout) -> Self
fn from(pl: PluginLayout) -> Self
Converts to this type from the input type.
Auto Trait Implementations§
impl Freeze for GridLayout
impl RefUnwindSafe for GridLayout
impl Send for GridLayout
impl Sync for GridLayout
impl Unpin for GridLayout
impl UnsafeUnpin for GridLayout
impl UnwindSafe for GridLayout
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
Mutably borrows from an owned value. Read more