[][src]Struct pane::Pane

pub struct Pane<R = [f64; 4]> where
    R: Rectangle
{ /* fields omitted */ }

A rectangle which automatically determines the positions and sizes of things withing it

A Pane can have any number of child Panes, each of which has a size constrained by their parent Pane. The size and position of each child pane depends on its weight relative to its siblings as well as the split Orientation of its parent. This allows panes to be resized while keeping all their child panes consistently sized.

A pane can also have optional contents. Contents will be resized to fit the Pane

Methods

impl<R> Pane<R> where
    R: Rectangle
[src]

pub fn new() -> Self[src]

Create a new Pane

pub fn children(&self) -> impl DoubleEndedIterator<Item = &Pane<R>>[src]

Immutable iterate over the Pane's children

pub fn children_mut(&mut self) -> impl DoubleEndedIterator<Item = &mut Pane<R>>[src]

Mutable iterate over the Pane's children

pub fn contents(&self) -> Option<&Contents<R::Scalar>>[src]

Get the Pane's contents

pub fn with_contents(self, contents: Contents<R::Scalar>) -> Self[src]

Change the Pane's contents

pub fn with_no_contents(self) -> Self[src]

Remove the Pane's contents

pub fn rect(&self) -> R[src]

Get the Pane's rectangle

pub fn with_rect(self, rect: R) -> Self[src]

Set the Pane's rectangle

pub fn size(&self) -> R::Vector[src]

Get the Pane's size

pub fn with_size<T, V>(self, size: V) -> Self where
    T: Scalar,
    R::Scalar: From<T>,
    V: Vector2<Scalar = T>, 
[src]

Set the Pane's size

pub fn top_left(&self) -> R::Vector[src]

Get the position of the Pane's top-left corner

pub fn with_top_left<T, V>(self, top_left: V) -> Self where
    T: Scalar,
    R::Scalar: From<T>,
    V: Vector2<Scalar = T>, 
[src]

Set the position of the Pane's top-left corner

pub fn with_panes<'a, P, I>(self, panes: I) -> Self where
    P: NamedWeightedPane<'a, R>,
    I: IntoIterator<Item = P>, 
[src]

Set the Pane's inner Panes. Each inner Pane has a weight which defines how it is resized relative to its siblings. Panes can also have optional names that can be used to index their parent.

pub fn orientation(&self) -> Orientation[src]

Get the split orientation of the Pane's children

pub fn with_orientation(self, orientation: Orientation) -> Self[src]

Set the split orientation of the Pane's children

pub fn color(&self) -> Color[src]

Get the Pane's color

pub fn with_color(self, color: Color) -> Self[src]

Set the Pane's color

pub fn margin(&self) -> R::Scalar[src]

Get the Pane's margin

pub fn with_margin(self, margin: R::Scalar) -> Self[src]

Set the Pane's margin

pub fn margin_rect(&self) -> R[src]

Get the inner rectangle created by the Pane and its margin

pub fn fit_text<C>(self, glyphs: &mut C) -> Self where
    C: CharacterWidthCache<Scalar = R::Scalar>, 
[src]

Recursively fit the text of any Contents::Text in the Pane's tree

impl<R> Pane<R> where
    R: Rectangle<Scalar = f64>, 
[src]

pub fn draw<T, C, G>(
    &self,
    glyphs: &mut C,
    transform: Matrix2d,
    graphics: &mut G
) -> Result<(), C::Error> where
    T: ImageSize,
    C: CharacterCache<Texture = T>,
    G: Graphics<Texture = T>, 
[src]

Draw the Pane and all its contents to something using the piston2d-graphics crate

Trait Implementations

impl<'a, R> NamedWeightedPane<'a, R> for Pane<R> where
    R: Rectangle
[src]

impl<R: Clone> Clone for Pane<R> where
    R: Rectangle,
    R::Scalar: Clone,
    R::Scalar: Clone,
    R::Scalar: Clone
[src]

fn clone_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

impl<R> Default for Pane<R> where
    R: Rectangle
[src]

impl<R: Debug> Debug for Pane<R> where
    R: Rectangle,
    R::Scalar: Debug,
    R::Scalar: Debug,
    R::Scalar: Debug
[src]

impl<R> Index<usize> for Pane<R> where
    R: Rectangle
[src]

type Output = Pane<R>

The returned type after indexing.

impl<'a, R> Index<&'a str> for Pane<R> where
    R: Rectangle
[src]

type Output = Pane<R>

The returned type after indexing.

Auto Trait Implementations

impl<R> Sync for Pane<R> where
    R: Sync,
    <R as Rectangle>::Scalar: Sync

impl<R> Send for Pane<R> where
    R: Send,
    <R as Rectangle>::Scalar: Send

impl<R> Unpin for Pane<R> where
    R: Unpin,
    <R as Rectangle>::Scalar: Unpin

impl<R> RefUnwindSafe for Pane<R> where
    R: RefUnwindSafe,
    <R as Rectangle>::Scalar: RefUnwindSafe

impl<R> UnwindSafe for Pane<R> where
    R: UnwindSafe,
    <R as Rectangle>::Scalar: UnwindSafe

Blanket Implementations

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

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> 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]