raven/src/GenericStyle.hpp
2022-06-11 15:52:23 +03:00

49 lines
No EOL
1.5 KiB
C++

#pragma once
#include "pango/pango-font.h"
#include "RGB.hpp"
#define __RAVEN_STYLE_PROP(name, type, ...) \
private: \
type m_##name {__VA_ARGS__}; \
public: \
void set_##name(type new_prop_value) { m_##name = new_prop_value; style_prop_updated(); } \
type name() { return m_##name; } \
private:
namespace Raven {
class GenericStyle {
__RAVEN_STYLE_PROP(font_description, PangoFontDescription*, nullptr)
__RAVEN_STYLE_PROP(foreground, RGB, 0.00000, 0.00000, 0.00000)
__RAVEN_STYLE_PROP(background_norm, RGB, 1.00000, 1.00000, 1.00000)
__RAVEN_STYLE_PROP(background_focused, RGB, 1.00000, 1.00000, 1.00000)
__RAVEN_STYLE_PROP(background_active, RGB, 1.00000, 1.00000, 1.00000)
__RAVEN_STYLE_PROP(border_radius, double, 0.0)
__RAVEN_STYLE_PROP(fill_background, bool, true)
__RAVEN_STYLE_PROP(update_background, bool, false)
private:
void style_prop_updated() { }
public:
GenericStyle(
PangoFontDescription* font_description,
RGB foreground,
RGB background_norm,
RGB background_focused,
RGB background_active,
double border_radius,
bool fill_background,
bool update_background
)
: m_font_description(font_description)
, m_foreground(foreground)
, m_background_norm(background_norm)
, m_background_focused(background_focused)
, m_background_active(background_active)
, m_border_radius(border_radius)
, m_fill_background(fill_background)
, m_update_background(update_background) {}
};
}