/* 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 "base/object_ptr.h" #include "dialogs/ui/top_peers_strip.h" #include "ui/effects/animations.h" #include "ui/rp_widget.h" namespace Main { class Session; } // namespace Main namespace Ui { class ElasticScroll; class VerticalLayout; template class SlideWrap; } // namespace Ui namespace Window { class SessionController; } // namespace Window namespace Dialogs { struct RecentPeersList { std::vector> list; }; class Suggestions final : public Ui::RpWidget { public: Suggestions( not_null parent, not_null controller, rpl::producer topPeers, RecentPeersList recentPeers); ~Suggestions(); void selectJump(Qt::Key direction, int pageSize = 0); void chooseRow(); void show(anim::type animated, Fn finish); void hide(anim::type animated, Fn finish); [[nodiscard]] float64 shownOpacity() const; [[nodiscard]] rpl::producer> topPeerChosen() const { return _topPeerChosen.events(); } [[nodiscard]] rpl::producer> recentPeerChosen() const { return _recentPeerChosen.events(); } private: enum class JumpResult { NotApplied, Applied, AppliedAndOut, }; void paintEvent(QPaintEvent *e) override; void resizeEvent(QResizeEvent *e) override; [[nodiscard]] object_ptr> setupRecentPeers( not_null window, RecentPeersList recentPeers); [[nodiscard]] object_ptr> setupEmptyRecent( not_null window); const std::unique_ptr _scroll; const not_null _content; const not_null*> _topPeersWrap; const not_null _topPeers; rpl::variable _recentCount; Fn _recentPeersChoose; Fn _recentSelectJump; const not_null*> _recentPeers; const not_null*> _emptyRecent; rpl::event_stream> _topPeerChosen; rpl::event_stream> _recentPeerChosen; Ui::Animations::Simple _shownAnimation; Fn _showFinished; bool _hidden = false; QPixmap _cache; }; [[nodiscard]] rpl::producer TopPeersContent( not_null session); [[nodiscard]] RecentPeersList RecentPeersContent( not_null session); } // namespace Dialogs