Struct fyrox_ui::widget::WidgetBuilder
source · 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: 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<Brush>Background brush of the widget.
foreground: Option<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<Rc<dyn Any>>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.
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.
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_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: Brush) -> Self
pub fn with_background(self, brush: Brush) -> Self
Sets the desired background brush of the widget.
sourcepub fn with_foreground(self, brush: Brush) -> Self
pub fn with_foreground(self, brush: 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_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<UiNode>) -> Self
pub fn with_child(self, handle: Handle<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 an 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(self, user_data: Rc<dyn Any>) -> Self
pub fn with_user_data(self, user_data: Rc<dyn Any>) -> 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 widget will be deleted, the tooltip will be deleted only if there’s no one use 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 widget will be deleted, the tooltip will be deleted only if there’s no one use 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.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for WidgetBuilder
impl !Send for WidgetBuilder
impl !Sync for WidgetBuilder
impl Unpin for WidgetBuilder
impl !UnwindSafe for WidgetBuilder
Blanket Implementations§
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> FieldValue for Twhere
T: 'static,
impl<T> FieldValue for Twhere T: 'static,
§impl<T> Pointable for T
impl<T> Pointable for T
§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere SS: SubsetOf<SP>,
§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read more§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).§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.