GUI: Remove 'sticky button' feature

This feature made pressed buttons wait a few moments before returning to
an unpressed state. It was half-implemented, and caused several visual
bugs. Fixes #7083.
This commit is contained in:
Ori Avtalion 2016-04-13 15:02:33 +03:00
parent 5e49800901
commit e30a94e6ff
4 changed files with 5 additions and 46 deletions

View file

@ -299,7 +299,7 @@ ButtonWidget::ButtonWidget(GuiObject *boss, const Common::String &name, const Co
void ButtonWidget::handleMouseUp(int x, int y, int button, int clickCount) {
if (isEnabled() && _duringPress && x >= 0 && x < _w && y >= 0 && y < _h) {
startAnimatePressedState();
setUnpressedState();
sendCommand(_cmd, 0);
}
_duringPress = false;
@ -344,40 +344,17 @@ void ButtonWidget::setHighLighted(bool enable) {
draw();
}
void ButtonWidget::handleTickle() {
if (_lastTime) {
uint32 curTime = g_system->getMillis();
if (curTime - _lastTime > kPressedButtonTime) {
stopAnimatePressedState();
}
}
}
void ButtonWidget::setPressedState() {
wantTickle(true);
setFlags(WIDGET_PRESSED);
clearFlags(WIDGET_HILITED);
draw();
}
void ButtonWidget::stopAnimatePressedState() {
wantTickle(false);
_lastTime = 0;
void ButtonWidget::setUnpressedState() {
clearFlags(WIDGET_PRESSED);
draw();
}
void ButtonWidget::startAnimatePressedState() {
_lastTime = g_system->getMillis();
}
void ButtonWidget::wantTickle(bool tickled) {
if (tickled)
((GUI::Dialog *)_boss)->setTickleWidget(this);
else
((GUI::Dialog *)_boss)->unSetTickleWidget();
}
#pragma mark -
PicButtonWidget::PicButtonWidget(GuiObject *boss, int x, int y, int w, int h, const char *tooltip, uint32 cmd, uint8 hotkey)