GUI: Clean up file browser path entry

This commit is contained in:
Bastien Bouclet 2018-08-27 06:39:40 +02:00
parent 94a520d299
commit ac4b2efd3f
3 changed files with 4 additions and 13 deletions

View File

@ -36,7 +36,8 @@ namespace GUI {
enum {
kChooseCmd = 'Chos',
kGoUpCmd = 'GoUp',
kHiddenCmd = 'Hidd'
kHiddenCmd = 'Hidd',
kPathEditedCmd = 'Path'
};
/* We want to use this as a general directory selector at some point... possible uses
@ -57,7 +58,7 @@ BrowserDialog::BrowserDialog(const char *title, bool dirBrowser)
new StaticTextWidget(this, "Browser.Headline", title);
// Current path - TODO: handle long paths ?
_currentPath = new EditTextWidget(this, "Browser.Path", "DUMMY");
_currentPath = new EditTextWidget(this, "Browser.Path", "", nullptr, 0, kPathEditedCmd);
// Add file list
_fileList = new ListWidget(this, "Browser.List");
@ -96,7 +97,7 @@ void BrowserDialog::open() {
void BrowserDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 data) {
switch (cmd) {
//Search for typed-in directory
case kExitTxtCmd:
case kPathEditedCmd:
_node = Common::FSNode(_currentPath->getEditString());
updateListing();
break;

View File

@ -132,7 +132,6 @@ void EditTextWidget::startEditMode() {
void EditTextWidget::endEditMode() {
releaseFocus();
sendCommand(kExitTxtCmd, 0);
sendCommand(_finishCmd, 0);
}
@ -143,8 +142,4 @@ void EditTextWidget::abortEditMode() {
releaseFocus();
}
Common::String EditTextWidget::getEditString() {
return _backupString;
}
} // End of namespace GUI

View File

@ -29,10 +29,6 @@
namespace GUI {
enum {
kExitTxtCmd = 'TXTE'
};
/* EditTextWidget */
class EditTextWidget : public EditableWidget {
protected:
@ -48,7 +44,6 @@ public:
EditTextWidget(GuiObject *boss, const String &name, const String &text, const char *tooltp = 0, uint32 cmd = 0, uint32 finishCmd = 0);
void setEditString(const String &str);
String getEditString();
virtual void handleMouseDown(int x, int y, int button, int clickCount);