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 2.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. /*
  2. * Carla Style, based on Qt5 fusion style
  3. * Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies)
  4. * Copyright (C) 2013 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.hpp"
  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. enum ColorScheme {
  32. COLOR_BLACK = 0,
  33. COLOR_BLUE = 1,
  34. COLOR_SYSTEM = 2
  35. };
  36. CarlaStyle();
  37. ~CarlaStyle();
  38. QPalette standardPalette() const override;
  39. void drawPrimitive(PrimitiveElement elem, const QStyleOption* option, QPainter* painter,
  40. const QWidget* widget = nullptr) const override;
  41. void drawControl(ControlElement ce, const QStyleOption* option, QPainter* painter, const QWidget* widget) const override;
  42. int pixelMetric(PixelMetric metric, const QStyleOption* option = nullptr, const QWidget* widget = nullptr) const override;
  43. void drawComplexControl(ComplexControl control, const QStyleOptionComplex* option, QPainter* painter,
  44. const QWidget* widget) const override;
  45. QRect subElementRect(SubElement r, const QStyleOption* opt, const QWidget* widget = nullptr) const override;
  46. QSize sizeFromContents(ContentsType type, const QStyleOption* option, const QSize& size, const QWidget* widget) const override;
  47. QRect subControlRect(ComplexControl cc, const QStyleOptionComplex* opt, SubControl sc, const QWidget* widget) const override;
  48. int styleHint(StyleHint hint, const QStyleOption* option = nullptr, const QWidget* widget = nullptr,
  49. QStyleHintReturn* returnData = nullptr) const override;
  50. void drawItemText(QPainter *painter, const QRect& rect, int flags, const QPalette& pal, bool enabled, const QString& text,
  51. QPalette::ColorRole textRole = QPalette::NoRole) const override;
  52. void polish(QWidget* widget) override;
  53. void unpolish(QWidget* widget) override;
  54. private:
  55. CarlaStylePrivate* const d;
  56. friend class CarlaStylePrivate;
  57. };
  58. #endif // CARLA_STYLE_HPP_INCLUDED