11class CatchEventBase :
public ComponentBase {
14 CatchEventBase(std::function<
bool(Event)> on_event)
15 : on_event_(std::move(on_event)) {}
18 bool OnEvent(Event event)
override {
26 std::function<bool(Event)> on_event_;
45 std::function<
bool(
Event event)> on_event) {
47 out->Add(std::move(child));
virtual bool OnEvent(Event)
Called in response to an event.
std::shared_ptr< T > Make(Args &&... args)
std::shared_ptr< ComponentBase > Component
Component CatchEvent(Component child, std::function< bool(Event)>)
Represent an event. It can be key press event, a terminal resize, or more ...