silent_toggle.h 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  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. #include "ui/widgets/tooltip.h"
  10. namespace Ui {
  11. class SilentToggle final
  12. : public RippleButton
  13. , public AbstractTooltipShower {
  14. public:
  15. SilentToggle(QWidget *parent, not_null<ChannelData*> channel);
  16. void setChecked(bool checked);
  17. bool checked() const {
  18. return _checked;
  19. }
  20. // AbstractTooltipShower interface
  21. QString tooltipText() const override;
  22. QPoint tooltipPos() const override;
  23. bool tooltipWindowActive() const override;
  24. protected:
  25. void paintEvent(QPaintEvent *e) override;
  26. void mouseMoveEvent(QMouseEvent *e) override;
  27. void leaveEventHook(QEvent *e) override;
  28. QImage prepareRippleMask() const override;
  29. QPoint prepareRippleStartPosition() const override;
  30. private:
  31. const style::IconButton &_st;
  32. not_null<ChannelData*> _channel;
  33. bool _checked = false;
  34. // Animations::Simple _crossLineAnimation;
  35. };
  36. } // namespace Ui