Module message

Source
Expand description

Message and events module contains all possible widget messages and OS events. See UiMessage docs for more info and examples.

Structs§

KeyboardModifiers
A set of possible keyboard modifiers.
UiMessage
Message is basic communication element that is used to deliver information to widget or to user code.

Enums§

ButtonState
Mouse button state.
CursorIcon
A fixed set of cursor icons that available on most OSes.
Force
Describes the force of a touch event
KeyCode
Code of a key on keyboard. Shamelessly taken from winit source code to match their key codes with fyrox-ui’s.
MessageDirection
Message direction allows you to distinguish from where message has came from. Often there is a need to find out who created a message to respond properly. Imagine that we have a NumericUpDown input field for a property and we using some data source to feed data into input field. When we change something in the input field by typing, it creates a message with new value. On other hand we often need to put new value in the input field from some code, in this case we again creating a message. But how to understand from which “side” message has came from? Was it filled in by user and we should create a command to change value in the data source, or it was created from syncing code just to pass new value to UI? This problem solved by setting a direction to a message. Also it solves another problem: often we need to respond to a message only if it did some changes. In this case at first we fire a message with ToWidget direction, widget catches it and checks if changes are needed and if so, it “rethrows” message with direction FromWidget. Listeners are “subscribed” to FromWidget messages only and won’t respond to ToWidget messages.
MouseButton
A set of possible mouse buttons.
OsEvent
An event that an OS sends to a window, that is then can be used to “feed” the user interface so it can do some actions.
RoutingStrategy
Defines a way of how the message will behave in the widget tree after it was delivered to the destination node.
TouchPhase
A set of possible touch phases

Traits§

MessageData
A trait, that is used by every messages used in the user interface. It contains utility methods, that are used for downcasting and equality comparison.

Functions§

compare_and_set
Compares the new value with the existing one, and if they do not match, sets the new value to it and sends the given message back to the message queue with the opposite direction. This function is useful to reduce boilerplate code when reacting to widget messages.