Add an icon to a webview bot button.

This commit is contained in:
John Preston 2022-04-13 09:14:30 +04:00
parent 4216d72c67
commit 2253cd86e5
7 changed files with 10 additions and 0 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 239 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 298 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 393 B

View file

@ -143,6 +143,8 @@ void KeyboardStyle::paintButtonIcon(
case Type::Buy: return &st->msgBotKbPaymentIcon();
case Type::SwitchInlineSame:
case Type::SwitchInline: return &st->msgBotKbSwitchPmIcon();
case Type::WebView:
case Type::SimpleWebView: return &st->msgBotKbWebviewIcon();
}
return nullptr;
}();
@ -174,6 +176,8 @@ int KeyboardStyle::minButtonWidth(
case Type::Callback:
case Type::CallbackWithPassword:
case Type::Game: iconWidth = st::historySendingInvertedIcon.width(); break;
case Type::WebView:
case Type::SimpleWebView: iconWidth = st::msgBotKbWebviewIcon.width(); break;
}
if (iconWidth > 0) {
result = std::max(result, 2 * iconWidth + 4 * int(st::msgBotKbIconPadding));

View file

@ -483,6 +483,7 @@ msgBotKbIconPadding: 2px;
msgBotKbUrlIcon: icon {{ "inline_button_url", msgBotKbIconFg }};
msgBotKbSwitchPmIcon: icon {{ "inline_button_switch", msgBotKbIconFg }};
msgBotKbPaymentIcon: icon {{ "inline_button_card", msgBotKbIconFg }};
msgBotKbWebviewIcon: icon {{ "inline_button_web", msgBotKbIconFg }};
msgBotKbButton: BotKeyboardButton {
margin: 5px;
padding: 10px;

View file

@ -124,6 +124,7 @@ ChatStyle::ChatStyle() {
make(_msgBotKbUrlIcon, st::msgBotKbUrlIcon);
make(_msgBotKbPaymentIcon, st::msgBotKbPaymentIcon);
make(_msgBotKbSwitchPmIcon, st::msgBotKbSwitchPmIcon);
make(_msgBotKbWebviewIcon, st::msgBotKbWebviewIcon);
make(_historyFastCommentsIcon, st::historyFastCommentsIcon);
make(_historyFastShareIcon, st::historyFastShareIcon);
make(_historyGoToOriginalIcon, st::historyGoToOriginalIcon);

View file

@ -232,6 +232,9 @@ public:
[[nodiscard]] const style::icon &msgBotKbSwitchPmIcon() const {
return _msgBotKbSwitchPmIcon;
}
[[nodiscard]] const style::icon &msgBotKbWebviewIcon() const {
return _msgBotKbWebviewIcon;
}
[[nodiscard]] const style::icon &historyFastCommentsIcon() const {
return _historyFastCommentsIcon;
}
@ -326,6 +329,7 @@ private:
style::icon _msgBotKbUrlIcon = { Qt::Uninitialized };
style::icon _msgBotKbPaymentIcon = { Qt::Uninitialized };
style::icon _msgBotKbSwitchPmIcon = { Qt::Uninitialized };
style::icon _msgBotKbWebviewIcon = { Qt::Uninitialized };
style::icon _historyFastCommentsIcon = { Qt::Uninitialized };
style::icon _historyFastShareIcon = { Qt::Uninitialized };
style::icon _historyGoToOriginalIcon = { Qt::Uninitialized };