Struct requestty_ui::layout::Layout [−][src]
pub struct Layout {
pub line_offset: u16,
pub offset_x: u16,
pub offset_y: u16,
pub width: u16,
pub height: u16,
pub max_height: u16,
pub render_region: RenderRegion,
}Expand description
Layout represents a portion of the screen that is available to be rendered to.
Assume the highlighted part of the block below is the place available for rendering in the given box
____________
| |
| ███████|
| ██████████|
| ██████████|
'------------'Fields
line_offset: u16 ____________
| vvv-- line_offset
| ███████|
| ██████████|
| ██████████|
'------------'offset_x: u16 ____________
|vv-- offset_x
| ███████|
| ██████████|
| ██████████|
'------------'offset_y: u16 .-- offset_y
|'> |
| ███████|
| ██████████|
| ██████████|
'------------'width: u16 ____________
| |
| ███████|
| ██████████|
| ██████████|
'------------'
^^^^^^^^^^^^-- widthheight: u16 _____ height --.
| | <'
| ███████| <'
| ██████████| <'
| ██████████| <'
'------------'max_height: u16 ____________
|.-- max_height
|'> ███████|
|'>██████████|
|'>██████████|
'------------'render_region: RenderRegionThe region to render if full text cannot be rendered
Implementations
Creates a new Layout with given line_offset.
Creates a new Layout with new offset_x and offset_y.
Creates a new Layout with new render_region.
Creates a new Layout with new max_height.
Creates a new Layout that represents a region past the cursor_pos. cursor_pos is
relative to offset_x and offset_y.
Converts a cursor_pos relative to (offset_x, offset_y) to be relative to (0, 0)
Gets the width of renderable space on the first line.
____________
| vvvvvvv-- line_width
| ███████|
| ██████████|
| ██████████|
'------------'Gets the width of renderable space on subsequent lines.
____________
| vvvvvvvvvv-- available_width
| ███████|
| ██████████|
| ██████████|
'------------'Gets the starting line number for the given height taking into account the max_height
and the render_region.
If the height of the widget to render is 5 and the max_height is 2, then the start would be:
RenderRegion::Top: 0RenderRegion::Middle: 1RenderRegion::Top: 3
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for Layout
impl UnwindSafe for Layout
Blanket Implementations
Mutably borrows from an owned value. Read more