cross_line.h 1018 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. // This file is part of Desktop App Toolkit,
  2. // a set of libraries for developing nice desktop applications.
  3. //
  4. // For license and copyright information please follow this link:
  5. // https://github.com/desktop-app/legal/blob/master/LEGAL
  6. //
  7. #pragma once
  8. #include "styles/style_widgets.h"
  9. namespace Ui {
  10. class CrossLineAnimation {
  11. public:
  12. CrossLineAnimation(
  13. const style::CrossLineAnimation &st,
  14. bool reversed = false,
  15. float angle = 315);
  16. void paint(
  17. QPainter &p,
  18. QPoint position,
  19. float64 progress,
  20. std::optional<QColor> colorOverride = std::nullopt);
  21. void paint(
  22. QPainter &p,
  23. int left,
  24. int top,
  25. float64 progress,
  26. std::optional<QColor> colorOverride = std::nullopt);
  27. void invalidate();
  28. private:
  29. void fillFrame(float64 progress, std::optional<QColor> colorOverride);
  30. const style::CrossLineAnimation &_st;
  31. const bool _reversed;
  32. const QPen _transparentPen;
  33. QPen _strokePen;
  34. QLineF _line;
  35. QImage _frame;
  36. QImage _completeCross;
  37. QImage _completeCrossOverride;
  38. };
  39. } // namespace Ui