2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-09-07 01:45:39 +00:00

Don't uncheck a radiobutton on second click.

This commit is contained in:
John Preston
2017-07-18 20:11:44 +03:00
parent 794ad7bda7
commit 077e128e9a
2 changed files with 11 additions and 10 deletions

View File

@@ -408,11 +408,15 @@ void Checkbox::onStateChanged(State was, StateChangeSource source) {
auto now = state();
if (!isDisabled() && (was & StateFlag::Over) && (now & StateFlag::Over)) {
if ((was & StateFlag::Down) && !(now & StateFlag::Down)) {
setChecked(!checked());
handlePress();
}
}
}
void Checkbox::handlePress() {
setChecked(!checked());
}
int Checkbox::resizeGetHeight(int newWidth) {
return _check->getSize().height();
}
@@ -461,14 +465,9 @@ void Radiobutton::handleNewGroupValue(int value) {
}
}
void Radiobutton::onStateChanged(State was, StateChangeSource source) {
Checkbox::onStateChanged(was, source);
auto now = state();
if (!isDisabled() && (was & StateFlag::Over) && (now & StateFlag::Over)) {
if ((was & StateFlag::Down) && !(now & StateFlag::Down)) {
_group->setValue(_value);
}
void Radiobutton::handlePress() {
if (!checkbox()->checked()) {
checkbox()->setChecked(true);
}
}