pub struct Divider {
pub min_before: usize,
pub min_after: usize,
pub thickness: usize,
/* private fields */
}Expand description
A border between two panes along one axis, where the mouse can grab and drag it and the keyboard can nudge it.
Positions are cells along the axis: the first pane’s size, then
thickness cells of border, then the second pane. Both panes keep at
least their minimum while the total has room for that.
Fields§
§min_before: usizeThe fewest cells the first pane takes.
min_after: usizeThe fewest cells the second pane takes.
thickness: usizeThe cells the border takes.
Implementations§
Source§impl Divider
impl Divider
Sourcepub fn new(thickness: usize) -> Divider
pub fn new(thickness: usize) -> Divider
A border thickness cells thick, with no minimum pane size.
Sourcepub fn at(self, position: usize) -> Divider
pub fn at(self, position: usize) -> Divider
Put the border at position (the first pane’s size), until dragged.
Sourcepub fn position(&self) -> Option<usize>
pub fn position(&self) -> Option<usize>
Where the border was put or dragged to, before clamping.
pub fn set_position(&mut self, position: Option<usize>)
Sourcepub fn clamp(&self, position: usize, total: usize) -> usize
pub fn clamp(&self, position: usize, total: usize) -> usize
The first pane’s size for a border at position in total cells:
both panes at least their minimum when there is room for that.
Sourcepub fn resolve(&self, total: usize, default: usize) -> usize
pub fn resolve(&self, total: usize, default: usize) -> usize
The first pane’s size in total cells: where the border was put or
dragged, clamped, or default when it has not been.
Sourcepub fn hit(&self, at: usize, first: usize) -> bool
pub fn hit(&self, at: usize, first: usize) -> bool
Whether at (a cell along the axis) is on the border when the first
pane is first cells.
Sourcepub fn press(&mut self, at: usize, first: usize) -> bool
pub fn press(&mut self, at: usize, first: usize) -> bool
A press at at: grab the border if it is there. Returns whether it
was grabbed.
Sourcepub fn drag(&mut self, at: usize, total: usize) -> bool
pub fn drag(&mut self, at: usize, total: usize) -> bool
A drag to at in total cells: move the border there if grabbed.
Returns whether it moved.
Trait Implementations§
impl Copy for Divider
impl Eq for Divider
impl StructuralPartialEq for Divider
Auto Trait Implementations§
impl Freeze for Divider
impl RefUnwindSafe for Divider
impl Send for Divider
impl Sync for Divider
impl Unpin for Divider
impl UnsafeUnpin for Divider
impl UnwindSafe for Divider
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,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.