pub struct BoxBorder { /* private fields */ }Expand description
A single-line box border drawn around a Rect.
The interior of the rectangle is not touched. area must be at least
2×2, or Widget::render is a no-op. style defaults to Theme::DARK (as if
BoxBorder::theme had been called); set it with BoxBorder::style.
§Examples
use retroglyph_core::grid::{Grid, Rect};
use retroglyph_ui::{BoxBorder, Surface, Widget};
let area = Rect::new(0, 0, 10, 4);
let mut grid = Grid::new(10, 4);
BoxBorder::new().render(&mut Surface::new(&mut grid, area, 0));Implementations§
Source§impl BoxBorder
impl BoxBorder
Sourcepub fn new() -> Self
pub fn new() -> Self
A box border styled from Theme::DARK (as if BoxBorder::theme had been called); see
BoxBorder::style to override it.
Sourcepub const fn border_type(self, border_type: BorderType) -> Self
pub const fn border_type(self, border_type: BorderType) -> Self
Set which box-drawing glyphs the border is drawn with. Defaults to
BorderType::Plain.
Sourcepub fn theme(self, theme: Theme) -> Self
pub fn theme(self, theme: Theme) -> Self
Sets style to theme.border on theme.panel_bg.
The background is set explicitly for the same reason, and with the same caveat, as
super::Gauge::theme; see its doc comment for the full explanation. Unlike
super::Panel, which also owns and fills its own interior, a standalone BoxBorder
genuinely doesn’t know what it’s drawn over: theme.panel_bg is the closest default,
matching what a themed super::Panel/super::Modal around it would use. Drawing this
border directly on the raw screen background instead needs a manual BoxBorder::style
override afterwards.
Call before any manual BoxBorder::style override you want to keep.
Sourcepub fn theme_on(self, theme: Theme, bg: Color) -> Self
pub fn theme_on(self, theme: Theme, bg: Color) -> Self
Same as BoxBorder::theme, but style is drawn on bg instead of theme.panel_bg –
for a border drawn directly on a backdrop other than a themed super::Panel/
super::Modal’s fill. BoxBorder::theme is exactly theme_on(theme, theme.panel_bg).
Trait Implementations§
impl Copy for BoxBorder
Auto Trait Implementations§
impl Freeze for BoxBorder
impl RefUnwindSafe for BoxBorder
impl Send for BoxBorder
impl Sync for BoxBorder
impl Unpin for BoxBorder
impl UnsafeUnpin for BoxBorder
impl UnwindSafe for BoxBorder
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<C> WithAlpha for Cwhere
C: Copy,
impl<C> WithAlpha for Cwhere
C: Copy,
§fn with_alpha_first<A>(self, alpha: A) -> AlphaFirst<A, Self>
fn with_alpha_first<A>(self, alpha: A) -> AlphaFirst<A, Self>
self with alpha, storing alpha before the color in memory
(see [AlphaFirst]).§fn with_alpha_last<A>(self, alpha: A) -> AlphaLast<A, Self>
fn with_alpha_last<A>(self, alpha: A) -> AlphaLast<A, Self>
self with alpha, storing alpha after the color in memory
(see [AlphaLast]).