Trait iced::advanced::text::Paragraph

source ·
pub trait Paragraph: Sized + Default {
    type Font: Copy + PartialEq;

    // Required methods
    fn with_text(text: Text<&str, Self::Font>) -> Self;
    fn resize(&mut self, new_bounds: Size);
    fn compare(&self, text: Text<&str, Self::Font>) -> Difference;
    fn horizontal_alignment(&self) -> Horizontal;
    fn vertical_alignment(&self) -> Vertical;
    fn min_bounds(&self) -> Size;
    fn hit_test(&self, point: Point) -> Option<Hit>;
    fn grapheme_position(&self, line: usize, index: usize) -> Option<Point>;

    // Provided methods
    fn update(&mut self, text: Text<&str, Self::Font>) { ... }
    fn min_width(&self) -> f32 { ... }
    fn min_height(&self) -> f32 { ... }
}
Available on crate feature advanced only.
Expand description

A text paragraph.

Required Associated Types§

source

type Font: Copy + PartialEq

The font of this Paragraph.

Required Methods§

source

fn with_text(text: Text<&str, Self::Font>) -> Self

Creates a new Paragraph laid out with the given Text.

source

fn resize(&mut self, new_bounds: Size)

Lays out the Paragraph with some new boundaries.

source

fn compare(&self, text: Text<&str, Self::Font>) -> Difference

Compares the Paragraph with some desired Text and returns the Difference.

source

fn horizontal_alignment(&self) -> Horizontal

Returns the horizontal alignment of the Paragraph.

source

fn vertical_alignment(&self) -> Vertical

Returns the vertical alignment of the Paragraph.

source

fn min_bounds(&self) -> Size

Returns the minimum boundaries that can fit the contents of the Paragraph.

source

fn hit_test(&self, point: Point) -> Option<Hit>

Tests whether the provided point is within the boundaries of the Paragraph, returning information about the nearest character.

source

fn grapheme_position(&self, line: usize, index: usize) -> Option<Point>

Returns the distance to the given grapheme index in the Paragraph.

Provided Methods§

source

fn update(&mut self, text: Text<&str, Self::Font>)

Updates the Paragraph to match the given Text, if needed.

source

fn min_width(&self) -> f32

Returns the minimum width that can fit the contents of the Paragraph.

source

fn min_height(&self) -> f32

Returns the minimum height that can fit the contents of the Paragraph.

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl Paragraph for ()

§

type Font = Font

source§

fn with_text(_text: Text<&str>)

source§

fn resize(&mut self, _new_bounds: Size)

source§

fn compare(&self, _text: Text<&str>) -> Difference

source§

fn horizontal_alignment(&self) -> Horizontal

source§

fn vertical_alignment(&self) -> Vertical

source§

fn grapheme_position(&self, _line: usize, _index: usize) -> Option<Point>

source§

fn min_bounds(&self) -> Size

source§

fn hit_test(&self, _point: Point) -> Option<Hit>

source§

impl Paragraph for Paragraph

§

type Font = Font

source§

fn with_text(text: Text<&str>) -> Paragraph

source§

fn resize(&mut self, new_bounds: Size)

source§

fn compare(&self, text: Text<&str>) -> Difference

source§

fn horizontal_alignment(&self) -> Horizontal

source§

fn vertical_alignment(&self) -> Vertical

source§

fn min_bounds(&self) -> Size

source§

fn hit_test(&self, point: Point) -> Option<Hit>

source§

fn grapheme_position(&self, line: usize, index: usize) -> Option<Point>

Implementors§