info_downloads_inner_widget.h 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  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/widgets/scroll_area.h"
  10. #include "base/unique_qptr.h"
  11. namespace Ui {
  12. class VerticalLayout;
  13. class SearchFieldController;
  14. } // namespace Ui
  15. namespace Info {
  16. class Controller;
  17. struct SelectedItems;
  18. enum class SelectionAction;
  19. namespace Media {
  20. class ListWidget;
  21. } // namespace Media
  22. namespace Downloads {
  23. class Memento;
  24. class EmptyWidget;
  25. class InnerWidget final : public Ui::RpWidget {
  26. public:
  27. InnerWidget(
  28. QWidget *parent,
  29. not_null<Controller*> controller);
  30. bool showInternal(not_null<Memento*> memento);
  31. void saveState(not_null<Memento*> memento);
  32. void restoreState(not_null<Memento*> memento);
  33. void setScrollHeightValue(rpl::producer<int> value);
  34. rpl::producer<Ui::ScrollToRequest> scrollToRequests() const;
  35. rpl::producer<SelectedItems> selectedListValue() const;
  36. void selectionAction(SelectionAction action);
  37. ~InnerWidget();
  38. protected:
  39. int resizeGetHeight(int newWidth) override;
  40. void visibleTopBottomUpdated(
  41. int visibleTop,
  42. int visibleBottom) override;
  43. private:
  44. int recountHeight();
  45. void refreshHeight();
  46. object_ptr<Media::ListWidget> setupList();
  47. const not_null<Controller*> _controller;
  48. object_ptr<Media::ListWidget> _list = { nullptr };
  49. object_ptr<EmptyWidget> _empty;
  50. bool _inResize = false;
  51. rpl::event_stream<Ui::ScrollToRequest> _scrollToRequests;
  52. rpl::event_stream<rpl::producer<SelectedItems>> _selectedLists;
  53. rpl::event_stream<rpl::producer<int>> _listTops;
  54. };
  55. } // namespace Downloads
  56. } // namespace Info