2 * Carla Style, based on Qt5 fusion style
3 * Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies)
4 * Copyright (C) 2013-2019 Filipe Coelho <falktx@falktx.com>
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU Lesser General Public License for more details.
15 * For a full copy of the license see the doc/LGPL.txt file
18 #ifndef CARLA_STYLE_HPP_INCLUDED
19 #define CARLA_STYLE_HPP_INCLUDED
21 #include "CarlaDefines.h"
28 #if defined(__GNUC__) && __GNUC__ >= 8
29 # pragma GCC diagnostic push
30 # pragma GCC diagnostic ignored "-Wdeprecated-copy"
33 #if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
34 # include <QtWidgets/QCommonStyle>
37 # pragma clang diagnostic push
38 # pragma clang diagnostic ignored "-Wdeprecated-register"
40 # if defined(__GNUC__) && __GNUC__ >= 8
41 # pragma GCC diagnostic ignored "-Wclass-memaccess"
43 # include <QtGui/QCommonStyle>
45 # pragma clang diagnostic pop
49 #if defined(__GNUC__) && __GNUC__ >= 8
50 # pragma GCC diagnostic pop
53 class CarlaStylePrivate
;
55 class CarlaStyle
: public QCommonStyle
57 #if (QT_VERSION < QT_VERSION_CHECK(5, 0, 0)) && defined(__clang_major__) && __clang_major__ >= 4
58 # pragma clang diagnostic push
59 # pragma clang diagnostic ignored "-Winconsistent-missing-override"
62 #if (QT_VERSION < QT_VERSION_CHECK(5, 0, 0)) && defined(__clang_major__) && __clang_major__ >= 4
63 # pragma clang diagnostic pop
68 ~CarlaStyle() override
;
70 QPalette
standardPalette() const override
;
71 void drawPrimitive(PrimitiveElement elem
, const QStyleOption
* option
, QPainter
* painter
,
72 const QWidget
* widget
= nullptr) const override
;
73 void drawControl(ControlElement ce
, const QStyleOption
* option
, QPainter
* painter
, const QWidget
* widget
) const override
;
74 int pixelMetric(PixelMetric metric
, const QStyleOption
* option
= nullptr, const QWidget
* widget
= nullptr) const override
;
75 void drawComplexControl(ComplexControl control
, const QStyleOptionComplex
* option
, QPainter
* painter
,
76 const QWidget
* widget
) const override
;
77 QRect
subElementRect(SubElement r
, const QStyleOption
* opt
, const QWidget
* widget
= nullptr) const override
;
78 QSize
sizeFromContents(ContentsType type
, const QStyleOption
* option
, const QSize
& size
, const QWidget
* widget
) const override
;
79 QRect
subControlRect(ComplexControl cc
, const QStyleOptionComplex
* opt
, SubControl sc
, const QWidget
* widget
) const override
;
80 QPixmap
standardPixmap(StandardPixmap sp
, const QStyleOption
* opt
= nullptr, const QWidget
* widget
= nullptr) const override
;
81 int styleHint(StyleHint hint
, const QStyleOption
* option
= nullptr, const QWidget
* widget
= nullptr,
82 QStyleHintReturn
* returnData
= nullptr) const override
;
83 void drawItemText(QPainter
*painter
, const QRect
& rect
, int flags
, const QPalette
& pal
, bool enabled
, const QString
& text
,
84 QPalette::ColorRole textRole
= QPalette::NoRole
) const override
;
85 void polish(QApplication
* app
) override
;
86 void polish(QPalette
& pal
) override
;
87 void polish(QWidget
* widget
) override
;
88 void unpolish(QApplication
* app
) override
;
89 void unpolish(QWidget
* widget
) override
;
92 CarlaStylePrivate
* const d
;
93 friend class CarlaStylePrivate
;
95 CARLA_DECLARE_NON_COPYABLE(CarlaStyle
);
98 #endif // CARLA_STYLE_HPP_INCLUDED