| 1 |
/* |
| 2 |
* This file is part of the DXX-Rebirth project <https://www.dxx-rebirth.com/>. |
| 3 |
* It is copyright by its individual contributors, as recorded in the |
| 4 |
* project's Git history. See COPYING.txt at the top level for license |
| 5 |
* terms and a link to the Git history. |
| 6 |
*/ |
| 7 |
|
| 8 |
#pragma once |
| 9 |
|
| 10 |
#include <cstdint> |
| 11 |
#include "dxxsconf.h" |
| 12 |
|
| 13 |
namespace dcx { |
| 14 |
|
| 15 |
struct d_event; |
| 16 |
struct d_change_event; |
| 17 |
struct d_select_event; |
| 18 |
|
| 19 |
enum class event_type : uint8_t; |
| 20 |
enum class window_event_result : uint8_t; |
| 21 |
|
| 22 |
// Sends input events to event handlers |
| 23 |
window_event_result event_poll(); |
| 24 |
void event_flush(); |
| 25 |
|
| 26 |
// Set and call the default event handler |
| 27 |
window_event_result call_default_handler(const d_event &event); |
| 28 |
|
| 29 |
// Send an event to the front window as first priority, then to the windows behind if it's not modal (editor), then the default handler |
| 30 |
window_event_result event_send(const d_event &event); |
| 31 |
|
| 32 |
// Sends input, idle and draw events to event handlers |
| 33 |
window_event_result event_process(); |
| 34 |
|
| 35 |
void event_enable_focus(); |
| 36 |
void event_disable_focus(); |
| 37 |
static inline void event_toggle_focus(int activate_focus) |
| 38 |
{ |
| 39 |
if (activate_focus) |
| 40 |
event_enable_focus(); |
| 41 |
else |
| 42 |
event_disable_focus(); |
| 43 |
} |
| 44 |
|
| 45 |
#if DXX_USE_EDITOR |
| 46 |
// See how long we were idle for |
| 47 |
void event_reset_idle_seconds(); |
| 48 |
#endif |
| 49 |
|
| 50 |
} |