Skip to main content

AreaBuilder

Struct AreaBuilder 

Source
pub struct AreaBuilder<'a> { /* private fields */ }
Expand description

A multiline text area (a <textarea>) whose box the app paints itself: the kit registers it at rect, wraps the text to its width, paints text, placeholder, selection, IME composition and a blinking caret line by line, and feeds per-line caret geometry to the text store, so clicks, drags, double / triple clicks, ArrowUp / ArrowDown and Home / End work by laid lines. Start with area.

Implementations§

Source§

impl<'a> AreaBuilder<'a>

Source

pub fn config(self, c: TextFieldConfig) -> Self

Editing behaviour (max length, filter, read-only); multiline is kept on.

Source

pub fn name(self, n: &'a str) -> Self

Accessible name (defaults to the placeholder).

Source

pub fn placeholder(self, p: &'a str) -> Self

Grey hint while empty.

Source

pub fn text_rect(self, r: Rect) -> Self

Where the lines run, when inset inside the hit rect.

Source

pub fn clip_to(self, r: Rect) -> Self

Clip paint and hits to r too (the scroll viewport the area sits in).

Source

pub fn font(self, px: f64, family: &'a str) -> Self

Font size, CSS family and weight.

Source

pub fn weight(self, w: u16) -> Self

Font weight (400 by default).

Source

pub fn line_height(self, h: f64) -> Self

Line height (default 1.45 × px).

Source

pub fn colors(self, text: &'a str, placeholder: &'a str) -> Self

Text and placeholder colours (CSS); the theme’s when unset.

Source

pub fn caret_color(self, c: &'a str) -> Self

Caret colour (the text colour when unset).

Source

pub fn set(self, text: Option<&'a str>) -> Self

Replace the text this frame (Some("") clears it); the caret goes to the end.

Source

pub fn parent(self, p: impl Into<WidgetId>) -> Self

Nest the area under a container (a dialog scrim) for focus scoping.

Source

pub fn scroll(self, y: f64) -> Self

Scroll the lines up by y (the host’s scroll view offset).

Source

pub fn build<'c, C: ContentCx<'c>>(self, cx: &mut C) -> AreaResponse

Register, draw, and feed the store.

Auto Trait Implementations§

§

impl<'a> Forget for AreaBuilder<'a>

§

impl<'a> Freeze for AreaBuilder<'a>

§

impl<'a> Move for AreaBuilder<'a>

§

impl<'a> RefUnwindSafe for AreaBuilder<'a>

§

impl<'a> Send for AreaBuilder<'a>

§

impl<'a> Sync for AreaBuilder<'a>

§

impl<'a> Unpin for AreaBuilder<'a>

§

impl<'a> UnsafeUnpin for AreaBuilder<'a>

§

impl<'a> UnwindSafe for AreaBuilder<'a>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.