1 /*=========================================================================
4 Module: $RCSfile: bbwxFileSelector.cxx,v $
6 Date: $Date: 2008/07/24 14:37:06 $
7 Version: $Revision: 1.4 $
9 Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
10 l'Image). All rights reserved. See Doc/License.txt or
11 http://www.creatis.insa-lyon.fr/Public/bbtk/License.html for details.
13 This software is distributed WITHOUT ANY WARRANTY; without even
14 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15 PURPOSE. See the above copyright notices for more information.
17 =========================================================================*/
24 #ifdef _USE_WXWIDGETS_
27 #include "bbwxFileSelector.h"
28 #include "bbwxPackage.h"
31 #include <wx/filedlg.h>
37 BBTK_ADD_BLACK_BOX_TO_PACKAGE(wx,FileSelector);
40 BBTK_BLACK_BOX_IMPLEMENTATION(FileSelector,bbtk::AtomicBlackBox);
43 void FileSelector::Process()
45 bbtkDebugMessageInc("Core",9,"FileSelector::Process() ["
46 <<bbGetFullName()<<"]"<<std::endl);
49 if (bbGetInputOpenSave()=="Save")
51 style = wxSAVE | wxOVERWRITE_PROMPT;
55 style = wxOPEN | wxFILE_MUST_EXIST;
58 std::string wc(bbGetInputWildcard());
65 wxFileDialog* FD = new wxFileDialog( 0,
66 bbtk::std2wx(bbGetInputMessage()),
67 bbtk::std2wx(bbGetInputDefaultDir()),
68 bbtk::std2wx(bbGetInputDefaultFile()),
74 int result_FD = FD->ShowModal();
76 // This line is need it by windows //EED
77 FD->SetReturnCode( result_FD );
79 if (FD->GetReturnCode()==wxID_OK)
81 bbSetOutputOut( bbtk::wx2std (FD->GetPath()) );
88 bbtkDebugDecTab("Core",9);
92 void FileSelector::bbUserConstructor()
94 bbSetInputOpenSave("Open");
101 #endif // _USE_WXWIDGETS_