diff -r 50619b0878b5 lib/irrlicht/include/IGUIFileOpenDialog.h --- a/lib/irrlicht/include/IGUIFileOpenDialog.h Sun Aug 31 23:04:30 2008 +0200 +++ b/lib/irrlicht/include/IGUIFileOpenDialog.h Sun Aug 31 23:25:40 2008 +0200 @@ -21,8 +21,12 @@ IGUIFileOpenDialog(IGUIEnvironment* environment, IGUIElement* parent, s32 id, core::rect rectangle) : IGUIElement(EGUIET_FILE_OPEN_DIALOG, environment, parent, id, rectangle) {} - //! Returns the filename of the selected file. Returns NULL, if no file was selected. - virtual const wchar_t* getFileName() const = 0; + //! 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; }; diff -r 50619b0878b5 lib/irrlicht/source/Irrlicht/CGUIFileOpenDialog.cpp --- a/lib/irrlicht/source/Irrlicht/CGUIFileOpenDialog.cpp Sun Aug 31 23:04:30 2008 +0200 +++ b/lib/irrlicht/source/Irrlicht/CGUIFileOpenDialog.cpp Sun Aug 31 23:25:40 2008 +0200 @@ -81,7 +81,8 @@ 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->setAlignment(EGUIA_UPPERLEFT, EGUIA_LOWERRIGHT, EGUIA_UPPERLEFT, EGUIA_LOWERRIGHT); + FileBox->setSelectionMode( EGUI_LBS_MULTI_SELECTION ); FileBox->grab(); FileNameText = Environment->addStaticText(0, core::rect(10, 30, RelativeRect.getWidth()-90, 50), true, false, this); @@ -130,8 +131,12 @@ const wchar_t* CGUIFileOpenDialog::getFileName() const { return FileName.c_str(); +} + +const core::array& CGUIFileOpenDialog::getSelectedFilenames() const +{ + return FileNames; } - //! called if an event happened. bool CGUIFileOpenDialog::OnEvent(const SEvent& event) @@ -163,38 +168,34 @@ } break; - case EGET_LISTBOX_CHANGED: - { - s32 selected = FileBox->getSelected(); - if (FileList && FileSystem) - { - if (FileList->isDirectory(selected)) - FileName = L""; - else - FileName = FileList->getFullFileName(selected); - } - } - break; + case EGET_LISTBOX_CHANGED: + { + if (FileList && FileSystem) + { + s32 selected = FileBox->getSelected(); + if (FileList->isDirectory(selected)) + { + FileSystem->changeWorkingDirectoryTo(FileList->getFileName(selected)); + fillListBox(); + FileName = L""; + FileNames.clear(); + } + else + { + FileName = FileList->getFullFileName(selected); + + FileNames.clear(); + selected = FileBox->getNextMultiSelectedItem(-1); + while ( selected >= 0 ) + { + FileNames.push_back ( FileList->getFullFileName(selected) ); + selected = FileBox->getNextMultiSelectedItem(selected); + } + } + } + } + break; - case EGET_LISTBOX_SELECTED_AGAIN: - { - const s32 selected = FileBox->getSelected(); - if (FileList && FileSystem) - { - if (FileList->isDirectory(selected)) - { - FileSystem->changeWorkingDirectoryTo(FileList->getFileName(selected)); - fillListBox(); - FileName = L""; - } - else - { - FileName = FileList->getFullFileName(selected); - return true; - } - } - } - break; default: break; } diff -r 50619b0878b5 lib/irrlicht/source/Irrlicht/CGUIFileOpenDialog.h --- a/lib/irrlicht/source/Irrlicht/CGUIFileOpenDialog.h Sun Aug 31 23:04:30 2008 +0200 +++ b/lib/irrlicht/source/Irrlicht/CGUIFileOpenDialog.h Sun Aug 31 23:25:40 2008 +0200 @@ -28,8 +28,12 @@ //! destructor virtual ~CGUIFileOpenDialog(); - //! returns the filename of the selected file. Returns NULL, if no file was selected. - virtual const wchar_t* getFileName() const; + //! 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; //! called if an event happened. virtual bool OnEvent(const SEvent& event); @@ -49,7 +53,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; bool Dragging; IGUIButton* CloseButton; IGUIButton* OKButton;