2023-04-13 17:19:36 +02:00
|
|
|
/******************************************************************************
|
2023-05-12 14:26:24 +02:00
|
|
|
* QSkinny - Copyright (C) 2023 Edelhirsch Software GmbH
|
2023-04-13 17:19:36 +02:00
|
|
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
|
|
*****************************************************************************/
|
|
|
|
|
|
|
|
#ifndef QSK_WINDOWS_SKIN_H
|
|
|
|
#define QSK_WINDOWS_SKIN_H
|
|
|
|
|
|
|
|
#include "QskWindowsGlobal.h"
|
|
|
|
|
|
|
|
#include <QskBoxShapeMetrics.h>
|
|
|
|
#include <QskGradient.h>
|
|
|
|
#include <QskShadowMetrics.h>
|
2023-05-06 15:46:12 +02:00
|
|
|
#include <QskSkin.h>
|
2023-04-13 17:19:36 +02:00
|
|
|
|
|
|
|
#include <array>
|
|
|
|
|
|
|
|
class QSK_WINDOWS_EXPORT QskWindowsTheme
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
enum Theme
|
|
|
|
{
|
|
|
|
Light,
|
|
|
|
Dark
|
|
|
|
};
|
|
|
|
|
|
|
|
enum AccentColors
|
|
|
|
{
|
|
|
|
AccentLight3,
|
|
|
|
AccentLight2,
|
|
|
|
AccentLight1,
|
|
|
|
AccentBase,
|
|
|
|
AccentDark1,
|
|
|
|
AccentDark2,
|
|
|
|
AccentDark3,
|
|
|
|
|
|
|
|
NumAccentColors
|
|
|
|
};
|
|
|
|
|
|
|
|
QskWindowsTheme( Theme );
|
|
|
|
QskWindowsTheme( Theme, std::array< QRgb, NumAccentColors > );
|
|
|
|
|
2023-05-12 16:27:20 +02:00
|
|
|
typedef std::array< QRgb, 2 > BorderGradient;
|
|
|
|
|
2023-04-13 17:19:36 +02:00
|
|
|
struct FillColor
|
|
|
|
{
|
|
|
|
struct Text
|
|
|
|
{
|
|
|
|
QRgb primary;
|
|
|
|
QRgb secondary;
|
|
|
|
QRgb tertiary;
|
|
|
|
QRgb disabled;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct AccentText
|
|
|
|
{
|
|
|
|
QRgb primary;
|
|
|
|
QRgb secondary;
|
|
|
|
QRgb tertiary;
|
|
|
|
QRgb disabled;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct TextOnAccent
|
|
|
|
{
|
|
|
|
QRgb primary;
|
|
|
|
QRgb secondary;
|
|
|
|
QRgb tertiary;
|
|
|
|
QRgb disabled;
|
|
|
|
QRgb selectedText;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct Control
|
|
|
|
{
|
|
|
|
QRgb transparent;
|
|
|
|
QRgb defaultColor;
|
|
|
|
QRgb secondary;
|
|
|
|
QRgb tertiary;
|
|
|
|
QRgb inputActive;
|
|
|
|
QRgb disabled;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct ControlStrong
|
|
|
|
{
|
|
|
|
QRgb defaultColor;
|
|
|
|
QRgb disabled;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct Subtle
|
|
|
|
{
|
|
|
|
QRgb transparent;
|
|
|
|
QRgb secondary;
|
|
|
|
QRgb tertiary;
|
|
|
|
QRgb disabled;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct ControlSolid
|
|
|
|
{
|
|
|
|
QRgb defaultColor;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct ControlAlt
|
|
|
|
{
|
|
|
|
QRgb transparent;
|
|
|
|
QRgb secondary;
|
|
|
|
QRgb tertiary;
|
|
|
|
QRgb quaternary;
|
|
|
|
QRgb disabled;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct Accent
|
|
|
|
{
|
|
|
|
QRgb defaultColor;
|
|
|
|
QRgb secondary;
|
|
|
|
QRgb tertiary;
|
|
|
|
QRgb disabled;
|
|
|
|
QRgb selectedTextBackground;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct System
|
|
|
|
{
|
|
|
|
QRgb critical;
|
|
|
|
QRgb success;
|
|
|
|
QRgb attention;
|
|
|
|
QRgb caution;
|
|
|
|
QRgb attentionBackground;
|
|
|
|
QRgb successBackground;
|
|
|
|
QRgb cautionBackground;
|
|
|
|
QRgb criticalBackground;
|
|
|
|
QRgb neutral;
|
|
|
|
QRgb neutralBackground;
|
|
|
|
QRgb solidNeutral;
|
|
|
|
QRgb solidAttentionBackground;
|
|
|
|
QRgb solidNeutralBackground;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct ControlOnImage
|
|
|
|
{
|
|
|
|
QRgb defaultColor;
|
|
|
|
QRgb secondary;
|
|
|
|
QRgb tertiary;
|
|
|
|
QRgb disabled;
|
|
|
|
};
|
|
|
|
|
|
|
|
Text text;
|
|
|
|
AccentText accentText;
|
|
|
|
TextOnAccent textOnAccent;
|
|
|
|
Control control;
|
|
|
|
ControlStrong controlStrong;
|
|
|
|
Subtle subtle;
|
|
|
|
ControlSolid controlSolid;
|
|
|
|
ControlAlt controlAlt;
|
|
|
|
Accent accent;
|
|
|
|
System system;
|
|
|
|
ControlOnImage controlOnImage;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct Elevation
|
|
|
|
{
|
|
|
|
struct Control
|
|
|
|
{
|
2023-05-12 16:27:20 +02:00
|
|
|
BorderGradient border;
|
2023-04-13 17:19:36 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
struct Circle
|
|
|
|
{
|
2023-05-12 16:27:20 +02:00
|
|
|
BorderGradient border;
|
2023-04-13 17:19:36 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
struct TextControl
|
|
|
|
{
|
2023-05-12 16:27:20 +02:00
|
|
|
BorderGradient border;
|
|
|
|
BorderGradient borderFocused;
|
2023-04-13 17:19:36 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
struct AccentControl
|
|
|
|
{
|
2023-05-12 16:27:20 +02:00
|
|
|
BorderGradient border;
|
2023-04-13 17:19:36 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
Control control;
|
|
|
|
Circle circle;
|
|
|
|
TextControl textControl;
|
|
|
|
AccentControl accentControl;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct StrokeColor
|
|
|
|
{
|
|
|
|
struct ControlStroke
|
|
|
|
{
|
|
|
|
QRgb defaultColor;
|
|
|
|
QRgb secondary;
|
|
|
|
QRgb onAccentDefault;
|
|
|
|
QRgb onAccentSecondary;
|
|
|
|
QRgb onAccentTertiary;
|
|
|
|
QRgb onAccentDisabled;
|
|
|
|
QRgb forStrongFillWhenOnImage;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct ControlStrongStroke
|
|
|
|
{
|
|
|
|
QRgb defaultColor;
|
|
|
|
QRgb disabled;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct CardStroke
|
|
|
|
{
|
|
|
|
QRgb defaultColor;
|
|
|
|
QRgb defaultSolid;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct DividerStroke
|
|
|
|
{
|
|
|
|
QRgb defaultColor;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct SurfaceStroke
|
|
|
|
{
|
|
|
|
QRgb defaultColor;
|
|
|
|
QRgb flyout;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct FocusStroke
|
|
|
|
{
|
|
|
|
QRgb outer;
|
|
|
|
QRgb inner;
|
|
|
|
};
|
|
|
|
|
|
|
|
ControlStroke controlStroke;
|
|
|
|
ControlStrongStroke controlStrongStroke;
|
|
|
|
CardStroke cardStroke;
|
|
|
|
DividerStroke dividerStroke;
|
|
|
|
SurfaceStroke surfaceStroke;
|
|
|
|
FocusStroke focusStroke;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct Background
|
|
|
|
{
|
|
|
|
struct FillColor
|
|
|
|
{
|
|
|
|
struct CardBackground
|
|
|
|
{
|
|
|
|
QRgb defaultColor;
|
|
|
|
QRgb secondary;
|
|
|
|
QRgb tertiary;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct Stroke
|
|
|
|
{
|
|
|
|
QRgb defaultColor;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct Layer
|
|
|
|
{
|
|
|
|
QRgb defaultColor;
|
|
|
|
QRgb alt;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct LayerOnAcrylic
|
|
|
|
{
|
|
|
|
QRgb defaultColor;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct LayerOnAccentAcrylic
|
|
|
|
{
|
|
|
|
QRgb defaultColor;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct AcrylicBackground
|
|
|
|
{
|
|
|
|
QRgb defaultColor;
|
|
|
|
QRgb base;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct AccentAcrylicBackground
|
|
|
|
{
|
|
|
|
QRgb base;
|
|
|
|
QRgb defaultColor;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct MicaBackground
|
|
|
|
{
|
|
|
|
QRgb base;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct SolidBackground
|
|
|
|
{
|
|
|
|
QRgb base;
|
|
|
|
QRgb secondary;
|
|
|
|
QRgb tertiary;
|
|
|
|
QRgb quaternary;
|
|
|
|
};
|
|
|
|
|
|
|
|
CardBackground cardBackground;
|
|
|
|
Stroke stroke;
|
|
|
|
Layer layer;
|
|
|
|
LayerOnAcrylic layerOnAcrylic;
|
|
|
|
LayerOnAccentAcrylic layerOnAccentAcrylic;
|
|
|
|
AcrylicBackground acrylicBackground;
|
|
|
|
AccentAcrylicBackground accentAcrylicBackground;
|
|
|
|
MicaBackground micaBackground;
|
|
|
|
SolidBackground solidBackground;
|
|
|
|
};
|
|
|
|
|
|
|
|
FillColor fillColor;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
struct Palette
|
|
|
|
{
|
|
|
|
FillColor fillColor;
|
|
|
|
Elevation elevation;
|
|
|
|
StrokeColor strokeColor;
|
|
|
|
Background background;
|
|
|
|
};
|
|
|
|
|
|
|
|
Palette palette;
|
2023-05-06 15:46:12 +02:00
|
|
|
|
|
|
|
typedef QPair< QskShadowMetrics, QRgb > ShadowSettings;
|
|
|
|
|
|
|
|
struct Shadow
|
|
|
|
{
|
|
|
|
ShadowSettings cardRest;
|
|
|
|
ShadowSettings cardHover;
|
|
|
|
ShadowSettings tooltip;
|
|
|
|
ShadowSettings flyout;
|
|
|
|
ShadowSettings dialog;
|
|
|
|
};
|
|
|
|
|
|
|
|
Shadow shadow;
|
2023-04-13 17:19:36 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
class QSK_WINDOWS_EXPORT QskWindowsSkin : public QskSkin
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
using Inherited = QskSkin;
|
|
|
|
|
|
|
|
public:
|
|
|
|
QskWindowsSkin( const QskWindowsTheme&, QObject* parent = nullptr );
|
|
|
|
~QskWindowsSkin() override;
|
|
|
|
|
|
|
|
enum GraphicRole
|
|
|
|
{
|
2023-05-08 17:35:14 +02:00
|
|
|
GraphicRoleFillColorTextDisabled,
|
2023-05-01 19:34:36 +02:00
|
|
|
GraphicRoleFillColorTextOnAccentDisabled,
|
|
|
|
GraphicRoleFillColorTextOnAccentPrimary,
|
|
|
|
GraphicRoleFillColorTextOnAccentSecondary,
|
2023-05-08 17:35:14 +02:00
|
|
|
GraphicRoleFillColorTextPrimary,
|
|
|
|
GraphicRoleFillColorTextSecondary,
|
2023-04-13 17:19:36 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
enum FontRole
|
|
|
|
{
|
2023-05-12 15:35:16 +02:00
|
|
|
Caption = TinyFont,
|
|
|
|
Body = DefaultFont,
|
|
|
|
BodyStrong = SmallFont,
|
|
|
|
BodyLarge = MediumFont,
|
|
|
|
Subtitle = LargeFont,
|
|
|
|
Title = HugeFont,
|
2023-04-13 17:19:36 +02:00
|
|
|
TitleLarge,
|
2023-05-12 15:35:16 +02:00
|
|
|
Display,
|
2023-04-13 17:19:36 +02:00
|
|
|
};
|
|
|
|
|
2023-04-29 10:38:55 +02:00
|
|
|
static constexpr QskAspect::Variation Standard = QskAspect::NoVariation;
|
|
|
|
static constexpr QskAspect::Variation Accent = QskAspect::Large;
|
|
|
|
|
2023-04-13 17:19:36 +02:00
|
|
|
private:
|
|
|
|
void setupFonts();
|
|
|
|
void setupGraphicFilters( const QskWindowsTheme& palette );
|
|
|
|
void setGraphicColor( GraphicRole, QRgb );
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|