diff -r c76c5dcf81c5 lib/irrlicht/include/IGUIFileOpenDialog.h --- a/lib/irrlicht/include/IGUIFileOpenDialog.h Thu Jun 04 01:38:19 2009 +0200 +++ b/lib/irrlicht/include/IGUIFileOpenDialog.h Thu Jun 04 01:58:28 2009 +0200 @@ -22,7 +22,11 @@ : IGUIElement(EGUIET_FILE_OPEN_DIALOG, environment, parent, id, rectangle) {} //! Returns the filename of the selected file. Returns NULL, if no file was selected. + //! DEPRECATED (will only return first selected filename) virtual const wchar_t* getFileName() const = 0; + + //! Returns the filenames of all selected files. Array is emply if no file was selected. + virtual const core::array& getSelectedFilenames() const = 0; //! Returns the directory of the selected file. Returns NULL, if no directory was selected. virtual const core::string& getDirectoryName() = 0; diff -r c76c5dcf81c5 lib/irrlicht/source/Irrlicht/CGUIFileOpenDialog.cpp --- a/lib/irrlicht/source/Irrlicht/CGUIFileOpenDialog.cpp Thu Jun 04 01:38:19 2009 +0200 +++ b/lib/irrlicht/source/Irrlicht/CGUIFileOpenDialog.cpp Thu Jun 04 01:58:28 2009 +0200 @@ -82,6 +82,7 @@ FileBox = Environment->addListBox(core::rect(10, 55, RelativeRect.getWidth()-90, 230), this, -1, true); FileBox->setSubElement(true); FileBox->setAlignment(EGUIA_UPPERLEFT, EGUIA_LOWERRIGHT, EGUIA_UPPERLEFT, EGUIA_LOWERRIGHT); + FileBox->setSelectionMode( EGUI_LBS_MULTI_SELECTION ); FileBox->grab(); FileNameText = Environment->addEditBox(0, core::rect(10, 30, RelativeRect.getWidth()-90, 50), true, this); @@ -130,6 +131,11 @@ const wchar_t* CGUIFileOpenDialog::getFileName() const { return FileName.c_str(); +} + +const core::array& CGUIFileOpenDialog::getSelectedFilenames() const +{ + return FileNames; } //! Returns the directory of the selected file. Returns NULL, if no directory was selected. @@ -177,45 +183,36 @@ } break; - case EGET_LISTBOX_CHANGED: + case EGET_LISTBOX_CHANGED: + { + if (FileList && FileSystem) { s32 selected = FileBox->getSelected(); - if (FileList && FileSystem) + if (FileList->isDirectory(selected)) { - if (FileList->isDirectory(selected)) + FileSystem->changeWorkingDirectoryTo(FileList->getFileName(selected)); + fillListBox(); + FileName = L""; + FileNames.clear(); + FileDirectory = FileList->getFullFileName(selected); + } + else + { + FileDirectory = L""; + FileName = FileList->getFullFileName(selected); + + FileNames.clear(); + selected = FileBox->getNextMultiSelectedItem(-1); + while ( selected >= 0 ) { - FileName = L""; - FileDirectory = FileList->getFullFileName(selected); - } - else - { - FileDirectory = L""; - FileName = FileList->getFullFileName(selected); + FileNames.push_back ( FileList->getFullFileName(selected) ); + selected = FileBox->getNextMultiSelectedItem(selected); } } } - break; + } + break; - case EGET_LISTBOX_SELECTED_AGAIN: - { - const s32 selected = FileBox->getSelected(); - if (FileList && FileSystem) - { - if (FileList->isDirectory(selected)) - { - FileDirectory = FileList->getFullFileName(selected); - FileSystem->changeWorkingDirectoryTo(FileList->getFileName(selected)); - fillListBox(); - FileName = ""; - } - else - { - FileName = FileList->getFullFileName(selected); - return true; - } - } - } - break; case EGET_EDITBOX_ENTER: if (event.GUIEvent.Caller == FileNameText) { @@ -224,6 +221,7 @@ { fillListBox(); FileName = L""; + FileNames.clear(); } return true; } diff -r c76c5dcf81c5 lib/irrlicht/source/Irrlicht/CGUIFileOpenDialog.h --- a/lib/irrlicht/source/Irrlicht/CGUIFileOpenDialog.h Thu Jun 04 01:38:19 2009 +0200 +++ b/lib/irrlicht/source/Irrlicht/CGUIFileOpenDialog.h Thu Jun 04 01:58:28 2009 +0200 @@ -30,7 +30,11 @@ virtual ~CGUIFileOpenDialog(); //! returns the filename of the selected file. Returns NULL, if no file was selected. + //! DEPRECATED (will only return first selected filename) virtual const wchar_t* getFileName() const; + + //! Returns the filenames of all selected files. Array is emply if no file was selected. + virtual const core::array& getSelectedFilenames() const; //! Returns the directory of the selected file. Returns NULL, if no directory was selected. virtual const core::string& getDirectoryName(); @@ -53,7 +57,8 @@ void sendCancelEvent(); core::position2d DragStart; - core::stringw FileName; + core::stringw FileName; // this is now redundant and only kept for backward compatibility + core::array FileNames; core::string FileDirectory; IGUIButton* CloseButton;