Slightly improved box for writing captions to be more generic.

This commit is contained in:
23rd 2025-05-22 15:44:09 +03:00
parent 0e44de2fe3
commit 5b9e24f3f4
2 changed files with 22 additions and 9 deletions

View file

@ -226,9 +226,8 @@ namespace {
} // namespace
void SendGifWithCaptionBox(
void CaptionBox(
not_null<Ui::GenericBox*> box,
not_null<DocumentData*> document,
not_null<PeerData*> peer,
const SendMenu::Details &details,
Fn<void(Api::SendOptions, TextWithTags)> done) {
@ -237,17 +236,10 @@ void SendGifWithCaptionBox(
if (!controller) {
return;
}
box->setTitle(tr::lng_send_gif_with_caption());
box->setWidth(st::boxWidth);
box->getDelegate()->setStyle(st::sendGifBox);
const auto container = box->verticalLayout();
[[maybe_unused]] const auto gifWidget = AddGifWidget(
container,
document,
st::boxWidth);
Ui::AddSkip(container);
const auto input = AddInputField(box, controller);
box->setFocusCallback([=] {
@ -339,4 +331,19 @@ void SendGifWithCaptionBox(
) | rpl::start_with_next([=] { send({}); }, input->lifetime());
}
void SendGifWithCaptionBox(
not_null<Ui::GenericBox*> box,
not_null<DocumentData*> document,
not_null<PeerData*> peer,
const SendMenu::Details &details,
Fn<void(Api::SendOptions, TextWithTags)> done) {
box->setTitle(tr::lng_send_gif_with_caption());
[[maybe_unused]] const auto gifWidget = AddGifWidget(
box->verticalLayout(),
document,
st::boxWidth);
Ui::AddSkip(box->verticalLayout());
CaptionBox(box, peer, details, std::move(done));
}
} // namespace Ui

View file

@ -22,6 +22,12 @@ namespace Ui {
class GenericBox;
void CaptionBox(
not_null<Ui::GenericBox*> box,
not_null<PeerData*> peer,
const SendMenu::Details &details,
Fn<void(Api::SendOptions, TextWithTags)> done);
void SendGifWithCaptionBox(
not_null<Ui::GenericBox*> box,
not_null<DocumentData*> document,