| 1 | /**************************************************************************** |
|---|---|
| 2 | ** |
| 3 | ** Copyright (C) 2016 The Qt Company Ltd. |
| 4 | ** Contact: https://www.qt.io/licensing/ |
| 5 | ** |
| 6 | ** This file is part of the plugins of the Qt Toolkit. |
| 7 | ** |
| 8 | ** $QT_BEGIN_LICENSE:LGPL$ |
| 9 | ** Commercial License Usage |
| 10 | ** Licensees holding valid commercial Qt licenses may use this file in |
| 11 | ** accordance with the commercial license agreement provided with the |
| 12 | ** Software or, alternatively, in accordance with the terms contained in |
| 13 | ** a written agreement between you and The Qt Company. For licensing terms |
| 14 | ** and conditions see https://www.qt.io/terms-conditions. For further |
| 15 | ** information use the contact form at https://www.qt.io/contact-us. |
| 16 | ** |
| 17 | ** GNU Lesser General Public License Usage |
| 18 | ** Alternatively, this file may be used under the terms of the GNU Lesser |
| 19 | ** General Public License version 3 as published by the Free Software |
| 20 | ** Foundation and appearing in the file LICENSE.LGPL3 included in the |
| 21 | ** packaging of this file. Please review the following information to |
| 22 | ** ensure the GNU Lesser General Public License version 3 requirements |
| 23 | ** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. |
| 24 | ** |
| 25 | ** GNU General Public License Usage |
| 26 | ** Alternatively, this file may be used under the terms of the GNU |
| 27 | ** General Public License version 2.0 or (at your option) the GNU General |
| 28 | ** Public license version 3 or any later version approved by the KDE Free |
| 29 | ** Qt Foundation. The licenses are as published by the Free Software |
| 30 | ** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 |
| 31 | ** included in the packaging of this file. Please review the following |
| 32 | ** information to ensure the GNU General Public License requirements will |
| 33 | ** be met: https://www.gnu.org/licenses/gpl-2.0.html and |
| 34 | ** https://www.gnu.org/licenses/gpl-3.0.html. |
| 35 | ** |
| 36 | ** $QT_END_LICENSE$ |
| 37 | ** |
| 38 | ****************************************************************************/ |
| 39 | |
| 40 | #ifndef QGENERICUNIXTHEMES_H |
| 41 | #define QGENERICUNIXTHEMES_H |
| 42 | |
| 43 | // |
| 44 | // W A R N I N G |
| 45 | // ------------- |
| 46 | // |
| 47 | // This file is not part of the Qt API. It exists purely as an |
| 48 | // implementation detail. This header file may change from version to |
| 49 | // version without notice, or even be removed. |
| 50 | // |
| 51 | // We mean it. |
| 52 | // |
| 53 | |
| 54 | #include <qpa/qplatformtheme.h> |
| 55 | #include <QtCore/QString> |
| 56 | #include <QtCore/QStringList> |
| 57 | #include <QtGui/QFont> |
| 58 | |
| 59 | QT_BEGIN_NAMESPACE |
| 60 | |
| 61 | class ResourceHelper |
| 62 | { |
| 63 | public: |
| 64 | ResourceHelper(); |
| 65 | ~ResourceHelper() { clear(); } |
| 66 | |
| 67 | void clear(); |
| 68 | |
| 69 | QPalette *palettes[QPlatformTheme::NPalettes]; |
| 70 | QFont *fonts[QPlatformTheme::NFonts]; |
| 71 | }; |
| 72 | |
| 73 | class QGenericUnixThemePrivate; |
| 74 | |
| 75 | class Q_GUI_EXPORT QGenericUnixTheme : public QPlatformTheme |
| 76 | { |
| 77 | Q_DECLARE_PRIVATE(QGenericUnixTheme) |
| 78 | public: |
| 79 | QGenericUnixTheme(); |
| 80 | |
| 81 | static QPlatformTheme *createUnixTheme(const QString &name); |
| 82 | static QStringList themeNames(); |
| 83 | |
| 84 | const QFont *font(Font type) const override; |
| 85 | QVariant themeHint(ThemeHint hint) const override; |
| 86 | |
| 87 | static QStringList xdgIconThemePaths(); |
| 88 | static QStringList iconFallbackPaths(); |
| 89 | #ifndef QT_NO_DBUS |
| 90 | QPlatformMenuBar *createPlatformMenuBar() const override; |
| 91 | #endif |
| 92 | #if !defined(QT_NO_DBUS) && !defined(QT_NO_SYSTEMTRAYICON) |
| 93 | QPlatformSystemTrayIcon *createPlatformSystemTrayIcon() const override; |
| 94 | #endif |
| 95 | |
| 96 | static const char *name; |
| 97 | }; |
| 98 | |
| 99 | #if QT_CONFIG(settings) |
| 100 | class QKdeThemePrivate; |
| 101 | |
| 102 | class QKdeTheme : public QPlatformTheme |
| 103 | { |
| 104 | Q_DECLARE_PRIVATE(QKdeTheme) |
| 105 | public: |
| 106 | QKdeTheme(const QStringList& kdeDirs, int kdeVersion); |
| 107 | |
| 108 | static QPlatformTheme *createKdeTheme(); |
| 109 | QVariant themeHint(ThemeHint hint) const override; |
| 110 | |
| 111 | QIcon fileIcon(const QFileInfo &fileInfo, |
| 112 | QPlatformTheme::IconOptions iconOptions = { }) const override; |
| 113 | |
| 114 | const QPalette *palette(Palette type = SystemPalette) const override; |
| 115 | |
| 116 | const QFont *font(Font type) const override; |
| 117 | #ifndef QT_NO_DBUS |
| 118 | QPlatformMenuBar *createPlatformMenuBar() const override; |
| 119 | #endif |
| 120 | #if !defined(QT_NO_DBUS) && !defined(QT_NO_SYSTEMTRAYICON) |
| 121 | QPlatformSystemTrayIcon *createPlatformSystemTrayIcon() const override; |
| 122 | #endif |
| 123 | |
| 124 | static const char *name; |
| 125 | }; |
| 126 | #endif // settings |
| 127 | |
| 128 | class QGnomeThemePrivate; |
| 129 | |
| 130 | class Q_GUI_EXPORT QGnomeTheme : public QPlatformTheme |
| 131 | { |
| 132 | Q_DECLARE_PRIVATE(QGnomeTheme) |
| 133 | public: |
| 134 | QGnomeTheme(); |
| 135 | QVariant themeHint(ThemeHint hint) const override; |
| 136 | QIcon fileIcon(const QFileInfo &fileInfo, |
| 137 | QPlatformTheme::IconOptions = { }) const override; |
| 138 | const QFont *font(Font type) const override; |
| 139 | QString standardButtonText(int button) const override; |
| 140 | |
| 141 | virtual QString gtkFontName() const; |
| 142 | #ifndef QT_NO_DBUS |
| 143 | QPlatformMenuBar *createPlatformMenuBar() const override; |
| 144 | #endif |
| 145 | #if !defined(QT_NO_DBUS) && !defined(QT_NO_SYSTEMTRAYICON) |
| 146 | QPlatformSystemTrayIcon *createPlatformSystemTrayIcon() const override; |
| 147 | #endif |
| 148 | |
| 149 | static const char *name; |
| 150 | }; |
| 151 | |
| 152 | QPlatformTheme *qt_createUnixTheme(); |
| 153 | |
| 154 | QT_END_NAMESPACE |
| 155 | |
| 156 | #endif // QGENERICUNIXTHEMES_H |
| 157 |