MCPcopy Create free account
hub / github.com/TDesktop-x64/tdesktop / createMultiSelect

Method createMultiSelect

Telegram/SourceFiles/boxes/peer_lists_box.cpp:82–129  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

80}
81
82void PeerListsBox::createMultiSelect() {
83 Expects(_select == nullptr);
84
85 auto entity = object_ptr<Ui::MultiSelect>(
86 this,
87 (firstController()->selectSt()
88 ? *firstController()->selectSt()
89 : st::defaultMultiSelect),
90 tr::lng_participant_filter());
91 _select.create(this, std::move(entity));
92 _select->heightValue(
93 ) | rpl::on_next(
94 [this] { updateScrollSkips(); },
95 lifetime());
96 _select->entity()->setSubmittedCallback([=](Qt::KeyboardModifiers) {
97 for (const auto &list : _lists) {
98 if (list.content->submitted()) {
99 break;
100 }
101 }
102 });
103 _select->entity()->setQueryChangedCallback([=](const QString &query) {
104 searchQueryChanged(query);
105 });
106 _select->entity()->setItemRemovedCallback([=](uint64 itemId) {
107 for (const auto &list : _lists) {
108 if (list.controller->handleDeselectForeignRow(itemId)) {
109 return;
110 }
111 }
112 const auto session = &firstController()->session();
113 if (const auto peer = session->data().peerLoaded(PeerId(itemId))) {
114 const auto id = peer->id;
115 for (const auto &list : _lists) {
116 if (const auto row = list.delegate->peerListFindRow(id.value)) {
117 list.content->changeCheckState(
118 row,
119 false,
120 anim::type::normal);
121 update();
122 }
123 list.controller->itemDeselectedHook(peer);
124 }
125 }
126 });
127 _select->resizeToWidth(firstController()->contentWidth());
128 _select->moveToLeft(0, 0);
129}
130
131int PeerListsBox::getTopScrollSkip() const {
132 auto result = 0;

Callers

nothing calls this directly

Calls 15

PeerIdClass · 0.85
selectStMethod · 0.80
setSubmittedCallbackMethod · 0.80
moveToLeftMethod · 0.80
updateFunction · 0.50
createMethod · 0.45
heightValueMethod · 0.45
submittedMethod · 0.45
sessionMethod · 0.45

Tested by

no test coverage detected