30 #define WIN32_LEAN_AND_MEAN
34 #include <FL/Fl_File_Chooser.H>
49 @deftypefn {Built-in Function} {} __fltk_uigetfile__ (@dots{})\n\
50 Undocumented internal function.\n\
64 std::string file_filter = args(0).string_value ();
65 std::string title = args(1).string_value ();
66 std::string default_name = args(2).string_value ();
67 Matrix pos = args(3).matrix_value ();
69 int multi_type = Fl_File_Chooser::SINGLE;
70 std::string flabel =
"Filename:";
72 std::string multi = args(4).string_value ();
74 multi_type = Fl_File_Chooser::MULTI;
75 else if (multi ==
"dir")
77 multi_type = Fl_File_Chooser::DIRECTORY;
78 flabel =
"Directory:";
80 else if (multi ==
"create")
81 multi_type = Fl_File_Chooser::CREATE;
83 Fl_File_Chooser::filename_label = flabel.c_str ();
85 Fl_File_Chooser fc (default_name.c_str (), file_filter.c_str (),
86 multi_type, title.c_str ());
90 if (multi_type == Fl_File_Chooser::CREATE)
100 int file_count = fc.count ();
104 std::string sep =
"/";
107 if (file_count == 1 && multi_type != Fl_File_Chooser::DIRECTORY)
110 idx = fname.find_last_of (sep);
111 retval(0) = fname.substr (idx + 1);
115 Cell file_cell =
Cell (file_count, 1);
118 fname = fc.value (n);
119 idx = fname.find_last_of (sep);
120 file_cell(n - 1) = fname.substr (idx + 1);
122 retval(0) = file_cell;
125 if (multi_type == Fl_File_Chooser::DIRECTORY)
126 retval(0) = std::string (fc.value ());
129 retval(1) = std::string (fc.directory ()) + sep;
130 retval(2) = fc.filter_value () + 1;
139 error (
"__fltk_uigetfile__: not available without OpenGL and FLTK libraries");