aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gui/ListWidget.cpp20
-rw-r--r--gui/ListWidget.h7
-rw-r--r--gui/saveload.cpp9
3 files changed, 34 insertions, 2 deletions
diff --git a/gui/ListWidget.cpp b/gui/ListWidget.cpp
index 6f4fd25ee4..195256b66f 100644
--- a/gui/ListWidget.cpp
+++ b/gui/ListWidget.cpp
@@ -64,6 +64,7 @@ ListWidget::ListWidget(GuiObject *boss, const String &name, uint32 cmd)
_editable = true;
_quickSelect = true;
+ _editColor = ThemeEngine::kFontColorNormal;
}
ListWidget::ListWidget(GuiObject *boss, int x, int y, int w, int h, uint32 cmd)
@@ -141,6 +142,16 @@ void ListWidget::setSelected(int item) {
}
}
+ThemeEngine::FontColor ListWidget::getSelectionColor() const {
+ if (_listColors.empty())
+ return ThemeEngine::kFontColorNormal;
+
+ if (_filter.empty())
+ return _listColors[_selectedItem];
+ else
+ return _listColors[_listIndex[_selectedItem]];
+}
+
void ListWidget::setList(const StringList &list, const ColorList *colors) {
if (_editMode && _caretVisible)
drawCaret(true);
@@ -460,6 +471,7 @@ void ListWidget::drawWidget() {
if (_selectedItem == pos && _editMode) {
buffer = _editString;
+ color = _editColor;
adjustOffset();
width = _w - r.left - _hlRightPadding - _leftPadding - scrollbarW;
g_gui.theme()->drawText(Common::Rect(_x + r.left, y, _x + r.left + width, y + fontHeight - 2), buffer, _state,
@@ -526,6 +538,14 @@ void ListWidget::startEditMode() {
if (_editable && !_editMode && _selectedItem >= 0) {
_editMode = true;
setEditString(_list[_selectedItem]);
+ if (_listColors.empty()) {
+ _editColor = ThemeEngine::kFontColorNormal;
+ } else {
+ if (_filter.empty())
+ _editColor = _listColors[_selectedItem];
+ else
+ _editColor = _listColors[_listIndex[_selectedItem]];
+ }
draw();
g_system->setFeatureState(OSystem::kFeatureVirtualKeyboard, true);
}
diff --git a/gui/ListWidget.h b/gui/ListWidget.h
index 1ee6a94e8a..c4fab9bd17 100644
--- a/gui/ListWidget.h
+++ b/gui/ListWidget.h
@@ -84,6 +84,8 @@ protected:
uint32 _cmd;
+ ThemeEngine::FontColor _editColor;
+
public:
ListWidget(GuiObject *boss, const String &name, uint32 cmd = 0);
ListWidget(GuiObject *boss, int x, int y, int w, int h, uint32 cmd = 0);
@@ -97,6 +99,7 @@ public:
int getSelected() const { return (_filter.empty() || _selectedItem == -1) ? _selectedItem : _listIndex[_selectedItem]; }
void setSelected(int item);
const String &getSelectedString() const { return _list[_selectedItem]; }
+ ThemeEngine::FontColor getSelectionColor() const;
void setNumberingMode(NumberingMode numberingMode) { _numberingMode = numberingMode; }
bool isEditable() const { return _editable; }
void setEditable(bool editable) { _editable = editable; }
@@ -105,6 +108,8 @@ public:
void enableQuickSelect(bool enable) { _quickSelect = enable; }
String getQuickSelectString() const { return _quickSelectStr; }
+ void setEditColor(ThemeEngine::FontColor color) { _editColor = color; }
+
void setFilter(const String &filter, bool redraw = true);
virtual void handleTickle();
@@ -119,7 +124,7 @@ public:
virtual bool wantsFocus() { return true; }
- // Made startEditMode for SCUMM's SaveLoadChooser
+ // Made startEditMode for SaveLoadChooser
void startEditMode();
void endEditMode();
diff --git a/gui/saveload.cpp b/gui/saveload.cpp
index 381abcdc83..058911d43f 100644
--- a/gui/saveload.cpp
+++ b/gui/saveload.cpp
@@ -278,8 +278,15 @@ void SaveLoadChooser::updateSelection(bool redraw) {
// game is write protected
_chooseButton->setEnabled(selItem >= 0 && !isWriteProtected);
- if (startEditMode)
+ if (startEditMode) {
_list->startEditMode();
+
+ if (_chooseButton->isEnabled() && _list->getSelectedString() == "Untitled savestate" &&
+ _list->getSelectionColor() == ThemeEngine::kFontColorAlternate) {
+ _list->setEditString("");
+ _list->setEditColor(ThemeEngine::kFontColorNormal);
+ }
+ }
} else {
// Disable the load button if nothing is selected, or if an empty
// list item is selected.