Struct embedded_text::TextBox [−][src]
#[must_use]pub struct TextBox<'a, S> { pub text: &'a str, pub bounds: Rectangle, pub character_style: S, pub style: TextBoxStyle, pub vertical_offset: i32, }
Expand description
A text box object.
The TextBox struct represents a piece of text that can be drawn on a display inside the given
bounding box.
Use the draw method to draw the textbox on a display.
See the module-level documentation for more information.
Fields
text: &'a strThe text to be displayed in this TextBox
bounds: RectangleThe bounding box of this TextBox
character_style: SThe character style of the TextBox.
style: TextBoxStyleThe style of the TextBox.
vertical_offset: i32Vertical offset applied to the text just before rendering.
Implementations
pub fn with_textbox_style(
text: &'a str,
bounds: Rectangle,
character_style: S,
textbox_style: TextBoxStyle
) -> Self[src]
pub fn with_textbox_style(
text: &'a str,
bounds: Rectangle,
character_style: S,
textbox_style: TextBoxStyle
) -> Self[src]Creates a new TextBox instance with a given bounding Rectangle and a given TextBoxStyle.
pub fn with_alignment(
text: &'a str,
bounds: Rectangle,
character_style: S,
alignment: HorizontalAlignment
) -> TextBox<'a, S>[src]
pub fn with_alignment(
text: &'a str,
bounds: Rectangle,
character_style: S,
alignment: HorizontalAlignment
) -> TextBox<'a, S>[src]Creates a new TextBox instance with a given bounding Rectangle and a given TextBoxStyle.
pub fn with_vertical_alignment(
text: &'a str,
bounds: Rectangle,
character_style: S,
vertical_alignment: VerticalAlignment
) -> TextBox<'a, S>[src]
pub fn with_vertical_alignment(
text: &'a str,
bounds: Rectangle,
character_style: S,
vertical_alignment: VerticalAlignment
) -> TextBox<'a, S>[src]Creates a new TextBox instance with a given bounding Rectangle and a given TextBoxStyle.
Sets the vertical text offset.
Sets the height of the TextBox to the height of the text.
Trait Implementations
Returns the bounding box.
impl<'a, F> Drawable for TextBox<'a, F> where
F: TextRenderer<Color = <F as CharacterStyle>::Color> + CharacterStyle,
<F as CharacterStyle>::Color: From<Rgb888>, [src]
impl<'a, F> Drawable for TextBox<'a, F> where
F: TextRenderer<Color = <F as CharacterStyle>::Color> + CharacterStyle,
<F as CharacterStyle>::Color: From<Rgb888>, [src]Auto Trait Implementations
impl<'a, S> RefUnwindSafe for TextBox<'a, S> where
S: RefUnwindSafe, impl<'a, S> UnwindSafe for TextBox<'a, S> where
S: UnwindSafe, Blanket Implementations
Mutably borrows from an owned value. Read more
Casts the value.
Casts the value.
type Output = T
type Output = TShould always be Self
Casts the value.
Casts the value.
Casts the value.