/* This file is part of Telegram Desktop, the official desktop application for the Telegram messaging service. For license and copyright information please follow this link: https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL */ #pragma once #include "boxes/peer_list_box.h" class PeerListsBox : public Ui::BoxContent { public: PeerListsBox( QWidget*, std::vector> controllers, Fn)> init); [[nodiscard]] std::vector> collectSelectedRows(); protected: void prepare() override; void setInnerFocus() override; void keyPressEvent(QKeyEvent *e) override; void resizeEvent(QResizeEvent *e) override; void paintEvent(QPaintEvent *e) override; private: class Delegate final : public PeerListContentDelegate { public: Delegate( not_null box, not_null controller); void peerListSetTitle(rpl::producer title) override; void peerListSetAdditionalTitle(rpl::producer title) override; void peerListSetSearchMode(PeerListSearchMode mode) override; void peerListSetRowChecked( not_null row, bool checked) override; void peerListSetForeignRowChecked( not_null row, bool checked, anim::type animated) override; bool peerListIsRowChecked(not_null row) override; int peerListSelectedRowsCount() override; void peerListScrollToTop() override; void peerListAddSelectedPeerInBunch(not_null peer) override { _box->addSelectItem(peer, anim::type::instant); } void peerListAddSelectedRowInBunch(not_null row) override { _box->addSelectItem(row, anim::type::instant); } void peerListFinishSelectedRowsBunch() override; std::shared_ptr peerListUiShow() override; private: const not_null _box; const not_null _controller; const std::shared_ptr _show; }; struct List { std::unique_ptr controller; std::unique_ptr delegate; PeerListContent *content = nullptr; }; friend class Delegate; [[nodiscard]] List makeList( std::unique_ptr controller); [[nodiscard]] std::vector makeLists( std::vector> controllers); [[nodiscard]] not_null firstController() const; void addSelectItem( not_null peer, anim::type animated); void addSelectItem( not_null row, anim::type animated); void addSelectItem( uint64 itemId, const QString &text, PaintRoundImageCallback paintUserpic, anim::type animated); void setSearchMode(PeerListSearchMode mode); void createMultiSelect(); int getTopScrollSkip() const; void updateScrollSkips(); void searchQueryChanged(const QString &query); object_ptr> _select = { nullptr }; std::vector _lists; Fn _init; bool _scrollBottomFixed = false; };