PlaneBuilder

Struct PlaneBuilder 

Source
pub struct PlaneBuilder { /* private fields */ }
Expand description

A Plane builder.

Implementations§

Source§

impl PlaneBuilder

§Constructors

Source

pub fn new() -> Self

Returns a new default PlaneBuilder.

Size, position and margins are set to 0. The plane will be maximized to its parent size.

Source

pub fn build(self, nc: &Notcurses) -> Result<Plane>

Returns a new standalone Plane.

Source

pub fn build_child(self, parent: &mut Plane) -> Result<Plane>

Returns a new child Plane of the provided parent.

Source§

impl PlaneBuilder

§Methods (chainable)

Source

pub fn y(self, y: i32) -> Self

Sets the vertical position relative to the parent plane.

Default: 0.

Effect: Sets the y coordinate and unsets vertical alignment.

Source

pub fn x(self, x: i32) -> Self

Sets the horizontal position relative to the parent plane.

Default: 0.

Effect: Sets the x coordinate and unsets vertical alignment.

Source

pub fn position(self, position: impl Into<Position>) -> Self

Sets the position relative to parent plane.

Default: 0, 0.

Effect: Sets both x & y coordinates and unsets both horizontal and vertical alignment.

Source

pub fn valign(self, vertical: Align) -> Self

Sets the vertical alignment.

Default: Align::Top.

Effect: Sets v alignment.

Source

pub fn halign(self, horizontal: Align) -> Self

Sets the horizontal alignment.

Default: Align::Left.

Effect: Sets h alignment.

Source

pub fn align(self, vertical: Align, horizontal: Align) -> Self

Sets the vertical & horizontal placement relative to parent plane.

Default: 0, 0.

Effect: Sets both horizontal and vertical alignment.

Source

pub fn height(self, height: u32) -> Self

Sets the height of the plane (rows).

Default: 0.

Effect: Sets the height of the plane and unmaximizes it.

Source

pub fn width(self, width: u32) -> Self

Sets the width for the plane (columns).

Default: 0.

Effect: Sets the width of the plane and unmaximizes it.

Source

pub fn size(self, size: impl Into<Size>) -> Self

Sets the size of the plane (rows, columns).

Default: 0.

Effect: Sets the height and width of the plane and unmaximizes it.

Source

pub fn maximize(self, right_bottom: impl Into<Size>) -> Self

Maximizes the plane, with optional right & bottom margins.

Default: (0, 0).

Effect: maximizes the plane relative to the parent plane, minus the provided margins.

See also: sys::NcPlaneFlag::Marginalized.

Source

pub fn fixed(self, fixed: bool) -> Self

If true, the plane will not scroll with the parent.

Default: false (scrolls with the parent).

Effect: (un)fixes the plane.

See also: sys::NcPlaneFlag::Fixed.

Source

pub fn scroll(self, scroll: bool) -> Self

If true, the plane will scroll vertically to accommodate output.

This is equivalent to immediately calling set_scrolling(true) following Plane creation.

Default: false.

Effect: (un)sets vertical scrolling.

Source

pub fn autogrow(self, autogrow: bool) -> Self

If true, the plane will grow automatically.

Default: false.

Effect: (un)sets the plane to automatically grow to accomodate output.

Note that just setting autogrow makes the plane grow to the right, and setting autogrow and scroll makes the plane grow downwards.

Trait Implementations§

Source§

impl Debug for PlaneBuilder

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for PlaneBuilder

Source§

fn default() -> PlaneBuilder

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.