Struct cursive_core::views::ScreensView
source · pub struct ScreensView<V = BoxedView> { /* private fields */ }
Expand description
A view that can switch between different screens.
Implementations§
source§impl<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§
source§impl<V> Default for ScreensView<V>
impl<V> Default for ScreensView<V>
source§impl<V> ViewWrapper for ScreensView<V>where
V: View,
impl<V> ViewWrapper for ScreensView<V>where
V: View,
source§fn 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
source§fn 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
source§fn 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.source§fn 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.source§fn wrap_required_size(&mut self, req: Vec2) -> Vec2
fn wrap_required_size(&mut self, req: Vec2) -> Vec2
Wraps the
required_size
method.source§fn wrap_on_event(&mut self, ch: Event) -> EventResult
fn wrap_on_event(&mut self, ch: Event) -> EventResult
Wraps the
on_event
method.source§fn wrap_layout(&mut self, size: Vec2)
fn wrap_layout(&mut self, size: Vec2)
Wraps the
layout
method.source§fn 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.source§fn wrap_needs_relayout(&self) -> bool
fn wrap_needs_relayout(&self) -> bool
Wraps the
needs_relayout
method.source§fn wrap_important_area(&self, size: Vec2) -> Rect
fn wrap_important_area(&self, size: Vec2) -> Rect
Wraps the
important_area
method.