pub(crate) struct Placer {
grid: Option<GridLayout>,
layout: Layout,
region: Region,
}
Fields§
§grid: Option<GridLayout>
If set this will take precedence over crate::layout
.
layout: Layout
§region: Region
Implementations§
source§impl Placer
impl Placer
pub(crate) fn new(max_rect: Rect, layout: Layout) -> Self
pub(crate) fn set_grid(&mut self, grid: GridLayout)
pub(crate) fn save_grid(&mut self)
pub(crate) fn grid(&self) -> Option<&GridLayout>
pub(crate) fn is_grid(&self) -> bool
pub(crate) fn layout(&self) -> &Layout
pub(crate) fn prefer_right_to_left(&self) -> bool
pub(crate) fn min_rect(&self) -> Rect
pub(crate) fn max_rect(&self) -> Rect
pub(crate) fn force_set_min_rect(&mut self, min_rect: Rect)
pub(crate) fn cursor(&self) -> Rect
pub(crate) fn set_cursor(&mut self, cursor: Rect)
source§impl Placer
impl Placer
pub(crate) fn align_size_within_rect(&self, size: Vec2, outer: Rect) -> Rect
pub(crate) fn available_rect_before_wrap(&self) -> Rect
sourcepub(crate) fn available_size(&self) -> Vec2
pub(crate) fn available_size(&self) -> Vec2
Amount of space available for a widget. For wrapping layouts, this is the maximum (after wrap).
sourcepub(crate) fn next_space(&self, child_size: Vec2, item_spacing: Vec2) -> Rect
pub(crate) fn next_space(&self, child_size: Vec2, item_spacing: Vec2) -> Rect
Returns where to put the next widget that is of the given size.
The returned frame_rect
will always be justified along the cross axis.
This is what you then pass to advance_after_rects
.
Use justify_and_align
to get the inner widget_rect
.
sourcepub(crate) fn next_widget_position(&self) -> Pos2
pub(crate) fn next_widget_position(&self) -> Pos2
Where do we expect a zero-sized widget to be placed?
sourcepub(crate) fn justify_and_align(&self, rect: Rect, child_size: Vec2) -> Rect
pub(crate) fn justify_and_align(&self, rect: Rect, child_size: Vec2) -> Rect
Apply justify or alignment after calling next_space
.
sourcepub(crate) fn advance_cursor(&mut self, amount: f32)
pub(crate) fn advance_cursor(&mut self, amount: f32)
Advance the cursor by this many points.
Self::min_rect
will expand to contain the cursor.
sourcepub(crate) fn advance_after_rects(
&mut self,
frame_rect: Rect,
widget_rect: Rect,
item_spacing: Vec2,
)
pub(crate) fn advance_after_rects( &mut self, frame_rect: Rect, widget_rect: Rect, item_spacing: Vec2, )
Advance cursor after a widget was added to a specific rectangle
and expand the region min_rect
.
frame_rect
: the frame inside which a widget was e.g. centeredwidget_rect
: the actual rect used by the widget
sourcepub(crate) fn end_row(&mut self, item_spacing: Vec2, painter: &Painter)
pub(crate) fn end_row(&mut self, item_spacing: Vec2, painter: &Painter)
Move to the next row in a grid layout or wrapping layout. Otherwise does nothing.
sourcepub(crate) fn set_row_height(&mut self, height: f32)
pub(crate) fn set_row_height(&mut self, height: f32)
Set row height in horizontal wrapping layout.
source§impl Placer
impl Placer
sourcepub(crate) fn expand_to_include_rect(&mut self, rect: Rect)
pub(crate) fn expand_to_include_rect(&mut self, rect: Rect)
Expand the min_rect
and max_rect
of this ui to include a child at the given rect.
sourcepub(crate) fn expand_to_include_x(&mut self, x: f32)
pub(crate) fn expand_to_include_x(&mut self, x: f32)
Expand the min_rect
and max_rect
of this ui to include a child at the given x-coordinate.
sourcepub(crate) fn expand_to_include_y(&mut self, y: f32)
pub(crate) fn expand_to_include_y(&mut self, y: f32)
Expand the min_rect
and max_rect
of this ui to include a child at the given y-coordinate.
fn next_widget_space_ignore_wrap_justify(&self, size: Vec2) -> Rect
sourcepub(crate) fn set_max_width(&mut self, width: f32)
pub(crate) fn set_max_width(&mut self, width: f32)
Set the maximum width of the ui. You won’t be able to shrink it below the current minimum size.
sourcepub(crate) fn set_max_height(&mut self, height: f32)
pub(crate) fn set_max_height(&mut self, height: f32)
Set the maximum height of the ui. You won’t be able to shrink it below the current minimum size.
sourcepub(crate) fn set_min_width(&mut self, width: f32)
pub(crate) fn set_min_width(&mut self, width: f32)
Set the minimum width of the ui. This can’t shrink the ui, only make it larger.
sourcepub(crate) fn set_min_height(&mut self, height: f32)
pub(crate) fn set_min_height(&mut self, height: f32)
Set the minimum height of the ui. This can’t shrink the ui, only make it larger.