Allow locked toggles in SettingsButton.

This commit is contained in:
John Preston 2022-10-25 17:50:18 +04:00
parent 7f1dd3c351
commit 865056eec8
3 changed files with 8 additions and 1 deletions

View file

@ -736,6 +736,12 @@ bool SettingsButton::toggled() const {
return _toggle ? _toggle->checked() : false;
}
void SettingsButton::setToggleLocked(bool locked) {
if (_toggle) {
_toggle->setLocked(locked);
}
}
rpl::producer<bool> SettingsButton::toggledChanges() const {
if (_toggle) {
return _toggle->checkedChanges();

View file

@ -270,6 +270,7 @@ public:
rpl::producer<bool> toggledChanges() const;
rpl::producer<bool> toggledValue() const;
void setToggleLocked(bool locked);
void setColorOverride(std::optional<QColor> textColorOverride);
void setPaddingOverride(style::margins padding);

View file

@ -121,7 +121,7 @@ void ToggleView::paint(QPainter &p, int left, int top, int outerWidth) {
p.setBrush(anim::brush(_st->untoggledBg, _st->toggledBg, toggled));
p.drawEllipse(fgRect);
if (_st->xsize > 0) {
if (_locked || _st->xsize > 0) {
p.setPen(Qt::NoPen);
p.setBrush(fgBrush);
if (_locked) {