bwidgets/inc/basic_widgets/w/feat/event_handler_impl.hpp

25 lines
586 B
C++

#ifndef BWIDGETS_EVENT_HANDLER_IMPL_HPP
#define BWIDGETS_EVENT_HANDLER_IMPL_HPP
#include <unordered_map>
#include <basic_widgets/w/feat/event_handler.hpp>
namespace bwidgets
{
class EventHandlerImpl : public virtual EventHandler
{
std::unordered_map<SDL_EventType, std::function<void(const SDL_Event&)>>
_event_handlers {};
protected:
auto _add_event_handler(handler_t) -> bool;
auto _remove_event_handler(SDL_EventType) -> std::pair<handler_t, bool>;
public:
void handle_event(const SDL_Event&) override;
};
}
#endif