Remove AddFullWidthButton helper.

This commit is contained in:
John Preston
2025-12-16 13:11:37 +04:00
parent 1ea2d936b5
commit 9496ebd19e
4 changed files with 8 additions and 47 deletions

View File

@@ -340,34 +340,6 @@ not_null<Ui::AbstractButton*> AddViewListButton(
return button;
}
not_null<Ui::RoundButton*> AddFullWidthButton(
not_null<Ui::BoxContent*> box,
rpl::producer<QString> text,
Fn<void()> callback,
const style::RoundButton *stOverride) {
const auto &boxSt = box->getDelegate()->style();
const auto result = box->addButton(
std::move(text),
std::move(callback),
stOverride ? *stOverride : boxSt.button);
rpl::combine(
box->widthValue(),
result->widthValue()
) | rpl::on_next([=](int width, int buttonWidth) {
const auto correct = width
- boxSt.buttonPadding.left()
- boxSt.buttonPadding.right();
if (correct > 0 && buttonWidth != correct) {
result->resizeToWidth(correct);
result->moveToLeft(
boxSt.buttonPadding.left(),
boxSt.buttonPadding.top(),
width);
}
}, result->lifetime());
return result;
}
void AddFullWidthButtonFooter(
not_null<Ui::BoxContent*> box,
not_null<Ui::RpWidget*> button,
@@ -494,11 +466,11 @@ object_ptr<Ui::BoxContent> StarRefLinkBox(
};
};
preview->setClickedCallback(copy(false));
const auto button = AddFullWidthButton(
box,
const auto button = box->addButton(
tr::lng_star_ref_link_copy(),
copy(true),
&st::starrefCopyButton);
[=] { copy(true); },
st::starrefCopyButton);
const auto name = TextWithEntities{ bot->name() };
AddFullWidthButtonFooter(
box,
@@ -712,8 +684,7 @@ object_ptr<Ui::BoxContent> JoinStarRefBox(
show->showToast(u"Failed: "_q + error);
});
};
const auto button = AddFullWidthButton(
box,
const auto button = box->addButton(
tr::lng_star_ref_one_join(),
send);
AddFullWidthButtonFooter(

View File

@@ -55,12 +55,6 @@ using ConnectedBots = std::vector<ConnectedBot>;
rpl::producer<QString> subtitle,
bool newBadge = false);
not_null<Ui::RoundButton*> AddFullWidthButton(
not_null<Ui::BoxContent*> box,
rpl::producer<QString> text,
Fn<void()> callback = nullptr,
const style::RoundButton *stOverride = nullptr);
void AddFullWidthButtonFooter(
not_null<Ui::BoxContent*> box,
not_null<Ui::RpWidget*> button,