diff -abBdpuNPr --exclude='*.svn' irrlicht-svn-ss/trunk/include/IGUIFileOpenDialog.h Irrlicht_starsonata/include/IGUIFileOpenDialog.h --- irrlicht-svn-ss/trunk/include/IGUIFileOpenDialog.h 2007-07-26 02:11:22.000000000 +0200 +++ Irrlicht_starsonata/include/IGUIFileOpenDialog.h 2007-11-22 01:28:08.000000000 +0100 @@ -25,8 +25,11 @@ namespace gui virtual ~IGUIFileOpenDialog() {}; //! Returns the filename of the selected file. Returns NULL, if no file was selected. + //! Starsonata, MICHA: only for backward compatibility virtual const wchar_t* getFilename() = 0; + //! Micha, Starsonata: to allow multiple selection of files + virtual const core::array& getSelectedFilenames() const = 0; }; diff -abBdpuNPr --exclude='*.svn' irrlicht-svn-ss/trunk/source/Irrlicht/CGUIFileOpenDialog.cpp Irrlicht_starsonata/source/Irrlicht/CGUIFileOpenDialog.cpp --- irrlicht-svn-ss/trunk/source/Irrlicht/CGUIFileOpenDialog.cpp 2007-07-26 02:11:08.000000000 +0200 +++ Irrlicht_starsonata/source/Irrlicht/CGUIFileOpenDialog.cpp 2008-05-23 00:58:26.000000000 +0200 @@ -79,6 +79,7 @@ CGUIFileOpenDialog::CGUIFileOpenDialog(c 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->addStaticText(0, core::rect(10, 30, RelativeRect.getWidth()-90, 50), true, false, this); @@ -130,11 +131,18 @@ const wchar_t* CGUIFileOpenDialog::getFi return FileName.c_str(); } - +//! Micha, Starsonata: to allow multiple selection of files +const core::array& CGUIFileOpenDialog::getSelectedFilenames() const +{ + return FileNames; +} //! called if an event happened. bool CGUIFileOpenDialog::OnEvent(SEvent event) { + if (!IsEnabled) + return IGUIElement::OnEvent(event); + switch(event.EventType) { case EET_GUI_EVENT: @@ -162,36 +170,52 @@ bool CGUIFileOpenDialog::OnEvent(SEvent 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_SELECTED_AGAIN: - { s32 selected = FileBox->getSelected(); - if (FileList && FileSystem) - { if (FileList->isDirectory(selected)) { FileSystem->changeWorkingDirectoryTo(FileList->getFileName(selected)); fillListBox(); FileName = L""; + FileNames.clear(); } else { FileName = FileList->getFullFileName(selected); - return true; + + FileNames.clear(); + selected = FileBox->getNextMultiSelectedItem(-1); + while ( selected >= 0 ) + { + FileNames.push_back ( FileList->getFullFileName(selected) ); + selected = FileBox->getNextMultiSelectedItem(selected); + } } } } break; + + // Micha, Starsonata: Changing the directory already on the first click makes multiselection easier + //case EGET_LISTBOX_SELECTED_AGAIN: + // { + // 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; } break; case EET_MOUSE_INPUT_EVENT: @@ -227,7 +251,7 @@ bool CGUIFileOpenDialog::OnEvent(SEvent } } - return Parent ? Parent->OnEvent(event) : false; + return IGUIElement::OnEvent(event); } diff -abBdpuNPr --exclude='*.svn' irrlicht-svn-ss/trunk/source/Irrlicht/CGUIFileOpenDialog.h Irrlicht_starsonata/source/Irrlicht/CGUIFileOpenDialog.h --- irrlicht-svn-ss/trunk/source/Irrlicht/CGUIFileOpenDialog.h 2007-07-26 02:11:08.000000000 +0200 +++ Irrlicht_starsonata/source/Irrlicht/CGUIFileOpenDialog.h 2007-11-22 01:29:58.000000000 +0100 @@ -28,6 +28,9 @@ namespace gui //! returns the filename of the selected file. Returns NULL, if no file was selected. virtual const wchar_t* getFilename(); + //! Micha, Starsonata: to allow multiple selection of files + virtual const core::array& getSelectedFilenames() const; + //! called if an event happened. virtual bool OnEvent(SEvent event); @@ -46,7 +49,9 @@ namespace gui void sendCancelEvent(); core::position2d DragStart; - core::stringw FileName; + core::stringw FileName; // Starsonata, Micha: this is now redundant and only kept for backward compatibility + core::array FileNames; + bool Dragging; IGUIButton* CloseButton; IGUIButton* OKButton;