pub enum WidgetMessage {
Show 56 variants
MouseDown {
pos: Matrix<f32, Const<2>, Const<1>, ArrayStorage<f32, 2, 1>>,
button: MouseButton,
},
MouseUp {
pos: Matrix<f32, Const<2>, Const<1>, ArrayStorage<f32, 2, 1>>,
button: MouseButton,
},
MouseMove {
pos: Matrix<f32, Const<2>, Const<1>, ArrayStorage<f32, 2, 1>>,
state: MouseState,
},
MouseWheel {
pos: Matrix<f32, Const<2>, Const<1>, ArrayStorage<f32, 2, 1>>,
amount: f32,
},
MouseLeave,
MouseEnter,
Text(String),
KeyDown(KeyCode),
KeyUp(KeyCode),
Focus,
Unfocus,
DragStarted(Handle<UiNode>),
DragOver(Handle<UiNode>),
Drop(Handle<UiNode>),
Topmost,
Lowermost,
Unlink,
Remove,
LinkWith(Handle<UiNode>),
LinkWithReverse(Handle<UiNode>),
ReplaceChildren(Vec<Handle<UiNode>>),
Background(StyledProperty<Brush>),
Foreground(StyledProperty<Brush>),
Name(String),
Width(f32),
Height(f32),
VerticalAlignment(VerticalAlignment),
HorizontalAlignment(HorizontalAlignment),
MaxSize(Matrix<f32, Const<2>, Const<1>, ArrayStorage<f32, 2, 1>>),
MinSize(Matrix<f32, Const<2>, Const<1>, ArrayStorage<f32, 2, 1>>),
Row(usize),
Column(usize),
Margin(Thickness),
HitTestVisibility(bool),
Visibility(bool),
ZIndex(usize),
DesiredPosition(Matrix<f32, Const<2>, Const<1>, ArrayStorage<f32, 2, 1>>),
Align {
relative_to: Handle<UiNode>,
horizontal_alignment: HorizontalAlignment,
vertical_alignment: VerticalAlignment,
margin: Thickness,
},
Enabled(bool),
Center,
AdjustPositionToFit,
Cursor(Option<CursorIcon>),
Opacity(Option<f32>),
LayoutTransform(Matrix<f32, Const<3>, Const<3>, ArrayStorage<f32, 3, 3>>),
RenderTransform(Matrix<f32, Const<3>, Const<3>, ArrayStorage<f32, 3, 3>>),
DoubleClick {
button: MouseButton,
},
ContextMenu(Option<RcUiNodeHandle>),
Tooltip(Option<RcUiNodeHandle>),
TouchStarted {
pos: Matrix<f32, Const<2>, Const<1>, ArrayStorage<f32, 2, 1>>,
force: Option<Force>,
id: u64,
},
TouchEnded {
pos: Matrix<f32, Const<2>, Const<1>, ArrayStorage<f32, 2, 1>>,
id: u64,
},
TouchMoved {
pos: Matrix<f32, Const<2>, Const<1>, ArrayStorage<f32, 2, 1>>,
force: Option<Force>,
id: u64,
},
TouchCancelled {
pos: Matrix<f32, Const<2>, Const<1>, ArrayStorage<f32, 2, 1>>,
id: u64,
},
DoubleTap {
pos: Matrix<f32, Const<2>, Const<1>, ArrayStorage<f32, 2, 1>>,
force: Option<Force>,
id: u64,
},
SortChildren(SortingPredicate),
Style(Resource<Style>),
ResetVisual,
}Expand description
A set of messages for any kind of widgets (including user controls). These messages provide basic communication elements of the UI library.
Variants§
MouseDown
Initiated when a user clicks on a widget’s geometry.
Direction: From UI.
Fields
A button that was pressed.
MouseUp
Initiated when a user releases mouse button while the cursor is over widget’s geometry.
Direction: From UI.
Fields
A button that was released.
MouseMove
Initiated when user moves cursor over widget’s geometry.
Direction: From/To UI.
Fields
pos: Matrix<f32, Const<2>, Const<1>, ArrayStorage<f32, 2, 1>>New position of cursor in screen coordinates.
state: MouseStateState of mouse buttons.
MouseWheel
Initiated when a user scrolls mouse wheel while the cursor is over widget’s geometry.
Direction: From/To UI.
Fields
MouseLeave
Initiated when cursor leaves geometry of a widget.
Direction: From UI.
MouseEnter
Initiated when the cursor enters geometry of a widget.
Direction: From UI.
Text(String)
Initiated when widget is in focus and user types something on a keyboard.
Direction: From/To UI.
KeyDown(KeyCode)
Initiated when widget is in focus and user presses a button on a keyboard.
Direction: From UI.
KeyUp(KeyCode)
Initiated when the widget is in focus and user releases a button on a keyboard.
Direction: From UI.
Focus
Initiated when widget received focus (when direction is crate::message::MessageDirection::FromWidget). In most cases, focus is received
by clicking on widget. You can request focus explicitly by sending this message to a widget with crate::message::MessageDirection::ToWidget
Direction: From UI/To UI.
Unfocus
Initiated when widget has lost its focus (when direction is crate::message::MessageDirection::FromWidget). Can be used to
remove focus from the widget if sent with crate::message::MessageDirection::ToWidget
Direction: From UI/To UI.
DragStarted(Handle<UiNode>)
Initiated when dragging of a widget has started.
Direction: From UI.
DragOver(Handle<UiNode>)
Initiated when a user drags a widget over some other widget.
Direction: From UI.
Drop(Handle<UiNode>)
Initiated when a user drops a widget onto some other widget.
Direction: From UI.
Topmost
A request to make widget topmost. Widget can be made topmost only in the same hierarchy level only!
Direction: From/To UI.
Lowermost
A request to make widget lowermost. Widget can be made lowermost only in the same hierarchy level only!
Direction: From/To UI.
Unlink
A request to detach widget from its current parent and attach to root canvas.
Direction: From/To UI.
Remove
A request to delete widget with all its children widgets. All handles to a node and its children will be invalid after processing such message!
Direction: From/To UI.
LinkWith(Handle<UiNode>)
A request to link initiator with specified widget.
Direction: From/To UI.
LinkWithReverse(Handle<UiNode>)
A request to link initiator with a specified widget and put it in front of children list.
Direction: From/To UI.
ReplaceChildren(Vec<Handle<UiNode>>)
A request to delete all the children widgets and replace them with the given nodes as the new child nodes.
Direction: To UI.
Background(StyledProperty<Brush>)
A request to change background brush of a widget. Background brushes are used to fill the volume with widgets.
Direction: From/To UI
Foreground(StyledProperty<Brush>)
A request to change foreground brush of a widget. Foreground brushes are used for text, borders and so on.
Direction: From/To UI
Name(String)
A request to change the name of a widget. Name is given to widget mostly for debugging purposes.
Direction: From/To UI
Width(f32)
A request to set the width of a widget. In most cases, there is no need to explicitly set the width of a widget, because fyrox-ui uses automatic layout engine which will correctly calculate the desired width of a widget.
Direction: From/To UI
Height(f32)
A request to set the height of a widget. In most cases, there is no need to explicitly set the height of a widget, because fyrox-ui uses automatic layout engine which will correctly calculate the desired height of a widget.
Direction: From/To UI
VerticalAlignment(VerticalAlignment)
A request to set vertical alignment of a widget. Vertical alignment tells where to put widget in the parent widget’s bounds in vertical direction.
Direction: From/To UI
HorizontalAlignment(HorizontalAlignment)
A request to set horizontal alignment of a widget. Horizontal alignment tells where to put widget in the parent widget’s bounds in horizontal direction.
Direction: From/To UI
MaxSize(Matrix<f32, Const<2>, Const<1>, ArrayStorage<f32, 2, 1>>)
A request to set the maximum size of widget. Maximum size restricts the size of a widget during layout pass. For example, you can set the maximum size to a button which was placed into a grid’s cell. if the maximum size wouldn’t be set, the button would be stretched to fill the entire cell.
Direction: From/To UI
MinSize(Matrix<f32, Const<2>, Const<1>, ArrayStorage<f32, 2, 1>>)
A request to set the minimum size of widget. Minimum size restricts the size of a widget during layout pass. For example, you can set minimum size to a button which was placed into a grid’s cell, if minimum size wouldn’t be set, the button would be compressed to fill the entire cell.
Direction: From/To UI
Row(usize)
A request to set row number of a grid to which widget should belong to.
Direction: From/To UI
§Notes
This is a bad API, and it should be changed in the future. Grid should have an explicit list of pairs (row, child) instead of this indirect attachment.
Column(usize)
A request to set column number of a grid to which widget should belong to.
Direction: From/To UI
§Notes
This is a bad API, and it should be changed in the future. Grid should have an explicit list of pairs (column, child) instead of this indirect attachment.
Margin(Thickness)
A request to set new margin of widget. Margin could be used to add some free space around the widget to make the UI look less dense.
Direction: From/To UI
HitTestVisibility(bool)
A request to set new state hit test visibility. If set to false, the widget will become “non-clickable”. It is useful for decorations which should be transparent for mouse events.
Direction: From/To UI
Visibility(bool)
A request to set new visibility of a widget. Widget can be either visible or not. Invisible widgets do not take space in layout pass and collapsed to a point.
Direction: From/To UI
ZIndex(usize)
A request to set new z index of a widget. Z index is used to change drawing order of widgets. Please note that it works only in the same hierarchy level, which means that it is impossible to set z index to 9999 (or similar huge value) to force the widget to be drawn on top of everything.
Direction: From/To UI
DesiredPosition(Matrix<f32, Const<2>, Const<1>, ArrayStorage<f32, 2, 1>>)
A request to set new desired position of a widget. It is called “desired” because the layout system may ignore it and set some other position. Desired position works with a combination of a layout panel that supports direct coordinated (Canvas for example).
Direction: From/To UI
Align
Aligns the widget in the specified widget’s bounds using the given options. It can be used only if the widget is a child of a container that supports arbitrary positions (such as Canvas).
Fields
relative_to: Handle<UiNode>A handle of a node to which the sender of this message should be aligned to.
horizontal_alignment: HorizontalAlignmentHorizontal alignment of the widget.
vertical_alignment: VerticalAlignmentVertical alignment of the widget.
Enabled(bool)
A request to enable or disable widget. Disabled widget won’t receive mouse events and may look differently (it is defined by internal styling).
Direction: From/To UI
Center
A request to set the desired position at center in local coordinates.
Direction: From/To UI
AdjustPositionToFit
A request to adjust widget’s position to fit in parent’s bounds.
Cursor(Option<CursorIcon>)
A request to set new cursor icon for widget.
Direction: From/To UI
Opacity(Option<f32>)
A request to set new opacity for widget.
Direction: From/To UI
LayoutTransform(Matrix<f32, Const<3>, Const<3>, ArrayStorage<f32, 3, 3>>)
A request to set new layout transform.
RenderTransform(Matrix<f32, Const<3>, Const<3>, ArrayStorage<f32, 3, 3>>)
A request to set new render transform.
DoubleClick
A double click of a mouse button has occurred on a widget.
Fields
A button, that was double-clicked.
ContextMenu(Option<RcUiNodeHandle>)
A request to set new context menu for a widget. The old context menu will be removed only if its reference counter was 1.
Tooltip(Option<RcUiNodeHandle>)
A request to set new tooltip for a widget. The old tooltip will be removed only if its reference counter was 1.
TouchStarted
Initiated when user places finger on the screen.
Direction: From UI.
Fields
TouchEnded
Initiated when user removes finger from the screen.
Direction: From UI.
Fields
TouchMoved
Initiated when a user drags their finger across the screen.
Direction: From UI.
Fields
TouchCancelled
Initiated when a user cancels their touch event.
Direction: From UI.
Fields
DoubleTap
Initiated when a user taps the screen two or more times in rapid succession.
Direction: From UI.
Fields
SortChildren(SortingPredicate)
Sorts children widgets of a widget.
Direction: To UI.
Style(Resource<Style>)
Applies a style to the widget.
ResetVisual
Asks a widget to reset its visual state. The actual response to this message is widget-specific. In most cases, it does nothing.
Implementations§
Source§impl WidgetMessage
impl WidgetMessage
Sourcepub fn drag_started(
handle: Handle<impl ObjectOrVariant<UiNode>>,
) -> WidgetMessage
pub fn drag_started( handle: Handle<impl ObjectOrVariant<UiNode>>, ) -> WidgetMessage
Creates a Self::DragStarted message.
Sourcepub fn drag_over(handle: Handle<impl ObjectOrVariant<UiNode>>) -> WidgetMessage
pub fn drag_over(handle: Handle<impl ObjectOrVariant<UiNode>>) -> WidgetMessage
Creates a Self::DragOver message.
Sourcepub fn drop(handle: Handle<impl ObjectOrVariant<UiNode>>) -> WidgetMessage
pub fn drop(handle: Handle<impl ObjectOrVariant<UiNode>>) -> WidgetMessage
Creates a Self::Drop message.
Sourcepub fn link_with(handle: Handle<impl ObjectOrVariant<UiNode>>) -> WidgetMessage
pub fn link_with(handle: Handle<impl ObjectOrVariant<UiNode>>) -> WidgetMessage
Creates a Self::LinkWith message.
Sourcepub fn link_with_reverse(
handle: Handle<impl ObjectOrVariant<UiNode>>,
) -> WidgetMessage
pub fn link_with_reverse( handle: Handle<impl ObjectOrVariant<UiNode>>, ) -> WidgetMessage
Creates a Self::LinkWithReverse message.
Trait Implementations§
Source§impl Clone for WidgetMessage
impl Clone for WidgetMessage
Source§fn clone(&self) -> WidgetMessage
fn clone(&self) -> WidgetMessage
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for WidgetMessage
impl Debug for WidgetMessage
Source§impl MessageData for WidgetMessage
impl MessageData for WidgetMessage
Source§fn need_perform_layout(&self) -> bool
fn need_perform_layout(&self) -> bool
true when the message starts a new layout pass before being passed to its
destination.Source§impl PartialEq for WidgetMessage
impl PartialEq for WidgetMessage
impl StructuralPartialEq for WidgetMessage
Auto Trait Implementations§
impl Freeze for WidgetMessage
impl !RefUnwindSafe for WidgetMessage
impl Send for WidgetMessage
impl Sync for WidgetMessage
impl Unpin for WidgetMessage
impl !UnwindSafe for WidgetMessage
Blanket Implementations§
Source§impl<T> AsyncTaskResult for T
impl<T> AsyncTaskResult for T
Source§impl<T> BaseMessageData for T
impl<T> BaseMessageData 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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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 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>, which can then be
downcast into Box<dyn 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>, which 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> DowncastSend for T
impl<T> DowncastSend for T
Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
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<F, T> IntoSample<T> for Fwhere
T: FromSample<F>,
impl<F, T> IntoSample<T> for Fwhere
T: FromSample<F>,
fn into_sample(self) -> T
Source§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.