[][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 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<(), ViewNotFound> where
    F: FnOnce(&Selector<'_>) -> Result<(), ViewNotFound>, 
[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_left(&mut self, n: usize)[src]

Scroll by n cells to the left.

pub fn scroll_up(&mut self, n: usize)[src]

Scroll by n cells to the top.

pub fn scroll_down(&mut self, n: usize)[src]

Scroll by n cells to the bottom.

pub fn scroll_right(&mut self, n: usize)[src]

Scroll by n cells to the right.

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 release_grab(&mut self)[src]

Stops grabbing the scrollbar.

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.

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

Returns the last size available for the child view.

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

Returns the last size given by layout.

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

Checks if we can scroll up.

Returns true if vertical scrolling is enabled, and if we are not at the top already.

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

Checks if we can scroll to the left.

Returns true if horizontal scrolling is enabled, and if we are not at the left edge already.

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

Checks if we can scroll down.

Returns true if vertical scrolling is enabled, and if we are not at the bottom already.

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

Checks if we can scroll to the right.

Returns true if horizontal scrolling is enabled, and if we are not at the right edge already.

pub fn start_drag(&mut self, position: XY<usize>) -> bool[src]

Starts scrolling from the cursor position.

Returns true if the event was consumed.

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

Called when a mouse drag is detected.

Trait Implementations

impl Debug for Core[src]

impl Default for Core[src]

Auto Trait Implementations

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]