Struct rg3d::gui::message::UiMessage [−][src]
pub struct UiMessage {
pub handled: Cell<bool>,
pub data: Rc<dyn MessageData + 'static>,
pub destination: Handle<UiNode>,
pub direction: MessageDirection,
pub perform_layout: Cell<bool>,
pub flags: u64,
}
Expand description
Message is basic communication element that is used to deliver information to UI nodes or to user code.
Threading
UiMessage is nor Send or Sync. User interface is a single-thread thing, as well as its messages.
Fields
handled: Cell<bool>
Useful flag to check if a message was already handled.
data: Rc<dyn MessageData + 'static>
Actual message data.
destination: Handle<UiNode>
Handle of node that will receive message. Please note that all nodes in hierarchy will also receive this message, order is “up-on-tree”.
direction: MessageDirection
Indicates the direction of the message.
See MessageDirection for details.
perform_layout: Cell<bool>
Whether or not message requires layout to be calculated first.
Some of message handling routines uses layout info, but message loop performed right after layout pass, but some of messages may change layout and this flag tells UI to perform layout before passing message further. In ideal case we’d perform layout after each message, but since layout pass is super heavy we should do it only when it is actually needed.
flags: u64
A custom user flags.
Implementations
Creates a new copy of the message with reversed direction. Typical use case is to re-send messages to create “response” in widget. For example you have a float input field and it has Value message. When the input field receives Value message with MessageDirection::ToWidget it checks if value needs to be changed and if it does, it re-sends same message but with reversed direction back to message queue so every “listener” can reach properly. The input field won’t react at MessageDirection::FromWidget message so there will be no infinite message loop.
Trait Implementations
Auto Trait Implementations
impl !RefUnwindSafe for UiMessage
impl !UnwindSafe for UiMessage
Blanket Implementations
Mutably borrows from an owned value. Read more
impl<T> Downcast for T where
T: Any,
impl<T> Downcast for T where
T: Any,
Convert 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
. Read more
pub fn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
pub fn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
Convert Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
. Read more
Convert &Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s. Read more
pub fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
pub fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert &mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s. Read more
The inverse inclusion map: attempts to construct self
from the equivalent element of its
superset. Read more
pub fn is_in_subset(&self) -> bool
pub fn is_in_subset(&self) -> bool
Checks if self
is actually part of its subset T
(and can be converted to it).
pub fn to_subset_unchecked(&self) -> SS
pub fn to_subset_unchecked(&self) -> SS
Use with care! Same as self.to_subset
but without any property checks. Always succeeds.
pub fn from_subset(element: &SS) -> SP
pub fn from_subset(element: &SS) -> SP
The inclusion map: converts self
to the equivalent element of its superset.