diff options
Diffstat (limited to 'gui.cpp')
-rw-r--r-- | gui.cpp | 44 |
1 files changed, 34 insertions, 10 deletions
@@ -10,7 +10,8 @@ #include <FL/Fl.H> #include <FL/Fl_Box.H> #include <FL/Fl_Button.H> -#include <FL/Fl_File_Chooser.H> +//#include <FL/Fl_File_Chooser.H> +#include <FL/Fl_Native_File_Chooser.H> #include <FL/Fl_Group.H> #include <FL/Fl_Scroll.H> #include <FL/Fl_Window.H> @@ -150,16 +151,39 @@ Simulation *simulation; static void openBotFileChooser(){ - Fl_File_Chooser *fc=new Fl_File_Chooser( - "programs","Robocom Bot Files (*.rob)",Fl_File_Chooser::MULTI,"Add bots to sim"); - fc->callback([](Fl_File_Chooser *fc,void*){ - if(fc->shown())return; - int count=fc->count(); - for(int i=1;i<=count;i++){ - simulation->add(fc->value(i)); + + Fl_Native_File_Chooser fc; + // fc.type(Fl_Native_File_Chooser::BROWSE_MULTI_FILE); + // fc.title("Add bots to sim"); + // fc.filter("Robocom Bot Files (*.rob)\t*.rob"); + + switch(fc.show()) { + case -1: + cout << "Error: " << fc.errmsg() << endl; + break; + case 1: + cout << "Cancelled" << endl; + break; + default: + int count = fc.count(); + for(int i=0; i<count; i++) { + cout << fc.filename(i) << endl; + // simulation->add(fc.filename(i)); } - }); - fc->show(); + break; + } + + // Fl_File_Chooser *fc=new Fl_File_Chooser( + // "programs","Robocom Bot Files (*.rob)",Fl_File_Chooser::MULTI,"Add bots to sim"); + // fc->callback([](Fl_File_Chooser *fc,void*){ + // if(fc->shown())return; + // int count=fc->count(); + // for(int i=1;i<=count;i++){ + // cout << fc->value(i) << endl; + // simulation->add(fc->value(i)); + // } + // }); + // fc->show(); } static BotList* makeBotlist(Fl_Group *parent){ |