2021-08-06 14:22:56 +02:00
|
|
|
#ifndef BWIDGETS_FOCUS_HANDLER_HPP
|
|
|
|
#define BWIDGETS_FOCUS_HANDLER_HPP
|
2021-07-18 18:26:12 +02:00
|
|
|
|
2021-08-15 20:04:53 +02:00
|
|
|
#include <functional>
|
|
|
|
|
2021-07-18 18:26:12 +02:00
|
|
|
struct SDL_Rect;
|
|
|
|
|
2021-08-06 14:22:56 +02:00
|
|
|
namespace bwidgets
|
2021-07-18 18:26:12 +02:00
|
|
|
{
|
|
|
|
class FocusHandler
|
|
|
|
{
|
2021-07-29 16:06:03 +02:00
|
|
|
public:
|
2021-08-12 16:10:49 +02:00
|
|
|
FocusHandler() = default;
|
2021-08-12 15:29:25 +02:00
|
|
|
FocusHandler(const FocusHandler&) = delete;
|
2021-08-12 16:10:49 +02:00
|
|
|
FocusHandler(FocusHandler&&) = delete;
|
2021-08-12 23:50:22 +02:00
|
|
|
auto operator=(FocusHandler&&) = delete;
|
|
|
|
auto operator=(const FocusHandler&) = delete;
|
2021-08-12 15:29:25 +02:00
|
|
|
|
2021-08-15 20:04:53 +02:00
|
|
|
virtual ~FocusHandler() = default;
|
2021-08-23 23:50:14 +02:00
|
|
|
// set focus state.
|
2021-08-15 20:04:53 +02:00
|
|
|
virtual void focus(bool focus) = 0;
|
2021-08-23 23:50:14 +02:00
|
|
|
// get focus state.
|
2021-08-15 20:04:53 +02:00
|
|
|
virtual bool focus() = 0;
|
2021-08-23 23:50:14 +02:00
|
|
|
// set an handler for focus states changes.
|
2021-08-15 20:04:53 +02:00
|
|
|
virtual void focus_handler(std::function<void(bool)>) = 0;
|
2021-07-18 18:26:12 +02:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|