color_button.h 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. /* color_button.h - choose color button
  2. * Copyright (C) 2017 caryoscelus
  3. *
  4. * This program is free software: you can redistribute it and/or modify
  5. * it under the terms of the GNU General Public License as published by
  6. * the Free Software Foundation, either version 3 of the License, or
  7. * (at your option) any later version.
  8. *
  9. * This program is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. * GNU General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU General Public License
  15. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  16. */
  17. #ifndef STUDIO_WIDGETS_COLOR_BUTTON_H_7B49507F_31E7_5286_8CCA_E064A56F26EB
  18. #define STUDIO_WIDGETS_COLOR_BUTTON_H_7B49507F_31E7_5286_8CCA_E064A56F26EB
  19. #include <QDebug>
  20. #include <QPushButton>
  21. #include <core/color/color.h>
  22. #include <generic/node_editor.h>
  23. namespace rainynite::studio {
  24. class ColorButton : public QPushButton {
  25. Q_OBJECT
  26. public:
  27. ColorButton(QWidget* parent = nullptr);
  28. public:
  29. inline core::colors::Color value() const {
  30. return color;
  31. }
  32. void setReadOnly(bool ro);
  33. Q_SIGNALS:
  34. void editingFinished();
  35. protected:
  36. void update_value(core::colors::Color color_);
  37. private Q_SLOTS:
  38. void choose_color();
  39. private:
  40. void update_button_color();
  41. private:
  42. core::colors::Color color;
  43. };
  44. } // namespace rainynite::studio
  45. #endif