libGumball 0.0.2
C23-Based, libGimbal-powered UI Library
Loading...
Searching...
No Matches
gumball_event.h
Go to the documentation of this file.
1#ifndef GUM_EVENT_H
2#define GUM_EVENT_H
3
4// View this file's documentation online: https://libgumball.psyops.studio/gumball__event_8h.html
5
6/*! \file
7 * \ingroup events
8 *
9 * GUM_Event is the base event type used in libGumball.
10 *
11 * \author 2025 Agustín Bellagamba
12 * \copyright MIT License
13*/
14
15#include <gimbal/gimbal_meta.h>
16
17/*! \name Type System
18 * \brief Type UUID and Cast Operators
19 * @{
20*/
21#define GUM_EVENT_TYPE (GBL_TYPEID (GUM_Event)) //!< Returns the GUM_Event Type UUID
22#define GUM_EVENT(self) (GBL_CAST (GUM_Event, self)) //!< Casts an instance of a compatible event to a GUM_Event
23#define GUM_EVENT_CLASS(klass) (GBL_CLASS_CAST (GUM_Event, klass)) //!< Casts a class of a compatible event to a GUM_EventClass
24#define GUM_EVENT_CLASSOF(self) (GBL_CLASSOF (GUM_Event, self)) //!< Casts an instance of a compatible event to a GUM_EventClass
25//! @}
26
27#define GBL_SELF_TYPE GUM_Event
28
29GBL_DECLS_BEGIN
30GBL_FORWARD_DECLARE_STRUCT(GUM_Event);
31
32/*! \struct GUM_EventClass
33 * \extends GblEventClass
34 * \brief GUM_Event structure
35 *
36 * GUM_EventClass derives from GblEvent, adding nothing new.
37*/
38GBL_CLASS_DERIVE_EMPTY(GUM_Event, GblEvent)
39
40/*!
41 * \class GUM_Event
42 * \extends GblEvent
43 * \brief Basic event type
44 *
45 * GUM_Event is the base event type used in libGumball.
46 * It inhertis from GblEvent, and only adds a timestamp.
47 *
48*/
49GBL_INSTANCE_DERIVE(GUM_Event, GblEvent)
50 uint32_t timestamp; //!< Timestamp of the event in ms since program start, wraps after ~49 days
51GBL_INSTANCE_END
52
53//! \cond
54GblType GUM_Event_type(void);
55//! \endcond
56
57GBL_DECLS_END
58#undef GBL_SELF_TYPE
59
60#endif // GUM_EVENT_H