profile_cover_drop_area.h 939 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  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/animations.h"
  9. #include "ui/rp_widget.h"
  10. namespace Profile {
  11. class CoverDropArea : public TWidget {
  12. public:
  13. CoverDropArea(QWidget *parent, const QString &title, const QString &subtitle);
  14. void showAnimated();
  15. using HideFinishCallback = Fn<void(CoverDropArea*)>;
  16. void hideAnimated(HideFinishCallback &&callback);
  17. bool hiding() const {
  18. return _hiding;
  19. }
  20. protected:
  21. void paintEvent(QPaintEvent *e) override;
  22. private:
  23. void setupAnimation();
  24. QString _title, _subtitle;
  25. int _titleWidth, _subtitleWidth;
  26. QPixmap _cache;
  27. Ui::Animations::Simple _a_appearance;
  28. bool _hiding = false;
  29. HideFinishCallback _hideFinishCallback;
  30. };
  31. } // namespace Profile