[][src]Struct cursive::view::scroll::Core

pub struct Core { /* fields omitted */ }

Core system for scrolling views.

This is the lowest-level element handling scroll logic.

Higher-level abstractions are probably what you're after.

In particular, see also ScrollView.

Implementations

impl Core[src]

pub fn new() -> Core[src]

Creates a new Core.

pub fn sub_printer(&self, printer: &Printer<'a, 'b>) -> Printer<'a, 'b>[src]

Returns a sub-printer ready to draw the content.

pub fn is_event_inside(&self, event: &mut Event) -> bool[src]

Returns true if event should be processed by the content.

This also updates event so that it is relative to the content.

pub fn on_inner_event(
    &mut self,
    event: Event,
    inner_result: EventResult,
    important_area: Rect
) -> EventResult
[src]

Handle an event after processing by the content.

pub fn last_size(&self) -> XY<usize>[src]

Returns the size last given in set_last_size().

pub fn needs_relayout(&self) -> bool[src]

Returns true if we should relayout, no matter the content.

Even if this returns false, the content itself might still needs to relayout.

pub fn call_on_any<F>(
    &mut self,
    selector: &Selector,
    cb: &'a mut (dyn FnMut(&mut (dyn View + 'static)) + 'a),
    inner_call_on_any: F
) where
    F: FnOnce(&Selector, &mut dyn FnMut(&mut (dyn View + 'static))), 
[src]

Performs View::call_on_any()

pub fn focus_view<F>(
    &mut self,
    selector: &Selector,
    inner_focus_view: F
) -> Result<(), ()> where
    F: FnOnce(&Selector) -> Result<(), ()>, 
[src]

Performs View::focus_view()

pub fn content_viewport(&self) -> Rect[src]

Returns the viewport in the inner content.

pub fn set_scroll_strategy(&mut self, strategy: ScrollStrategy)[src]

Defines the way scrolling is adjusted on content or size change.

The scroll strategy defines how the scrolling position is adjusted when the size of the view or the content change.

It is reset to ScrollStrategy::KeepRow whenever the user scrolls manually.

pub fn scroll_strategy(self, strategy: ScrollStrategy) -> Core[src]

Defines the way scrolling is adjusted on content or size change.

Chainable variant.

pub fn set_scrollbar_padding<V>(&mut self, scrollbar_padding: V) where
    V: Into<XY<usize>>, 
[src]

Sets the padding between content and scrollbar.

pub fn scrollbar_padding<V>(self, scrollbar_padding: V) -> Core where
    V: Into<XY<usize>>, 
[src]

Sets the padding between content and scrollbar.

Chainable variant.

pub fn get_scrollbar_padding(&self) -> XY<usize>[src]

Returns the padding between content and scrollbar.

pub fn is_enabled(&self) -> XY<bool>[src]

For each axis, returns true if this view can scroll.

For example, a vertically-scrolling view will return XY { x: false, y: true }.

pub fn set_show_scrollbars(&mut self, show_scrollbars: bool)[src]

Control whether scroll bars are visibile.

Defaults to true.

pub fn show_scrollbars(self, show_scrollbars: bool) -> Core[src]

Control whether scroll bars are visibile.

Chainable variant

pub fn get_show_scrollbars(&self) -> bool[src]

Returns true if we will show scrollbars when needed.

Scrollbars are always hidden when not needed.

pub fn inner_size(&self) -> XY<usize>[src]

Returns the size given to the content on the last layout phase.

pub fn set_offset<S>(&mut self, offset: S) where
    S: Into<XY<usize>>, 
[src]

Sets the scroll offset to the given value

pub fn set_scroll_y(&mut self, enabled: bool)[src]

Controls whether this view can scroll vertically.

Defaults to true.

pub fn set_scroll_x(&mut self, enabled: bool)[src]

Controls whether this view can scroll horizontally.

Defaults to false.

pub fn scroll_y(self, enabled: bool) -> Core[src]

Controls whether this view can scroll vertically.

Defaults to true.

Chainable variant.

pub fn scroll_x(self, enabled: bool) -> Core[src]

Controls whether this view can scroll horizontally.

Defaults to false.

Chainable variant.

pub fn keep_in_view(&mut self, rect: Rect)[src]

Try to keep the given rect in view.

pub fn scroll_to_rect(&mut self, important_area: Rect)[src]

Scrolls until the given rect is in view.

pub fn scroll_to(&mut self, pos: XY<usize>)[src]

Scroll until the given point is visible.

pub fn scroll_to_x(&mut self, x: usize)[src]

Scroll until the given column is visible.

pub fn scroll_to_y(&mut self, y: usize)[src]

Scroll until the given row is visible.

pub fn scroll_to_top(&mut self)[src]

Programmatically scroll to the top of the view.

pub fn scroll_to_bottom(&mut self)[src]

Programmatically scroll to the bottom of the view.

pub fn scroll_to_left(&mut self)[src]

Programmatically scroll to the leftmost side of the view.

pub fn scroll_to_right(&mut self)[src]

Programmatically scroll to the rightmost side of the view.

pub fn is_scrolling(&self) -> XY<bool>[src]

Returns for each axis if we are scrolling.

pub fn scrollbar_size(&self) -> XY<usize>[src]

Returns the size taken by the scrollbars.

Will be zero in axis where we're not scrolling.

The scrollbar_size().x will be the horizontal space taken by the vertical scrollbar.

Trait Implementations

impl Debug for Core[src]

impl Default for Core[src]

Auto Trait Implementations

impl RefUnwindSafe for Core

impl Send for Core

impl Sync for Core

impl Unpin for Core

impl UnwindSafe for Core

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Erased for T

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> With for T[src]