pub struct Split<'a, M> { /* private fields */ }Expand description
Two children side by side (Split::horizontal) or one above the other
(Split::vertical), with a border between them. The border drags with
the mouse (#476’s preview border, generalised, #479) and moves with
Alt+H/Alt+L (side by side) or Alt+K/Alt+J (stacked); each pane keeps its
minimum size. Tab moves focus between the panes.
Implementations§
Source§impl<'a, M> Split<'a, M>
impl<'a, M> Split<'a, M>
Sourcepub fn horizontal(
left: impl Component<Output = M> + 'a,
right: impl Component<Output = M> + 'a,
) -> Split<'a, M>
pub fn horizontal( left: impl Component<Output = M> + 'a, right: impl Component<Output = M> + 'a, ) -> Split<'a, M>
left and right, side by side.
Sourcepub fn vertical(
top: impl Component<Output = M> + 'a,
bottom: impl Component<Output = M> + 'a,
) -> Split<'a, M>
pub fn vertical( top: impl Component<Output = M> + 'a, bottom: impl Component<Output = M> + 'a, ) -> Split<'a, M>
top above bottom. The split takes the whole height.
Sourcepub fn ratio(self, percent: u8) -> Self
pub fn ratio(self, percent: u8) -> Self
The first pane’s share, in percent, until the border is moved (default 50).
Sourcepub fn at(self, cells: usize) -> Self
pub fn at(self, cells: usize) -> Self
Put the border after cells of the first pane, until moved.
Sourcepub fn mins(self, first: usize, second: usize) -> Self
pub fn mins(self, first: usize, second: usize) -> Self
The first pane at least first cells and the second at least
second.
Sourcepub fn on(
self,
action: &str,
keys: impl IntoIterator<Item = Key>,
description: &str,
handler: impl FnMut() -> Flow<M> + 'a,
) -> Self
pub fn on( self, action: &str, keys: impl IntoIterator<Item = Key>, description: &str, handler: impl FnMut() -> Flow<M> + 'a, ) -> Self
Run handler when one of keys bubbles up unused by the
focused child: an action of yours, listed in the keymap under
this container’s context.
Sourcepub fn shortcut(
self,
action: &str,
keys: impl IntoIterator<Item = Key>,
description: &str,
handler: impl FnMut() -> Flow<M> + 'a,
) -> Self
pub fn shortcut( self, action: &str, keys: impl IntoIterator<Item = Key>, description: &str, handler: impl FnMut() -> Flow<M> + 'a, ) -> Self
Run handler when one of keys is pressed, before the focused
child sees it.
Sourcepub fn rebind(self, action: &str, keys: impl IntoIterator<Item = Key>) -> Self
pub fn rebind(self, action: &str, keys: impl IntoIterator<Item = Key>) -> Self
Make keys do this container’s action (focus-next, and the
container’s own); no keys unbinds it.
Sourcepub fn own_keymap(&self) -> &Keymap
pub fn own_keymap(&self) -> &Keymap
This container’s own bindings, without its children’s.
Sourcepub fn with_mouse(self, on: bool) -> Self
pub fn with_mouse(self, on: bool) -> Self
Report the mouse even when no child asks for it: for a click to focus a child, or a border to drag.
pub fn axis(&self) -> Axis
pub fn first(&self) -> &(dyn Component<Output = M> + 'a)
pub fn second(&self) -> &(dyn Component<Output = M> + 'a)
pub fn first_mut(&mut self) -> &mut (dyn Component<Output = M> + 'a)
pub fn second_mut(&mut self) -> &mut (dyn Component<Output = M> + 'a)
Trait Implementations§
Source§impl<M> Component for Split<'_, M>
impl<M> Component for Split<'_, M>
type Output = M
Source§fn start(&mut self, context: &Context<'_>) -> Flow<M>
fn start(&mut self, context: &Context<'_>) -> Flow<M>
Done or Cancel finishes the component
without waiting for an event. The default does nothing.Source§fn handle(&mut self, event: &Event, context: &Context<'_>) -> Flow<M>
fn handle(&mut self, event: &Event, context: &Context<'_>) -> Flow<M>
Outcome::Interrupted.Source§fn tick(&self) -> Option<Duration>
fn tick(&self) -> Option<Duration>
Event::Tick, for a spinner or a
countdown. None (the default): never.Source§fn mouse(&self) -> bool
fn mouse(&self) -> bool
run then enables mouse reporting
for the session.Source§fn keymap(&self) -> Keymap
fn keymap(&self) -> Keymap
keymap). A container’s include its focused
child’s, before its own. The default declares none.Source§fn focusable(&self) -> bool
fn focusable(&self) -> bool
Source§fn focus_step(&mut self, forward: bool) -> bool
fn focus_step(&mut self, forward: bool) -> bool
forward) or previous focus stop inside
this component, for Tab and Shift+Tab. false when there is none
after the current one, so the container moves on to its next
child. The default, for a component that is one stop: false.Source§fn focus_enter(&mut self, forward: bool) -> bool
fn focus_enter(&mut self, forward: bool) -> bool
forward,
at the last otherwise. false when nothing in it can take focus.
The default: whether the component is focusable.Source§fn default_value(&self) -> Option<Self::Output>
fn default_value(&self) -> Option<Self::Output>
None: there is none.Auto Trait Implementations§
impl<'a, M> !RefUnwindSafe for Split<'a, M>
impl<'a, M> !Send for Split<'a, M>
impl<'a, M> !Sync for Split<'a, M>
impl<'a, M> !UnwindSafe for Split<'a, M>
impl<'a, M> Freeze for Split<'a, M>
impl<'a, M> Unpin for Split<'a, M>
impl<'a, M> UnsafeUnpin for Split<'a, M>where
Group<'a, M>: UnsafeUnpin,
Bindings<'a, M>: UnsafeUnpin,
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<C> ComponentExt for Cwhere
C: Component,
impl<C> ComponentExt for Cwhere
C: Component,
Source§fn map<'a, M>(
self,
done: impl FnMut(Self::Output) -> Flow<M> + 'a,
) -> Map<'a, Self, M>where
Self: 'a,
fn map<'a, M>(
self,
done: impl FnMut(Self::Output) -> Flow<M> + 'a,
) -> Map<'a, Self, M>where
Self: 'a,
M’s flow: Flow::Done(m) to
finish the whole composition with m, Flow::Continue to carry on
(the component stays, showing its answer, and focus moves past it).
Cancelling cancels the composition unless
on_cancel says otherwise.