Implement automatic clearing of "Untitled Savestate" in edit mode of the SaveLoadChooser as requested in feature request #2834637 "GUI: Allow greying out dummy ListWidget entries".
svn-id: r43555
This commit is contained in:
parent
8b0a10ad75
commit
f898cd12e6
3 changed files with 34 additions and 2 deletions
|
@ -64,6 +64,7 @@ ListWidget::ListWidget(GuiObject *boss, const String &name, uint32 cmd)
|
||||||
_editable = true;
|
_editable = true;
|
||||||
|
|
||||||
_quickSelect = true;
|
_quickSelect = true;
|
||||||
|
_editColor = ThemeEngine::kFontColorNormal;
|
||||||
}
|
}
|
||||||
|
|
||||||
ListWidget::ListWidget(GuiObject *boss, int x, int y, int w, int h, uint32 cmd)
|
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) {
|
void ListWidget::setList(const StringList &list, const ColorList *colors) {
|
||||||
if (_editMode && _caretVisible)
|
if (_editMode && _caretVisible)
|
||||||
drawCaret(true);
|
drawCaret(true);
|
||||||
|
@ -460,6 +471,7 @@ void ListWidget::drawWidget() {
|
||||||
|
|
||||||
if (_selectedItem == pos && _editMode) {
|
if (_selectedItem == pos && _editMode) {
|
||||||
buffer = _editString;
|
buffer = _editString;
|
||||||
|
color = _editColor;
|
||||||
adjustOffset();
|
adjustOffset();
|
||||||
width = _w - r.left - _hlRightPadding - _leftPadding - scrollbarW;
|
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,
|
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) {
|
if (_editable && !_editMode && _selectedItem >= 0) {
|
||||||
_editMode = true;
|
_editMode = true;
|
||||||
setEditString(_list[_selectedItem]);
|
setEditString(_list[_selectedItem]);
|
||||||
|
if (_listColors.empty()) {
|
||||||
|
_editColor = ThemeEngine::kFontColorNormal;
|
||||||
|
} else {
|
||||||
|
if (_filter.empty())
|
||||||
|
_editColor = _listColors[_selectedItem];
|
||||||
|
else
|
||||||
|
_editColor = _listColors[_listIndex[_selectedItem]];
|
||||||
|
}
|
||||||
draw();
|
draw();
|
||||||
g_system->setFeatureState(OSystem::kFeatureVirtualKeyboard, true);
|
g_system->setFeatureState(OSystem::kFeatureVirtualKeyboard, true);
|
||||||
}
|
}
|
||||||
|
|
|
@ -84,6 +84,8 @@ protected:
|
||||||
|
|
||||||
uint32 _cmd;
|
uint32 _cmd;
|
||||||
|
|
||||||
|
ThemeEngine::FontColor _editColor;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
ListWidget(GuiObject *boss, const String &name, uint32 cmd = 0);
|
ListWidget(GuiObject *boss, const String &name, uint32 cmd = 0);
|
||||||
ListWidget(GuiObject *boss, int x, int y, int w, int h, 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]; }
|
int getSelected() const { return (_filter.empty() || _selectedItem == -1) ? _selectedItem : _listIndex[_selectedItem]; }
|
||||||
void setSelected(int item);
|
void setSelected(int item);
|
||||||
const String &getSelectedString() const { return _list[_selectedItem]; }
|
const String &getSelectedString() const { return _list[_selectedItem]; }
|
||||||
|
ThemeEngine::FontColor getSelectionColor() const;
|
||||||
void setNumberingMode(NumberingMode numberingMode) { _numberingMode = numberingMode; }
|
void setNumberingMode(NumberingMode numberingMode) { _numberingMode = numberingMode; }
|
||||||
bool isEditable() const { return _editable; }
|
bool isEditable() const { return _editable; }
|
||||||
void setEditable(bool editable) { _editable = editable; }
|
void setEditable(bool editable) { _editable = editable; }
|
||||||
|
@ -105,6 +108,8 @@ public:
|
||||||
void enableQuickSelect(bool enable) { _quickSelect = enable; }
|
void enableQuickSelect(bool enable) { _quickSelect = enable; }
|
||||||
String getQuickSelectString() const { return _quickSelectStr; }
|
String getQuickSelectString() const { return _quickSelectStr; }
|
||||||
|
|
||||||
|
void setEditColor(ThemeEngine::FontColor color) { _editColor = color; }
|
||||||
|
|
||||||
void setFilter(const String &filter, bool redraw = true);
|
void setFilter(const String &filter, bool redraw = true);
|
||||||
|
|
||||||
virtual void handleTickle();
|
virtual void handleTickle();
|
||||||
|
@ -119,7 +124,7 @@ public:
|
||||||
|
|
||||||
virtual bool wantsFocus() { return true; }
|
virtual bool wantsFocus() { return true; }
|
||||||
|
|
||||||
// Made startEditMode for SCUMM's SaveLoadChooser
|
// Made startEditMode for SaveLoadChooser
|
||||||
void startEditMode();
|
void startEditMode();
|
||||||
void endEditMode();
|
void endEditMode();
|
||||||
|
|
||||||
|
|
|
@ -278,8 +278,15 @@ void SaveLoadChooser::updateSelection(bool redraw) {
|
||||||
// game is write protected
|
// game is write protected
|
||||||
_chooseButton->setEnabled(selItem >= 0 && !isWriteProtected);
|
_chooseButton->setEnabled(selItem >= 0 && !isWriteProtected);
|
||||||
|
|
||||||
if (startEditMode)
|
if (startEditMode) {
|
||||||
_list->startEditMode();
|
_list->startEditMode();
|
||||||
|
|
||||||
|
if (_chooseButton->isEnabled() && _list->getSelectedString() == "Untitled savestate" &&
|
||||||
|
_list->getSelectionColor() == ThemeEngine::kFontColorAlternate) {
|
||||||
|
_list->setEditString("");
|
||||||
|
_list->setEditColor(ThemeEngine::kFontColorNormal);
|
||||||
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
// Disable the load button if nothing is selected, or if an empty
|
// Disable the load button if nothing is selected, or if an empty
|
||||||
// list item is selected.
|
// list item is selected.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue