orbtk-api 0.3.1-alpha3

API crate that provides base api and elements for OrbTk like widgets basis.
1
2
3
4
5
6
7
8
9
10
use crate::{event::EventBox, widget_base::StatesContext};

/// This trait is used to define an event handler.
pub trait EventHandler {
    /// Handles an `event` by the given `widget`. If it returns `true` the event will not be forwarded.
    fn handle_event(&self, state_context: &mut StatesContext, event: &EventBox) -> bool;

    /// Check if the handler could handle the given event box.
    fn handles_event(&self, event: &EventBox) -> bool;
}