mirror of
https://github.com/libretro/scummvm.git
synced 2024-12-03 23:52:41 +00:00
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
@ -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);
|
||||
}
|
||||
|
@ -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();
|
||||
|
||||
|
@ -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.
|
||||
|
Loading…
Reference in New Issue
Block a user