qskinny/skins/material/QskMaterialSkin.h

83 lines
1.8 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>
2022-02-17 21:54:56 +01:00
#include <QskRgbValue.h>
2017-07-21 18:21:34 +02:00
class QSK_MATERIAL_EXPORT QskMaterialPalette
2022-02-17 21:54:56 +01:00
{
public:
enum Lightness
2022-02-17 21:54:56 +01:00
{
Light,
Dark
};
2022-02-17 21:54:56 +01:00
QskMaterialPalette( Lightness lightness )
: m_lightness( lightness )
{
2022-02-17 21:54:56 +01:00
}
inline QRgb elevated( const QRgb rgb, const float level = 1 ) const
{
return ( m_lightness == Light )
? QskRgb::darker( rgb, 100 + level * 15 )
: QskRgb::lighter( rgb, 130 + level * 30 );
2022-02-17 21:54:56 +01:00
}
2022-04-02 11:50:55 +02:00
inline QRgb toDisabled( const QRgb rgb ) const
{
return QskRgb::toTransparentF( rgb, this->m_disabled );
}
public:
QRgb primary;
QRgb primaryVariant;
QRgb onPrimary;
QRgb secondary;
QRgb secondaryVariant;
QRgb onSecondary;
QRgb background;
QRgb onBackground;
QRgb error;
QRgb onError;
QRgb primaryNoSaturation;
QRgb secondaryNoSaturation;
QRgb secondaryVariantNoSaturation;
const qreal disabledOccupancy = 0.2;
const qreal widgetBackgroundDisabled = 0.6;
const qreal hover = 0.1;
const qreal focused = 0.4;
const qreal pressed = 0.5;
2022-04-02 11:50:55 +02:00
private:
const qreal m_disabled = 0.3;
const 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 QskMaterialPalette&, QObject* parent = nullptr );
2018-07-31 17:32:25 +02:00
~QskMaterialSkin() override;
2017-07-21 18:21:34 +02:00
};
#endif