Struct WidgetBuilder

Source
pub struct WidgetBuilder {
Show 37 fields pub name: String, pub width: f32, pub height: f32, pub desired_position: Matrix<f32, Const<2>, Const<1>, ArrayStorage<f32, 2, 1>>, pub vertical_alignment: VerticalAlignment, pub horizontal_alignment: HorizontalAlignment, pub max_size: Option<Matrix<f32, Const<2>, Const<1>, ArrayStorage<f32, 2, 1>>>, pub min_size: Option<Matrix<f32, Const<2>, Const<1>, ArrayStorage<f32, 2, 1>>>, pub background: Option<StyledProperty<Brush>>, pub foreground: Option<StyledProperty<Brush>>, pub row: usize, pub column: usize, pub margin: Thickness, pub children: Vec<Handle<UiNode>>, pub is_hit_test_visible: bool, pub visibility: bool, pub z_index: usize, pub allow_drag: bool, pub allow_drop: bool, pub user_data: Option<Arc<Mutex<RawMutex, dyn Any + Send>>>, pub draw_on_top: bool, pub enabled: bool, pub cursor: Option<CursorIcon>, pub opacity: Option<f32>, pub tooltip: Option<RcUiNodeHandle>, pub tooltip_time: f32, pub context_menu: Option<RcUiNodeHandle>, pub preview_messages: bool, pub handle_os_events: bool, pub need_update: bool, pub layout_transform: Matrix<f32, Const<3>, Const<3>, ArrayStorage<f32, 3, 3>>, pub render_transform: Matrix<f32, Const<3>, Const<3>, ArrayStorage<f32, 3, 3>>, pub clip_to_bounds: bool, pub id: Uuid, pub tab_index: Option<usize>, pub tab_stop: bool, pub accepts_input: bool,
}
Expand description

Widget builder creates Widget instances.

Fields§

§name: String

Name of the widget.

§width: f32

Width of the widget.

§height: f32

Height of the widget.

§desired_position: Matrix<f32, Const<2>, Const<1>, ArrayStorage<f32, 2, 1>>

Desired position of the widget.

§vertical_alignment: VerticalAlignment

Vertical alignment of the widget.

§horizontal_alignment: HorizontalAlignment

Horizontal alignment of the widget.

§max_size: Option<Matrix<f32, Const<2>, Const<1>, ArrayStorage<f32, 2, 1>>>

Max size of the widget.

§min_size: Option<Matrix<f32, Const<2>, Const<1>, ArrayStorage<f32, 2, 1>>>

Min size of the widget.

§background: Option<StyledProperty<Brush>>

Background brush of the widget.

§foreground: Option<StyledProperty<Brush>>

Foreground brush of the widget.

§row: usize

Row index of the widget.

§column: usize

Column index of the widget.

§margin: Thickness

Margin of the widget.

§children: Vec<Handle<UiNode>>

Children handles of the widget.

§is_hit_test_visible: bool

Whether the hit test is enabled or not.

§visibility: bool

Whether the widget is visible or not.

§z_index: usize

Z index of the widget.

§allow_drag: bool

Whether the dragging of the widget is allowed or not.

§allow_drop: bool

Whether the drop of the widget is allowed or not.

§user_data: Option<Arc<Mutex<RawMutex, dyn Any + Send>>>

User-defined data.

§draw_on_top: bool

Whether to draw the widget on top of any other or not.

§enabled: bool

Whether the widget is enabled or not.

§cursor: Option<CursorIcon>

Cursor of the widget.

§opacity: Option<f32>

Opacity of the widget.

§tooltip: Option<RcUiNodeHandle>

Tooltip of the widget.

§tooltip_time: f32

Visibility interval (in seconds) of the tooltip of the widget.

§context_menu: Option<RcUiNodeHandle>

Context menu of the widget.

§preview_messages: bool

Whether the preview messages is enabled or not.

§handle_os_events: bool

Whether the widget will handle OS events or not.

§need_update: bool

Whether the widget will be updated or not.

§layout_transform: Matrix<f32, Const<3>, Const<3>, ArrayStorage<f32, 3, 3>>

Layout transform of the widget.

§render_transform: Matrix<f32, Const<3>, Const<3>, ArrayStorage<f32, 3, 3>>

Render transform of the widget.

§clip_to_bounds: bool

Whether the widget bounds should be clipped by its parent or not.

§id: Uuid

Unique id of the widget.

§tab_index: Option<usize>

Defines the order in which this widget will get keyboard focus when Tab key is pressed. If set to None, Tab key won’t do anything on such widget. Default is None.

§tab_stop: bool

