qskinny/skins/fluent2/QskFluent2Skin.h

275 lines
5.4 KiB
C
Raw Normal View History

2023-04-13 15:19:36 +00:00
/******************************************************************************
2023-05-12 12:26:24 +00:00
* QSkinny - Copyright (C) 2023 Edelhirsch Software GmbH
2023-04-13 15:19:36 +00:00
* SPDX-License-Identifier: BSD-3-Clause
*****************************************************************************/
2023-06-17 10:23:34 +00:00
#ifndef QSK_FLUENT2_SKIN_H
#define QSK_FLUENT2_SKIN_H
2023-04-13 15:19:36 +00:00
2023-06-17 10:23:34 +00:00
#include "QskFluent2Global.h"
2023-04-13 15:19:36 +00:00
#include <QskBoxShapeMetrics.h>
#include <QskGradient.h>
#include <QskShadowMetrics.h>
2023-05-06 13:46:12 +00:00
#include <QskSkin.h>
2023-04-13 15:19:36 +00:00
#include <array>
2023-06-17 10:23:34 +00:00
class QSK_FLUENT2_EXPORT QskFluent2Theme
2023-04-13 15:19:36 +00:00
{
public:
enum AccentColors
{
AccentLight3,
AccentLight2,
AccentLight1,
AccentBase,
AccentDark1,
AccentDark2,
AccentDark3,
NumAccentColors
};
2023-06-27 13:15:27 +00:00
QskFluent2Theme( QskSkin::ColorScheme );
QskFluent2Theme( QskSkin::ColorScheme, const std::array< QRgb, NumAccentColors >& );
2023-04-13 15:19:36 +00:00
typedef std::array< QRgb, 2 > BorderGradient;
2023-04-13 15:19:36 +00:00
struct FillColor
{
struct
2023-04-13 15:19:36 +00:00
{
QRgb primary;
QRgb secondary;
QRgb tertiary;
QRgb disabled;
} text;
2023-04-13 15:19:36 +00:00
struct
2023-04-13 15:19:36 +00:00
{
QRgb primary;
QRgb secondary;
QRgb tertiary;
QRgb disabled;
} accentText;
2023-04-13 15:19:36 +00:00
struct
2023-04-13 15:19:36 +00:00
{
QRgb primary;
QRgb secondary;
QRgb tertiary;
QRgb disabled;
QRgb selectedText;
} textOnAccent;
2023-04-13 15:19:36 +00:00
struct
2023-04-13 15:19:36 +00:00
{
QRgb defaultColor;
QRgb secondary;
QRgb tertiary;
QRgb inputActive;
QRgb disabled;
} control;
2023-04-13 15:19:36 +00:00
struct
2023-04-13 15:19:36 +00:00
{
QRgb defaultColor;
QRgb disabled;
} controlStrong;
2023-04-13 15:19:36 +00:00
struct
2023-04-13 15:19:36 +00:00
{
QRgb secondary;
QRgb tertiary;
QRgb disabled;
} subtle;
2023-04-13 15:19:36 +00:00
struct
2023-04-13 15:19:36 +00:00
{
QRgb defaultColor;
} controlSolid;
2023-04-13 15:19:36 +00:00
struct
2023-04-13 15:19:36 +00:00
{
QRgb secondary;
QRgb tertiary;
QRgb quaternary;
QRgb disabled;
} controlAlt;
2023-04-13 15:19:36 +00:00
struct
2023-04-13 15:19:36 +00:00
{
QRgb defaultColor;
QRgb secondary;
QRgb tertiary;
QRgb disabled;
QRgb selectedTextBackground;
} accent;
2023-04-13 15:19:36 +00:00
};
struct Elevation
{
struct
2023-04-13 15:19:36 +00:00
{
BorderGradient border;
} control;
2023-04-13 15:19:36 +00:00
struct
2023-04-13 15:19:36 +00:00
{
BorderGradient border;
} circle;
2023-04-13 15:19:36 +00:00
struct
2023-04-13 15:19:36 +00:00
{
BorderGradient border;
BorderGradient borderFocused;
} textControl;
2023-04-13 15:19:36 +00:00
struct
2023-04-13 15:19:36 +00:00
{
BorderGradient border;
} accentControl;
2023-04-13 15:19:36 +00:00
};
struct StrokeColor
{
struct
2023-04-13 15:19:36 +00:00
{
QRgb defaultColor;
QRgb secondary;
QRgb onAccentDefault;
QRgb onAccentSecondary;
QRgb onAccentTertiary;
QRgb onAccentDisabled;
} control;
2023-04-13 15:19:36 +00:00
struct
2023-04-13 15:19:36 +00:00
{
QRgb defaultColor;
QRgb disabled;
} controlStrong;
2023-04-13 15:19:36 +00:00
struct
2023-04-13 15:19:36 +00:00
{
QRgb defaultColor;
QRgb defaultSolid;
} card;
2023-04-13 15:19:36 +00:00
struct
2023-04-13 15:19:36 +00:00
{
QRgb defaultColor;
} divider;
2023-04-13 15:19:36 +00:00
struct
2023-04-13 15:19:36 +00:00
{
QRgb defaultColor;
QRgb flyout;
} surface;
2023-04-13 15:19:36 +00:00
struct
2023-04-13 15:19:36 +00:00
{
QRgb outer;
QRgb inner;
} focus;
2023-04-13 15:19:36 +00:00
};
struct Background
{
struct
2023-04-13 15:19:36 +00:00
{
QRgb defaultColor;
QRgb secondary;
QRgb tertiary;
} card;
2023-04-13 15:19:36 +00:00
struct
{
QRgb defaultColor;
} overlay;
struct
{
QRgb alt;
} layer;
struct
{
QRgb defaultColor;
} flyout;
2023-04-13 15:19:36 +00:00
struct
{
QRgb base;
QRgb secondary;
QRgb tertiary;
QRgb quaternary;
} solid;
};
2023-04-13 15:19:36 +00:00
struct
2023-04-13 15:19:36 +00:00
{
FillColor fillColor;
Elevation elevation;
StrokeColor strokeColor;
Background background;
} palette;
2023-05-06 13:46:12 +00:00
struct ShadowSettings
{
QskShadowMetrics metrics;
QRgb color;
};
2023-05-06 13:46:12 +00:00
struct
2023-05-06 13:46:12 +00:00
{
ShadowSettings cardRest;
ShadowSettings cardHover;
ShadowSettings flyout;
ShadowSettings dialog;
} shadow;
2023-04-13 15:19:36 +00:00
};
2023-06-17 10:23:34 +00:00
class QSK_FLUENT2_EXPORT QskFluent2Skin : public QskSkin
2023-04-13 15:19:36 +00:00
{
Q_OBJECT
using Inherited = QskSkin;
public:
2023-06-17 10:23:34 +00:00
QskFluent2Skin( const QskFluent2Theme&, QObject* parent = nullptr );
~QskFluent2Skin() override;
2023-04-13 15:19:36 +00:00
enum GraphicRole
{
GraphicRoleFillColorTextDisabled,
2023-05-01 17:34:36 +00:00
GraphicRoleFillColorTextOnAccentDisabled,
GraphicRoleFillColorTextOnAccentPrimary,
GraphicRoleFillColorTextOnAccentSecondary,
GraphicRoleFillColorTextPrimary,
GraphicRoleFillColorTextSecondary,
2023-04-13 15:19:36 +00:00
};
enum FontRole
{
2023-05-12 13:35:16 +00:00
Caption = TinyFont,
Body = DefaultFont,
BodyStrong = SmallFont,
BodyLarge = MediumFont,
Subtitle = LargeFont,
Title = HugeFont,
2023-04-13 15:19:36 +00:00
TitleLarge,
2023-05-12 13:35:16 +00:00
Display,
2023-04-13 15:19:36 +00:00
};
2023-04-29 08:38:55 +00:00
static constexpr QskAspect::Variation Standard = QskAspect::NoVariation;
static constexpr QskAspect::Variation Accent = QskAspect::Large;
2023-04-13 15:19:36 +00:00
private:
void setupFonts();
2023-06-17 10:23:34 +00:00
void setupGraphicFilters( const QskFluent2Theme& palette );
2023-04-13 15:19:36 +00:00
void setGraphicColor( GraphicRole, QRgb );
};
#endif