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.

69 lines
2.8KB

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