LmmsStyle.h 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. /*
  2. * LmmsStyle.h - the graphical style used by LMMS to create a consistent
  3. * interface
  4. *
  5. * Copyright (c) 2007-2014 Tobias Doerffel <tobydox/at/users.sourceforge.net>
  6. *
  7. * This file is part of LMMS - https://lmms.io
  8. *
  9. * This program is free software; you can redistribute it and/or
  10. * modify it under the terms of the GNU General Public
  11. * License as published by the Free Software Foundation; either
  12. * version 2 of the License, or (at your option) any later version.
  13. *
  14. * This program is distributed in the hope that it will be useful,
  15. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  17. * General Public License for more details.
  18. *
  19. * You should have received a copy of the GNU General Public
  20. * License along with this program (see COPYING); if not, write to the
  21. * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
  22. * Boston, MA 02110-1301 USA.
  23. *
  24. */
  25. #ifndef LMMS_STYLE_H
  26. #define LMMS_STYLE_H
  27. #include <QProxyStyle>
  28. class LmmsStyle : public QProxyStyle
  29. {
  30. public:
  31. enum ColorRole
  32. {
  33. AutomationBarFill,
  34. AutomationBarValue,
  35. AutomationSelectedBarFill,
  36. AutomationCrosshair,
  37. PianoRollStepNote,
  38. PianoRollSelectedNote,
  39. PianoRollDefaultNote,
  40. PianoRollFrozenNote,
  41. PianoRollMutedNote,
  42. PianoRollEditHandle,
  43. PianoRollVolumeLevel,
  44. PianoRollPanningLevel,
  45. PianoRollSelectedLevel,
  46. TimelineForecolor,
  47. StandardGraphLine,
  48. StandardGraphHandle,
  49. StandardGraphHandleBorder,
  50. StandardGraphCrosshair,
  51. TextFloatForecolor,
  52. TextFloatFill,
  53. VisualizationLevelLow,
  54. VisualizationLevelMid,
  55. VisualizationLevelPeak,
  56. NumColorRoles
  57. };
  58. LmmsStyle();
  59. virtual ~LmmsStyle()
  60. {
  61. }
  62. QPalette standardPalette( void ) const override;
  63. virtual void drawComplexControl(
  64. ComplexControl control,
  65. const QStyleOptionComplex * option,
  66. QPainter *painter,
  67. const QWidget *widget ) const override;
  68. virtual void drawPrimitive( PrimitiveElement element,
  69. const QStyleOption *option,
  70. QPainter *painter,
  71. const QWidget *widget = 0 ) const override;
  72. virtual int pixelMetric( PixelMetric metric,
  73. const QStyleOption * option = 0,
  74. const QWidget * widget = 0 ) const override;
  75. static QPalette * s_palette;
  76. private:
  77. QImage colorizeXpm( const char * const * xpm, const QBrush& fill ) const;
  78. void hoverColors( bool sunken, bool hover, bool active, QColor& color, QColor& blend ) const;
  79. QColor m_colors[ LmmsStyle::NumColorRoles ];
  80. };
  81. #endif