Struct cursive_core::views::HideableView
source · [−]pub struct HideableView<V> { /* private fields */ }
Expand description
Wrapper around another view that can be hidden at will.
By default, it simply forwards all calls to the inner view.
When hidden (with HideableView::hide()
), it will appear as a zero-sized
invisible view, will not take focus and will not accept input.
It can be made visible again with HideableView::unhide()
.
Implementations
sourceimpl<V> HideableView<V>
impl<V> HideableView<V>
sourcepub fn new(view: V) -> Self
pub fn new(view: V) -> Self
Creates a new HideableView around view
.
It will be visible by default.
sourcepub fn set_visible(&mut self, visible: bool)
pub fn set_visible(&mut self, visible: bool)
Sets the visibility for this view.
Sets the visibility for this view to false
.
Chainable variant.
sourcepub fn visible(self, flag: bool) -> Self
pub fn visible(self, flag: bool) -> Self
Sets the visibility for this view to flag value. Useful when creating views needs to be decided at runtime. Chainable variant.
sourcepub fn is_visible(&self) -> bool
pub fn is_visible(&self) -> bool
Returns true
if the wrapped view is going to be visible.
sourcepub fn get_inner_mut(&mut self) -> &mut V
pub fn get_inner_mut(&mut self) -> &mut V
Gets mutable access to the inner view.
Trait Implementations
sourceimpl<V> Default for HideableView<V> where
V: Default,
impl<V> Default for HideableView<V> where
V: Default,
sourceimpl<V: View> ViewWrapper for HideableView<V>
impl<V: View> ViewWrapper for HideableView<V>
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 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_layout(&mut self, size: Vec2)
fn wrap_layout(&mut self, size: Vec2)
Wraps the layout
method.
sourcefn wrap_needs_relayout(&self) -> bool
fn wrap_needs_relayout(&self) -> bool
Wraps the needs_relayout
method.
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_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_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 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 HideableView<V> where
V: RefUnwindSafe,
impl<V> Send for HideableView<V> where
V: Send,
impl<V> Sync for HideableView<V> where
V: Sync,
impl<V> Unpin for HideableView<V> where
V: Unpin,
impl<V> UnwindSafe for HideableView<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