2021-08-06 14:22:56 +02:00
|
|
|
#ifndef BWIDGETS_FONT_HANDLER_HPP
|
|
|
|
#define BWIDGETS_FONT_HANDLER_HPP
|
2021-07-18 18:26:12 +02:00
|
|
|
|
|
|
|
#include <basic_widgets/core/font.hpp>
|
|
|
|
|
2021-08-06 14:22:56 +02:00
|
|
|
namespace bwidgets
|
2021-07-18 18:26:12 +02:00
|
|
|
{
|
|
|
|
class FontHandler
|
|
|
|
{
|
2021-07-29 16:06:03 +02:00
|
|
|
public:
|
2021-08-06 14:22:56 +02:00
|
|
|
inline static const Color default_font_color_bg {255, 255, 255,
|
|
|
|
SDL_ALPHA_OPAQUE};
|
|
|
|
inline static const Color default_font_color_fg {0, 0, 0, SDL_ALPHA_OPAQUE};
|
2021-08-08 14:30:56 +02:00
|
|
|
|
2021-08-12 23:50:22 +02:00
|
|
|
FontHandler(const FontHandler&) = delete;
|
2021-08-14 09:25:28 +02:00
|
|
|
FontHandler(FontHandler&&) = delete;
|
2021-08-12 23:50:22 +02:00
|
|
|
auto operator=(const FontHandler&) = delete;
|
2021-08-14 09:25:28 +02:00
|
|
|
auto operator=(FontHandler&&) = delete;
|
2021-08-08 16:00:22 +02:00
|
|
|
virtual ~FontHandler() noexcept = default;
|
2021-07-29 16:06:03 +02:00
|
|
|
|
2022-02-01 20:48:54 +01:00
|
|
|
[[nodiscard]] virtual auto font() const -> const std::shared_ptr<Font>& = 0;
|
2021-08-23 23:50:14 +02:00
|
|
|
// Set the used font.
|
2022-02-01 20:48:54 +01:00
|
|
|
virtual void font(std::shared_ptr<Font>) = 0;
|
|
|
|
[[nodiscard]] virtual auto font_color_bg() const -> const Color& = 0;
|
2021-08-27 01:21:25 +02:00
|
|
|
// Set background color used for shaded text rendering
|
|
|
|
// mode.
|
2022-02-01 20:48:54 +01:00
|
|
|
virtual void font_color_bg(const Color&) = 0;
|
|
|
|
[[nodiscard]] virtual auto font_color_fg() const -> const Color& = 0;
|
2021-08-27 01:21:25 +02:00
|
|
|
// Set foreground (glyphs) color.
|
2022-02-01 20:48:54 +01:00
|
|
|
virtual void font_color_fg(const Color&) = 0;
|
2021-08-26 18:59:52 +02:00
|
|
|
|
|
|
|
protected:
|
|
|
|
FontHandler() noexcept = default;
|
2021-07-18 18:26:12 +02:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|