emoji_fly_animation.h 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. /*
  2. This file is part of Telegram Desktop,
  3. the official desktop application for the Telegram messaging service.
  4. For license and copyright information please follow this link:
  5. https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
  6. */
  7. #pragma once
  8. #include "ui/effects/reaction_fly_animation.h"
  9. #include "ui/rp_widget.h"
  10. namespace Ui {
  11. struct ReactionFlyCenter;
  12. class EmojiFlyAnimation {
  13. public:
  14. EmojiFlyAnimation(
  15. not_null<RpWidget*> body,
  16. not_null<Data::Reactions*> owner,
  17. Ui::ReactionFlyAnimationArgs &&args,
  18. Fn<void()> repaint,
  19. Fn<QColor()> textColor,
  20. Data::CustomEmojiSizeTag tag);
  21. [[nodiscard]] not_null<Ui::RpWidget*> layer();
  22. [[nodiscard]] bool finished() const;
  23. void repaint();
  24. bool paintBadgeFrame(not_null<QWidget*> widget);
  25. [[nodiscard]] ReactionFlyCenter grabBadgeCenter();
  26. private:
  27. const int _flySize = 0;
  28. Fn<QColor()> _textColor;
  29. Ui::ReactionFlyAnimation _fly;
  30. Ui::RpWidget _layer;
  31. QRect _area;
  32. bool _areaUpdated = false;
  33. QPointer<QWidget> _target;
  34. };
  35. } // namespace Ui