diff options
Diffstat (limited to 'src/lib/FL/Fl_Native_File_Chooser_FLTK.H')
-rw-r--r-- | src/lib/FL/Fl_Native_File_Chooser_FLTK.H | 89 |
1 files changed, 89 insertions, 0 deletions
diff --git a/src/lib/FL/Fl_Native_File_Chooser_FLTK.H b/src/lib/FL/Fl_Native_File_Chooser_FLTK.H new file mode 100644 index 0000000..39e4a4a --- /dev/null +++ b/src/lib/FL/Fl_Native_File_Chooser_FLTK.H | |||
@@ -0,0 +1,89 @@ | |||
1 | // | ||
2 | // Fl_Native_File_Chooser_DEFAULT.H -- FLTK native OS file chooser widget | ||
3 | // | ||
4 | // Copyright 2005 by Nathan Vander Wilt. | ||
5 | // March 2005 - wrapper around Fl_File_Chooser | ||
6 | // | ||
7 | // This library is free software; you can redistribute it and/or | ||
8 | // modify it under the terms of the GNU Library General Public | ||
9 | // License as published by the Free Software Foundation; either | ||
10 | // version 2 of the License, or (at your option) any later version. | ||
11 | // | ||
12 | // This library is distributed in the hope that it will be useful, | ||
13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
15 | // Library General Public License for more details. | ||
16 | // | ||
17 | // You should have received a copy of the GNU Library General Public | ||
18 | // License along with this library; if not, write to the Free Software | ||
19 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 | ||
20 | // USA. | ||
21 | // | ||
22 | |||
23 | // Use FLTK BROWSER | ||
24 | #include <FL/Fl_File_Chooser.H> | ||
25 | #include <string.h> | ||
26 | |||
27 | class Fl_Native_File_Chooser { | ||
28 | public: | ||
29 | enum Type { | ||
30 | BROWSE_FILE = 0, | ||
31 | BROWSE_DIRECTORY, | ||
32 | BROWSE_MULTI_FILE, | ||
33 | BROWSE_MULTI_DIRECTORY, | ||
34 | BROWSE_SAVE_FILE, | ||
35 | BROWSE_SAVE_DIRECTORY | ||
36 | }; | ||
37 | enum Option { | ||
38 | NO_OPTIONS = 0x0000, // no options enabled | ||
39 | SAVEAS_CONFIRM = 0x0001, // Show native 'Save As' overwrite | ||
40 | // confirm dialog (if supported) | ||
41 | NEW_FOLDER = 0x0002, // Show 'New Folder' icon | ||
42 | // (if supported) | ||
43 | PREVIEW = 0x0004 // enable preview mode | ||
44 | }; | ||
45 | private: | ||
46 | int _btype; // kind-of browser to show() | ||
47 | int _options; // general options | ||
48 | char *_filter; // user supplied filter | ||
49 | char *_parsedfilt; // parsed filter | ||
50 | int _filtvalue; // selected filter | ||
51 | char *_preset_file; | ||
52 | char *_prevvalue; // Returned filename | ||
53 | char *_directory; | ||
54 | char *_errmsg; // error message | ||
55 | Fl_File_Chooser *file_chooser; | ||
56 | int _nfilters; | ||
57 | |||
58 | // Private methods | ||
59 | void errmsg(const char *msg); | ||
60 | int type_fl_file(int); | ||
61 | void parse_filter(); | ||
62 | void keeplocation(); | ||
63 | |||
64 | public: | ||
65 | Fl_Native_File_Chooser(int val=BROWSE_FILE); | ||
66 | ~Fl_Native_File_Chooser(); | ||
67 | |||
68 | // Public methods | ||
69 | void type(int); | ||
70 | int type() const; | ||
71 | void options(int); | ||
72 | int options() const; | ||
73 | int count() const; | ||
74 | const char *filename() const; | ||
75 | const char *filename(int i) const; | ||
76 | void directory(const char *val); | ||
77 | const char *directory() const; | ||
78 | void title(const char *); | ||
79 | const char* title() const; | ||
80 | const char *filter() const; | ||
81 | void filter(const char *); | ||
82 | int filters() const { return(_nfilters); } | ||
83 | void filter_value(int i); | ||
84 | int filter_value() const; | ||
85 | void preset_file(const char*); | ||
86 | const char* preset_file() const; | ||
87 | const char *errmsg() const; | ||
88 | int show(); | ||
89 | }; | ||