harmony_color_wheel.hpp 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. /**
  2. * \file
  3. *
  4. * \author Mattia Basaglia
  5. *
  6. * \copyright Copyright (C) 2013-2020 Mattia Basaglia
  7. * \copyright Copyright (C) 2017 caryoscelus
  8. *
  9. * This program is free software: you can redistribute it and/or modify
  10. * it under the terms of the GNU Lesser General Public License as published by
  11. * the Free Software Foundation, either version 3 of the License, or
  12. * (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
  17. * GNU Lesser General Public License for more details.
  18. *
  19. * You should have received a copy of the GNU Lesser General Public License
  20. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  21. *
  22. */
  23. #ifndef HARMONY_COLOR_WHEEL_HPP
  24. #define HARMONY_COLOR_WHEEL_HPP
  25. #include "color_wheel.hpp"
  26. namespace color_widgets {
  27. /**
  28. * \brief ColorWheel with color harmonies
  29. */
  30. class QCP_EXPORT HarmonyColorWheel : public ColorWheel
  31. {
  32. Q_OBJECT
  33. public:
  34. explicit HarmonyColorWheel(QWidget *parent = 0);
  35. ~HarmonyColorWheel();
  36. /// Get all harmony colors (including main)
  37. QList<QColor> harmonyColors() const;
  38. /// Get number of harmony colors (including main)
  39. unsigned int harmonyCount() const;
  40. /// Clear harmony color scheme
  41. void clearHarmonies();
  42. /**
  43. * @brief Add harmony color
  44. * @param hue_diff Initial hue difference (in [0-1) range)
  45. * @param editable Whether this harmony should be editable
  46. * @returns Index of newly added harmony
  47. */
  48. unsigned addHarmony(double hue_diff, bool editable);
  49. /**
  50. * @brief Add symmetric harmony color
  51. * @param relative_to Index of other harmony that should be symmetric relative to main hue
  52. * @returns Index of newly added harmony
  53. * Editability is inherited from symmetric editor
  54. */
  55. unsigned addSymmetricHarmony(unsigned relative_to);
  56. /**
  57. * @brief Add opposite harmony color
  58. * @param relative_to Index of other harmony that should be opposite to this
  59. * @returns Index of newly added harmony
  60. * Editability is inherited from opposite editor
  61. */
  62. unsigned addOppositeHarmony(unsigned relative_to);
  63. Q_SIGNALS:
  64. /**
  65. * Emitted when harmony settings or harmony colors are changed (including due to main hue change)
  66. */
  67. void harmonyChanged();
  68. protected:
  69. void paintEvent(QPaintEvent *) Q_DECL_OVERRIDE;
  70. void mouseMoveEvent(QMouseEvent *) Q_DECL_OVERRIDE;
  71. void mousePressEvent(QMouseEvent *) Q_DECL_OVERRIDE;
  72. void mouseReleaseEvent(QMouseEvent *) Q_DECL_OVERRIDE;
  73. private:
  74. class Private;
  75. Private * p;
  76. };
  77. } // namespace color_widgets
  78. #endif // COLOR_WHEEL_HPP