pub struct PushSpecs {
pub side: Side,
pub width: Option<f32>,
pub height: Option<f32>,
pub hidden: bool,
pub cluster: bool,
}Expand description
Information on how a Widget should be pushed onto another.
This information is composed of four parts:
- A side to push;
- An optional width;
- An optional height;
- Wether to hide it by default;
- wether to cluster the
Widget
Constraints are demands that must be met by the widget’s
Area, on a best effort basis.
So, for example, if the PushSpecs are:
use duat::prelude::*;
let specs = ui::PushSpecs {
side: ui::Side::Left,
width: Some(3.0),
height: None,
hidden: false,
cluster: true,
};Then the widget should be pushed to the left, with a width of 3, an unspecified height, not hidden by default and clustered if possible. Note that you can shorten the definition above:
use duat::prelude::*;
let specs = ui::PushSpecs {
side: ui::Side::Left,
width: Some(3.0),
..Default::default()
};Since the remaining values are the default.
Fields§
§side: Side§width: Option<f32>A width (in character cells) for this Widget.
Note that this may be ignored if it is not possible to create an area big (or small) enough.
height: Option<f32>A height (in lines) for this Widget.
Note that this may be ignored if it is not possible to create an area big (or small) enough.
Hide this Widget by default.
You can call Area::hide or Area::reveal to toggle
this property.
cluster: boolCluster this Widget when pushing.
This makes it so, if the main Widget is moved or deleted,
then this one will follow. Useful for things like
LineNumbers, since they should follow their Buffer
around.
Implementations§
Source§impl PushSpecs
impl PushSpecs
Sourcepub const fn axis(&self) -> Axis
pub const fn axis(&self) -> Axis
The Axis where it will be pushed.
- left/right:
Axis::Horizontal. - above/below:
Axis::Vertical.
Sourcepub const fn comes_earlier(&self) -> bool
pub const fn comes_earlier(&self) -> bool
Wether this “comes earlier” on the screen.
This returns true if self.side() == Side::Left || self.side() == Side::Above, since that is considered “earlier” on
screens.