FLTK 1.3.2
Fl_File_Chooser.H
1 //
2 // "$Id: Fl_File_Chooser.H 8864 2011-07-19 04:49:30Z greg.ercolano $"
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. Distribution and use rights are outlined in
9 // the file "COPYING" which should have been included with this file. If this
10 // file is missing or damaged, see the license at:
11 //
12 // http://www.fltk.org/COPYING.php
13 //
14 // Please report all bugs and problems on the following page:
15 //
16 // http://www.fltk.org/str.php
17 //
18 
19 // generated by Fast Light User Interface Designer (fluid) version 1.0300
20 
21 #ifndef Fl_File_Chooser_H
22 #define Fl_File_Chooser_H
23 #include <FL/Fl.H>
24 #include <FL/Fl_Double_Window.H>
25 #include <stdio.h>
26 #include <stdlib.h>
27 #include <string.h>
28 #include <FL/Fl_Group.H>
29 #include <FL/Fl_Choice.H>
30 #include <FL/Fl_Menu_Button.H>
31 #include <FL/Fl_Button.H>
32 #include <FL/Fl_Preferences.H>
33 #include <FL/Fl_Tile.H>
34 #include <FL/Fl_File_Browser.H>
35 #include <FL/Fl_Box.H>
36 #include <FL/Fl_Check_Button.H>
37 #include <FL/Fl_File_Input.H>
38 #include <FL/Fl_Return_Button.H>
39 #include <FL/fl_ask.H>
40 
41 class FL_EXPORT Fl_File_Chooser {
42 public:
43  enum { SINGLE = 0, MULTI = 1, CREATE = 2, DIRECTORY = 4 };
44 private:
45  static Fl_Preferences prefs_;
46  void (*callback_)(Fl_File_Chooser*, void *);
47  void *data_;
48  char directory_[FL_PATH_MAX];
49  char pattern_[FL_PATH_MAX];
50  char preview_text_[2048];
51  int type_;
52  void favoritesButtonCB();
53  void favoritesCB(Fl_Widget *w);
54  void fileListCB();
55  void fileNameCB();
56  void newdir();
57  static void previewCB(Fl_File_Chooser *fc);
58  void showChoiceCB();
59  void update_favorites();
60  void update_preview();
61 public:
62  Fl_File_Chooser(const char *d, const char *p, int t, const char *title);
63 private:
64  Fl_Double_Window *window;
65  void cb_window_i(Fl_Double_Window*, void*);
66  static void cb_window(Fl_Double_Window*, void*);
67  Fl_Choice *showChoice;
68  void cb_showChoice_i(Fl_Choice*, void*);
69  static void cb_showChoice(Fl_Choice*, void*);
70  Fl_Menu_Button *favoritesButton;
71  void cb_favoritesButton_i(Fl_Menu_Button*, void*);
72  static void cb_favoritesButton(Fl_Menu_Button*, void*);
73 public:
75 private:
76  void cb_newButton_i(Fl_Button*, void*);
77  static void cb_newButton(Fl_Button*, void*);
78  void cb__i(Fl_Tile*, void*);
79  static void cb_(Fl_Tile*, void*);
80  Fl_File_Browser *fileList;
81  void cb_fileList_i(Fl_File_Browser*, void*);
82  static void cb_fileList(Fl_File_Browser*, void*);
83  Fl_Box *previewBox;
84 public:
86 private:
87  void cb_previewButton_i(Fl_Check_Button*, void*);
88  static void cb_previewButton(Fl_Check_Button*, void*);
89 public:
91 private:
92  void cb_showHiddenButton_i(Fl_Check_Button*, void*);
93  static void cb_showHiddenButton(Fl_Check_Button*, void*);
94  Fl_File_Input *fileName;
95  void cb_fileName_i(Fl_File_Input*, void*);
96  static void cb_fileName(Fl_File_Input*, void*);
97  Fl_Return_Button *okButton;
98  void cb_okButton_i(Fl_Return_Button*, void*);
99  static void cb_okButton(Fl_Return_Button*, void*);
100  Fl_Button *cancelButton;
101  void cb_cancelButton_i(Fl_Button*, void*);
102  static void cb_cancelButton(Fl_Button*, void*);
103  Fl_Double_Window *favWindow;
104  Fl_File_Browser *favList;
105  void cb_favList_i(Fl_File_Browser*, void*);
106  static void cb_favList(Fl_File_Browser*, void*);
107  Fl_Button *favUpButton;
108  void cb_favUpButton_i(Fl_Button*, void*);
109  static void cb_favUpButton(Fl_Button*, void*);
110  Fl_Button *favDeleteButton;
111  void cb_favDeleteButton_i(Fl_Button*, void*);
112  static void cb_favDeleteButton(Fl_Button*, void*);
113  Fl_Button *favDownButton;
114  void cb_favDownButton_i(Fl_Button*, void*);
115  static void cb_favDownButton(Fl_Button*, void*);
116  Fl_Button *favCancelButton;
117  void cb_favCancelButton_i(Fl_Button*, void*);
118  static void cb_favCancelButton(Fl_Button*, void*);
119  Fl_Return_Button *favOkButton;
120  void cb_favOkButton_i(Fl_Return_Button*, void*);
121  static void cb_favOkButton(Fl_Return_Button*, void*);
122 public:
123  ~Fl_File_Chooser();
124  void callback(void (*cb)(Fl_File_Chooser *, void *), void *d = 0);
125  void color(Fl_Color c);
126  Fl_Color color();
127  int count();
128  void directory(const char *d);
129  char * directory();
130  void filter(const char *p);
131  const char * filter();
132  int filter_value();
133  void filter_value(int f);
134  void hide();
135  void iconsize(uchar s);
136  uchar iconsize();
137  void label(const char *l);
138  const char * label();
139  void ok_label(const char *l);
140  const char * ok_label();
141  void preview(int e);
142  int preview() const { return previewButton->value(); };
143 private:
144  void showHidden(int e);
145  void remove_hidden_files();
146 public:
147  void rescan();
148  void rescan_keep_filename();
149  void show();
150  int shown();
151  void textcolor(Fl_Color c);
152  Fl_Color textcolor();
153  void textfont(Fl_Font f);
154  Fl_Font textfont();
155  void textsize(Fl_Fontsize s);
156  Fl_Fontsize textsize();
157  void type(int t);
158  int type();
159  void * user_data() const;
160  void user_data(void *d);
161  const char *value(int f = 1);
162  void value(const char *filename);
163  int visible();
167  static const char *add_favorites_label;
171  static const char *all_files_label;
175  static const char *custom_filter_label;
179  static const char *existing_file_label;
183  static const char *favorites_label;
187  static const char *filename_label;
191  static const char *filesystems_label;
195  static const char *manage_favorites_label;
199  static const char *new_directory_label;
203  static const char *new_directory_tooltip;
207  static const char *preview_label;
211  static const char *save_label;
215  static const char *show_label;
219  static const char *hidden_label;
225 private:
226  Fl_Widget* ext_group;
227 public:
228  Fl_Widget* add_extra(Fl_Widget* gr);
229 };
230 FL_EXPORT char *fl_dir_chooser(const char *message,const char *fname,int relative=0);
231 FL_EXPORT char *fl_file_chooser(const char *message,const char *pat,const char *fname,int relative=0);
232 FL_EXPORT void fl_file_chooser_callback(void (*cb)(const char*));
233 FL_EXPORT void fl_file_chooser_ok_label(const char*l);
234 #endif
235 
236 //
237 // End of "$Id: Fl_File_Chooser.H 8864 2011-07-19 04:49:30Z greg.ercolano $".
238 //
Fl_Widget is the base class for all widgets in FLTK.
Definition: Fl_Widget.H:100
static const char * new_directory_label
[standard text may be customized at run-time]
Definition: Fl_File_Chooser.H:199
The Fl_Tile class lets you resize the children by dragging the border between them: ...
Definition: Fl_Tile.H:70
static const char * show_label
[standard text may be customized at run-time]
Definition: Fl_File_Chooser.H:215
static const char * save_label
[standard text may be customized at run-time]
Definition: Fl_File_Chooser.H:211
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:85
static const char * favorites_label
[standard text may be customized at run-time]
Definition: Fl_File_Chooser.H:183
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:73
The Fl_Double_Window provides a double-buffered window.
Definition: Fl_Double_Window.H:40
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:50
The Fl_File_Browser widget displays a list of filenames, optionally with file-specific icons...
Definition: Fl_File_Browser.H:39
This widget simply draws its box, and possibly its label.
Definition: Fl_Box.H:34
static const char * all_files_label
[standard text may be customized at run-time]
Definition: Fl_File_Chooser.H:171
static const char * hidden_label
[standard text may be customized at run-time]
Definition: Fl_File_Chooser.H:219
This widget displays a pathname in a text input field.
Definition: Fl_File_Input.H:47
int preview() const
Returns the current state of the preview box.
Definition: Fl_File_Chooser.H:142
Fl_Button * newButton
The "new directory" button is exported so that application developers can control the appearance and ...
Definition: Fl_File_Chooser.H:74
int( Fl_File_Sort_F)(struct dirent **, struct dirent **)
File sorting function.
Definition: filename.H:116
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:33
The Fl_File_Chooser widget displays a standard file selection dialog that supports various selection ...
Definition: Fl_File_Chooser.H:41
static const char * add_favorites_label
[standard text may be customized at run-time]
Definition: Fl_File_Chooser.H:167
static const char * new_directory_tooltip
[standard text may be customized at run-time]
Definition: Fl_File_Chooser.H:203
Fl_Preferences provides methods to store user settings between application starts.
Definition: Fl_Preferences.H:60
A button with an "checkmark" to show its status.
Definition: Fl_Check_Button.H:42
#define FL_PATH_MAX
all path buffers should use this length
Definition: filename.H:38
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:155
int Fl_Fontsize
Size of a font in pixels.
Definition: Enumerations.H:746
Fl_Check_Button * showHiddenButton
When checked, hidden files (i.e., filename begins with dot) are displayed.
Definition: Fl_File_Chooser.H:90
static const char * manage_favorites_label
[standard text may be customized at run-time]
Definition: Fl_File_Chooser.H:195
A button that is used to pop up a menu.
Definition: Fl_Choice.H:76
unsigned int Fl_Color
an FLTK color value
Definition: Enumerations.H:774
static const char * preview_label
[standard text may be customized at run-time]
Definition: Fl_File_Chooser.H:207
int Fl_Font
A font number is an index into the internal font table.
Definition: Enumerations.H:717
static Fl_File_Sort_F * sort
the sort function that is used when loading the contents of a directory.
Definition: Fl_File_Chooser.H:224
int value(int v)
Sets the current value of the button.
Definition: Fl_Button.cxx:41
void fl_file_chooser_callback(void(*cb)(const char *))
Set the file chooser callback.
Definition: fl_file_dir.cxx:44
static const char * custom_filter_label
[standard text may be customized at run-time]
Definition: Fl_File_Chooser.H:175
static const char * filesystems_label
[standard text may be customized at run-time]
Definition: Fl_File_Chooser.H:191
void fl_file_chooser_ok_label(const char *l)
Set the "OK" button label.
Definition: fl_file_dir.cxx:54
static const char * filename_label
[standard text may be customized at run-time]
Definition: Fl_File_Chooser.H:187
Buttons generate callbacks when they are clicked by the user.
Definition: Fl_Button.H:78
static const char * existing_file_label
[standard text may be customized at run-time]
Definition: Fl_File_Chooser.H:179
unsigned char uchar
unsigned char
Definition: fl_types.h:30