bwidgets/inc/basic_widgets/w/feat/focus_handler.hpp

30 lines
834 B
C++
Raw Permalink Normal View History

2021-08-06 14:22:56 +02:00
#ifndef BWIDGETS_FOCUS_HANDLER_HPP
#define BWIDGETS_FOCUS_HANDLER_HPP
2021-08-15 20:04:53 +02:00
#include <functional>
struct SDL_Rect;
2021-08-06 14:22:56 +02:00
namespace bwidgets
{
class FocusHandler
{
public:
2021-08-12 16:10:49 +02:00
FocusHandler() = default;
FocusHandler(const FocusHandler&) = delete;
2021-08-12 16:10:49 +02:00
FocusHandler(FocusHandler&&) = delete;
auto operator=(FocusHandler&&) = delete;
auto operator=(const FocusHandler&) = delete;
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;
};
}
#endif