Struct cursive_core::views::ScreensView
source · [−]pub struct ScreensView<V = BoxedView> { /* private fields */ }
Expand description
A view that can switch between different screens.
Implementations
sourceimpl<V> ScreensView<V>
impl<V> ScreensView<V>
sourcepub fn single_screen(v: V) -> Self
pub fn single_screen(v: V) -> Self
Creates a new ScreensView
with a single screen.
sourcepub fn screen(&self) -> Option<&V>
pub fn screen(&self) -> Option<&V>
Returns a reference to the currently active screen.
Returns None
if there is no active screen.
sourcepub fn screen_mut(&mut self) -> Option<&mut V>
pub fn screen_mut(&mut self) -> Option<&mut V>
Returns a mutable reference to the currently active screen.
sourcepub fn active_screen(&self) -> usize
pub fn active_screen(&self) -> usize
Returns the id of the currently active screen.
sourcepub fn add_screen(&mut self, v: V) -> usize
pub fn add_screen(&mut self, v: V) -> usize
Adds a new screen, and returns its ID.
sourcepub fn add_active_screen(&mut self, v: V) -> usize
pub fn add_active_screen(&mut self, v: V) -> usize
Convenient method to create a new screen, and set it as active.
sourcepub fn set_active_screen(&mut self, screen_id: usize)
pub fn set_active_screen(&mut self, screen_id: usize)
Sets the active screen. Panics if no such screen exist.
Trait Implementations
sourceimpl<V> Default for ScreensView<V>
impl<V> Default for ScreensView<V>
sourceimpl<V> ViewWrapper for ScreensView<V> where
V: View,
impl<V> ViewWrapper for ScreensView<V> where
V: View,
type V = V
type V = V
Type that this view wraps.
sourcefn with_view<F, R>(&self, f: F) -> Option<R> where
F: FnOnce(&Self::V) -> R,
fn with_view<F, R>(&self, f: F) -> Option<R> where
F: FnOnce(&Self::V) -> R,
Runs a function on the inner view, returning the result. Read more
sourcefn with_view_mut<F, R>(&mut self, f: F) -> Option<R> where
F: FnOnce(&mut Self::V) -> R,
fn with_view_mut<F, R>(&mut self, f: F) -> Option<R> where
F: FnOnce(&mut Self::V) -> R,
Runs a function on the inner view, returning the result. Read more
sourcefn wrap_call_on_any<'a>(&mut self, selector: &Selector<'_>, callback: AnyCb<'a>)
fn wrap_call_on_any<'a>(&mut self, selector: &Selector<'_>, callback: AnyCb<'a>)
Wraps the find
method.
sourcefn wrap_focus_view(
&mut self,
selector: &Selector<'_>
) -> Result<EventResult, ViewNotFound>
fn wrap_focus_view(
&mut self,
selector: &Selector<'_>
) -> Result<EventResult, ViewNotFound>
Wraps the focus_view
method.
sourcefn into_inner(self) -> Result<Self::V, Self> where
Self: Sized,
Self::V: Sized,
fn into_inner(self) -> Result<Self::V, Self> where
Self: Sized,
Self::V: Sized,
Attempts to retrieve the inner view.
sourcefn wrap_required_size(&mut self, req: Vec2) -> Vec2
fn wrap_required_size(&mut self, req: Vec2) -> Vec2
Wraps the required_size
method.
sourcefn wrap_on_event(&mut self, ch: Event) -> EventResult
fn wrap_on_event(&mut self, ch: Event) -> EventResult
Wraps the on_event
method.
sourcefn wrap_layout(&mut self, size: Vec2)
fn wrap_layout(&mut self, size: Vec2)
Wraps the layout
method.
sourcefn wrap_take_focus(
&mut self,
source: Direction
) -> Result<EventResult, CannotFocus>
fn wrap_take_focus(
&mut self,
source: Direction
) -> Result<EventResult, CannotFocus>
Wraps the take_focus
method.
sourcefn wrap_needs_relayout(&self) -> bool
fn wrap_needs_relayout(&self) -> bool
Wraps the needs_relayout
method.
sourcefn wrap_important_area(&self, size: Vec2) -> Rect
fn wrap_important_area(&self, size: Vec2) -> Rect
Wraps the important_area
method.
Auto Trait Implementations
impl<V> RefUnwindSafe for ScreensView<V> where
V: RefUnwindSafe,
impl<V> Send for ScreensView<V> where
V: Send,
impl<V> Sync for ScreensView<V> where
V: Sync,
impl<V> Unpin for ScreensView<V> where
V: Unpin,
impl<V> UnwindSafe for ScreensView<V> where
V: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more