pub struct SplitPanel { /* private fields */ }Expand description
Split panel.
Contains two panes with an optionally movable divider between them and an optional border. (Both features are enabled by default.)
Can be oriented horizontally (the default) or vertically.
When movable_divider is true will support the following events (configurable):
- Shift+Left/Shift+Up: move the divider towards the front
- Shift+Right/Shift+Down: move the divider towards the back
- Mouse dragging of the divider
Implementations§
Source§impl SplitPanel
impl SplitPanel
Sourcepub fn new(orientation: Orientation) -> Self
pub fn new(orientation: Orientation) -> Self
Constructor.
Sourcepub fn horizontal() -> Self
pub fn horizontal() -> Self
Constructor.
Sourcepub fn orientation(&self) -> Orientation
pub fn orientation(&self) -> Orientation
Orienation.
Sourcepub fn set_orientation(&mut self, orientation: Orientation)
pub fn set_orientation(&mut self, orientation: Orientation)
Set orientation.
Sourcepub fn with_orientation(self, orientation: Orientation) -> Self
pub fn with_orientation(self, orientation: Orientation) -> Self
Set orientation.
Chainable.
Sourcepub fn set_border(&mut self, border: bool)
pub fn set_border(&mut self, border: bool)
Set whether to draw a border.
Sourcepub fn with_border(self, border: bool) -> Self
pub fn with_border(self, border: bool) -> Self
Set whether to draw a border.
Chainable.
Sourcepub fn visible_divider(&self) -> bool
pub fn visible_divider(&self) -> bool
Whether the divider is visible.
Sourcepub fn set_visible_divider(&mut self, visible_divider: bool)
pub fn set_visible_divider(&mut self, visible_divider: bool)
Set whether the divider is visible.
Sourcepub fn with_visible_divider(self, visible_divider: bool) -> Self
pub fn with_visible_divider(self, visible_divider: bool) -> Self
Set whether the divider is visible.
Chainable.
Sourcepub fn movable_divider(&self) -> bool
pub fn movable_divider(&self) -> bool
Whether to allow the divider to move.
Sourcepub fn set_movable_divider(&mut self, movable_divider: bool)
pub fn set_movable_divider(&mut self, movable_divider: bool)
Set whether to allow the divider to move.
Sourcepub fn with_movable_divider(self, movable_divider: bool) -> Self
pub fn with_movable_divider(self, movable_divider: bool) -> Self
Set whether to allow the divider to move.
Chainable.
Sourcepub fn set_front<ViewT>(&mut self, view: ViewT)where
ViewT: 'static + IntoBoxedView,
pub fn set_front<ViewT>(&mut self, view: ViewT)where
ViewT: 'static + IntoBoxedView,
Set view for front panel.
Sourcepub fn with_front<ViewT>(self, view: ViewT) -> Selfwhere
ViewT: 'static + IntoBoxedView,
pub fn with_front<ViewT>(self, view: ViewT) -> Selfwhere
ViewT: 'static + IntoBoxedView,
Set view for front panel.
Chainable.
Examples found in repository?
6fn main() {
7 let mut cursive = default();
8
9 cursive.add_fullscreen_layer(
10 SplitPanel::default()
11 .with_front(text_view().scrollable().full_screen())
12 .with_back(text_view().scrollable().full_screen()),
13 );
14
15 cursive.add_global_callback('q', |cursive| cursive.quit());
16
17 cursive.run();
18}Sourcepub fn set_back<ViewT>(&mut self, view: ViewT)where
ViewT: 'static + IntoBoxedView,
pub fn set_back<ViewT>(&mut self, view: ViewT)where
ViewT: 'static + IntoBoxedView,
Set view for back panel.
Sourcepub fn with_back<ViewT>(self, view: ViewT) -> Selfwhere
ViewT: 'static + IntoBoxedView,
pub fn with_back<ViewT>(self, view: ViewT) -> Selfwhere
ViewT: 'static + IntoBoxedView,
Set view for back panel.
Chainable.
Examples found in repository?
6fn main() {
7 let mut cursive = default();
8
9 cursive.add_fullscreen_layer(
10 SplitPanel::default()
11 .with_front(text_view().scrollable().full_screen())
12 .with_back(text_view().scrollable().full_screen()),
13 );
14
15 cursive.add_global_callback('q', |cursive| cursive.quit());
16
17 cursive.run();
18}Sourcepub fn divider(&self) -> Option<usize>
pub fn divider(&self) -> Option<usize>
The divider position as the distance from the front border.
Returns None if not yet set.
Sourcepub fn set_divider(&mut self, divider: usize)
pub fn set_divider(&mut self, divider: usize)
Set divider position as the distance from the front border.
Note that if it doesn’t fit it will move during layout.
Sourcepub fn with_divider(self, divider: usize) -> Self
pub fn with_divider(self, divider: usize) -> Self
Set divider position as the distance from the front border.
Note that if it doesn’t fit it will move during layout.
Chainable.
Sourcepub fn actions_mut(&mut self) -> &mut Actions
pub fn actions_mut(&mut self) -> &mut Actions
Action map.
Sourcepub fn set_actions(&mut self, actions: Actions)
pub fn set_actions(&mut self, actions: Actions)
Set action map.
Sourcepub fn with_actions(self, actions: Actions) -> Self
pub fn with_actions(self, actions: Actions) -> Self
Set action map.
Chainable.
Sourcepub fn set_action<EventT>(&mut self, action: Action, event: EventT)
pub fn set_action<EventT>(&mut self, action: Action, event: EventT)
Set action.
Note that actions can be associated with more than one event.
Sourcepub fn with_action<EventT>(self, action: Action, event: EventT) -> Self
pub fn with_action<EventT>(self, action: Action, event: EventT) -> Self
Set action.
Note that actions can be associated with more than one event.
Chainable.
Sourcepub fn remove_action(&mut self, action: Action) -> bool
pub fn remove_action(&mut self, action: Action) -> bool
Remove action.
Will remove all associated events.
Return true if removed.
Sourcepub fn without_action(self, action: Action) -> Self
pub fn without_action(self, action: Action) -> Self
Remove action.
Will remove all associated events.
Chainable.
Trait Implementations§
Source§impl Default for SplitPanel
impl Default for SplitPanel
Source§impl View for SplitPanel
impl View for SplitPanel
Source§fn focus_view(
&mut self,
selector: &Selector<'_>,
) -> Result<EventResult, ViewNotFound>
fn focus_view( &mut self, selector: &Selector<'_>, ) -> Result<EventResult, ViewNotFound>
Source§fn take_focus(&mut self, source: Direction) -> Result<EventResult, CannotFocus>
fn take_focus(&mut self, source: Direction) -> Result<EventResult, CannotFocus>
Source§fn needs_relayout(&self) -> bool
fn needs_relayout(&self) -> bool
Source§fn layout(&mut self, size: Vec2)
fn layout(&mut self, size: Vec2)
Source§fn required_size(&mut self, constraint: Vec2) -> Vec2
fn required_size(&mut self, constraint: Vec2) -> Vec2
Source§fn important_area(&self, size: Vec2) -> Rect
fn important_area(&self, size: Vec2) -> Rect
Source§fn on_event(&mut self, event: Event) -> EventResult
fn on_event(&mut self, event: Event) -> EventResult
Auto Trait Implementations§
impl Freeze for SplitPanel
impl !RefUnwindSafe for SplitPanel
impl Send for SplitPanel
impl Sync for SplitPanel
impl Unpin for SplitPanel
impl UnsafeUnpin for SplitPanel
impl !UnwindSafe for SplitPanel
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> Finder for Twhere
T: View,
impl<T> Finder for Twhere
T: View,
Source§fn call_on_all<V, F>(&mut self, sel: &Selector<'_>, callback: F)
fn call_on_all<V, F>(&mut self, sel: &Selector<'_>, callback: F)
sel. Read moreSource§fn call_on<V, F, R>(&mut self, sel: &Selector<'_>, callback: F) -> Option<R>
fn call_on<V, F, R>(&mut self, sel: &Selector<'_>, callback: F) -> Option<R>
sel. Read moreSource§fn call_on_name<V, F, R>(&mut self, name: &str, callback: F) -> Option<R>
fn call_on_name<V, F, R>(&mut self, name: &str, callback: F) -> Option<R>
call_on with a view::Selector::Name.Source§impl<T> IntoBoxedView for Twhere
T: View,
impl<T> IntoBoxedView for Twhere
T: View,
Source§fn into_boxed_view(self) -> Box<dyn View>
fn into_boxed_view(self) -> Box<dyn View>
Box<View>.Source§impl<T> Resizable for Twhere
T: View,
impl<T> Resizable for Twhere
T: View,
Source§fn resized(
self,
width: SizeConstraint,
height: SizeConstraint,
) -> ResizedView<Self>
fn resized( self, width: SizeConstraint, height: SizeConstraint, ) -> ResizedView<Self>
self in a ResizedView with the given size constraints.Source§fn fixed_size<S>(self, size: S) -> ResizedView<Self>
fn fixed_size<S>(self, size: S) -> ResizedView<Self>
self into a fixed-size ResizedView.Source§fn fixed_width(self, width: usize) -> ResizedView<Self>
fn fixed_width(self, width: usize) -> ResizedView<Self>
self into a fixed-width ResizedView.Source§fn fixed_height(self, height: usize) -> ResizedView<Self>
fn fixed_height(self, height: usize) -> ResizedView<Self>
self into a fixed-width ResizedView.Source§fn full_screen(self) -> ResizedView<Self>
fn full_screen(self) -> ResizedView<Self>
self into a full-screen ResizedView.Source§fn full_width(self) -> ResizedView<Self>
fn full_width(self) -> ResizedView<Self>
self into a full-width ResizedView.Source§fn full_height(self) -> ResizedView<Self>
fn full_height(self) -> ResizedView<Self>
self into a full-height ResizedView.Source§fn max_size<S>(self, size: S) -> ResizedView<Self>
fn max_size<S>(self, size: S) -> ResizedView<Self>
self into a limited-size ResizedView.Source§fn max_width(self, max_width: usize) -> ResizedView<Self>
fn max_width(self, max_width: usize) -> ResizedView<Self>
self into a limited-width ResizedView.Source§fn max_height(self, max_height: usize) -> ResizedView<Self>
fn max_height(self, max_height: usize) -> ResizedView<Self>
self into a limited-height ResizedView.Source§fn min_size<S>(self, size: S) -> ResizedView<Self>
fn min_size<S>(self, size: S) -> ResizedView<Self>
self into a ResizedView at least sized size.Source§fn min_width(self, min_width: usize) -> ResizedView<Self>
fn min_width(self, min_width: usize) -> ResizedView<Self>
self in a ResizedView at least min_width wide.Source§fn min_height(self, min_height: usize) -> ResizedView<Self>
fn min_height(self, min_height: usize) -> ResizedView<Self>
self in a ResizedView at least min_height tall.Source§impl<T> Scrollable for Twhere
T: View,
impl<T> Scrollable for Twhere
T: View,
Source§fn scrollable(self) -> ScrollView<Self>
fn scrollable(self) -> ScrollView<Self>
self in a ScrollView.