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.

91 lines
3.0KB

  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 <QtGui/QStylePlugin>
  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();
  33. enum ColorScheme {
  34. COLOR_BLACK = 0,
  35. COLOR_BLUE = 1,
  36. COLOR_SYSTEM = 2
  37. };
  38. void ready(QApplication* app);
  39. void setColorScheme(ColorScheme color);
  40. QPalette standardPalette() const;
  41. void drawPrimitive(PrimitiveElement elem,
  42. const QStyleOption *option,
  43. QPainter *painter, const QWidget *widget = 0) const;
  44. void drawControl(ControlElement ce, const QStyleOption *option, QPainter *painter,
  45. const QWidget *widget) const;
  46. int pixelMetric(PixelMetric metric, const QStyleOption *option = 0, const QWidget *widget = 0) const;
  47. void drawComplexControl(ComplexControl control, const QStyleOptionComplex *option,
  48. QPainter *painter, const QWidget *widget) const;
  49. QRect subElementRect(SubElement r, const QStyleOption *opt, const QWidget *widget = 0) const;
  50. QSize sizeFromContents(ContentsType type, const QStyleOption *option,
  51. const QSize &size, const QWidget *widget) const;
  52. QRect subControlRect(ComplexControl cc, const QStyleOptionComplex *opt,
  53. SubControl sc, const QWidget *widget) const;
  54. int styleHint(StyleHint hint, const QStyleOption *option = 0, const QWidget *widget = 0,
  55. QStyleHintReturn *returnData = 0) const;
  56. void drawItemText(QPainter *painter, const QRect &rect,
  57. int flags, const QPalette &pal, bool enabled,
  58. const QString &text, QPalette::ColorRole textRole = QPalette::NoRole) const;
  59. void polish(QWidget *widget);
  60. void unpolish(QWidget *widget);
  61. private:
  62. QPalette fPalBlack;
  63. QPalette fPalBlue;
  64. QPalette fPalSystem;
  65. CarlaStylePrivate* const d;
  66. friend class CarlaStylePrivate;
  67. };
  68. class CarlaStylePlugin : public QStylePlugin
  69. {
  70. Q_OBJECT
  71. public:
  72. CarlaStylePlugin(QObject* parent = nullptr);
  73. QStyle* create(const QString& key);
  74. QStringList keys() const;
  75. };
  76. #endif // __CARLA_STYLE_HPP__