Implemented EditTextWidget; fixed Add Game/Remove Game in launcher; make use of EditTextWidget in EditGameDialog; various other tweaks
svn-id: r5665
This commit is contained in:
parent
5852b6a09b
commit
9ff12dbc01
9 changed files with 223 additions and 65 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue