info_profile_members.h 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  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 "boxes/peer_list_box.h"
  10. class ParticipantsBoxController;
  11. namespace Ui {
  12. class InputField;
  13. class CrossButton;
  14. class IconButton;
  15. class FlatLabel;
  16. struct ScrollToRequest;
  17. class AbstractButton;
  18. class SettingsButton;
  19. } // namespace Ui
  20. namespace Window {
  21. class Show;
  22. } // namespace Window
  23. namespace Info {
  24. class Controller;
  25. enum class Wrap;
  26. namespace Profile {
  27. class Memento;
  28. struct MembersState {
  29. std::unique_ptr<PeerListState> list;
  30. std::optional<QString> search;
  31. };
  32. class Members
  33. : public Ui::RpWidget
  34. , private PeerListContentDelegate {
  35. public:
  36. Members(
  37. QWidget *parent,
  38. not_null<Controller*> controller);
  39. rpl::producer<Ui::ScrollToRequest> scrollToRequests() const;
  40. std::unique_ptr<MembersState> saveState();
  41. void restoreState(std::unique_ptr<MembersState> state);
  42. [[nodiscard]] int desiredHeight() const;
  43. [[nodiscard]] rpl::producer<int> onlineCountValue() const;
  44. [[nodiscard]] rpl::producer<int> fullCountValue() const;
  45. protected:
  46. void visibleTopBottomUpdated(
  47. int visibleTop,
  48. int visibleBottom) override;
  49. int resizeGetHeight(int newWidth) override;
  50. private:
  51. using ListWidget = PeerListContent;
  52. // PeerListContentDelegate interface.
  53. void peerListSetTitle(rpl::producer<QString> title) override;
  54. void peerListSetAdditionalTitle(rpl::producer<QString> title) override;
  55. bool peerListIsRowChecked(not_null<PeerListRow*> row) override;
  56. int peerListSelectedRowsCount() override;
  57. void peerListScrollToTop() override;
  58. void peerListAddSelectedPeerInBunch(
  59. not_null<PeerData*> peer) override;
  60. void peerListAddSelectedRowInBunch(
  61. not_null<PeerListRow*> row) override;
  62. void peerListFinishSelectedRowsBunch() override;
  63. void peerListSetDescription(
  64. object_ptr<Ui::FlatLabel> description) override;
  65. std::shared_ptr<Main::SessionShow> peerListUiShow() override;
  66. //void peerListAppendRow(
  67. // std::unique_ptr<PeerListRow> row) override {
  68. // PeerListContentDelegate::peerListAppendRow(std::move(row));
  69. // updateSearchEnabledByContent();
  70. //}
  71. //void peerListPrependRow(
  72. // std::unique_ptr<PeerListRow> row) override {
  73. // PeerListContentDelegate::peerListPrependRow(std::move(row));
  74. // updateSearchEnabledByContent();
  75. //}
  76. //void peerListRemoveRow(not_null<PeerListRow*> row) override {
  77. // PeerListContentDelegate::peerListRemoveRow(row);
  78. // updateSearchEnabledByContent();
  79. //}
  80. void setupHeader();
  81. object_ptr<Ui::FlatLabel> setupTitle();
  82. void setupList();
  83. void setupButtons();
  84. //void updateSearchOverrides();
  85. void addMember();
  86. void showMembersWithSearch(bool withSearch);
  87. //void toggleSearch(anim::type animated = anim::type::normal);
  88. //void cancelSearch();
  89. //void searchAnimationCallback();
  90. void updateHeaderControlsGeometry(int newWidth);
  91. //void updateSearchEnabledByContent();
  92. std::shared_ptr<Main::SessionShow> _show;
  93. //Wrap _wrap;
  94. not_null<Controller*> _controller;
  95. not_null<PeerData*> _peer;
  96. std::unique_ptr<ParticipantsBoxController> _listController;
  97. object_ptr<Ui::RpWidget> _header = { nullptr };
  98. object_ptr<ListWidget> _list = { nullptr };
  99. Ui::SettingsButton *_openMembers = nullptr;
  100. Ui::RpWidget *_titleWrap = nullptr;
  101. Ui::FlatLabel *_title = nullptr;
  102. Ui::IconButton *_addMember = nullptr;
  103. //base::unique_qptr<Ui::InputField> _searchField;
  104. Ui::IconButton *_search = nullptr;
  105. //Ui::CrossButton *_cancelSearch = nullptr;
  106. //Ui::Animations::Simple _searchShownAnimation;
  107. //bool _searchShown = false;
  108. //base::Timer _searchTimer;
  109. rpl::event_stream<Ui::ScrollToRequest> _scrollToRequests;
  110. };
  111. } // namespace Profile
  112. } // namespace Info