Permalink
Browse files

GUI: Clean up file browser path entry

  • Loading branch information...
bgK committed Aug 27, 2018
1 parent 94a520d commit ac4b2efd3fb7fd7a02fc2bc74de249045d353b2b
Showing with 4 additions and 13 deletions.
  1. +4 −3 gui/browser.cpp
  2. +0 −5 gui/widgets/edittext.cpp
  3. +0 −5 gui/widgets/edittext.h
@@ -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;
@@ -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
@@ -29,10 +29,6 @@

namespace GUI {

enum {
kExitTxtCmd = 'TXTE'
};

/* EditTextWidget */
class EditTextWidget : public EditableWidget {
protected:
@@ -48,7 +44,6 @@ class EditTextWidget : public EditableWidget {
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);

0 comments on commit ac4b2ef

Please sign in to comment.