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.

93 lines
3.1KB

  1. /*
  2. * Carla Style, based on Qt5 fusion style
  3. * Copyright (C) 2013 Filipe Coelho <falktx@falktx.com>
  4. * Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies)
  5. *
  6. * This program is free software; you can redistribute it and/or
  7. * modify it under the terms of the GNU General Public License as
  8. * published by the Free Software Foundation; either version 3 of
  9. * the License, or any later version.
  10. *
  11. * This program is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU General Public License for more details.
  15. *
  16. * For a full copy of the GNU General Public License see the GPL3.txt file
  17. */
  18. #ifndef __CARLA_STYLE_HPP__
  19. #define __CARLA_STYLE_HPP__
  20. #include "CarlaDefines.hpp"
  21. #include <QtGui/QStylePlugin>
  22. #if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
  23. # include <QtWidgets/QCommonStyle>
  24. #else
  25. # include <QtGui/QCommonStyle>
  26. #endif
  27. class CarlaStylePrivate;
  28. class CarlaStyle : public QCommonStyle
  29. {
  30. Q_OBJECT
  31. public:
  32. CarlaStyle();
  33. ~CarlaStyle();
  34. enum ColorScheme {
  35. COLOR_BLACK = 0,
  36. COLOR_BLUE = 1,
  37. COLOR_SYSTEM = 2
  38. };
  39. void ready(QApplication* app);
  40. void setColorScheme(ColorScheme color);
  41. QPalette standardPalette() const;
  42. void drawPrimitive(PrimitiveElement elem,
  43. const QStyleOption *option,
  44. QPainter *painter, const QWidget *widget = 0) const;
  45. void drawControl(ControlElement ce, const QStyleOption *option, QPainter *painter,
  46. const QWidget *widget) const;
  47. int pixelMetric(PixelMetric metric, const QStyleOption *option = 0, const QWidget *widget = 0) const;
  48. void drawComplexControl(ComplexControl control, const QStyleOptionComplex *option,
  49. QPainter *painter, const QWidget *widget) const;
  50. QRect subElementRect(SubElement r, const QStyleOption *opt, const QWidget *widget = 0) const;
  51. QSize sizeFromContents(ContentsType type, const QStyleOption *option,
  52. const QSize &size, const QWidget *widget) const;
  53. QRect subControlRect(ComplexControl cc, const QStyleOptionComplex *opt,
  54. SubControl sc, const QWidget *widget) const;
  55. int styleHint(StyleHint hint, const QStyleOption *option = 0, const QWidget *widget = 0,
  56. QStyleHintReturn *returnData = 0) const;
  57. void drawItemText(QPainter *painter, const QRect &rect,
  58. int flags, const QPalette &pal, bool enabled,
  59. const QString &text, QPalette::ColorRole textRole = QPalette::NoRole) const;
  60. void polish(QWidget *widget);
  61. void unpolish(QWidget *widget);
  62. private:
  63. QPalette fPalBlack;
  64. QPalette fPalBlue;
  65. QPalette fPalSystem;
  66. CarlaStylePrivate* const d;
  67. friend class CarlaStylePrivate;
  68. };
  69. class CarlaStylePlugin : public QStylePlugin
  70. {
  71. Q_OBJECT
  72. public:
  73. CarlaStylePlugin(QObject* parent = nullptr);
  74. QStyle* create(const QString& key);
  75. QStringList keys() const;
  76. };
  77. #endif // __CARLA_STYLE_HPP__