window_history_hider.h 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  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/rp_widget.h"
  9. #include "ui/effects/animations.h"
  10. namespace Data {
  11. class Thread;
  12. } // namespace Data
  13. namespace Ui {
  14. class RoundButton;
  15. } // namespace Ui
  16. namespace Window {
  17. class HistoryHider final : public Ui::RpWidget {
  18. public:
  19. HistoryHider(QWidget *parent, const QString &text);
  20. ~HistoryHider();
  21. void startHide();
  22. [[nodiscard]] rpl::producer<> hidden() const;
  23. protected:
  24. void paintEvent(QPaintEvent *e) override;
  25. void keyPressEvent(QKeyEvent *e) override;
  26. void mousePressEvent(QMouseEvent *e) override;
  27. void resizeEvent(QResizeEvent *e) override;
  28. private:
  29. void refreshLang();
  30. void updateControlsGeometry();
  31. void animationCallback();
  32. QString _text;
  33. Ui::Animations::Simple _a_opacity;
  34. QRect _box;
  35. bool _hiding = false;
  36. int _chooseWidth = 0;
  37. rpl::event_stream<> _hidden;
  38. };
  39. } // namespace Window