info_layer_widget.h 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  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/layers/layer_widget.h"
  9. #include "media/player/media_player_float.h"
  10. namespace Window {
  11. class SessionController;
  12. } // namespace Window
  13. namespace Info {
  14. class Memento;
  15. class MoveMemento;
  16. class WrapWidget;
  17. class TopBar;
  18. class LayerWidget
  19. : public Ui::LayerWidget
  20. , private ::Media::Player::FloatDelegate {
  21. public:
  22. LayerWidget(
  23. not_null<Window::SessionController*> controller,
  24. not_null<Memento*> memento);
  25. LayerWidget(
  26. not_null<Window::SessionController*> controller,
  27. not_null<MoveMemento*> memento);
  28. void showFinished() override;
  29. void parentResized() override;
  30. bool takeToThirdSection() override;
  31. bool showSectionInternal(
  32. not_null<Window::SectionMemento*> memento,
  33. const Window::SectionShow &params) override;
  34. bool closeByOutsideClick() const override;
  35. static int MinimalSupportedWidth();
  36. ~LayerWidget();
  37. protected:
  38. int resizeGetHeight(int newWidth) override;
  39. void doSetInnerFocus() override;
  40. void paintEvent(QPaintEvent *e) override;
  41. private:
  42. void closeHook() override;
  43. void restoreFloatPlayerDelegate();
  44. not_null<::Media::Player::FloatDelegate*> floatPlayerDelegate();
  45. not_null<Ui::RpWidget*> floatPlayerWidget() override;
  46. void floatPlayerToggleGifsPaused(bool paused) override;
  47. not_null<::Media::Player::FloatSectionDelegate*> floatPlayerGetSection(
  48. Window::Column column) override;
  49. void floatPlayerEnumerateSections(Fn<void(
  50. not_null<::Media::Player::FloatSectionDelegate*> widget,
  51. Window::Column widgetColumn)> callback) override;
  52. bool floatPlayerIsVisible(not_null<HistoryItem*> item) override;
  53. void floatPlayerDoubleClickEvent(
  54. not_null<const HistoryItem*> item) override;
  55. void setupHeightConsumers();
  56. void setContentHeight(int height);
  57. [[nodiscard]] QRect countGeometry(int newWidth);
  58. not_null<Window::SessionController*> _controller;
  59. object_ptr<WrapWidget> _contentWrap;
  60. int _desiredHeight = 0;
  61. int _contentWrapHeight = 0;
  62. int _savedHeight = 0;
  63. Ui::Animations::Simple _heightAnimation;
  64. Ui::Animations::Simple _savedHeightAnimation;
  65. bool _heightAnimated = false;
  66. bool _inResize = false;
  67. bool _pendingResize = false;
  68. bool _tillBottom = false;
  69. bool _contentTillBottom = false;
  70. bool _floatPlayerDelegateRestored = false;
  71. };
  72. } // namespace Info