5#ifndef QGTK3INTERFACE_H
6#define QGTK3INTERFACE_H
19#include <QtCore/QString>
20#include <QtCore/QCache>
21#include <private/qflatmap_p.h>
22#include <QtCore/QObject>
24#include <QtGui/QPalette>
25#include <QtWidgets/QWidget>
26#include <QtCore/QLoggingCategory>
27#include <QtGui/QPixmap>
28#include <qpa/qplatformtheme.h>
39using namespace Qt::StringLiterals;
44
45
46
47
48
49
50
51
52
63
64
65
66
67
68
94
95
96
97
98
99
100
101
109 Q_ENUM(QGtkColorSource)
112
113
114
115
116
117
118
119
120
121
122
128 Q_ENUM(QGtkColorDefault)
135 QFont font(QPlatformTheme::Font type)
const;
152 QGtkColorSource colorSource = QGtkColorSource::Background;
153 GtkStateFlags state = GTK_STATE_FLAG_NORMAL;
156 bool operator<(
const ColorKey& other)
const {
157 return std::tie(colorSource, state) <
158 std::tie(other.colorSource, other.state);
161 QDebug operator<<(QDebug dbg)
163 return dbg <<
"QGtk3Interface::ColorKey(colorSource=" << colorSource <<
", GTK state=" << fromGtkState(state) <<
")";
168 QString propertyName = QString();
169 QGtkColorDefault genericSource = QGtkColorDefault::Background;
171 QDebug operator<<(QDebug dbg)
173 return dbg <<
"QGtk3Interface::ColorValue(propertyName=" << propertyName <<
", genericSource=" << genericSource <<
")";
177 typedef QFlatMap<ColorKey, ColorValue> ColorMap;
178 ColorMap gtkColorMap;
181 GdkRGBA genericColor(GtkStyleContext *con, GtkStateFlags state, QGtkColorDefault def)
const;
184 mutable QFlatMap<QGtkWidget, GtkWidget *> cache;
187 QImage qt_gtk_get_icon(
const char *iconName)
const;
188 QImage qt_convert_gdk_pixbuf(GdkPixbuf *buf)
const;
191 GtkWidget *qt_new_gtkWidget(
QGtkWidget type)
const;
197 GtkStyleContext *context(GtkWidget *widget =
nullptr)
const;
200 static inline QColor fromGdkColor (
const GdkRGBA &c)
201 {
return QColor::fromRgbF(c.red, c.green, c.blue, c.alpha); }
204 QColor color (GtkWidget *widget, QGtkColorSource source, GtkStateFlags state)
const;
207 inline static constexpr QGtkWidget toWidgetType(QPlatformTheme::Font);
208 inline static constexpr QFont::Style toFontStyle(PangoStyle style);
209 inline static constexpr int toFontWeight(PangoWeight weight);
The QGtk3Interface class centralizes communication with the GTK3 library.
QIcon fileIcon(const QFileInfo &fileInfo) const
Returns a GTK styled file icon for.
QFont font(QPlatformTheme::Font type) const
Return a GTK styled font.
Qt::ColorScheme colorSchemeByColors() const
Determine color scheme by colors.
QImage standardPixmap(QPlatformTheme::StandardPixmap standardPixmap) const
Returns a QImage corresponding to.
QString themeName() const
Returns the name of the current GTK theme.
static const QLatin1String fromGtkState(GtkStateFlags state)
Returns.
@ gtk_separator_menu_item
static int toGtkState(const QString &state)
Converts a string into the GtkStateFlags enum.
void handleThemeChange()
Handles a theme change at runtime.
const QPalette * palette(QPlatformTheme::Palette=QPlatformTheme::SystemPalette) const
Return a GTK styled QPalette.
QFlatMap< QPlatformTheme::Palette, BrushMap > PaletteMap
static QPalette standardPalette()
Returns a simple, hard coded base palette.
const QString themeName() const
Qt::ColorScheme colorScheme() const
QFlatMap< TargetBrush, Source > BrushMap
QIcon fileIcon(const QFileInfo &fileInfo) const
Returns a GTK styled file icon corresponding to.
void populateMap()
Populates a map with information about how to locate colors in GTK.
SourceType
This enum represents the type of a color source.
const QFont * font(QPlatformTheme::Font type) const
Return a GTK styled font.
QPixmap standardPixmap(QPlatformTheme::StandardPixmap standardPixmap, const QSizeF &size) const
Return a GTK styled standard pixmap if available.
QIcon fileIcon(const QFileInfo &fileInfo, QPlatformTheme::IconOptions iconOptions={ }) const override
Return an icon for fileInfo, observing iconOptions.
Qt::ColorScheme colorScheme() const override
bool usePlatformNativeDialog(DialogType type) const override
virtual QVariant themeHint(ThemeHint hint) const override
void requestColorScheme(Qt::ColorScheme scheme) override
QPlatformDialogHelper * createPlatformDialogHelper(DialogType type) const override
const QPalette * palette(Palette type=SystemPalette) const override
Return a color palette for type type.
virtual QString gtkFontName() const override
QPixmap standardPixmap(StandardPixmap sp, const QSizeF &size) const override
Return a pixmap for standardPixmap, at the given size.
const QFont * font(Font type=SystemFont) const override
QT_BEGIN_NAMESPACE Q_DECLARE_LOGGING_CATEGORY(lcEventDispatcher)
QDebug operator<<(QDebug dbg)
QPalette::ColorRole colorRole2
QDebug operator<<(QDebug dbg)
QPalette::ColorGroup sourceGroup
QPalette::ColorRole colorRole1
static QColor mixColors(const QColor &color1, const QColor &color2)
QDebug operator<<(QDebug dbg)
QPalette::ColorRole colorRole
QPalette::ColorGroup colorGroup
Qt::ColorScheme colorScheme
Source(const QBrush &brush)
Source(QPalette::ColorGroup group, QPalette::ColorRole role, Qt::ColorScheme scheme, int p_lighter, int p_red, int p_green, int p_blue)
Source(QPalette::ColorGroup group, QPalette::ColorRole role, Qt::ColorScheme scheme, int p_red, int p_green, int p_blue)
Source(QGtk3Interface::QGtkWidget wtype, QGtk3Interface::QGtkColorSource csource, GtkStateFlags cstate, int bwidth=-1, int bheight=-1)
Source(QPalette::ColorGroup group, QPalette::ColorRole role, Qt::ColorScheme scheme, int p_lighter=100)
QDebug operator<<(QDebug dbg)
Source(QPalette::ColorGroup sourceGroup, QPalette::ColorRole role1, QPalette::ColorRole role2)
QPalette::ColorRole colorRole
QPalette::ColorGroup colorGroup
TargetBrush(QPalette::ColorGroup group, QPalette::ColorRole role, Qt::ColorScheme scheme=Qt::ColorScheme::Unknown)
TargetBrush(const TargetBrush &other, Qt::ColorScheme scheme)
Qt::ColorScheme colorScheme
bool operator<(const TargetBrush &other) const