[−][src]Struct pane::Pane
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]
R: Rectangle,
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]
T: Scalar,
R::Scalar: From<T>,
V: Vector2<Scalar = T>,
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]
T: Scalar,
R::Scalar: From<T>,
V: Vector2<Scalar = T>,
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]
P: NamedWeightedPane<'a, R>,
I: IntoIterator<Item = P>,
Set the Pane
's inner Pane
s. Each inner Pane
has a
weight which defines how it is resized relative to its
siblings. Pane
s 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]
C: CharacterWidthCache<Scalar = R::Scalar>,
Recursively fit the text of any Contents::Text
in the Pane
's tree
impl<R> Pane<R> where
R: Rectangle<Scalar = f64>,
[src]
R: Rectangle<Scalar = f64>,
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]
&self,
glyphs: &mut C,
transform: Matrix2d,
graphics: &mut G
) -> Result<(), C::Error> where
T: ImageSize,
C: CharacterCache<Texture = T>,
G: Graphics<Texture = T>,
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]
R: Rectangle,
impl<R> Default for Pane<R> where
R: Rectangle,
[src]
R: Rectangle,
impl<R: Clone> Clone for Pane<R> where
R: Rectangle,
R::Scalar: Clone,
R::Scalar: Clone,
R::Scalar: Clone,
[src]
R: Rectangle,
R::Scalar: Clone,
R::Scalar: Clone,
R::Scalar: Clone,
fn clone(&self) -> Pane<R>
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl<R: Debug> Debug for Pane<R> where
R: Rectangle,
R::Scalar: Debug,
R::Scalar: Debug,
R::Scalar: Debug,
[src]
R: Rectangle,
R::Scalar: Debug,
R::Scalar: Debug,
R::Scalar: Debug,
impl<R> Index<usize> for Pane<R> where
R: Rectangle,
[src]
R: Rectangle,
type Output = Pane<R>
The returned type after indexing.
fn index(&self, index: usize) -> &Self::Output
[src]
impl<'a, R> Index<&'a str> for Pane<R> where
R: Rectangle,
[src]
R: Rectangle,
Auto Trait Implementations
impl<R> Sync for Pane<R> where
R: Sync,
<R as Rectangle>::Scalar: Sync,
R: Sync,
<R as Rectangle>::Scalar: Sync,
impl<R> Unpin for Pane<R> where
R: Unpin,
<R as Rectangle>::Scalar: Unpin,
R: Unpin,
<R as Rectangle>::Scalar: Unpin,
impl<R> Send for Pane<R> where
R: Send,
<R as Rectangle>::Scalar: Send,
R: Send,
<R as Rectangle>::Scalar: Send,
impl<R> UnwindSafe for Pane<R> where
R: UnwindSafe,
<R as Rectangle>::Scalar: UnwindSafe,
R: UnwindSafe,
<R as Rectangle>::Scalar: UnwindSafe,
impl<R> RefUnwindSafe for Pane<R> where
R: RefUnwindSafe,
<R as Rectangle>::Scalar: RefUnwindSafe,
R: RefUnwindSafe,
<R as Rectangle>::Scalar: RefUnwindSafe,
Blanket Implementations
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T> From<T> for T
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,