ScummVM API documentation
filebrowser-dialog.h
1 /* ScummVM - Graphic Adventure Engine
2  *
3  * ScummVM is the legal property of its developers, whose names
4  * are too numerous to list here. Please refer to the COPYRIGHT
5  * file distributed with this source distribution.
6  *
7  * This program is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation, either version 3 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program. If not, see <http://www.gnu.org/licenses/>.
19  *
20  */
21 
22 #ifndef FILEBROWSER_DIALOG_H
23 #define FILEBROWSER_DIALOG_H
24 
25 #include "gui/dialog.h"
26 #include "gui/widgets/edittext.h"
27 
28 namespace GUI {
29 
30 class ListWidget;
31 class EditTextWidget;
32 class CommandSender;
33 
34 enum {
35  kFBModeLoad = 0,
36  kFBModeSave
37 };
38 
39 class FileBrowserDialog : public Dialog {
40 public:
41  FileBrowserDialog(const char *title, const char *fileExtension, int mode, const char *fileMask = NULL, const char *initialFilename = NULL);
42 
43  void open() override;
44 
45  void handleCommand(CommandSender *sender, uint32 cmd, uint32 data) override;
46 
47  Common::String getResult() { return Dialog::getResult() ? _fileName->getEditString().encode() : Common::String(); }
48 
49 protected:
50  EditTextWidget *_fileName;
51  ListWidget *_fileList;
52  Common::String _fileMask;
53  Common::String _fileExt;
54  int _mode;
55 
56  void updateListing();
57  void normalieFileName();
58  bool isProceedSave();
59 };
60 
61 } // End of namespace GUI
62 
63 #endif
Definition: str.h:59
Definition: edittext.h:32
Definition: system.h:46
Definition: filebrowser-dialog.h:39
String encode(CodePage page=kUtf8) const
Definition: list.h:51
Definition: dialog.h:49
Definition: object.h:40