Trait kas::app::AppData

source ·
pub trait AppData: 'static {
    // Required method
    fn handle_messages(&mut self, messages: &mut MessageStack) -> Action;
}
Expand description

Application state

Kas allows application state to be stored both in the widget tree (in Adapt nodes and user-defined widgets) and by the application root (shared across windows). This trait must be implemented by the latter.

When no top-level data is required, use () which implements this trait.

Required Methods§

source

fn handle_messages(&mut self, messages: &mut MessageStack) -> Action

Handle messages

This is the last message handler: it is called when, after traversing the widget tree (see kas::event module doc), a message is left on the stack. Unhandled messages will result in warnings in the log.

The method returns an Action, usually either Action::empty (nothing to do) or Action::UPDATE (to update widgets). This action affects all windows.

Implementations on Foreign Types§

source§

impl AppData for ()

source§

fn handle_messages(&mut self, _: &mut MessageStack) -> Action

Implementors§