2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-31 06:26:18 +00:00

Support new rounding in bot inline keyboards.

This commit is contained in:
John Preston
2022-10-03 15:11:05 +04:00
parent 9cab06e17d
commit e5f2d83548
58 changed files with 498 additions and 305 deletions

View File

@@ -36,6 +36,9 @@ Widget::Widget(
, _contentMaxHeight(st::emojiPanMaxHeight)
, _contentHeight(_contentMaxHeight)
, _scroll(this, st::inlineBotsScroll)
, _innerRounding(Ui::PrepareCornerPixmaps(
ImageRoundRadius::Small,
st::emojiPanBg))
, _inlineRequestTimer([=] { onInlineRequest(); }) {
resize(QRect(0, 0, st::emojiPanWidth, _contentHeight).marginsAdded(innerPadding()).size());
_width = width();
@@ -59,6 +62,13 @@ Widget::Widget(
_inner->clearInlineRowsPanel();
}, lifetime());
style::PaletteChanged(
) | rpl::start_with_next([=] {
_innerRounding = Ui::PrepareCornerPixmaps(
ImageRoundRadius::Small,
st::emojiPanBg);
}, lifetime());
macWindowDeactivateEvents(
) | rpl::filter([=] {
return !isHidden();
@@ -150,7 +160,17 @@ void Widget::paintEvent(QPaintEvent *e) {
void Widget::paintContent(QPainter &p) {
auto inner = innerRect();
Ui::FillRoundRect(p, inner, st::emojiPanBg, ImageRoundRadius::Small, RectPart::FullTop | RectPart::FullBottom);
const auto radius = st::roundRadiusSmall;
const auto top = Ui::CornersPixmaps{
.p = { _innerRounding.p[0], _innerRounding.p[1], QPixmap(), QPixmap() },
};
Ui::FillRoundRect(p, inner.x(), inner.y(), inner.width(), radius, st::emojiPanBg, top);
const auto bottom = Ui::CornersPixmaps{
.p = { QPixmap(), QPixmap(), _innerRounding.p[2], _innerRounding.p[3] },
};
Ui::FillRoundRect(p, inner.x(), inner.y() + inner.height() - radius, inner.width(), radius, st::emojiPanBg, bottom);
auto horizontal = horizontalRect();
auto sidesTop = horizontal.y();