qskinny/skins/material/QskMaterialSkin.h

106 lines
2.2 KiB
C
Raw Normal View History

2017-07-21 18:21:34 +02:00
/******************************************************************************
* QSkinny - Copyright (C) 2016 Uwe Rathmann
* This file may be used under the terms of the QSkinny License, Version 1.0
*****************************************************************************/
#ifndef QSK_MATERIAL_SKIN_H
#define QSK_MATERIAL_SKIN_H
2018-10-12 08:03:03 +02:00
#include "QskMaterialGlobal.h"
2017-07-21 18:21:34 +02:00
#include <QskSkin.h>
#include <QskRgbPalette.h>
2017-07-21 18:21:34 +02:00
class QSK_MATERIAL_EXPORT QskMaterialTheme
2022-02-17 21:54:56 +01:00
{
public:
enum Lightness
{
Light,
Dark
};
enum PaletteType
{
Primary,
Secondary,
Tertiary,
Error,
Neutral,
NeutralVariant,
NumPaletteTypes
};
QskMaterialTheme( Lightness );
QskMaterialTheme( Lightness, std::array< QskRgbPalette, NumPaletteTypes > );
2022-02-17 21:54:56 +01:00
QRgb primary;
QRgb onPrimary;
QRgb primaryContainer;
QRgb onPrimaryContainer;
QRgb secondary;
QRgb onSecondary;
QRgb secondaryContainer;
QRgb onSecondaryContainer;
QRgb tertiary;
QRgb onTertiary;
QRgb tertiaryContainer;
QRgb onTertiaryContainer;
QRgb error;
QRgb onError;
QRgb errorContainer;
QRgb onErrorContainer;
QRgb background;
QRgb onBackground;
QRgb surface;
QRgb onSurface;
QRgb surfaceVariant;
QRgb onSurfaceVariant;
QRgb outline;
const qreal hoverOpacity = 0.08;
const qreal focusOpacity = 0.12;
const qreal pressedOpacity = 0.12;
const qreal draggedOpacity = 0.16;
std::array< QskRgbPalette, NumPaletteTypes > palettes() const;
void setPalette( PaletteType type, const QskRgbPalette& palette );
private:
void initColors();
std::array< QskRgbPalette, NumPaletteTypes > m_palettes;
Lightness m_lightness;
2022-02-17 21:54:56 +01:00
};
2018-10-12 08:03:03 +02:00
class QSK_MATERIAL_EXPORT QskMaterialSkin : public QskSkin
2017-07-21 18:21:34 +02:00
{
Q_OBJECT
using Inherited = QskSkin;
2018-08-03 08:15:28 +02:00
public:
QskMaterialSkin( const QskMaterialTheme&, QObject* parent = nullptr );
2018-07-31 17:32:25 +02:00
~QskMaterialSkin() override;
2022-06-07 12:40:21 +02:00
enum FontRole
{
M3LabelLarge = QskSkin::HugeFont + 1,
};
void setPalette( QskMaterialTheme::PaletteType, const QskRgbPalette& palette );
2022-06-07 12:40:21 +02:00
private:
void init( const QskMaterialTheme& palette );
2022-06-07 12:40:21 +02:00
void setupFonts();
QskMaterialTheme m_theme;
2017-07-21 18:21:34 +02:00
};
#endif