Macro zng_app::event_macro

source ·
macro_rules! event_macro {
    ($(
        $(#[$attr:meta])*
        $vis:vis static $EVENT:ident: $Args:path;
    )+) => { ... };
}
Expand description

Declares new Event<A> static items.

Event static items represent external, app or widget events. You can also use command! to declare events specialized for commanding widgets and services.

§Conventions

Command events have the _EVENT suffix, for example an event representing a click is called CLICK_EVENT.

§Properties

If the event targets widgets you can use event_property! to declare properties that setup event handlers for the event.

§Examples

The example defines two events with the same arguments type.

event! {
    /// Event docs.
    pub static CLICK_EVENT: ClickArgs;

    /// Other event docs.
    pub static DOUBLE_CLICK_EVENT: ClickArgs;
}