2021-08-17 11:40:03 +02:00
|
|
|
#ifndef BWIDGETS_BUTTON_IMPL_HPP
|
|
|
|
#define BWIDGETS_BUTTON_IMPL_HPP
|
|
|
|
|
|
|
|
#include <basic_widgets/w/base/widget_impl.hpp>
|
|
|
|
#include <basic_widgets/w/button.hpp>
|
2021-08-19 15:00:44 +02:00
|
|
|
#include <basic_widgets/w/caption.hpp>
|
|
|
|
#include <basic_widgets/w/feat/font_handler_impl.hpp>
|
2021-08-17 11:40:03 +02:00
|
|
|
#include <basic_widgets/w/feat/mouse_handler_impl.hpp>
|
|
|
|
|
|
|
|
namespace bwidgets
|
|
|
|
{
|
|
|
|
class ButtonImpl : public virtual Button,
|
2021-08-21 20:59:39 +02:00
|
|
|
public virtual FontHandlerImpl,
|
2021-08-19 15:00:44 +02:00
|
|
|
public virtual MouseHandlerImpl,
|
2021-08-21 20:59:39 +02:00
|
|
|
public virtual WidgetImpl
|
2021-08-17 11:40:03 +02:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
ButtonImpl(Widget* parent = nullptr) noexcept;
|
|
|
|
|
2021-08-27 01:21:25 +02:00
|
|
|
// Smallest valid button size.
|
2021-08-17 11:40:03 +02:00
|
|
|
[[nodiscard]] auto size() const noexcept -> Size override;
|
2021-08-21 20:59:39 +02:00
|
|
|
[[nodiscard]] auto text() const noexcept -> std::string_view override;
|
|
|
|
void text(std::string) override;
|
2021-08-17 11:40:03 +02:00
|
|
|
|
|
|
|
protected:
|
2021-08-19 15:00:44 +02:00
|
|
|
std::unique_ptr<Caption> _caption;
|
|
|
|
SDL_Rect _caption_area {};
|
|
|
|
Color _color_foreground = default_color_fg;
|
2021-08-17 11:40:03 +02:00
|
|
|
|
|
|
|
void _handle_font_change(const std::shared_ptr<Font>&) override;
|
|
|
|
void _handle_font_color_change(Color, Color)
|
|
|
|
override;
|
|
|
|
void _handle_geometry_change(const SDL_Rect&) override;
|
|
|
|
void _handle_renderer_change(const std::shared_ptr<Renderer>&) override;
|
|
|
|
void _handle_rendering() override;
|
|
|
|
void _on_push(bool) override;
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|