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.

CarlaStyle.hpp 3.7KB

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