A flag, that defines whether the Tab key navigation is enabled or disabled for this widget.

§accepts_input: bool

A flag, that indicates that the widget accepts user input.

Implementations§

Source§

impl WidgetBuilder

Source

pub fn new() -> WidgetBuilder

Creates new widget builder with the default values.

Source

pub fn with_preview_messages(self, state: bool) -> WidgetBuilder

Enables or disables message previewing of the widget. It basically defines whether the crate::Control::preview_message will be called or not.

Source

pub fn with_handle_os_events(self, state: bool) -> WidgetBuilder

Enables or disables OS event handling of the widget. It basically defines whether the crate::Control::handle_os_event will be called or not.

Source

pub fn with_need_update(self, state: bool) -> WidgetBuilder

Enables or disables updating of the widget. It basically defines whether the crate::Control::update will be called or not.

Source

pub fn with_width(self, width: f32) -> WidgetBuilder

Sets the desired width of the widget.

Source

pub fn with_height(self, height: f32) -> WidgetBuilder

Sets the desired height of the widget.

Source

pub fn with_clip_to_bounds(self, clip_to_bounds: bool) -> WidgetBuilder

Enables or disables clipping of widget’s bound to its parent’s bounds.

Source

pub fn with_enabled(self, enabled: bool) -> WidgetBuilder

Enables or disables the widget.

Source

pub fn with_vertical_alignment(self, valign: VerticalAlignment) -> WidgetBuilder

Sets the desired vertical alignment of the widget.

Source

pub fn with_horizontal_alignment( self, halign: HorizontalAlignment, ) -> WidgetBuilder

Sets the desired horizontal alignment of the widget.

Source

pub fn with_max_size( self, max_size: Matrix<f32, Const<2>, Const<1>, ArrayStorage<f32, 2, 1>>, ) -> WidgetBuilder

Sets the max size of the widget.

Source

pub fn with_min_size( self, min_size: Matrix<f32, Const<2>, Const<1>, ArrayStorage<f32, 2, 1>>, ) -> WidgetBuilder

Sets the min size of the widget.

Source

pub fn with_background(self, brush: StyledProperty<Brush>) -> WidgetBuilder

Sets the desired background brush of the widget.

Source

pub fn with_foreground(self, brush: StyledProperty<Brush>) -> WidgetBuilder

Sets the desired foreground brush of the widget.

Source

pub fn on_row(self, row: usize) -> WidgetBuilder

Sets the desired row index of the widget.

Source

pub fn on_column(self, column: usize) -> WidgetBuilder

Sets the desired column index of the widget.

Source

pub fn with_margin(self, margin: Thickness) -> WidgetBuilder

Sets the desired margin of the widget.

Source

pub fn with_uniform_margin(self, margin: f32) -> WidgetBuilder

Sets the desired, uniform margin of the widget.

Source

pub fn with_desired_position( self, desired_position: Matrix<f32, Const<2>, Const<1>, ArrayStorage<f32, 2, 1>>, ) -> WidgetBuilder

Sets the desired position of the widget.

Source

pub fn with_layout_transform( self, layout_transform: Matrix<f32, Const<3>, Const<3>, ArrayStorage<f32, 3, 3>>, ) -> WidgetBuilder

Sets the desired layout transform of the widget.

Source

pub fn with_render_transform( self, render_transform: Matrix<f32, Const<3>, Const<3>, ArrayStorage<f32, 3, 3>>, ) -> WidgetBuilder

Sets the desired render transform of the widget.

Source

pub fn with_z_index(self, z_index: usize) -> WidgetBuilder

Sets the desired Z index of the widget.

Source

pub fn with_child(self, handle: Handle<UiNode>) -> WidgetBuilder

Adds a child handle to the widget. Handle::NONE values are ignored.

Source

pub fn with_draw_on_top(self, draw_on_top: bool) -> WidgetBuilder

Enables or disables top-most widget drawing.

Source

pub fn with_children<I>(self, children: I) -> WidgetBuilder
where I: IntoIterator<Item = Handle<UiNode>>,

Sets the desired set of children nodes.

Source

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

Sets the desired widget name.

Source

pub fn with_hit_test_visibility(self, state: bool) -> WidgetBuilder

Enables or disables hit test of the widget.

Source

pub fn with_visibility(self, visibility: bool) -> WidgetBuilder

Sets the desired widget visibility.

Source

pub fn with_allow_drop(self, allow_drop: bool) -> WidgetBuilder

Enables or disables an ability to drop other widgets on this widget.

Source

pub fn with_allow_drag(self, allow_drag: bool) -> WidgetBuilder

Enables or disables dragging of the widget.

