[][src]Struct cursive_aligned_view::AlignedView

pub struct AlignedView<T> { /* fields omitted */ }

This struct aligns a child view with a given alignment.

The child view will have its minimum allowed size. Additionally, the child may get cropped if it is larger than the available size.

The padded space around the child view is filled with the View color from cursive's color palette.

Usage

The AlignedView may be used in 2 different ways:

  1. Via the Alignable composition trait
  2. Via normal constructors

Using Alignable

use cursive::Cursive;
use cursive::view::Boxable;
use cursive::views::{Panel, DummyView};
use cursive_aligned_view::Alignable;

fn main() {
    let mut siv = Cursive::default();

    let panel = Panel::new(DummyView)
        .title("Hello, world!")
        .fixed_width(20)
        .align_top_center(); // `align_...` methods from `Alignable`

    siv.add_fullscreen_layer(panel);
    // siv.run()
}

Constructors

use cursive::Cursive;
use cursive::view::Boxable;
use cursive::views::{Panel, DummyView};
use cursive_aligned_view::AlignedView;

fn main() {
    let mut siv = Cursive::default();

    let panel = Panel::new(DummyView)
        .title("Hello, world!")
        .fixed_width(20);
    let aligned = AlignedView::with_bottom_center(panel); // constructor

    siv.add_fullscreen_layer(aligned);
    // siv.run()
}

Methods

impl<T: View> AlignedView<T>[src]

pub fn with_top_left(view: T) -> Self[src]

Wrap a child view and align it at the top-left of the parent.

pub fn with_top_center(view: T) -> Self[src]

Wrap a child view and align it at the top-center of the parent.

pub fn with_top_right(view: T) -> Self[src]

Wrap a child view and align it at the top-right of the parent.

pub fn with_center_left(view: T) -> Self[src]

Wrap a child view and align it at the center-left of the parent.

pub fn with_center(view: T) -> Self[src]

Wrap a child view and align it at the center of the parent.

pub fn with_center_right(view: T) -> Self[src]

Wrap a child view and align it at the center-right of the parent.

pub fn with_bottom_left(view: T) -> Self[src]

Wrap a child view and align it at the bottom-left of the parent.

pub fn with_bottom_center(view: T) -> Self[src]

Wrap a child view and align it at the bottom-center of the parent.

pub fn with_bottom_right(view: T) -> Self[src]

Wrap a child view and align it at the bottom-right of the parent.

pub fn set_top_left(&mut self)[src]

Set the alignment of this view to top-left.

pub fn set_top_center(&mut self)[src]

Set the alignment of this view to top-center.

pub fn set_top_right(&mut self)[src]

Set the alignment of this view to top-right.

pub fn set_center_left(&mut self)[src]

Set the alignment of this view to center-left.

pub fn set_center(&mut self)[src]

Set the alignment of this view to center.

pub fn set_center_right(&mut self)[src]

Set the alignment of this view to center-right.

pub fn set_bottom_left(&mut self)[src]

Set the alignment of this view to bottom-left.

pub fn set_bottom_center(&mut self)[src]

Set the alignment of this view to bottom-center.

pub fn set_bottom_right(&mut self)[src]

Set the alignment of this view to bottom-right.

pub fn alignment(&self) -> &Align[src]

Get the current alignment of this view.

Trait Implementations

impl<T: View> View for AlignedView<T>[src]

Auto Trait Implementations

impl<T> Unpin for AlignedView<T> where
    T: Unpin

impl<T> Sync for AlignedView<T> where
    T: Sync

impl<T> Send for AlignedView<T> where
    T: Send

impl<T> UnwindSafe for AlignedView<T> where
    T: UnwindSafe

impl<T> RefUnwindSafe for AlignedView<T> where
    T: RefUnwindSafe

Blanket Implementations

impl<T> Alignable for T where
    T: View
[src]

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

impl<T> From<T> for 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> BorrowMut<T> for T where
    T: ?Sized
[src]

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

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

impl<T> Identifiable for T where
    T: View
[src]

impl<T> Boxable for T where
    T: View
[src]

impl<T> With for T[src]

impl<T> View for T where
    T: ViewWrapper
[src]

impl<T> Scrollable for T where
    T: View
[src]

impl<T> Finder for T where
    T: View
[src]

impl<T> AnyView for T where
    T: View
[src]

fn as_any(&self) -> &(dyn Any + 'static)[src]

Downcast self to a Any.

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)[src]

Downcast self to a mutable Any.

impl<T> IntoBoxedView for T where
    T: View
[src]

impl<T> Erased for T