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