diff options
Diffstat (limited to 'gui/ListWidget.cpp')
-rw-r--r-- | gui/ListWidget.cpp | 70 |
1 files changed, 35 insertions, 35 deletions
diff --git a/gui/ListWidget.cpp b/gui/ListWidget.cpp index 751b31f037..db999d5d8e 100644 --- a/gui/ListWidget.cpp +++ b/gui/ListWidget.cpp @@ -92,7 +92,7 @@ void ListWidget::handleTickle() { uint32 time = _boss->getGui()->get_time(); if (_editMode && _caretTime < time) { - _caretTime = time + 300; + _caretTime = time + kCaretBlinkTime; if (_caretVisible) { drawCaret(true); } else { @@ -101,40 +101,6 @@ void ListWidget::handleTickle() } } -void ListWidget::drawCaret(bool erase) -{ - // Only draw if item is visible - if (_selectedItem < _currentPos || _selectedItem >= _currentPos + _entriesPerPage) - return; - if (!isVisible() || !_boss->isVisible()) - return; - - NewGui *gui = _boss->getGui(); - - // The item is selected, thus _bgcolor is used to draw the caret and _textcolorhi to erase it - int16 color = erase ? gui->_textcolorhi : gui->_bgcolor; - int x = _x + _boss->getX() + 3; - int y = _y + _boss->getY() + 1; - ScummVM::String buffer; - - y += (_selectedItem - _currentPos) * kLineHeight; - - if (_numberingMode == kListNumberingZero || _numberingMode == kListNumberingOne) { - char temp[10]; - sprintf(temp, "%2d. ", (_selectedItem + _numberingMode)); - buffer = temp; - buffer += _list[_selectedItem]; - } else - buffer = _list[_selectedItem]; - - x += gui->getStringWidth(buffer); - - gui->vline(x, y, y+kLineHeight, color); - gui->addDirtyRect(x, y, 2, kLineHeight); - - _caretVisible = !erase; -} - void ListWidget::handleMouseDown(int x, int y, int button, int clickCount) { if (isEnabled()) { @@ -332,6 +298,40 @@ void ListWidget::drawWidget(bool hilite) } } +void ListWidget::drawCaret(bool erase) +{ + // Only draw if item is visible + if (_selectedItem < _currentPos || _selectedItem >= _currentPos + _entriesPerPage) + return; + if (!isVisible() || !_boss->isVisible()) + return; + + NewGui *gui = _boss->getGui(); + + // The item is selected, thus _bgcolor is used to draw the caret and _textcolorhi to erase it + int16 color = erase ? gui->_textcolorhi : gui->_bgcolor; + int x = _x + _boss->getX() + 3; + int y = _y + _boss->getY() + 1; + ScummVM::String buffer; + + y += (_selectedItem - _currentPos) * kLineHeight; + + if (_numberingMode == kListNumberingZero || _numberingMode == kListNumberingOne) { + char temp[10]; + sprintf(temp, "%2d. ", (_selectedItem + _numberingMode)); + buffer = temp; + buffer += _list[_selectedItem]; + } else + buffer = _list[_selectedItem]; + + x += gui->getStringWidth(buffer); + + gui->vline(x, y, y+kLineHeight, color); + gui->addDirtyRect(x, y, 2, kLineHeight); + + _caretVisible = !erase; +} + void ListWidget::scrollToCurrent() { // Only do something if the current item is not in our view port |