/* 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 */ #include "ui/widgets/expandable_peer_list.h" #include "data/data_peer.h" #include "ui/controls/userpic_button.h" #include "ui/rect.h" #include "ui/text/text_utilities.h" #include "ui/vertical_list.h" #include "ui/widgets/buttons.h" #include "ui/widgets/participants_check_view.h" #include "ui/wrap/slide_wrap.h" #include "ui/wrap/vertical_layout.h" #include "styles/style_boxes.h" #include "styles/style_layers.h" #include "styles/style_widgets.h" namespace Ui { namespace { class Button final : public Ui::RippleButton { public: Button(not_null parent, int count); [[nodiscard]] not_null checkView() const; private: void paintEvent(QPaintEvent *event) override; QImage prepareRippleMask() const override; QPoint prepareRippleStartPosition() const override; std::unique_ptr _view; }; Button::Button(not_null parent, int count) : Ui::RippleButton(parent, st::defaultRippleAnimation) , _view(std::make_unique( count, st::slideWrapDuration, false, [=] { update(); })) { } not_null Button::checkView() const { return _view.get(); } QImage Button::prepareRippleMask() const { return _view->prepareRippleMask(); } QPoint Button::prepareRippleStartPosition() const { return mapFromGlobal(QCursor::pos()); } void Button::paintEvent(QPaintEvent *event) { auto p = QPainter(this); Ui::RippleButton::paintRipple(p, QPoint()); _view->paint(p, 0, 0, width()); } } // namespace void AddExpandablePeerList( not_null checkbox, not_null controller, not_null inner) { const auto &participants = controller->data.participants; const auto hideRightButton = controller->data.hideRightButton; const auto checkTopOnAllInner = controller->data.checkTopOnAllInner; const auto isSingle = controller->data.skipSingle ? false : (participants.size() == 1); if (isSingle) { const auto p = participants.front(); controller->collectRequests = [=] { return Participants{ p }; }; return; } const auto count = int(participants.size()); const auto button = !hideRightButton ? Ui::CreateChild