GUI: FileBrowser: support initial filename

Certain callers may want to specify a default filename for their
savegames. This is used in Director, where the file browser can be
constructed with the filename field prefilled.
This commit is contained in:
Misty De Meo 2023-07-05 15:22:17 -07:00 committed by Eugene Sandulenko
parent 9b6d9b0c27
commit 1100f490ee
2 changed files with 3 additions and 3 deletions

View File

@ -38,7 +38,7 @@ enum {
kChooseCmd = 'Chos'
};
FileBrowserDialog::FileBrowserDialog(const char *title, const char *fileExtension, int mode, const char *fileMask)
FileBrowserDialog::FileBrowserDialog(const char *title, const char *fileExtension, int mode, const char *fileMask, const char *initialFilename)
: Dialog("FileBrowser"), _mode(mode), _fileExt(fileExtension) {
if (fileMask == NULL) {
@ -52,7 +52,7 @@ FileBrowserDialog::FileBrowserDialog(const char *title, const char *fileExtensio
new StaticTextWidget(this, "FileBrowser.Headline", title ? Common::convertToU32String(title) :
mode == kFBModeLoad ? _("Choose file for loading") : _("Enter filename for saving"));
_fileName = new EditTextWidget(this, "FileBrowser.Filename", Common::U32String());
_fileName = new EditTextWidget(this, "FileBrowser.Filename", Common::U32String(initialFilename));
if (mode == kFBModeLoad)
_fileName->setEnabled(false);

View File

@ -38,7 +38,7 @@ enum {
class FileBrowserDialog : public Dialog {
public:
FileBrowserDialog(const char *title, const char *fileExtension, int mode, const char *fileMask = NULL);
FileBrowserDialog(const char *title, const char *fileExtension, int mode, const char *fileMask = NULL, const char *initialFilename = NULL);
void open() override;