pub struct WidgetBuilder {Show 39 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<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<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: Matrix3<f32>,
pub render_transform: Matrix3<f32>,
pub clip_to_bounds: bool,
pub id: Uuid,
pub tab_index: Option<usize>,
pub tab_stop: bool,
pub accepts_input: bool,
pub material: WidgetMaterial,
pub style: StyleResource,
}Expand description
Widget builder creates Widget instances.
Fields§
§name: StringName of the widget.
width: f32Width of the widget.
height: f32Height of the widget.
desired_position: Vector2<f32>Desired position of the widget.
vertical_alignment: VerticalAlignmentVertical alignment of the widget.
horizontal_alignment: HorizontalAlignmentHorizontal 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<StyledProperty<Brush>>Background brush of the widget.
foreground: Option<StyledProperty<Brush>>Foreground brush of the widget.
row: usizeRow index of the widget.
column: usizeColumn index of the widget.
margin: ThicknessMargin of the widget.
children: Vec<Handle<UiNode>>Children handles of the widget.
is_hit_test_visible: boolWhether the hit test is enabled or not.
visibility: boolWhether the widget is visible or not.
z_index: usizeZ index of the widget.
allow_drag: boolWhether the dragging of the widget is allowed or not.
allow_drop: boolWhether the drop of the widget is allowed or not.
user_data: Option<Arc<Mutex<dyn Any + Send>>>User-defined data.
draw_on_top: boolWhether to draw the widget on top of any other or not.
enabled: boolWhether 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: f32Visibility interval (in seconds) of the tooltip of the widget.
Context menu of the widget.
preview_messages: boolWhether the preview messages is enabled or not.
handle_os_events: boolWhether the widget will handle OS events or not.
need_update: boolWhether the widget will be updated or not.
layout_transform: Matrix3<f32>Layout transform of the widget.
render_transform: Matrix3<f32>Render transform of the widget.
clip_to_bounds: boolWhether the widget bounds should be clipped by its parent or not.
id: UuidUnique id of the widget.
tab_index: Option<usize>Defines the order in which this widget will get keyboard focus when the Tab key is pressed.
If set to None, Tab key won’t do anything on such widget. Default is None.
tab_stop: boolA flag, that defines whether the Tab key navigation is enabled or disabled for this widget.
accepts_input: boolA flag, that indicates that the widget accepts user input.
material: WidgetMaterialA material that will be used for rendering.
style: StyleResourceStyle of the widget.
Implementations§
Source§impl WidgetBuilder
impl WidgetBuilder
Sourcepub fn with_preview_messages(self, state: bool) -> Self
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.
Sourcepub fn with_handle_os_events(self, state: bool) -> Self
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.
Sourcepub fn with_need_update(self, state: bool) -> Self
pub fn with_need_update(self, state: bool) -> Self
Enables or disables updating of the widget. It basically defines whether the crate::Control::update will
be called or not.
Sourcepub fn with_width(self, width: f32) -> Self
pub fn with_width(self, width: f32) -> Self
Sets the desired width of the widget.
Sourcepub fn with_height(self, height: f32) -> Self
pub fn with_height(self, height: f32) -> Self
Sets the desired height of the widget.
Sourcepub fn with_clip_to_bounds(self, clip_to_bounds: bool) -> Self
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.
Sourcepub fn with_enabled(self, enabled: bool) -> Self
pub fn with_enabled(self, enabled: bool) -> Self
Enables or disables the widget.
Sourcepub fn with_vertical_alignment(self, valign: VerticalAlignment) -> Self
pub fn with_vertical_alignment(self, valign: VerticalAlignment) -> Self
Sets the desired vertical alignment of the widget.
Sourcepub fn with_horizontal_alignment(self, halign: HorizontalAlignment) -> Self
pub fn with_horizontal_alignment(self, halign: HorizontalAlignment) -> Self
Sets the desired horizontal alignment of the widget.
Sourcepub fn with_max_size(self, max_size: Vector2<f32>) -> Self
pub fn with_max_size(self, max_size: Vector2<f32>) -> Self
Sets the max size of the widget.
Sourcepub fn with_min_size(self, min_size: Vector2<f32>) -> Self
pub fn with_min_size(self, min_size: Vector2<f32>) -> Self
Sets the min size of the widget.
Sourcepub fn with_background(self, brush: StyledProperty<Brush>) -> Self
pub fn with_background(self, brush: StyledProperty<Brush>) -> Self
Sets the desired background brush of the widget.
Sourcepub fn with_foreground(self, brush: StyledProperty<Brush>) -> Self
pub fn with_foreground(self, brush: StyledProperty<Brush>) -> Self
Sets the desired foreground brush of the widget.
Sourcepub fn with_margin(self, margin: Thickness) -> Self
pub fn with_margin(self, margin: Thickness) -> Self
Sets the desired margin of the widget.
Sourcepub fn with_uniform_margin(self, margin: f32) -> Self
pub fn with_uniform_margin(self, margin: f32) -> Self
Sets the desired, uniform margin of the widget.
Sourcepub fn with_desired_position(self, desired_position: Vector2<f32>) -> Self
pub fn with_desired_position(self, desired_position: Vector2<f32>) -> Self
Sets the desired position of the widget.
Sourcepub fn with_layout_transform(self, layout_transform: Matrix3<f32>) -> Self
pub fn with_layout_transform(self, layout_transform: Matrix3<f32>) -> Self
Sets the desired layout transform of the widget.
Sourcepub fn with_render_transform(self, render_transform: Matrix3<f32>) -> Self
pub fn with_render_transform(self, render_transform: Matrix3<f32>) -> Self
Sets the desired render transform of the widget.
Sourcepub fn with_z_index(self, z_index: usize) -> Self
pub fn with_z_index(self, z_index: usize) -> Self
Sets the desired Z index of the widget.
Sourcepub fn with_child(self, handle: Handle<impl ObjectOrVariant<UiNode>>) -> Self
pub fn with_child(self, handle: Handle<impl ObjectOrVariant<UiNode>>) -> Self
Adds a child handle to the widget. Handle::NONE values are ignored.
Sourcepub fn with_draw_on_top(self, draw_on_top: bool) -> Self
pub fn with_draw_on_top(self, draw_on_top: bool) -> Self
Enables or disables top-most widget drawing.
Sourcepub fn with_children<I: IntoIterator<Item = Handle<UiNode>>>(
self,
children: I,
) -> Self
pub fn with_children<I: IntoIterator<Item = Handle<UiNode>>>( self, children: I, ) -> Self
Sets the desired set of children nodes.
Sourcepub fn with_hit_test_visibility(self, state: bool) -> Self
pub fn with_hit_test_visibility(self, state: bool) -> Self
Enables or disables hit test of the widget.
Sourcepub fn with_visibility(self, visibility: bool) -> Self
pub fn with_visibility(self, visibility: bool) -> Self
Sets the desired widget visibility.
Sourcepub fn with_allow_drop(self, allow_drop: bool) -> Self
pub fn with_allow_drop(self, allow_drop: bool) -> Self
Enables or disables the ability to drop other widgets on this widget.
Sourcepub fn with_allow_drag(self, allow_drag: bool) -> Self
pub fn with_allow_drag(self, allow_drag: bool) -> Self
Enables or disables dragging of the widget.
Sourcepub fn with_user_data_value_opt<T: Any + Send>(
self,
user_data: Option<T>,
) -> Self
pub fn with_user_data_value_opt<T: Any + Send>( self, user_data: Option<T>, ) -> Self
Sets the desired widget user data.
Sourcepub fn with_user_data_value<T: Any + Send>(self, user_data: T) -> Self
pub fn with_user_data_value<T: Any + Send>(self, user_data: T) -> Self
Sets the desired widget user data.
Sourcepub fn with_user_data(self, user_data: Arc<Mutex<dyn Any + Send>>) -> Self
pub fn with_user_data(self, user_data: Arc<Mutex<dyn Any + Send>>) -> Self
Sets the desired widget user data.
Sourcepub fn with_cursor(self, cursor: Option<CursorIcon>) -> Self
pub fn with_cursor(self, cursor: Option<CursorIcon>) -> Self
Sets the desired widget cursor.
Sourcepub fn with_opacity(self, opacity: Option<f32>) -> Self
pub fn with_opacity(self, opacity: Option<f32>) -> Self
Sets the desired widget opacity.
Sourcepub fn with_tooltip(self, tooltip: RcUiNodeHandle) -> Self
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 the widget will be deleted, the tooltip will be deleted only if there’s no one using the tooltip anymore.
Sourcepub fn with_opt_tooltip(self, tooltip: Option<RcUiNodeHandle>) -> Self
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 the widget will be deleted, the tooltip will be deleted only if there’s no one using the tooltip anymore.
Sourcepub fn with_tooltip_time(self, tooltip_time: f32) -> Self
pub fn with_tooltip_time(self, tooltip_time: f32) -> Self
Sets the desired tooltip time.
The context menu receives PopupMessages for being displayed, and so should support those.
Sourcepub fn with_tab_index(self, tab_index: Option<usize>) -> Self
pub fn with_tab_index(self, tab_index: Option<usize>) -> Self
Sets the desired tab index.
Sourcepub fn with_tab_stop(self, tab_stop: bool) -> Self
pub fn with_tab_stop(self, tab_stop: bool) -> Self
Sets a flag, that defines whether the Tab key navigation is enabled or disabled for this widget.
Sourcepub fn with_accepts_input(self, accepts_input: bool) -> Self
pub fn with_accepts_input(self, accepts_input: bool) -> Self
Sets a flag, that indicates that the widget accepts user input.
Sourcepub fn with_material(self, material: WidgetMaterial) -> Self
pub fn with_material(self, material: WidgetMaterial) -> Self
Sets a material which will be used for rendering of this widget.
Sourcepub fn build(self, ctx: &BuildContext<'_>) -> Widget
pub fn build(self, ctx: &BuildContext<'_>) -> Widget
Finishes building of the base widget.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for WidgetBuilder
impl !RefUnwindSafe for WidgetBuilder
impl Send for WidgetBuilder
impl Sync for WidgetBuilder
impl Unpin for WidgetBuilder
impl UnsafeUnpin for WidgetBuilder
impl !UnwindSafe for WidgetBuilder
Blanket Implementations§
Source§impl<T> AsyncTaskResult for T
impl<T> AsyncTaskResult for T
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
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>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
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)
fn as_any(&self) -> &(dyn Any + 'static)
&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)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&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> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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 moreSource§impl<T, U> ObjectOrVariant<T> for Uwhere
PhantomData<U>: ObjectOrVariantHelper<T, U>,
impl<T, U> ObjectOrVariant<T> for Uwhere
PhantomData<U>: ObjectOrVariantHelper<T, U>,
Source§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.