emoji_button.h 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  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/widgets/buttons.h"
  9. namespace style {
  10. struct EmojiButton;
  11. } // namespace style
  12. namespace Ui {
  13. class InfiniteRadialAnimation;
  14. class EmojiButton final : public RippleButton {
  15. public:
  16. EmojiButton(QWidget *parent, const style::EmojiButton &st);
  17. void setLoading(bool loading);
  18. void setColorOverrides(
  19. const style::icon *iconOverride,
  20. const style::color *colorOverride,
  21. const style::color *rippleOverride);
  22. protected:
  23. void paintEvent(QPaintEvent *e) override;
  24. void onStateChanged(State was, StateChangeSource source) override;
  25. QImage prepareRippleMask() const override;
  26. QPoint prepareRippleStartPosition() const override;
  27. private:
  28. void loadingAnimationCallback();
  29. const style::EmojiButton &_st;
  30. std::unique_ptr<Ui::InfiniteRadialAnimation> _loading;
  31. const style::icon *_iconOverride = nullptr;
  32. const style::color *_colorOverride = nullptr;
  33. const style::color *_rippleOverride = nullptr;
  34. };
  35. } // namespace Ui