1// Copyright (C) 2020 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4#ifndef QGENERICUNIXTHEMES_H
5#define QGENERICUNIXTHEMES_H
6
7//
8// W A R N I N G
9// -------------
10//
11// This file is not part of the Qt API. It exists purely as an
12// implementation detail. This header file may change from version to
13// version without notice, or even be removed.
14//
15// We mean it.
16//
17
18#include <qpa/qplatformtheme.h>
19#include <QtCore/QString>
20#include <QtCore/QStringList>
21#include <QtGui/QFont>
22#include <QtCore/private/qglobal_p.h>
23
24QT_BEGIN_NAMESPACE
25
26class ResourceHelper
27{
28public:
29 ResourceHelper();
30 ~ResourceHelper() { clear(); }
31
32 void clear();
33
34 QPalette *palettes[QPlatformTheme::NPalettes];
35 QFont *fonts[QPlatformTheme::NFonts];
36};
37
38class QGenericUnixThemePrivate;
39
40class Q_GUI_EXPORT QGenericUnixTheme : public QPlatformTheme
41{
42 Q_DECLARE_PRIVATE(QGenericUnixTheme)
43public:
44 QGenericUnixTheme();
45
46 static QPlatformTheme *createUnixTheme(const QString &name);
47 static QStringList themeNames();
48
49 const QFont *font(Font type) const override;
50 QVariant themeHint(ThemeHint hint) const override;
51
52 static QStringList xdgIconThemePaths();
53 static QStringList iconFallbackPaths();
54#ifndef QT_NO_DBUS
55 QPlatformMenuBar *createPlatformMenuBar() const override;
56#endif
57#if !defined(QT_NO_DBUS) && !defined(QT_NO_SYSTEMTRAYICON)
58 QPlatformSystemTrayIcon *createPlatformSystemTrayIcon() const override;
59#endif
60
61 static const char *name;
62};
63
64#if QT_CONFIG(settings)
65class QKdeThemePrivate;
66
67class QKdeTheme : public QPlatformTheme
68{
69 Q_DECLARE_PRIVATE(QKdeTheme)
70public:
71 QKdeTheme(const QStringList& kdeDirs, int kdeVersion);
72
73 static QPlatformTheme *createKdeTheme();
74 QVariant themeHint(ThemeHint hint) const override;
75
76 QIcon fileIcon(const QFileInfo &fileInfo,
77 QPlatformTheme::IconOptions iconOptions = { }) const override;
78
79 const QPalette *palette(Palette type = SystemPalette) const override;
80 Qt::ColorScheme colorScheme() const override;
81
82 const QFont *font(Font type) const override;
83#ifndef QT_NO_DBUS
84 QPlatformMenuBar *createPlatformMenuBar() const override;
85#endif
86#if !defined(QT_NO_DBUS) && !defined(QT_NO_SYSTEMTRAYICON)
87 QPlatformSystemTrayIcon *createPlatformSystemTrayIcon() const override;
88#endif
89
90 static const char *name;
91};
92#endif // settings
93
94class QGnomeThemePrivate;
95
96class Q_GUI_EXPORT QGnomeTheme : public QPlatformTheme
97{
98 Q_DECLARE_PRIVATE(QGnomeTheme)
99public:
100 QGnomeTheme();
101 QVariant themeHint(ThemeHint hint) const override;
102 QIcon fileIcon(const QFileInfo &fileInfo,
103 QPlatformTheme::IconOptions = { }) const override;
104 const QFont *font(Font type) const override;
105 QString standardButtonText(int button) const override;
106
107 virtual QString gtkFontName() const;
108#ifndef QT_NO_DBUS
109 QPlatformMenuBar *createPlatformMenuBar() const override;
110 Qt::ColorScheme colorScheme() const override;
111#endif
112#if !defined(QT_NO_DBUS) && !defined(QT_NO_SYSTEMTRAYICON)
113 QPlatformSystemTrayIcon *createPlatformSystemTrayIcon() const override;
114#endif
115
116 static const char *name;
117};
118
119QPlatformTheme *qt_createUnixTheme();
120
121QT_END_NAMESPACE
122
123#endif // QGENERICUNIXTHEMES_H
124

source code of qtbase/src/gui/platform/unix/qgenericunixthemes_p.h