diff options
Diffstat (limited to 'engine/include/serial')
-rw-r--r-- | engine/include/serial/focusable.h | 36 | ||||
-rw-r--r-- | engine/include/serial/keyfocusable.h | 24 |
2 files changed, 60 insertions, 0 deletions
diff --git a/engine/include/serial/focusable.h b/engine/include/serial/focusable.h new file mode 100644 index 0000000..325f84b --- /dev/null +++ b/engine/include/serial/focusable.h @@ -0,0 +1,36 @@ +#ifndef __FOCUSABLE_H__ +#define __FOCUSABLE_H__ + +#include "types.h" + +class task_s; +union SDL_Event; + +class Focusable +{ + bool focused; + + task_s * event_trigger; + +protected: + + /* Callback to event */ + virtual void serial_cb(const SDL_Event*) = 0; + + /* Event stack specification */ + virtual Uint32 stackID() const = 0; + +public: + + Focusable(bool focused = true); + + virtual ~Focusable(); + + void setFocused(bool flag); + + bool isFocused() const; + + void serial_precall(void*); +}; + +#endif diff --git a/engine/include/serial/keyfocusable.h b/engine/include/serial/keyfocusable.h index e69de29..02b3361 100644 --- a/engine/include/serial/keyfocusable.h +++ b/engine/include/serial/keyfocusable.h @@ -0,0 +1,24 @@ +#ifndef __KEYFOCUSABLE_H__ +#define __KEYFOCUSABLE_H__ + +#include "focusable.h" + +struct SDL_KeyboardEvent; + +class KeyFocusable : public Focusable +{ + + virtual void serial_cb(const SDL_Event*) override; + + virtual Uint32 stackID() const override; + +protected: + + virtual void key_cb(const SDL_KeyboardEvent*) = 0; + +public: + + using Focusable::Focusable; +}; + +#endif |