logo

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

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

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

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

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

Performs the conversion.

Performs the conversion.

The alignment of pointer.

The type for initializers.

Initializes a with the given initializer. Read more

Dereferences the given pointer. Read more

Mutably dereferences the given pointer. Read more

Drops the object pointed to by the given pointer. Read more

Casts self to a &dyn Any

Should always be Self

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more

Checks if self is actually part of its subset T (and can be converted to it).

Use with care! Same as self.to_subset but without any property checks. Always succeeds.

The inclusion map: converts self to the equivalent element of its superset.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.