2021-08-15 20:04:53 +02:00
|
|
|
#ifndef BWIDGETS_KEYBOARD_HANDLER_HPP
|
|
|
|
#define BWIDGETS_KEYBOARD_HANDLER_HPP
|
2021-07-10 19:55:53 +02:00
|
|
|
|
2021-08-15 20:04:53 +02:00
|
|
|
#include <basic_widgets/w/feat/event_handler.hpp>
|
2021-07-18 18:26:12 +02:00
|
|
|
#include <basic_widgets/w/feat/focus_handler.hpp>
|
2021-07-10 19:55:53 +02:00
|
|
|
|
|
|
|
struct SDL_KeyboardEvent;
|
|
|
|
struct SDL_TextInputEvent;
|
|
|
|
|
2021-08-06 14:22:56 +02:00
|
|
|
namespace bwidgets
|
2021-07-10 19:55:53 +02:00
|
|
|
{
|
2021-08-15 20:04:53 +02:00
|
|
|
class KeyboardHandler : public virtual EventHandler,
|
|
|
|
public virtual FocusHandler
|
2021-07-10 19:55:53 +02:00
|
|
|
{
|
2021-07-29 16:06:03 +02:00
|
|
|
protected:
|
2021-08-15 20:04:53 +02:00
|
|
|
using EventHandler::EventHandler;
|
2021-07-10 19:55:53 +02:00
|
|
|
|
2021-07-29 16:06:03 +02:00
|
|
|
public:
|
2021-08-23 23:50:14 +02:00
|
|
|
// Disable keyboard event handling.
|
2021-08-15 20:04:53 +02:00
|
|
|
virtual void disable_keyboard_handler() = 0;
|
2021-08-23 23:50:14 +02:00
|
|
|
// Enable keyboard event handling.
|
2021-08-15 20:04:53 +02:00
|
|
|
virtual void enable_keyboard_handler() = 0;
|
2021-08-23 23:50:14 +02:00
|
|
|
// Set the handler for key press events.
|
2021-08-15 20:04:53 +02:00
|
|
|
virtual void key_handler(std::function<void(const SDL_KeyboardEvent&)>) = 0;
|
2021-08-23 23:50:14 +02:00
|
|
|
// Set the handler for text input events.
|
2021-08-15 20:04:53 +02:00
|
|
|
virtual void
|
2022-01-24 16:18:14 +01:00
|
|
|
text_input_handler(std::function<void(const SDL_TextInputEvent&)>) = 0;
|
2021-07-10 19:55:53 +02:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|