|
|
|
@ -60,6 +60,38 @@ bitflags! {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// Macro that constructs and returns a [`Borders`] object from TOP, BOTTOM, LEFT, RIGHT, and ALL.
|
|
|
|
|
/// Internally it creates an empty `Borders` object and then inserts each bit flag specified
|
|
|
|
|
/// into it using `Borders::insert()`.
|
|
|
|
|
///
|
|
|
|
|
/// ## Examples
|
|
|
|
|
///
|
|
|
|
|
///```
|
|
|
|
|
/// # use tui::widgets::{Block};
|
|
|
|
|
/// # use tui::style::{Style, Color};
|
|
|
|
|
/// Block::default()
|
|
|
|
|
/// //Construct a `Borders` object and use it in place
|
|
|
|
|
/// .borders(border!(TOP, BOTTOM))
|
|
|
|
|
///
|
|
|
|
|
/// //`border!` can be called with any order of individual sides
|
|
|
|
|
/// let bottom_first = border!(BOTTOM, LEFT, TOP);
|
|
|
|
|
/// //with the ALL keyword which works as expected
|
|
|
|
|
/// let all = border!(ALL);
|
|
|
|
|
/// //or with nothing at all to return `Borders::empty()`.
|
|
|
|
|
/// let empty = border!();
|
|
|
|
|
///
|
|
|
|
|
///```
|
|
|
|
|
#[macro_export]
|
|
|
|
|
macro_rules! border {
|
|
|
|
|
( $($b:tt), *) => {{
|
|
|
|
|
let mut border = Borders::empty();
|
|
|
|
|
$(
|
|
|
|
|
border.insert(Borders::$b);
|
|
|
|
|
)*
|
|
|
|
|
border
|
|
|
|
|
}};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// Base requirements for a Widget
|
|
|
|
|
pub trait Widget {
|
|
|
|
|
/// Draws the current state of the widget in the given buffer. That the only method required to
|
|
|
|
|