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 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
impl WidgetBuilder
Sourcepub fn new() -> WidgetBuilder
pub fn new() -> WidgetBuilder
Creates new widget builder with the default values.
Sourcepub fn with_preview_messages(self, state: bool) -> WidgetBuilder
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.
Sourcepub fn with_handle_os_events(self, state: bool) -> WidgetBuilder
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.
Sourcepub fn with_need_update(self, state: bool) -> WidgetBuilder
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.
Sourcepub fn with_width(self, width: f32) -> WidgetBuilder
pub fn with_width(self, width: f32) -> WidgetBuilder
Sets the desired width of the widget.
Sourcepub fn with_height(self, height: f32) -> WidgetBuilder
pub fn with_height(self, height: f32) -> WidgetBuilder
Sets the desired height of the widget.
Sourcepub fn with_clip_to_bounds(self, clip_to_bounds: bool) -> WidgetBuilder
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.
Sourcepub fn with_enabled(self, enabled: bool) -> WidgetBuilder
pub fn with_enabled(self, enabled: bool) -> WidgetBuilder
Enables or disables the widget.
Sourcepub fn with_vertical_alignment(self, valign: VerticalAlignment) -> WidgetBuilder
pub fn with_vertical_alignment(self, valign: VerticalAlignment) -> WidgetBuilder
Sets the desired vertical alignment of the widget.
Sourcepub fn with_horizontal_alignment(
self,
halign: HorizontalAlignment,
) -> WidgetBuilder
pub fn with_horizontal_alignment( self, halign: HorizontalAlignment, ) -> WidgetBuilder
Sets the desired horizontal alignment of the widget.
Sourcepub fn with_max_size(
self,
max_size: Matrix<f32, Const<2>, Const<1>, ArrayStorage<f32, 2, 1>>,
) -> WidgetBuilder
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.
Sourcepub fn with_min_size(
self,
min_size: Matrix<f32, Const<2>, Const<1>, ArrayStorage<f32, 2, 1>>,
) -> WidgetBuilder
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.
Sourcepub fn with_background(self, brush: StyledProperty<Brush>) -> WidgetBuilder
pub fn with_background(self, brush: StyledProperty<Brush>) -> WidgetBuilder
Sets the desired background brush of the widget.
Sourcepub fn with_foreground(self, brush: StyledProperty<Brush>) -> WidgetBuilder
pub fn with_foreground(self, brush: StyledProperty<Brush>) -> WidgetBuilder
Sets the desired foreground brush of the widget.
Sourcepub fn on_row(self, row: usize) -> WidgetBuilder
pub fn on_row(self, row: usize) -> WidgetBuilder
Sets the desired row index of the widget.
Sourcepub fn on_column(self, column: usize) -> WidgetBuilder
pub fn on_column(self, column: usize) -> WidgetBuilder
Sets the desired column index of the widget.
Sourcepub fn with_margin(self, margin: Thickness) -> WidgetBuilder
pub fn with_margin(self, margin: Thickness) -> WidgetBuilder
Sets the desired margin of the widget.
Sourcepub fn with_uniform_margin(self, margin: f32) -> WidgetBuilder
pub fn with_uniform_margin(self, margin: f32) -> WidgetBuilder
Sets the desired, uniform margin of the widget.
Sourcepub fn with_desired_position(
self,
desired_position: Matrix<f32, Const<2>, Const<1>, ArrayStorage<f32, 2, 1>>,
) -> WidgetBuilder
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.
Sourcepub fn with_layout_transform(
self,
layout_transform: Matrix<f32, Const<3>, Const<3>, ArrayStorage<f32, 3, 3>>,
) -> WidgetBuilder
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.
Sourcepub fn with_render_transform(
self,
render_transform: Matrix<f32, Const<3>, Const<3>, ArrayStorage<f32, 3, 3>>,
) -> WidgetBuilder
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.
Sourcepub fn with_z_index(self, z_index: usize) -> WidgetBuilder
pub fn with_z_index(self, z_index: usize) -> WidgetBuilder
Sets the desired Z index of the widget.
Sourcepub fn with_child(self, handle: Handle<UiNode>) -> WidgetBuilder
pub fn with_child(self, handle: Handle<UiNode>) -> WidgetBuilder
Adds a child handle to the widget. Handle::NONE
values are ignored.
Sourcepub fn with_draw_on_top(self, draw_on_top: bool) -> WidgetBuilder
pub fn with_draw_on_top(self, draw_on_top: bool) -> WidgetBuilder
Enables or disables top-most widget drawing.
Sourcepub fn with_children<I>(self, children: I) -> WidgetBuilder
pub fn with_children<I>(self, children: I) -> WidgetBuilder
Sets the desired set of children nodes.
Sourcepub fn with_name(self, name: &str) -> WidgetBuilder
pub fn with_name(self, name: &str) -> WidgetBuilder
Sets the desired widget name.
Sourcepub fn with_hit_test_visibility(self, state: bool) -> WidgetBuilder
pub fn with_hit_test_visibility(self, state: bool) -> WidgetBuilder
Enables or disables hit test of the widget.
Sourcepub fn with_visibility(self, visibility: bool) -> WidgetBuilder
pub fn with_visibility(self, visibility: bool) -> WidgetBuilder
Sets the desired widget visibility.
Sourcepub fn with_allow_drop(self, allow_drop: bool) -> WidgetBuilder
pub fn with_allow_drop(self, allow_drop: bool) -> WidgetBuilder
Enables or disables an ability to drop other widgets on this widget.
Sourcepub fn with_allow_drag(self, allow_drag: bool) -> WidgetBuilder
pub fn with_allow_drag(self, allow_drag: bool) -> WidgetBuilder
Enables or disables dragging of the widget.
Sourcepub fn with_user_data(
self,
user_data: Arc<Mutex<RawMutex, dyn Any + Send>>,
) -> WidgetBuilder
pub fn with_user_data( self, user_data: Arc<Mutex<RawMutex, dyn Any + Send>>, ) -> WidgetBuilder
Sets the desired widget user data.
Sourcepub fn with_cursor(self, cursor: Option<CursorIcon>) -> WidgetBuilder
pub fn with_cursor(self, cursor: Option<CursorIcon>) -> WidgetBuilder
Sets the desired widget cursor.
Sourcepub fn with_opacity(self, opacity: Option<f32>) -> WidgetBuilder
pub fn with_opacity(self, opacity: Option<f32>) -> WidgetBuilder
Sets the desired widget opacity.
Sourcepub fn with_id(self, id: Uuid) -> WidgetBuilder
pub fn with_id(self, id: Uuid) -> WidgetBuilder
Sets the desired widget id.
Sourcepub fn with_tooltip(self, tooltip: RcUiNodeHandle) -> WidgetBuilder
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.
Sourcepub fn with_opt_tooltip(self, tooltip: Option<RcUiNodeHandle>) -> WidgetBuilder
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.
Sourcepub fn with_tooltip_time(self, tooltip_time: f32) -> WidgetBuilder
pub fn with_tooltip_time(self, tooltip_time: f32) -> WidgetBuilder
Sets the desired tooltip time.
The context menu receives PopupMessage
s for being displayed, and so should support those.
Sourcepub fn with_tab_index(self, tab_index: Option<usize>) -> WidgetBuilder
pub fn with_tab_index(self, tab_index: Option<usize>) -> WidgetBuilder
Sets the desired tab index.
Sourcepub fn with_tab_stop(self, tab_stop: bool) -> WidgetBuilder
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.
Sourcepub fn with_accepts_input(self, accepts_input: bool) -> WidgetBuilder
pub fn with_accepts_input(self, accepts_input: bool) -> WidgetBuilder
Sets a flag, that indicates that the widget accepts user input.
Sourcepub fn build(self, ctx: &BuildContext<'_>) -> Widget
pub fn build(self, ctx: &BuildContext<'_>) -> Widget
Finishes building of the base widget.
Trait Implementations§
Source§impl Default for WidgetBuilder
impl Default for WidgetBuilder
Source§fn default() -> WidgetBuilder
fn default() -> WidgetBuilder
Auto Trait Implementations§
impl Freeze for WidgetBuilder
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> 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> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Any
. Could be used to downcast a trait object
to a particular type.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Any
. Could be used to downcast a trait object
to a particular type.fn into_any(self: Box<T>) -> Box<dyn Any>
Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<T> FieldValue for Twhere
T: 'static,
impl<T> FieldValue for Twhere
T: 'static,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
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> Pointable for T
impl<T> Pointable for T
Source§impl<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
Source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
ReadEndian::read_from_little_endian()
.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.