dxx-rebirth/common/include/event.h

85 lines
1.7 KiB
C
Raw Normal View History

2014-06-01 17:55:23 +00:00
/*
* This file is part of the DXX-Rebirth project <http://www.dxx-rebirth.com/>.
* It is copyright by its individual contributors, as recorded in the
* project's Git history. See COPYING.txt at the top level for license
* terms and a link to the Git history.
*/
2006-04-03 17:36:27 +00:00
// Event header file
#pragma once
#include "fwd-event.h"
#include "maths.h"
2006-04-03 17:36:27 +00:00
#ifdef __cplusplus
inline namespace dcx {
enum event_type : unsigned
2009-05-21 12:16:39 +00:00
{
EVENT_IDLE = 0,
EVENT_QUIT,
EVENT_JOYSTICK_BUTTON_DOWN,
EVENT_JOYSTICK_BUTTON_UP,
EVENT_JOYSTICK_MOVED,
EVENT_MOUSE_BUTTON_DOWN,
EVENT_MOUSE_BUTTON_UP,
EVENT_MOUSE_DOUBLE_CLICKED,
EVENT_MOUSE_MOVED,
EVENT_KEY_COMMAND,
EVENT_KEY_RELEASE,
EVENT_WINDOW_CREATED,
EVENT_WINDOW_ACTIVATED,
EVENT_WINDOW_DEACTIVATED,
EVENT_WINDOW_DRAW,
EVENT_WINDOW_CLOSE,
EVENT_WINDOW_CLOSED,
EVENT_NEWMENU_DRAW, // draw after the newmenu stuff is drawn (e.g. savegame previews)
EVENT_NEWMENU_CHANGED, // an item had its value/text changed
2012-03-03 12:12:25 +00:00
EVENT_NEWMENU_SELECTED, // user chose something - pressed enter/clicked on it
EVENT_UI_DIALOG_DRAW, // draw after the dialog stuff is drawn (e.g. spinning robots)
2012-03-03 12:12:25 +00:00
EVENT_UI_GADGET_PRESSED, // user 'pressed' a gadget
EVENT_UI_LISTBOX_MOVED,
EVENT_UI_LISTBOX_SELECTED,
EVENT_UI_USERBOX_DRAGGED
};
2009-05-21 12:16:39 +00:00
// A vanilla event. Cast to the correct type of event according to 'type'.
struct d_event
2009-05-21 12:16:39 +00:00
{
event_type type;
};
2009-05-21 12:16:39 +00:00
2014-12-20 04:36:09 +00:00
struct d_create_event : d_event
{
const void *createdata;
};
struct d_change_event : d_event
{
int citem;
d_change_event(const int c) :
d_event{EVENT_NEWMENU_CHANGED}, citem(c)
{
}
};
struct d_select_event : d_event
{
int citem;
d_select_event(const int c) :
d_event{EVENT_NEWMENU_SELECTED}, citem(c)
{
}
};
fix event_get_idle_seconds();
}
#endif