[−][src]Struct cursive_core::views::OnLayoutView
View wrapper overriding the View::layout method.
Implementations
impl<V> OnLayoutView<V>[src]
pub fn new<F>(view: V, on_layout: F) -> Self where
F: FnMut(&mut V, Vec2) + 'static, [src]
F: FnMut(&mut V, Vec2) + 'static,
Wraps a view in an OnLayoutView.
Will run the given closure for layout instead of the one from view.
use cursive_core::{ views::{OnLayoutView, TextView}, View, }; let view = TextView::new("foo"); // Here we just run the innver view's layout. OnLayoutView::new(view, |v, s| v.layout(s));
pub fn wrap(view: V) -> Self where
V: View, [src]
V: View,
Wraps a view in an OnLayoutView.
This is a shortcut for Self::new(view, V::layout)
You can change it later with set_on_layout.
pub fn set_on_layout<F>(&mut self, on_layout: F) where
F: FnMut(&mut V, Vec2) + 'static, [src]
F: FnMut(&mut V, Vec2) + 'static,
Replaces the callback to run.
pub fn get_inner(&self) -> &V[src]
Gets access to the inner view.
pub fn get_inner_mut(&mut self) -> &mut V[src]
Gets mutable access to the inner view.
Trait Implementations
impl<V: View> ViewWrapper for OnLayoutView<V>[src]
type V = V
Type that this view wraps.
pub fn with_view<F, R>(&self, f: F) -> Option<R> where
F: FnOnce(&Self::V) -> R, [src]
F: FnOnce(&Self::V) -> R,
pub fn with_view_mut<F, R>(&mut self, f: F) -> Option<R> where
F: FnOnce(&mut Self::V) -> R, [src]
F: FnOnce(&mut Self::V) -> R,
pub fn into_inner(self) -> Result<Self::V, Self> where
Self::V: Sized, [src]
Self::V: Sized,
pub fn wrap_layout(&mut self, size: Vec2)[src]
pub fn wrap_draw(&self, printer: &Printer<'_, '_>)[src]
pub fn wrap_required_size(&mut self, req: Vec2) -> Vec2[src]
pub fn wrap_on_event(&mut self, ch: Event) -> EventResult[src]
pub fn wrap_take_focus(&mut self, source: Direction) -> bool[src]
pub fn wrap_call_on_any<'a>(
&mut self,
selector: &Selector<'_>,
callback: AnyCb<'a>
)[src]
&mut self,
selector: &Selector<'_>,
callback: AnyCb<'a>
)
pub fn wrap_focus_view(
&mut self,
selector: &Selector<'_>
) -> Result<(), ViewNotFound>[src]
&mut self,
selector: &Selector<'_>
) -> Result<(), ViewNotFound>
pub fn wrap_needs_relayout(&self) -> bool[src]
pub fn wrap_important_area(&self, size: Vec2) -> Rect[src]
Auto Trait Implementations
impl<V> !RefUnwindSafe for OnLayoutView<V>[src]
impl<V> !Send for OnLayoutView<V>[src]
impl<V> !Sync for OnLayoutView<V>[src]
impl<V> Unpin for OnLayoutView<V> where
V: Unpin, [src]
V: Unpin,
impl<V> !UnwindSafe for OnLayoutView<V>[src]
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized, [src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized, [src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized, [src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T[src]
impl<T> Erased for T[src]
impl<T> From<T> for T[src]
impl<T, U> Into<U> for T where
U: From<T>, [src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>, [src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>, [src]
U: TryFrom<T>,