qskinny/designsystems/material3/QskMaterial3Skin.h

144 lines
3.5 KiB
C
Raw Normal View History

2017-07-21 18:21:34 +02:00
/******************************************************************************
2024-01-17 14:31:45 +01:00
* QSkinny - Copyright (C) The authors
2023-04-06 09:23:37 +02:00
* SPDX-License-Identifier: BSD-3-Clause
2017-07-21 18:21:34 +02:00
*****************************************************************************/
2022-07-05 08:36:25 +02:00
#ifndef QSK_MATERIAL3_SKIN_H
#define QSK_MATERIAL3_SKIN_H
2017-07-21 18:21:34 +02:00
2022-07-05 08:36:25 +02:00
#include "QskMaterial3Global.h"
2022-06-27 14:32:37 +02:00
2017-07-21 18:21:34 +02:00
#include <QskSkin.h>
2024-01-18 09:51:35 +01:00
#include <QskBoxShapeMetrics.h>
#include <QskShadowMetrics.h>
2017-07-21 18:21:34 +02:00
2024-01-18 09:51:35 +01:00
#include <qcolor.h>
2022-06-14 11:26:12 +02:00
2022-07-05 08:36:25 +02:00
class QSK_MATERIAL3_EXPORT QskMaterial3Theme
2022-02-17 21:54:56 +01:00
{
public:
2024-01-18 09:51:35 +01:00
class BaseColors
{
2024-01-18 09:51:35 +01:00
public:
BaseColors() = default;
QRgb primary = 0xff6750A4;
QRgb secondary = 0xff625B71;
QRgb tertiary = 0xff7D5260;
QRgb error = 0xffB3261E;
QRgb neutral = 0xff605D62;
QRgb neutralVariant = 0xff605D66;
};
2023-06-27 15:15:27 +02:00
QskMaterial3Theme( QskSkin::ColorScheme );
2024-01-18 09:51:35 +01:00
QskMaterial3Theme( QskSkin::ColorScheme, const BaseColors& );
2022-02-17 21:54:56 +01:00
QRgb primary;
QRgb primary8; // ### rename to primaryHovered or so?
2022-07-15 08:39:52 +02:00
QRgb primary12;
QRgb onPrimary;
QRgb primaryContainer;
QRgb onPrimaryContainer;
QRgb secondary;
QRgb onSecondary;
QRgb secondaryContainer;
QRgb onSecondaryContainer;
QRgb onSecondaryContainer8;
QRgb onSecondaryContainer12;
QRgb tertiary;
QRgb onTertiary;
QRgb tertiaryContainer;
QRgb onTertiaryContainer;
QRgb error;
QRgb error8;
QRgb error12;
QRgb onError;
QRgb errorContainer;
QRgb onErrorContainer;
QRgb background;
QRgb onBackground;
QRgb surface;
2022-07-15 08:39:52 +02:00
QRgb surface1;
QRgb surface2;
QRgb surface3;
QRgb surface4;
QRgb surface5;
QRgb onSurface;
QRgb onSurface8;
2022-07-15 08:39:52 +02:00
QRgb onSurface12;
QRgb onSurface38;
QRgb surfaceVariant;
2022-07-15 08:39:52 +02:00
QRgb surfaceVariant12;
QRgb onSurfaceVariant;
QRgb outline;
2023-03-05 10:38:55 +01:00
QRgb outlineVariant;
QRgb surfaceContainerHighest;
QRgb surfaceContainerHighest38;
2022-06-13 12:54:17 +02:00
QRgb shadow;
QskShadowMetrics elevation0;
QskShadowMetrics elevation1;
QskShadowMetrics elevation2;
QskShadowMetrics elevation3;
const qreal hoverOpacity = 0.08;
const qreal focusOpacity = 0.12;
const qreal pressedOpacity = 0.12;
const qreal draggedOpacity = 0.16;
2024-10-25 18:52:02 +02:00
const qreal disabledOpacity = 0.38;
qreal stateOpacity( int state ) const;
QskBoxShapeMetrics shapeExtraSmallTop;
2022-02-17 21:54:56 +01:00
};
2022-07-05 08:36:25 +02:00
class QSK_MATERIAL3_EXPORT QskMaterial3Skin : public QskSkin
2017-07-21 18:21:34 +02:00
{
Q_OBJECT
using Inherited = QskSkin;
2018-08-03 08:15:28 +02:00
public:
enum GraphicRole
{
GraphicRoleOnError,
GraphicRoleOnPrimary,
GraphicRoleOnPrimaryContainer,
2023-01-27 16:56:50 +01:00
GraphicRoleOnSecondaryContainer,
GraphicRoleOnSurface,
GraphicRoleOnSurface38,
GraphicRoleOnSurfaceVariant,
GraphicRolePrimary,
GraphicRoleSurface,
GraphicRoleSurfaceContainerHighest,
GraphicRoleSurfaceContainerHighest38,
};
2024-02-19 15:51:55 +01:00
QskMaterial3Skin( QObject* parent = nullptr );
~QskMaterial3Skin() override;
2022-06-07 12:40:21 +02:00
static constexpr QskAspect::Variation Filled = QskAspect::NoVariation;
static constexpr QskAspect::Variation Tonal = QskAspect::Huge;
static constexpr QskAspect::Variation Elevated = QskAspect::Large;
static constexpr QskAspect::Variation Outlined = QskAspect::Small;
static constexpr QskAspect::Variation Text = QskAspect::Tiny;
protected:
void initHints() override;
2022-06-07 12:40:21 +02:00
private:
void setupFonts();
2024-01-18 09:51:35 +01:00
void setupGraphicFilters( const QskMaterial3Theme& );
2023-02-26 15:07:08 +01:00
void setGraphicColor( GraphicRole, QRgb );
2017-07-21 18:21:34 +02:00
};
#endif