[][src]Struct nannou::ui::widget::primitive::text::Text

pub struct Text<'a> {
    pub common: CommonBuilder,
    pub text: &'a str,
    pub style: Style,
}

Displays some given text centered within a rectangular area.

By default, the rectangular dimensions are fit to the area occuppied by the text.

If some horizontal dimension is given, the text will automatically wrap to the width and align in accordance with the produced Alignment.

Fields

common: CommonBuilder

Data necessary and common for all widget builder types.

text: &'a str

The text to be drawn by the Text.

style: Style

Unique styling for the Text.

Methods

impl<'a> Text<'a>[src]

pub fn new(text: &'a str) -> Text<'a>[src]

Build a new Text widget.

pub fn no_line_wrap(self) -> Text<'a>[src]

Specify that the Text should not wrap lines around the width.

pub fn wrap_by_word(self) -> Text<'a>[src]

Line wrap the Text at the beginning of the first word that exceeds the width.

pub fn wrap_by_character(self) -> Text<'a>[src]

Line wrap the Text at the beginning of the first character that exceeds the width.

pub fn font_id(self, font_id: Id) -> Text<'a>[src]

A method for specifying the Font used for displaying the Text.

pub fn with_style(self, style: Style) -> Text<'a>[src]

Build the Text with the given Style.

pub fn left_justify(self) -> Text<'a>[src]

Align the text to the left of its bounding Rect's x axis range.

pub fn center_justify(self) -> Text<'a>[src]

Align the text to the middle of its bounding Rect's x axis range.

pub fn right_justify(self) -> Text<'a>[src]

Align the text to the right of its bounding Rect's x axis range.

pub fn font_size(self, font_size: u32) -> Text<'a>[src]

Build the type's self.$($assignee).+ with the given $Type.

pub fn justify(self, justify: Justify) -> Text<'a>[src]

Build the type's self.$($assignee).+ with the given $Type.

pub fn line_spacing(self, line_spacing: f64) -> Text<'a>[src]

Build the type's self.$($assignee).+ with the given $Type.

Trait Implementations

impl<'a> Clone for Text<'a>[src]

impl<'a> Colorable for Text<'a>[src]

impl<'a> Common for Text<'a>[src]

impl<'a> Debug for Text<'a>[src]

impl<'a> Widget for Text<'a>[src]

type State = State

State to be stored within the Uis widget cache. Read more

type Style = Style

Every widget is required to have its own associated Style type. This type is intended to contain high-level styling information for the widget that can be optionally specified by a user of the widget. Read more

type Event = ()

The type of event yielded by the widget, returned via the Widget::set function. Read more

fn default_x_dimension(&self, ui: &Ui) -> Dimension[src]

If no specific width was given, we'll use the width of the widest line as a default.

The Font used by the Text is retrieved in order to determine the width of each line. If the font used by the Text cannot be found, a dimension of Absolute(0.0) is returned.

fn default_y_dimension(&self, ui: &Ui) -> Dimension[src]

If no specific height was given, we'll use the total height of the text as a default.

The Font used by the Text is retrieved in order to determine the width of each line. If the font used by the Text cannot be found, a dimension of Absolute(0.0) is returned.

fn update(self, args: UpdateArgs<Text<'a>>) -> <Text<'a> as Widget>::Event[src]

Update the state of the Text.

Auto Trait Implementations

impl<'a> RefUnwindSafe for Text<'a>

impl<'a> Send for Text<'a>

impl<'a> Sync for Text<'a>

impl<'a> Unpin for Text<'a>

impl<'a> UnwindSafe for Text<'a>

Blanket Implementations

impl<S, D, Swp, Dwp, T> AdaptInto<D, Swp, Dwp, T> for S where
    D: AdaptFrom<S, Swp, Dwp, T>,
    Dwp: WhitePoint,
    Swp: WhitePoint,
    T: Component + Float
[src]

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, U> ConvertInto<U> for T where
    U: ConvertFrom<T>, 
[src]

impl<T> From<T> for T[src]

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

impl<W> Positionable for W where
    W: Widget
[src]

impl<T> SetParameter for T

impl<T> SetParameter for T

impl<W> Sizeable for W where
    W: Widget
[src]

fn get_x_dimension(&self, ui: &Ui) -> Dimension[src]

We attempt to retrieve the x Dimension for the widget via the following:

  • Check for specified value at maybe_x_dimension
  • Otherwise, use the default returned by Widget::default_x_dimension.

fn get_y_dimension(&self, ui: &Ui) -> Dimension[src]

We attempt to retrieve the y Dimension for the widget via the following:

  • Check for specified value at maybe_y_dimension
  • Otherwise, use the default returned by Widget::default_y_dimension.

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

type Owned = T

The resulting type after obtaining ownership.

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<V, T> VZip<V> for T where
    V: MultiLane<T>,