13class CatchEventBase :
public ComponentBase {
16 explicit CatchEventBase(std::function<
bool(Event)>
on_event)
20 bool OnEvent(Event
event)
override {
21 if (on_event_(
event)) {
29 std::function<
bool(Event)> on_event_;
virtual bool OnEvent(Event)
Called in response to an event.
std::shared_ptr< T > Make(Args &&... args)
std::shared_ptr< ComponentBase > Component
std::function< Component(Component)> ComponentDecorator
Component CatchEvent(Component child, std::function< bool(Event)>)
Represent an event. It can be key press event, a terminal resize, or more ...