18 #include <SDL2/SDL_events.h> 24 #define DOUBLE_CLICK_EVENT SDL_USEREVENT 25 #define TIMER_EVENT (SDL_USEREVENT + 1) 26 #define HOVER_REMOVE_POPUP_EVENT (SDL_USEREVENT + 2) 27 #define DRAW_EVENT (SDL_USEREVENT + 3) 28 #define CLOSE_WINDOW_EVENT (SDL_USEREVENT + 4) 29 #define SHOW_HELPTIP_EVENT (SDL_USEREVENT + 5) 30 #define INVOKE_FUNCTION_EVENT (SDL_USEREVENT + 6) 77 virtual void handle_event(
const SDL_Event& event) = 0;
90 virtual void join_global();
91 virtual void leave_global();
111 return std::vector<sdl_handler*>();
156 int ticks(
unsigned *refresh_counter=
nullptr,
unsigned refresh_rate=1);
183 bool is_input(
const SDL_Event& event);
void raise_resize_event()
void discard_input()
Discards all input events.
void set_focus(const sdl_handler *ptr)
std::vector< events::sdl_handler * > sdl_handler_vector
std::string join(const T &v, const std::string &s=",")
Generates a new string joining container items in a list.
void pump_and_draw()
pump() then immediately draw()
void add_handler(sdl_handler *ptr)
virtual bool has_joined_global()
bool remove_handler(sdl_handler *ptr)
virtual void process_event()
void call_in_main_thread(const std::function< void(void)> &f)
void focus_handler(const sdl_handler *ptr)
static events::event_context * event_context
void add_staging_handlers()
virtual bool requires_event_focus(const SDL_Event *=nullptr) const
std::list< sdl_handler * > handler_list
virtual bool has_joined()
void pump()
Process all events currently in the queue.
virtual void handle_window_event(const SDL_Event &)
void raise_process_event()
bool is_input(const SDL_Event &event)
Is the event an input event?
std::vector< sdl_handler * > staging_handlers
virtual void process_tooltip_string(int, int)
virtual std::vector< sdl_handler * > handler_members()
handler_list::iterator focused_handler
Handling of system events.
bool has_focus(const sdl_handler *hand, const SDL_Event *event)
std::pair< int, int > resize_dimensions
void draw()
Trigger a draw cycle.
std::string::const_iterator iterator
void process_tooltip_strings(int mousex, int mousey)
Triggered by mouse-motion, sends the cursor position to all handlers to check whether a tooltip shoul...
bool has_handler(const sdl_handler *ptr) const
Returns true if ptr is found in either the handlers or staging_handlers lists.