Audio plugin host https://kx.studio/carla
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

94 lines
3.7KB

  1. /*
  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>
  5. *
  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.
  9. *
  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.
  14. *
  15. * For a full copy of the license see the doc/LGPL.txt file
  16. */
  17. #ifndef CARLA_STYLE_HPP_INCLUDED
  18. #define CARLA_STYLE_HPP_INCLUDED
  19. #include "CarlaDefines.h"
  20. #undef noexcept
  21. #undef override
  22. #undef final
  23. #include <QtCore/Qt>
  24. #if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
  25. # include <QtWidgets/QCommonStyle>
  26. #else
  27. # ifdef __clang__
  28. # pragma clang diagnostic push
  29. # pragma clang diagnostic ignored "-Wdeprecated-register"
  30. # endif
  31. # if defined(__GNUC__) && __GNUC__ >= 8
  32. # pragma GCC diagnostic push
  33. # pragma GCC diagnostic ignored "-Wclass-memaccess"
  34. # endif
  35. # include <QtGui/QCommonStyle>
  36. # if defined(__GNUC__) && __GNUC__ >= 8
  37. # pragma GCC diagnostic pop
  38. # endif
  39. # ifdef __clang__
  40. # pragma clang diagnostic pop
  41. # endif
  42. #endif
  43. class CarlaStylePrivate;
  44. class CarlaStyle : public QCommonStyle
  45. {
  46. #if (QT_VERSION < QT_VERSION_CHECK(5, 0, 0)) && defined(__clang_major__) && __clang_major__ >= 4
  47. # pragma clang diagnostic push
  48. # pragma clang diagnostic ignored "-Winconsistent-missing-override"
  49. #endif
  50. Q_OBJECT
  51. #if (QT_VERSION < QT_VERSION_CHECK(5, 0, 0)) && defined(__clang_major__) && __clang_major__ >= 4
  52. # pragma clang diagnostic pop
  53. #endif
  54. public:
  55. CarlaStyle();
  56. ~CarlaStyle() override;
  57. QPalette standardPalette() const override;
  58. void drawPrimitive(PrimitiveElement elem, const QStyleOption* option, QPainter* painter,
  59. const QWidget* widget = nullptr) const override;
  60. void drawControl(ControlElement ce, const QStyleOption* option, QPainter* painter, const QWidget* widget) const override;
  61. int pixelMetric(PixelMetric metric, const QStyleOption* option = nullptr, const QWidget* widget = nullptr) const override;
  62. void drawComplexControl(ComplexControl control, const QStyleOptionComplex* option, QPainter* painter,
  63. const QWidget* widget) const override;
  64. QRect subElementRect(SubElement r, const QStyleOption* opt, const QWidget* widget = nullptr) const override;
  65. QSize sizeFromContents(ContentsType type, const QStyleOption* option, const QSize& size, const QWidget* widget) const override;
  66. QRect subControlRect(ComplexControl cc, const QStyleOptionComplex* opt, SubControl sc, const QWidget* widget) const override;
  67. QPixmap standardPixmap(StandardPixmap sp, const QStyleOption* opt = nullptr, const QWidget* widget = nullptr) const override;
  68. int styleHint(StyleHint hint, const QStyleOption* option = nullptr, const QWidget* widget = nullptr,
  69. QStyleHintReturn* returnData = nullptr) const override;
  70. void drawItemText(QPainter *painter, const QRect& rect, int flags, const QPalette& pal, bool enabled, const QString& text,
  71. QPalette::ColorRole textRole = QPalette::NoRole) const override;
  72. void polish(QApplication* app) override;
  73. void polish(QPalette& pal) override;
  74. void polish(QWidget* widget) override;
  75. void unpolish(QApplication* app) override;
  76. void unpolish(QWidget* widget) override;
  77. private:
  78. CarlaStylePrivate* const d;
  79. friend class CarlaStylePrivate;
  80. CARLA_DECLARE_NON_COPY_CLASS(CarlaStyle);
  81. };
  82. #endif // CARLA_STYLE_HPP_INCLUDED