pub struct WidgetBuilder {
Show 33 fields pub name: String, pub width: f32, pub height: f32, pub desired_position: Vector2<f32>, pub vertical_alignment: VerticalAlignment, pub horizontal_alignment: HorizontalAlignment, pub max_size: Option<Vector2<f32>>, pub min_size: Option<Vector2<f32>>, pub background: Option<Brush>, pub foreground: Option<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<Rc<dyn Any>>, 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 layout_transform: Matrix3<f32>, pub render_transform: Matrix3<f32>, pub clip_to_bounds: bool, pub id: Uuid,
}
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: Vector2<f32>

Desired position of the widget.

§vertical_alignment: VerticalAlignment

Vertical alignment of the widget.

§horizontal_alignment: HorizontalAlignment

Horizontal alignment of the widget.

§max_size: Option<Vector2<f32>>

Max size of the widget.

§min_size: Option<Vector2<f32>>

Min size of the widget.

§background: Option<Brush>

Background brush of the widget.

§foreground: Option<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<Rc<dyn Any>>

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.

§layout_transform: Matrix3<f32>

Layout transform of the widget.

§render_transform: Matrix3<f32>

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.

Implementations§

source§

impl WidgetBuilder

source

pub fn new() -> Self

Creates new widget builder with the default values.

source

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

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) -> Self

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_width(self, width: f32) -> Self

Sets the desired width of the widget.

source

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

Sets the desired height of the widget.

source

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

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

source

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

Enables or disables the widget.

source

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

Sets the desired vertical alignment of the widget.

source

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

Sets the desired horizontal alignment of the widget.

source

pub fn with_max_size(self, max_size: Vector2<f32>) -> Self

Sets the max size of the widget.

source

pub fn with_min_size(self, min_size: Vector2<f32>) -> Self

Sets the min size of the widget.

source

pub fn with_background(self, brush: Brush) -> Self

Sets the desired background brush of the widget.

source

pub fn with_foreground(self, brush: Brush) -> Self

Sets the desired foreground brush of the widget.

source

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

Sets the desired row index of the widget.

source

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

Sets the desired column index of the widget.

source

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

Sets the desired margin of the widget.

source

pub fn with_desired_position(self, desired_position: Vector2<f32>) -> Self

Sets the desired position of the widget.

source

pub fn with_layout_transform(self, layout_transform: Matrix3<f32>) -> Self

Sets the desired layout transform of the widget.

source

pub fn with_render_transform(self, render_transform: Matrix3<f32>) -> Self

Sets the desired render transform of the widget.

source

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

Sets the desired Z index of the widget.

source

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

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

source

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

Enables or disables top-most widget drawing.

source

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

Sets the desired set of children nodes.

source

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

Sets the desired widget name.

source

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

Enables or disables hit test of the widget.

source

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

Sets the desired widget visibility.

source

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

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

source

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

Enables or disables dragging of the widget.

source

pub fn with_user_data(self, user_data: Rc<dyn Any>) -> Self

Sets the desired widget user data.

source

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

Sets the desired widget cursor.

source

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

Sets the desired widget opacity.

source

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

Sets the desired widget id.

source

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

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>) -> Self

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) -> Self

Sets the desired tooltip time.

source

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

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

source

pub fn build(self) -> Widget

Finishes building of the base widget.

Trait Implementations§

source§

impl Default for WidgetBuilder

source§

fn default() -> Self

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

Auto Trait Implementations§

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

source§

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

Mutably borrows from an owned value. Read more
source§

impl<T> FieldValue for Twhere 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, U> Into<U> for Twhere 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.

§

impl<T> Pointable for T

§

const ALIGN: usize = mem::align_of::<T>()

The alignment of pointer.
§

type Init = T

The type for initializers.
§

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

Initializes a with the given initializer. Read more
§

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

Dereferences the given pointer. Read more
§

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

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

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

impl<T> Same<T> for T

§

type Output = T

Should always be Self
§

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

§

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

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

fn is_in_subset(&self) -> bool

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

fn to_subset_unchecked(&self) -> SS

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

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 Twhere U: Into<T>,

§

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 Twhere U: TryFrom<T>,

§

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

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

§

fn vzip(self) -> V