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.

86 lines
3.3KB

  1. /*
  2. * Carla Style, based on Qt5 fusion style
  3. * Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies)
  4. * Copyright (C) 2013-2014 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. # include <QtGui/QCommonStyle>
  32. # ifdef __clang__
  33. # pragma clang diagnostic pop
  34. # endif
  35. #endif
  36. class CarlaStylePrivate;
  37. class CarlaStyle : public QCommonStyle
  38. {
  39. #if (QT_VERSION < QT_VERSION_CHECK(5, 0, 0)) && defined(__clang_major__) && __clang_major__ >= 4
  40. # pragma clang diagnostic push
  41. # pragma clang diagnostic ignored "-Winconsistent-missing-override"
  42. #endif
  43. Q_OBJECT
  44. #if (QT_VERSION < QT_VERSION_CHECK(5, 0, 0)) && defined(__clang_major__) && __clang_major__ >= 4
  45. # pragma clang diagnostic pop
  46. #endif
  47. public:
  48. CarlaStyle();
  49. ~CarlaStyle() override;
  50. QPalette standardPalette() const override;
  51. void drawPrimitive(PrimitiveElement elem, const QStyleOption* option, QPainter* painter,
  52. const QWidget* widget = nullptr) const override;
  53. void drawControl(ControlElement ce, const QStyleOption* option, QPainter* painter, const QWidget* widget) const override;
  54. int pixelMetric(PixelMetric metric, const QStyleOption* option = nullptr, const QWidget* widget = nullptr) const override;
  55. void drawComplexControl(ComplexControl control, const QStyleOptionComplex* option, QPainter* painter,
  56. const QWidget* widget) const override;
  57. QRect subElementRect(SubElement r, const QStyleOption* opt, const QWidget* widget = nullptr) const override;
  58. QSize sizeFromContents(ContentsType type, const QStyleOption* option, const QSize& size, const QWidget* widget) const override;
  59. QRect subControlRect(ComplexControl cc, const QStyleOptionComplex* opt, SubControl sc, const QWidget* widget) const override;
  60. int styleHint(StyleHint hint, const QStyleOption* option = nullptr, const QWidget* widget = nullptr,
  61. QStyleHintReturn* returnData = nullptr) const override;
  62. void drawItemText(QPainter *painter, const QRect& rect, int flags, const QPalette& pal, bool enabled, const QString& text,
  63. QPalette::ColorRole textRole = QPalette::NoRole) const override;
  64. void polish(QApplication* app) override;
  65. void polish(QPalette& pal) override;
  66. void polish(QWidget* widget) override;
  67. void unpolish(QApplication* app) override;
  68. void unpolish(QWidget* widget) override;
  69. private:
  70. CarlaStylePrivate* const d;
  71. friend class CarlaStylePrivate;
  72. CARLA_DECLARE_NON_COPY_CLASS(CarlaStyle);
  73. };
  74. #endif // CARLA_STYLE_HPP_INCLUDED