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>
|
2022-06-15 15:20:46 +02:00
|
|
|
#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
|
|
|
{
|
2022-03-31 18:29:39 +02:00
|
|
|
public:
|
2024-01-18 09:51:35 +01:00
|
|
|
class BaseColors
|
2022-06-03 10:15:20 +02:00
|
|
|
{
|
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;
|
2022-06-03 10:15:20 +02:00
|
|
|
};
|
|
|
|
|
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
|
|
|
|
2022-03-31 18:29:39 +02:00
|
|
|
QRgb primary;
|
2023-02-03 11:53:43 +01:00
|
|
|
QRgb primary8; // ### rename to primaryHovered or so?
|
2022-07-15 08:39:52 +02:00
|
|
|
QRgb primary12;
|
2022-03-31 18:29:39 +02:00
|
|
|
QRgb onPrimary;
|
2022-06-03 09:32:29 +02:00
|
|
|
QRgb primaryContainer;
|
|
|
|
QRgb onPrimaryContainer;
|
2022-03-31 18:29:39 +02:00
|
|
|
|
|
|
|
QRgb secondary;
|
|
|
|
QRgb onSecondary;
|
2022-06-03 09:32:29 +02:00
|
|
|
QRgb secondaryContainer;
|
|
|
|
QRgb onSecondaryContainer;
|
2023-02-03 11:53:43 +01:00
|
|
|
QRgb onSecondaryContainer8;
|
|
|
|
QRgb onSecondaryContainer12;
|
2022-03-31 18:29:39 +02:00
|
|
|
|
2022-06-03 09:32:29 +02:00
|
|
|
QRgb tertiary;
|
|
|
|
QRgb onTertiary;
|
|
|
|
QRgb tertiaryContainer;
|
|
|
|
QRgb onTertiaryContainer;
|
2022-03-31 18:29:39 +02:00
|
|
|
|
|
|
|
QRgb error;
|
2023-01-08 18:22:33 +01:00
|
|
|
QRgb error8;
|
|
|
|
QRgb error12;
|
2022-03-31 18:29:39 +02:00
|
|
|
QRgb onError;
|
2022-06-03 09:32:29 +02:00
|
|
|
QRgb errorContainer;
|
|
|
|
QRgb onErrorContainer;
|
2022-03-31 18:29:39 +02:00
|
|
|
|
2022-06-03 09:32:29 +02:00
|
|
|
QRgb background;
|
|
|
|
QRgb onBackground;
|
|
|
|
QRgb surface;
|
2022-07-15 08:39:52 +02:00
|
|
|
QRgb surface1;
|
|
|
|
QRgb surface2;
|
|
|
|
QRgb surface3;
|
|
|
|
QRgb surface4;
|
|
|
|
QRgb surface5;
|
2022-07-12 15:10:09 +02:00
|
|
|
|
2022-06-03 09:32:29 +02:00
|
|
|
QRgb onSurface;
|
2023-01-06 16:25:40 +01:00
|
|
|
QRgb onSurface8;
|
2022-07-15 08:39:52 +02:00
|
|
|
QRgb onSurface12;
|
|
|
|
QRgb onSurface38;
|
2022-03-31 18:29:39 +02:00
|
|
|
|
2022-06-03 09:32:29 +02:00
|
|
|
QRgb surfaceVariant;
|
2022-07-15 08:39:52 +02:00
|
|
|
QRgb surfaceVariant12;
|
2022-06-03 09:32:29 +02:00
|
|
|
QRgb onSurfaceVariant;
|
|
|
|
QRgb outline;
|
2023-03-05 10:38:55 +01:00
|
|
|
QRgb outlineVariant;
|
2022-06-03 10:15:20 +02:00
|
|
|
|
2023-07-25 08:56:21 +02:00
|
|
|
QRgb surfaceContainerHighest;
|
|
|
|
|
2022-06-13 12:54:17 +02:00
|
|
|
QRgb shadow;
|
|
|
|
|
2023-02-03 11:53:43 +01:00
|
|
|
QskShadowMetrics elevation0;
|
|
|
|
QskShadowMetrics elevation1;
|
|
|
|
QskShadowMetrics elevation2;
|
|
|
|
QskShadowMetrics elevation3;
|
2022-06-15 15:20:46 +02:00
|
|
|
|
2022-06-03 10:40:13 +02:00
|
|
|
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;
|
2022-06-03 10:40:13 +02:00
|
|
|
|
2024-10-25 11:37:34 +02:00
|
|
|
qreal stateOpacity( int state ) const;
|
|
|
|
|
2023-02-14 08:58:37 +01:00
|
|
|
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:
|
2023-01-08 18:22:33 +01:00
|
|
|
enum GraphicRole
|
|
|
|
{
|
|
|
|
GraphicRoleOnError,
|
|
|
|
GraphicRoleOnPrimary,
|
2023-01-27 16:56:50 +01:00
|
|
|
GraphicRoleOnSecondaryContainer,
|
|
|
|
GraphicRoleOnSurface,
|
|
|
|
GraphicRoleOnSurface38,
|
2023-02-14 08:58:37 +01:00
|
|
|
GraphicRoleOnSurfaceVariant,
|
2023-02-03 11:53:43 +01:00
|
|
|
GraphicRolePrimary,
|
2023-01-08 18:22:33 +01:00
|
|
|
GraphicRoleSurface,
|
|
|
|
};
|
|
|
|
|
2024-02-19 15:51:55 +01:00
|
|
|
QskMaterial3Skin( QObject* parent = nullptr );
|
|
|
|
~QskMaterial3Skin() override;
|
2022-06-07 12:40:21 +02:00
|
|
|
|
2023-02-03 11:53:43 +01: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;
|
|
|
|
|
2024-01-30 14:52:40 +01:00
|
|
|
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
|