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.0KB

10 years ago
11 years ago
10 years ago
10 years ago
10 years ago
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  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. #ifdef CARLA_OS_MAC
  25. # undef Q_COMPILER_UNICODE_STRINGS
  26. # undef Q_DECL_CONSTEXPR
  27. # undef Q_DECL_NOEXCEPT_EXPR
  28. # define Q_DECL_CONSTEXPR
  29. # define Q_DECL_NOEXCEPT_EXPR(x)
  30. #endif
  31. #if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
  32. # include <QtWidgets/QCommonStyle>
  33. #else
  34. # include <QtGui/QCommonStyle>
  35. #endif
  36. class CarlaStylePrivate;
  37. class CarlaStyle : public QCommonStyle
  38. {
  39. Q_OBJECT
  40. public:
  41. CarlaStyle();
  42. ~CarlaStyle() override;
  43. QPalette standardPalette() const override;
  44. void drawPrimitive(PrimitiveElement elem, const QStyleOption* option, QPainter* painter,
  45. const QWidget* widget = nullptr) const override;
  46. void drawControl(ControlElement ce, const QStyleOption* option, QPainter* painter, const QWidget* widget) const override;
  47. int pixelMetric(PixelMetric metric, const QStyleOption* option = nullptr, const QWidget* widget = nullptr) const override;
  48. void drawComplexControl(ComplexControl control, const QStyleOptionComplex* option, QPainter* painter,
  49. const QWidget* widget) const override;
  50. QRect subElementRect(SubElement r, const QStyleOption* opt, const QWidget* widget = nullptr) const override;
  51. QSize sizeFromContents(ContentsType type, const QStyleOption* option, const QSize& size, const QWidget* widget) const override;
  52. QRect subControlRect(ComplexControl cc, const QStyleOptionComplex* opt, SubControl sc, const QWidget* widget) const override;
  53. int styleHint(StyleHint hint, const QStyleOption* option = nullptr, const QWidget* widget = nullptr,
  54. QStyleHintReturn* returnData = nullptr) const override;
  55. void drawItemText(QPainter *painter, const QRect& rect, int flags, const QPalette& pal, bool enabled, const QString& text,
  56. QPalette::ColorRole textRole = QPalette::NoRole) const override;
  57. void polish(QApplication* app) override;
  58. void polish(QPalette& pal) override;
  59. void polish(QWidget* widget) override;
  60. void unpolish(QApplication* app) override;
  61. void unpolish(QWidget* widget) override;
  62. private:
  63. CarlaStylePrivate* const d;
  64. friend class CarlaStylePrivate;
  65. CARLA_DECLARE_NON_COPY_CLASS(CarlaStyle);
  66. };
  67. #endif // CARLA_STYLE_HPP_INCLUDED