Source

pub fn with_user_data( self, user_data: Arc<Mutex<RawMutex, dyn Any + Send>>, ) -> WidgetBuilder

Sets the desired widget user data.

Source

pub fn with_cursor(self, cursor: Option<CursorIcon>) -> WidgetBuilder

Sets the desired widget cursor.

Source

pub fn with_opacity(self, opacity: Option<f32>) -> WidgetBuilder

Sets the desired widget opacity.

Source

pub fn with_id(self, id: Uuid) -> WidgetBuilder

Sets the desired widget id.

Source

pub fn with_tooltip(self, tooltip: RcUiNodeHandle) -> WidgetBuilder

Sets the desired tooltip for the node.

§Important

The widget will share the tooltip, which means that when widget will be deleted, the tooltip will be deleted only if there’s no one use the tooltip anymore.

Source

pub fn with_opt_tooltip(self, tooltip: Option<RcUiNodeHandle>) -> WidgetBuilder

Sets the desired tooltip for the node.

§Important

The widget will share the tooltip, which means that when widget will be deleted, the tooltip will be deleted only if there’s no one use the tooltip anymore.

Source

pub fn with_tooltip_time(self, tooltip_time: f32) -> WidgetBuilder

Sets the desired tooltip time.

Source

pub fn with_context_menu(self, context_menu: RcUiNodeHandle) -> WidgetBuilder

The context menu receives PopupMessages for being displayed, and so should support those.

Source

pub fn with_tab_index(self, tab_index: Option<usize>) -> WidgetBuilder

Sets the desired tab index.

Source

pub fn with_tab_stop(self, tab_stop: bool) -> WidgetBuilder

Sets a flag, that defines whether the Tab key navigation is enabled or disabled for this widget.

Source

pub fn with_accepts_input(self, accepts_input: bool) -> WidgetBuilder

Sets a flag, that indicates that the widget accepts user input.

Source

pub fn build(self, ctx: &BuildContext<'_>) -> Widget

Finishes building of the base widget.

Trait Implementations§

Source§

impl Default for WidgetBuilder

Source§

fn default() -> WidgetBuilder

Returns the “default value” for a type. Read more

Auto Trait Implementations§

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> AsyncTaskResult for T
where T: Any + Send + 'static,

Source§

fn into_any(self: Box<T>) -> Box<dyn Any>

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> Downcast for T
where T: Any,

Source§

fn into_any(self: Box<T>) -> Box<dyn Any>

Convert Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.
Source§

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>

Convert Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait.
Source§

fn as_any(&self) -> &(dyn Any + 'static)

Convert &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any’s vtable from &Trait’s.
Source§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Convert &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
Source§

impl<T> Downcast for T
where T: Any,

Source§

fn as_any(&self) -> &(dyn Any + 'static)

Converts self reference as a reference to Any. Could be used to downcast a trait object to a particular type.
Source§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Converts self reference as a reference to Any. Could be used to downcast a trait object to a particular type.
Source§

fn into_any(self: Box<T>) -> Box<dyn Any>

Source§

impl<T> DowncastSync for T
where T: Any + Send + Sync,

Source§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Send + Sync>

Convert Arc<Trait> (where Trait: Downcast) to Arc<Any>. Arc<Any> can then be further downcast into Arc<ConcreteType> where ConcreteType implements Trait.
Source§

impl<T> FieldValue for T
where T: 'static,

Source§

fn as_any(&self) -> &(dyn Any + 'static)

Casts self to a &dyn Any
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<R, P> ReadPrimitive<R> for P
where R: Read + ReadEndian<P>, P: Default,

Source§

fn read_from_little_endian(read: &mut R) -> Result<Self, Error>

Read this value from the supplied reader. Same as ReadEndian::read_from_little_endian().
Source§

fn read_from_big_endian(read: &mut R) -> Result<Self, Error>

Read this value from the supplied reader. Same as ReadEndian::read_from_big_endian().
Source§

fn read_from_native_endian(read: &mut R) -> Result<Self, Error>

Read this value from the supplied reader. Same as ReadEndian::read_from_native_endian().
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<SS, SP> SupersetOf<SS> for SP
where SS: SubsetOf<SP>,

Source§

fn to_subset(&self) -> Option<SS>

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more
Source§

fn is_in_subset(&self) -> bool

Checks if self is actually part of its subset T (and can be converted to it).
Source§

fn to_subset_unchecked(&self) -> SS

Use with care! Same as self.to_subset but without any property checks. Always succeeds.
Source§

fn from_subset(element: &SS) -> SP

The inclusion map: converts self to the equivalent element of its superset.
Source§

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

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more