FLTK 1.3.0
Fl_File_Chooser.H
1 //
2 // "$Id: Fl_File_Chooser.H 8786 2011-06-07 11:41:36Z manolo $"
3 //
4 // Fl_File_Chooser dialog for the Fast Light Tool Kit (FLTK).
5 //
6 // Copyright 1998-2011 by Bill Spitzak and others.
7 //
8 // This library is free software; you can redistribute it and/or
9 // modify it under the terms of the GNU Library General Public
10 // License as published by the Free Software Foundation; either
11 // version 2 of the License, or (at your option) any later version.
12 //
13 // This library is distributed in the hope that it will be useful,
14 // but WITHOUT ANY WARRANTY; without even the implied warranty of
15 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 // Library General Public License for more details.
17 //
18 // You should have received a copy of the GNU Library General Public
19 // License along with this library; if not, write to the Free Software
20 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
21 // USA.
22 //
23 // Please report all bugs and problems on the following page:
24 //
25 // http://www.fltk.org/str.php
26 //
27 
28 // generated by Fast Light User Interface Designer (fluid) version 1.0300
29 
30 #ifndef Fl_File_Chooser_H
31 #define Fl_File_Chooser_H
32 #include <FL/Fl.H>
33 #include <FL/Fl_Double_Window.H>
34 #include <stdio.h>
35 #include <stdlib.h>
36 #include <string.h>
37 #include <FL/Fl_Group.H>
38 #include <FL/Fl_Choice.H>
39 #include <FL/Fl_Menu_Button.H>
40 #include <FL/Fl_Button.H>
41 #include <FL/Fl_Preferences.H>
42 #include <FL/Fl_Tile.H>
43 #include <FL/Fl_File_Browser.H>
44 #include <FL/Fl_Box.H>
45 #include <FL/Fl_Check_Button.H>
46 #include <FL/Fl_File_Input.H>
47 #include <FL/Fl_Return_Button.H>
48 #include <FL/fl_ask.H>
49 
50 class FL_EXPORT Fl_File_Chooser {
51 public:
52  enum { SINGLE = 0, MULTI = 1, CREATE = 2, DIRECTORY = 4 };
53 private:
54  static Fl_Preferences prefs_;
55  void (*callback_)(Fl_File_Chooser*, void *);
56  void *data_;
57  char directory_[FL_PATH_MAX];
58  char pattern_[FL_PATH_MAX];
59  char preview_text_[2048];
60  int type_;
61  void favoritesButtonCB();
62  void favoritesCB(Fl_Widget *w);
63  void fileListCB();
64  void fileNameCB();
65  void newdir();
66  static void previewCB(Fl_File_Chooser *fc);
67  void showChoiceCB();
68  void update_favorites();
69  void update_preview();
70 public:
71  Fl_File_Chooser(const char *d, const char *p, int t, const char *title);
72 private:
73  Fl_Double_Window *window;
74  void cb_window_i(Fl_Double_Window*, void*);
75  static void cb_window(Fl_Double_Window*, void*);
76  Fl_Choice *showChoice;
77  void cb_showChoice_i(Fl_Choice*, void*);
78  static void cb_showChoice(Fl_Choice*, void*);
79  Fl_Menu_Button *favoritesButton;
80  void cb_favoritesButton_i(Fl_Menu_Button*, void*);
81  static void cb_favoritesButton(Fl_Menu_Button*, void*);
82 public:
84 private:
85  void cb_newButton_i(Fl_Button*, void*);
86  static void cb_newButton(Fl_Button*, void*);
87  void cb__i(Fl_Tile*, void*);
88  static void cb_(Fl_Tile*, void*);
89  Fl_File_Browser *fileList;
90  void cb_fileList_i(Fl_File_Browser*, void*);
91  static void cb_fileList(Fl_File_Browser*, void*);
92  Fl_Box *previewBox;
93 public:
95 private:
96  void cb_previewButton_i(Fl_Check_Button*, void*);
97  static void cb_previewButton(Fl_Check_Button*, void*);
98 public:
99  Fl_Check_Button *showHiddenButton;
100 private:
101  void cb_showHiddenButton_i(Fl_Check_Button*, void*);
102  static void cb_showHiddenButton(Fl_Check_Button*, void*);
103  Fl_File_Input *fileName;
104  void cb_fileName_i(Fl_File_Input*, void*);
105  static void cb_fileName(Fl_File_Input*, void*);
106  Fl_Return_Button *okButton;
107  void cb_okButton_i(Fl_Return_Button*, void*);
108  static void cb_okButton(Fl_Return_Button*, void*);
109  Fl_Button *cancelButton;
110  void cb_cancelButton_i(Fl_Button*, void*);
111  static void cb_cancelButton(Fl_Button*, void*);
112  Fl_Double_Window *favWindow;
113  Fl_File_Browser *favList;
114  void cb_favList_i(Fl_File_Browser*, void*);
115  static void cb_favList(Fl_File_Browser*, void*);
116  Fl_Button *favUpButton;
117  void cb_favUpButton_i(Fl_Button*, void*);
118  static void cb_favUpButton(Fl_Button*, void*);
119  Fl_Button *favDeleteButton;
120  void cb_favDeleteButton_i(Fl_Button*, void*);
121  static void cb_favDeleteButton(Fl_Button*, void*);
122  Fl_Button *favDownButton;
123  void cb_favDownButton_i(Fl_Button*, void*);
124  static void cb_favDownButton(Fl_Button*, void*);
125  Fl_Button *favCancelButton;
126  void cb_favCancelButton_i(Fl_Button*, void*);
127  static void cb_favCancelButton(Fl_Button*, void*);
128  Fl_Return_Button *favOkButton;
129  void cb_favOkButton_i(Fl_Return_Button*, void*);
130  static void cb_favOkButton(Fl_Return_Button*, void*);
131 public:
132  ~Fl_File_Chooser();
133  void callback(void (*cb)(Fl_File_Chooser *, void *), void *d = 0);
134  void color(Fl_Color c);
135  Fl_Color color();
136  int count();
137  void directory(const char *d);
138  char * directory();
139  void filter(const char *p);
140  const char * filter();
141  int filter_value();
142  void filter_value(int f);
143  void hide();
144  void iconsize(uchar s);
145  uchar iconsize();
146  void label(const char *l);
147  const char * label();
148  void ok_label(const char *l);
149  const char * ok_label();
150  void preview(int e);
151  int preview() const { return previewButton->value(); };
152 private:
153  void showHidden(int e);
154  void remove_hidden_files();
155 public:
156  void rescan();
157  void rescan_keep_filename();
158  void show();
159  int shown();
160  void textcolor(Fl_Color c);
161  Fl_Color textcolor();
162  void textfont(Fl_Font f);
163  Fl_Font textfont();
164  void textsize(Fl_Fontsize s);
165  Fl_Fontsize textsize();
166  void type(int t);
167  int type();
168  void * user_data() const;
169  void user_data(void *d);
170  const char *value(int f = 1);
171  void value(const char *filename);
172  int visible();
176  static const char *add_favorites_label;
180  static const char *all_files_label;
184  static const char *custom_filter_label;
188  static const char *existing_file_label;
192  static const char *favorites_label;
196  static const char *filename_label;
200  static const char *filesystems_label;
204  static const char *manage_favorites_label;
208  static const char *new_directory_label;
212  static const char *new_directory_tooltip;
216  static const char *preview_label;
220  static const char *save_label;
224  static const char *show_label;
228  static const char *hidden_label;
234 private:
235  Fl_Widget* ext_group;
236 public:
237  Fl_Widget* add_extra(Fl_Widget* gr);
238 };
239 FL_EXPORT char *fl_dir_chooser(const char *message,const char *fname,int relative=0);
240 FL_EXPORT char *fl_file_chooser(const char *message,const char *pat,const char *fname,int relative=0);
241 FL_EXPORT void fl_file_chooser_callback(void (*cb)(const char*));
242 FL_EXPORT void fl_file_chooser_ok_label(const char*l);
243 #endif
244 
245 //
246 // End of "$Id: Fl_File_Chooser.H 8786 2011-06-07 11:41:36Z manolo $".
247 //
Fl_Widget is the base class for all widgets in FLTK.
Definition: Fl_Widget.H:109
static const char * new_directory_label
[standard text may be customized at run-time]
Definition: Fl_File_Chooser.H:208
The Fl_Tile class lets you resize the children by dragging the border between them: ...
Definition: Fl_Tile.H:79
static const char * show_label
[standard text may be customized at run-time]
Definition: Fl_File_Chooser.H:224
static const char * save_label
[standard text may be customized at run-time]
Definition: Fl_File_Chooser.H:220
Fl static class.
Fl_Check_Button * previewButton
The "preview" button is exported so that application developers can control the appearance and use...
Definition: Fl_File_Chooser.H:94
static const char * favorites_label
[standard text may be customized at run-time]
Definition: Fl_File_Chooser.H:192
char * fl_file_chooser(const char *message, const char *pat, const char *fname, int relative)
Shows a file chooser dialog and gets a filename.
Definition: fl_file_dir.cxx:82
The Fl_Double_Window provides a double-buffered window.
Definition: Fl_Double_Window.H:49
This is a button that when pushed pops up a menu (or hierarchy of menus) defined by an array of Fl_Me...
Definition: Fl_Menu_Button.H:59
The Fl_File_Browser widget displays a list of filenames, optionally with file-specific icons...
Definition: Fl_File_Browser.H:48
This widget simply draws its box, and possibly it's label.
Definition: Fl_Box.H:43
static const char * all_files_label
[standard text may be customized at run-time]
Definition: Fl_File_Chooser.H:180
static const char * hidden_label
[standard text may be customized at run-time]
Definition: Fl_File_Chooser.H:228
This widget displays a pathname in a text input field.
Definition: Fl_File_Input.H:56
int preview() const
Returns the current state of the preview box.
Definition: Fl_File_Chooser.H:151
Fl_Button * newButton
The "new directory" button is exported so that application developers can control the appearance and ...
Definition: Fl_File_Chooser.H:83
int( Fl_File_Sort_F)(struct dirent **, struct dirent **)
File sorting function.
Definition: filename.H:122
The Fl_Return_Button is a subclass of Fl_Button that generates a callback when it is pressed or when ...
Definition: Fl_Return_Button.H:42
The Fl_File_Chooser widget displays a standard file selection dialog that supports various selection ...
Definition: Fl_File_Chooser.H:50
static const char * add_favorites_label
[standard text may be customized at run-time]
Definition: Fl_File_Chooser.H:176
static const char * new_directory_tooltip
[standard text may be customized at run-time]
Definition: Fl_File_Chooser.H:212
Fl_Preferences provides methods to store user settings between application starts.
Definition: Fl_Preferences.H:69
A button with an "checkmark" to show its status.
Definition: Fl_Check_Button.H:51
#define FL_PATH_MAX
all path buffers should use this length
Definition: filename.H:44
char * fl_dir_chooser(const char *message, const char *fname, int relative)
Shows a file chooser dialog and gets a directory.
Definition: fl_file_dir.cxx:164
int Fl_Fontsize
Size of a font in pixels.
Definition: Enumerations.H:741
static const char * manage_favorites_label
[standard text may be customized at run-time]
Definition: Fl_File_Chooser.H:204
A button that is used to pop up a menu.
Definition: Fl_Choice.H:85
unsigned int Fl_Color
an FLTK color value
Definition: Enumerations.H:769
static const char * preview_label
[standard text may be customized at run-time]
Definition: Fl_File_Chooser.H:216
int Fl_Font
A font number is an index into the internal font table.
Definition: Enumerations.H:712
static Fl_File_Sort_F * sort
the sort function that is used when loading the contents of a directory.
Definition: Fl_File_Chooser.H:233
void fl_file_chooser_callback(void(*cb)(const char *))
Set the file chooser callback.
Definition: fl_file_dir.cxx:53
static const char * custom_filter_label
[standard text may be customized at run-time]
Definition: Fl_File_Chooser.H:184
static const char * filesystems_label
[standard text may be customized at run-time]
Definition: Fl_File_Chooser.H:200
void fl_file_chooser_ok_label(const char *l)
Set the "OK" button label.
Definition: fl_file_dir.cxx:63
static const char * filename_label
[standard text may be customized at run-time]
Definition: Fl_File_Chooser.H:196
Buttons generate callbacks when they are clicked by the user.
Definition: Fl_Button.H:87
static const char * existing_file_label
[standard text may be customized at run-time]
Definition: Fl_File_Chooser.H:188
unsigned char uchar
unsigned char
Definition: fl_types.h:39