[][src]Struct conrod_core::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.

Implementations

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

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

Build a new Text widget.

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

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

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

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

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

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

pub fn font_id(self, font_id: Id) -> Self[src]

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

pub fn with_style(self, style: Style) -> Self[src]

Build the Text with the given Style.

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

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

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

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

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

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

pub fn font_size(self, font_size: FontSize) -> Self[src]

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

pub fn justify(self, justify: Justify) -> Self[src]

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

pub fn line_spacing(self, line_spacing: Scalar) -> Self[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<'_, '_, '_, '_, Self>) -> Self::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<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> 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<W> Sizeable for W where
    W: Widget
[src]

fn get_x_dimension(&Self, &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) -> 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.