Enum fyrox_ui::widget::WidgetMessage
source · pub enum WidgetMessage {
Show 46 variants
MouseDown {
pos: Vector2<f32>,
button: MouseButton,
},
MouseUp {
pos: Vector2<f32>,
button: MouseButton,
},
MouseMove {
pos: Vector2<f32>,
state: MouseState,
},
MouseWheel {
pos: Vector2<f32>,
amount: f32,
},
MouseLeave,
MouseEnter,
Text(char),
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>),
Background(Brush),
Foreground(Brush),
Name(String),
Width(f32),
Height(f32),
VerticalAlignment(VerticalAlignment),
HorizontalAlignment(HorizontalAlignment),
MaxSize(Vector2<f32>),
MinSize(Vector2<f32>),
Row(usize),
Column(usize),
Margin(Thickness),
HitTestVisibility(bool),
Visibility(bool),
ZIndex(usize),
DesiredPosition(Vector2<f32>),
Enabled(bool),
Center,
AdjustPositionToFit,
Cursor(Option<CursorIcon>),
Opacity(Option<f32>),
LayoutTransform(Matrix3<f32>),
RenderTransform(Matrix3<f32>),
DoubleClick {
button: MouseButton,
},
ContextMenu(Option<RcUiNodeHandle>),
Tooltip(Option<RcUiNodeHandle>),
}Expand description
A set of messages for any kind of widgets (including user controls). These messages provides basic communication elements of the UI library.
Variants§
MouseDown
Initiated when user clicks on a widget’s geometry.
Direction: From UI.
MouseUp
Initiated when user releases mouse button while cursor is over widget’s geometry.
Direction: From UI.
MouseMove
Fields
state: MouseStateState of mouse buttons.
Initiated when user moves cursor over widget’s geometry.
Direction: From/To UI.
MouseWheel
Initiated when user scrolls mouse wheel while cursor is over widget’s geometry.
Direction: From/To UI.
MouseLeave
Initiated when cursor leaves geometry of a widget.
Direction: From UI.
MouseEnter
Initiated when cursor enters geometry of a widget.
Direction: From UI.
Text(char)
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 widget is in focus and user releases a button on a keyboard.
Direction: From UI.
Focus
Initiated when widget received focus (when direction is 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 MessageDirection::ToWidget
Direction: From UI/To UI.
Unfocus
Initiated when widget has lost its focus (when direction is MessageDirection::FromWidget). Can be used to
removed focus from widget if sent with 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 user drags a widget over some other widget.
Direction: From UI.
Drop(Handle<UiNode>)
Initiated when 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 specified widget and put it in front of children list.
Direction: From/To UI.
Background(Brush)
A request to change background brush of a widget. Background brushes are used to fill volume of widgets.
Direction: From/To UI
Foreground(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 name of a widget. Name is given to widget mostly for debugging purposes.
Direction: From/To UI
Width(f32)
A request to set width of a widget. In most cases there is no need to explicitly set width of a widget, because fyrox-ui uses automatic layout engine which will correctly calculate desired width of a widget.
Direction: From/To UI
Height(f32)
A request to set height of a widget. In most cases there is no need to explicitly set height of a widget, because fyrox-ui uses automatic layout engine which will correctly calculate 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(Vector2<f32>)
A request to set maximum size of widget. Maximum size restricts size of a widget during layout pass. For example you can set maximum size to a button which was placed into a grid’s cell, if maximum size wouldn’t be set, button would be stretched to fill entire cell.
Direction: From/To UI
MinSize(Vector2<f32>)
A request to set minimum size of widget. Minimum size restricts 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, button would be compressed to fill 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 bad API and it should be changed in future. Grid should have 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 bad API and it should be changed in future. Grid should have 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 widget to make UI look less dense.
Direction: From/To UI
HitTestVisibility(bool)
A request to set new state hit test visibility. If set to false, 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 does 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 same hierarchy level, which means that it is impossible to set z index to 9999 (or similar huge value) to force widget to be drawn on top of everything.
Direction: From/To UI
DesiredPosition(Vector2<f32>)
A request to set new desired position of a widget. It is called “desired” because 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
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 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(Matrix3<f32>)
A request to set new layout transform.
RenderTransform(Matrix3<f32>)
A request to set new render transform.
DoubleClick
Fields
A button, that was double-clicked.
A double click of a mouse button has occurred on a widget.
ContextMenu(Option<RcUiNodeHandle>)
A request to set new context menu for a widget. 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. Old tooltip will be removed only if its reference counter was 1.
Implementations§
source§impl WidgetMessage
impl WidgetMessage
sourcepub fn remove(
destination: Handle<UiNode>,
direction: MessageDirection
) -> UiMessage
pub fn remove( destination: Handle<UiNode>, direction: MessageDirection ) -> UiMessage
Creates WidgetMessage::Remove message.
sourcepub fn unlink(
destination: Handle<UiNode>,
direction: MessageDirection
) -> UiMessage
pub fn unlink( destination: Handle<UiNode>, direction: MessageDirection ) -> UiMessage
Creates WidgetMessage::Unlink message.
sourcepub fn link(
destination: Handle<UiNode>,
direction: MessageDirection,
value: Handle<UiNode>
) -> UiMessage
pub fn link( destination: Handle<UiNode>, direction: MessageDirection, value: Handle<UiNode> ) -> UiMessage
Creates WidgetMessage::LinkWith message.
sourcepub fn link_reverse(
destination: Handle<UiNode>,
direction: MessageDirection,
value: Handle<UiNode>
) -> UiMessage
pub fn link_reverse( destination: Handle<UiNode>, direction: MessageDirection, value: Handle<UiNode> ) -> UiMessage
Creates WidgetMessage::LinkWithReverse message.
sourcepub fn background(
destination: Handle<UiNode>,
direction: MessageDirection,
value: Brush
) -> UiMessage
pub fn background( destination: Handle<UiNode>, direction: MessageDirection, value: Brush ) -> UiMessage
Creates WidgetMessage::Background message.
sourcepub fn foreground(
destination: Handle<UiNode>,
direction: MessageDirection,
value: Brush
) -> UiMessage
pub fn foreground( destination: Handle<UiNode>, direction: MessageDirection, value: Brush ) -> UiMessage
Creates WidgetMessage::Foreground message.
sourcepub fn visibility(
destination: Handle<UiNode>,
direction: MessageDirection,
value: bool
) -> UiMessage
pub fn visibility( destination: Handle<UiNode>, direction: MessageDirection, value: bool ) -> UiMessage
Creates WidgetMessage::Visibility message.
sourcepub fn width(
destination: Handle<UiNode>,
direction: MessageDirection,
value: f32
) -> UiMessage
pub fn width( destination: Handle<UiNode>, direction: MessageDirection, value: f32 ) -> UiMessage
Creates WidgetMessage::Width message.
sourcepub fn height(
destination: Handle<UiNode>,
direction: MessageDirection,
value: f32
) -> UiMessage
pub fn height( destination: Handle<UiNode>, direction: MessageDirection, value: f32 ) -> UiMessage
Creates WidgetMessage::Height message.
sourcepub fn desired_position(
destination: Handle<UiNode>,
direction: MessageDirection,
value: Vector2<f32>
) -> UiMessage
pub fn desired_position( destination: Handle<UiNode>, direction: MessageDirection, value: Vector2<f32> ) -> UiMessage
Creates WidgetMessage::DesiredPosition message.
sourcepub fn center(
destination: Handle<UiNode>,
direction: MessageDirection
) -> UiMessage
pub fn center( destination: Handle<UiNode>, direction: MessageDirection ) -> UiMessage
Creates WidgetMessage::Center message.
sourcepub fn adjust_position_to_fit(
destination: Handle<UiNode>,
direction: MessageDirection
) -> UiMessage
pub fn adjust_position_to_fit( destination: Handle<UiNode>, direction: MessageDirection ) -> UiMessage
Creates WidgetMessage::AdjustPositionToFit message.
sourcepub fn topmost(
destination: Handle<UiNode>,
direction: MessageDirection
) -> UiMessage
pub fn topmost( destination: Handle<UiNode>, direction: MessageDirection ) -> UiMessage
Creates WidgetMessage::Topmost message.
sourcepub fn lowermost(
destination: Handle<UiNode>,
direction: MessageDirection
) -> UiMessage
pub fn lowermost( destination: Handle<UiNode>, direction: MessageDirection ) -> UiMessage
Creates WidgetMessage::Lowermost message.
sourcepub fn enabled(
destination: Handle<UiNode>,
direction: MessageDirection,
value: bool
) -> UiMessage
pub fn enabled( destination: Handle<UiNode>, direction: MessageDirection, value: bool ) -> UiMessage
Creates WidgetMessage::Enabled message.
sourcepub fn name(
destination: Handle<UiNode>,
direction: MessageDirection,
value: String
) -> UiMessage
pub fn name( destination: Handle<UiNode>, direction: MessageDirection, value: String ) -> UiMessage
Creates WidgetMessage::Name message.
sourcepub fn row(
destination: Handle<UiNode>,
direction: MessageDirection,
value: usize
) -> UiMessage
pub fn row( destination: Handle<UiNode>, direction: MessageDirection, value: usize ) -> UiMessage
Creates WidgetMessage::Row message.
sourcepub fn column(
destination: Handle<UiNode>,
direction: MessageDirection,
value: usize
) -> UiMessage
pub fn column( destination: Handle<UiNode>, direction: MessageDirection, value: usize ) -> UiMessage
Creates WidgetMessage::Column message.
sourcepub fn cursor(
destination: Handle<UiNode>,
direction: MessageDirection,
value: Option<CursorIcon>
) -> UiMessage
pub fn cursor( destination: Handle<UiNode>, direction: MessageDirection, value: Option<CursorIcon> ) -> UiMessage
Creates WidgetMessage::Cursor message.
sourcepub fn z_index(
destination: Handle<UiNode>,
direction: MessageDirection,
value: usize
) -> UiMessage
pub fn z_index( destination: Handle<UiNode>, direction: MessageDirection, value: usize ) -> UiMessage
Creates WidgetMessage::ZIndex message.
sourcepub fn hit_test_visibility(
destination: Handle<UiNode>,
direction: MessageDirection,
value: bool
) -> UiMessage
pub fn hit_test_visibility( destination: Handle<UiNode>, direction: MessageDirection, value: bool ) -> UiMessage
Creates WidgetMessage::HitTestVisibility message.
sourcepub fn margin(
destination: Handle<UiNode>,
direction: MessageDirection,
value: Thickness
) -> UiMessage
pub fn margin( destination: Handle<UiNode>, direction: MessageDirection, value: Thickness ) -> UiMessage
Creates WidgetMessage::Margin message.
sourcepub fn min_size(
destination: Handle<UiNode>,
direction: MessageDirection,
value: Vector2<f32>
) -> UiMessage
pub fn min_size( destination: Handle<UiNode>, direction: MessageDirection, value: Vector2<f32> ) -> UiMessage
Creates WidgetMessage::MinSize message.
sourcepub fn max_size(
destination: Handle<UiNode>,
direction: MessageDirection,
value: Vector2<f32>
) -> UiMessage
pub fn max_size( destination: Handle<UiNode>, direction: MessageDirection, value: Vector2<f32> ) -> UiMessage
Creates WidgetMessage::MaxSize message.
sourcepub fn horizontal_alignment(
destination: Handle<UiNode>,
direction: MessageDirection,
value: HorizontalAlignment
) -> UiMessage
pub fn horizontal_alignment( destination: Handle<UiNode>, direction: MessageDirection, value: HorizontalAlignment ) -> UiMessage
Creates WidgetMessage::HorizontalAlignment message.
sourcepub fn vertical_alignment(
destination: Handle<UiNode>,
direction: MessageDirection,
value: VerticalAlignment
) -> UiMessage
pub fn vertical_alignment( destination: Handle<UiNode>, direction: MessageDirection, value: VerticalAlignment ) -> UiMessage
Creates WidgetMessage::VerticalAlignment message.
sourcepub fn opacity(
destination: Handle<UiNode>,
direction: MessageDirection,
value: Option<f32>
) -> UiMessage
pub fn opacity( destination: Handle<UiNode>, direction: MessageDirection, value: Option<f32> ) -> UiMessage
Creates WidgetMessage::Opacity message.
sourcepub fn layout_transform(
destination: Handle<UiNode>,
direction: MessageDirection,
value: Matrix3<f32>
) -> UiMessage
pub fn layout_transform( destination: Handle<UiNode>, direction: MessageDirection, value: Matrix3<f32> ) -> UiMessage
Creates WidgetMessage::LayoutTransform message.
sourcepub fn render_transform(
destination: Handle<UiNode>,
direction: MessageDirection,
value: Matrix3<f32>
) -> UiMessage
pub fn render_transform( destination: Handle<UiNode>, direction: MessageDirection, value: Matrix3<f32> ) -> UiMessage
Creates WidgetMessage::RenderTransform message.
Creates WidgetMessage::ContextMenu message.
sourcepub fn tooltip(
destination: Handle<UiNode>,
direction: MessageDirection,
value: Option<RcUiNodeHandle>
) -> UiMessage
pub fn tooltip( destination: Handle<UiNode>, direction: MessageDirection, value: Option<RcUiNodeHandle> ) -> UiMessage
Creates WidgetMessage::Tooltip message.
sourcepub fn focus(
destination: Handle<UiNode>,
direction: MessageDirection
) -> UiMessage
pub fn focus( destination: Handle<UiNode>, direction: MessageDirection ) -> UiMessage
Creates WidgetMessage::Focus message.
sourcepub fn unfocus(
destination: Handle<UiNode>,
direction: MessageDirection
) -> UiMessage
pub fn unfocus( destination: Handle<UiNode>, direction: MessageDirection ) -> UiMessage
Creates WidgetMessage::Unfocus message.
sourcepub fn mouse_down(
destination: Handle<UiNode>,
direction: MessageDirection,
pos: Vector2<f32>,
button: MouseButton
) -> UiMessage
pub fn mouse_down( destination: Handle<UiNode>, direction: MessageDirection, pos: Vector2<f32>, button: MouseButton ) -> UiMessage
Creates WidgetMessage::MouseDown message. This method is for internal use only, and should not
be used anywhere else.
sourcepub fn mouse_up(
destination: Handle<UiNode>,
direction: MessageDirection,
pos: Vector2<f32>,
button: MouseButton
) -> UiMessage
pub fn mouse_up( destination: Handle<UiNode>, direction: MessageDirection, pos: Vector2<f32>, button: MouseButton ) -> UiMessage
Creates WidgetMessage::MouseUp message. This method is for internal use only, and should not
be used anywhere else.
sourcepub fn mouse_move(
destination: Handle<UiNode>,
direction: MessageDirection,
pos: Vector2<f32>,
state: MouseState
) -> UiMessage
pub fn mouse_move( destination: Handle<UiNode>, direction: MessageDirection, pos: Vector2<f32>, state: MouseState ) -> UiMessage
Creates WidgetMessage::MouseMove message. This method is for internal use only, and should not
be used anywhere else.
sourcepub fn mouse_wheel(
destination: Handle<UiNode>,
direction: MessageDirection,
pos: Vector2<f32>,
amount: f32
) -> UiMessage
pub fn mouse_wheel( destination: Handle<UiNode>, direction: MessageDirection, pos: Vector2<f32>, amount: f32 ) -> UiMessage
Creates WidgetMessage::MouseWheel message. This method is for internal use only, and should not
be used anywhere else.
sourcepub fn mouse_leave(
destination: Handle<UiNode>,
direction: MessageDirection
) -> UiMessage
pub fn mouse_leave( destination: Handle<UiNode>, direction: MessageDirection ) -> UiMessage
Creates WidgetMessage::MouseLeave message. This method is for internal use only, and should not
be used anywhere else.
sourcepub fn mouse_enter(
destination: Handle<UiNode>,
direction: MessageDirection
) -> UiMessage
pub fn mouse_enter( destination: Handle<UiNode>, direction: MessageDirection ) -> UiMessage
Creates WidgetMessage::MouseEnter message. This method is for internal use only, and should not
be used anywhere else.
sourcepub fn text(
destination: Handle<UiNode>,
direction: MessageDirection,
value: char
) -> UiMessage
pub fn text( destination: Handle<UiNode>, direction: MessageDirection, value: char ) -> UiMessage
Creates WidgetMessage::Text message. This method is for internal use only, and should not
be used anywhere else.
sourcepub fn key_down(
destination: Handle<UiNode>,
direction: MessageDirection,
value: KeyCode
) -> UiMessage
pub fn key_down( destination: Handle<UiNode>, direction: MessageDirection, value: KeyCode ) -> UiMessage
Creates WidgetMessage::KeyDown message. This method is for internal use only, and should not
be used anywhere else.
sourcepub fn key_up(
destination: Handle<UiNode>,
direction: MessageDirection,
value: KeyCode
) -> UiMessage
pub fn key_up( destination: Handle<UiNode>, direction: MessageDirection, value: KeyCode ) -> UiMessage
Creates WidgetMessage::KeyUp message. This method is for internal use only, and should not
be used anywhere else.
sourcepub fn drag_started(
destination: Handle<UiNode>,
direction: MessageDirection,
value: Handle<UiNode>
) -> UiMessage
pub fn drag_started( destination: Handle<UiNode>, direction: MessageDirection, value: Handle<UiNode> ) -> UiMessage
Creates WidgetMessage::DragStarted message. This method is for internal use only, and should not
be used anywhere else.
sourcepub fn drag_over(
destination: Handle<UiNode>,
direction: MessageDirection,
value: Handle<UiNode>
) -> UiMessage
pub fn drag_over( destination: Handle<UiNode>, direction: MessageDirection, value: Handle<UiNode> ) -> UiMessage
Creates WidgetMessage::DragOver message. This method is for internal use only, and should not
be used anywhere else.
sourcepub fn drop(
destination: Handle<UiNode>,
direction: MessageDirection,
value: Handle<UiNode>
) -> UiMessage
pub fn drop( destination: Handle<UiNode>, direction: MessageDirection, value: Handle<UiNode> ) -> UiMessage
Creates WidgetMessage::Drop message. This method is for internal use only, and should not
be used anywhere else.
sourcepub fn double_click(
destination: Handle<UiNode>,
direction: MessageDirection,
button: MouseButton
) -> UiMessage
pub fn double_click( destination: Handle<UiNode>, direction: MessageDirection, button: MouseButton ) -> UiMessage
Creates WidgetMessage::DoubleClick message. This method is for internal use only, and should not
be used anywhere else.
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 PartialEq<WidgetMessage> for WidgetMessage
impl PartialEq<WidgetMessage> for WidgetMessage
source§fn eq(&self, other: &WidgetMessage) -> bool
fn eq(&self, other: &WidgetMessage) -> bool
self and other values to be equal, and is used
by ==.impl StructuralPartialEq for WidgetMessage
Auto Trait Implementations§
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> 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.