Skip to main content

NodeBuilder

Struct NodeBuilder 

Source
pub struct NodeBuilder<R: RoleKind = AnyRole> { /* private fields */ }
Expand description

Builds one annotated node and its children.

Implementations§

Source§

impl<R: RoleKind> NodeBuilder<R>

Source

pub fn child<R2: RoleType>( self, role: R2, name: &str, build: impl FnOnce(NodeBuilder<R2>) -> NodeBuilder<R2>, ) -> Self

Adds a child of a role, named unless name is empty.

Source

pub fn generic( self, build: impl FnOnce(NodeBuilder<AnyRole>) -> NodeBuilder<AnyRole>, ) -> Self

Adds an annotated child with no role, which infers as a generic.

Source

pub fn text(self, content: &str) -> Self

Adds an unannotated text call.

Source

pub fn text_at(self, content: &str, bounds: Rect) -> Self

Adds an unannotated text call at fixed bounds.

Source

pub fn bounds(self, x: f32, y: f32, width: f32, height: f32) -> Self

Fixed bounds instead of the automatic layout.

Source

pub fn component(self, kind: &'static str) -> Self

Reports the annotation as a component’s, such as iced-cube’s.

Source

pub fn kind(self, kind: &'static str) -> Self

The kind an app annotation names.

Source

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

The accessible name.

Source

pub fn description(self, text: &str) -> Self

The description.

Source

pub fn tooltip(self, text: &str) -> Self

The tooltip.

Source

pub fn test_id(self, id: &str) -> Self

The test id.

Source

pub fn widget_id(self, id: &str) -> Self

A widget::Id::new(id).

Source

pub fn prop(self, key: &str, value: &str) -> Self

A free-form property.

Source

pub fn text_size(self, size: f32) -> Self

The text size in logical pixels.

Source

pub fn carets(self, carets: impl IntoIterator<Item = (usize, Point)>) -> Self

Caret positions by byte offset.

Source

pub fn cursor_seen(self, seen: CursorSeen) -> Self

The cursor kind handed to the widget this frame.

Source

pub fn key(self, key: &str) -> Self

The key relations name this node by.

Source

pub fn labelled_by(self, key: &str) -> Self

Named by the node with this key.

Source

pub fn label_for(self, key: &str) -> Self

Labels the node with this key.

Source

pub fn described_by(self, key: &str) -> Self

Described by the node with this key.

Source

pub fn controls(self, key: &str) -> Self

Controls the node with this key.

Source

pub fn owns(self, key: &str) -> Self

Owns the node with this key.

Source

pub fn position(self, index: u32, of: u32) -> Self

Position in the set and set size.

Source

pub fn disabled(self, on: bool) -> Self

Takes no input.

Source

pub fn current(self, on: bool) -> Self

The current item in a set.

Source

pub fn busy(self, on: bool) -> Self

Loading or updating.

Source

pub fn hidden(self, on: bool) -> Self

Explicitly hidden.

Source

pub fn modal(self, on: bool) -> Self

Everything outside it is inert.

Source

pub fn required(self, on: bool) -> Self

Must be filled in.

Source

pub fn invalid(self, on: bool) -> Self

Its value is rejected.

Source

pub fn readonly(self, on: bool) -> Self

Its value cannot be changed.

Source

pub fn focused(self, on: bool) -> Self

Focusable, and focused or not.

Source

pub fn checked(self, state: impl Into<Checked>) -> Self
where R: Checkable,

Checked, unchecked or mixed.

Source

pub fn pressed(self, on: bool) -> Self
where R: Pressable,

A toggle button is pressed.

Source

pub fn expanded(self, on: bool) -> Self
where R: Expandable,

Content or a popup is shown.

Source

pub fn selected(self, on: bool) -> Self
where R: SelectableItem,

Selected in its container.

Source

pub fn level(self, level: u16) -> Self
where R: Leveled,

The heading or tree level, from 1.

Source

pub fn value(self, text: &str) -> Self
where R: HasValue,

A text value.

Source

pub fn range(self, now: f64, range: RangeInclusive<f64>) -> Self
where R: RangeValue,

A number within a range.

Source

pub fn placeholder(self, text: &str) -> Self
where R: Editable,

The placeholder.

Source

pub fn multiline(self, on: bool) -> Self
where R: Editable,

Takes more than one line.

Trait Implementations§

Source§

impl<R: Clone + RoleKind> Clone for NodeBuilder<R>

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<R: Debug + RoleKind> Debug for NodeBuilder<R>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<R> Forget for NodeBuilder<R>

§

impl<R> Freeze for NodeBuilder<R>

§

impl<R> Move for NodeBuilder<R>

§

impl<R> RefUnwindSafe for NodeBuilder<R>

§

impl<R> Send for NodeBuilder<R>
where RawVecInner: Send, &'static str: Send, String: Send, NodeRef<Owned, String, String, LeafOrInternal>: Send, BoxRaw<(String, String)>: Send, BoxRaw<RawAnnotation>: Send,

§

impl<R> Sync for NodeBuilder<R>
where RawVecInner: Sync, String: Sync, NodeRef<Owned, String, String, LeafOrInternal>: Sync, BoxRaw<(String, String)>: Sync, BoxRaw<RawAnnotation>: Sync,

§

impl<R> Unpin for NodeBuilder<R>
where *const u8 is !null: Unpin, &'static str: Unpin, String: Unpin, *const LeafNode<String, String> is !null: Unpin, Box<(String, String)>: Unpin, Box<RawAnnotation>: Unpin,

§

impl<R> UnsafeUnpin for NodeBuilder<R>

§

impl<R> UnwindSafe for NodeBuilder<R>

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.