FLTK 1.3.4
Fl_File_Chooser.H
1 //
2 // "$Id: Fl_File_Chooser.fl 10973 2015-12-19 06:35:26Z manolo $"
3 //
4 // Fl_File_Chooser dialog for the Fast Light Tool Kit (FLTK).
5 //
6 // Copyright 1998-2015 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 // DO NOT EDIT FL/Fl_File_Chooser.H and src/Fl_File_Chooser.cxx !!!
20 // =======================================================================
21 // Please use fluid to change src/Fl_File_Chooser.fl interactively
22 // and then use fluid to "write code" or edit and use fluid -c .
23 // =======================================================================
24 //
25 
26 // generated by Fast Light User Interface Designer (fluid) version 1.0304
27 
28 #ifndef Fl_File_Chooser_H
29 #define Fl_File_Chooser_H
30 #include <FL/Fl.H>
31 #include <FL/Fl_Double_Window.H>
32 #include <stdio.h>
33 #include <stdlib.h>
34 #include <string.h>
35 #include <FL/Fl_Group.H>
36 #include <FL/Fl_Choice.H>
37 #include <FL/Fl_Menu_Button.H>
38 #include <FL/Fl_Button.H>
39 #include <FL/Fl_Preferences.H>
40 #include <FL/Fl_Tile.H>
41 #include <FL/Fl_File_Browser.H>
42 #include <FL/Fl_Box.H>
43 #include <FL/Fl_Check_Button.H>
44 #include <FL/Fl_File_Input.H>
45 #include <FL/Fl_Return_Button.H>
46 #include <FL/fl_ask.H>
47 
48 class FL_EXPORT Fl_File_Chooser {
49 public:
50  enum { SINGLE = 0, MULTI = 1, CREATE = 2, DIRECTORY = 4 };
51 private:
52  static Fl_Preferences *prefs_;
53  void (*callback_)(Fl_File_Chooser*, void *);
54  void *data_;
55  char directory_[FL_PATH_MAX];
56  char pattern_[FL_PATH_MAX];
57  char preview_text_[2048];
58  int type_;
59  void favoritesButtonCB();
60  void favoritesCB(Fl_Widget *w);
61  void fileListCB();
62  void fileNameCB();
63  void newdir();
64  static void previewCB(Fl_File_Chooser *fc);
65  void showChoiceCB();
66  void update_favorites();
67  void update_preview();
68 public:
69  Fl_File_Chooser(const char *d, const char *p, int t, const char *title);
70 private:
71  Fl_Double_Window *window;
72  inline void cb_window_i(Fl_Double_Window*, void*);
73  static void cb_window(Fl_Double_Window*, void*);
74  Fl_Choice *showChoice;
75  inline void cb_showChoice_i(Fl_Choice*, void*);
76  static void cb_showChoice(Fl_Choice*, void*);
77  Fl_Menu_Button *favoritesButton;
78  inline void cb_favoritesButton_i(Fl_Menu_Button*, void*);
79  static void cb_favoritesButton(Fl_Menu_Button*, void*);
80 public:
82 private:
83  inline void cb_newButton_i(Fl_Button*, void*);
84  static void cb_newButton(Fl_Button*, void*);
85  inline void cb__i(Fl_Tile*, void*);
86  static void cb_(Fl_Tile*, void*);
87  Fl_File_Browser *fileList;
88  inline void cb_fileList_i(Fl_File_Browser*, void*);
89  static void cb_fileList(Fl_File_Browser*, void*);
90  Fl_Box *previewBox;
91 public:
93 private:
94  inline void cb_previewButton_i(Fl_Check_Button*, void*);
95  static void cb_previewButton(Fl_Check_Button*, void*);
96 public:
98 private:
99  inline void cb_showHiddenButton_i(Fl_Check_Button*, void*);
100  static void cb_showHiddenButton(Fl_Check_Button*, void*);
101  Fl_File_Input *fileName;
102  inline void cb_fileName_i(Fl_File_Input*, void*);
103  static void cb_fileName(Fl_File_Input*, void*);
104  Fl_Return_Button *okButton;
105  inline void cb_okButton_i(Fl_Return_Button*, void*);
106  static void cb_okButton(Fl_Return_Button*, void*);
107  Fl_Button *cancelButton;
108  inline void cb_cancelButton_i(Fl_Button*, void*);
109  static void cb_cancelButton(Fl_Button*, void*);
110  Fl_Double_Window *favWindow;
111  Fl_File_Browser *favList;
112  inline void cb_favList_i(Fl_File_Browser*, void*);
113  static void cb_favList(Fl_File_Browser*, void*);
114  Fl_Button *favUpButton;
115  inline void cb_favUpButton_i(Fl_Button*, void*);
116  static void cb_favUpButton(Fl_Button*, void*);
117  Fl_Button *favDeleteButton;
118  inline void cb_favDeleteButton_i(Fl_Button*, void*);
119  static void cb_favDeleteButton(Fl_Button*, void*);
120  Fl_Button *favDownButton;
121  inline void cb_favDownButton_i(Fl_Button*, void*);
122  static void cb_favDownButton(Fl_Button*, void*);
123  Fl_Button *favCancelButton;
124  inline void cb_favCancelButton_i(Fl_Button*, void*);
125  static void cb_favCancelButton(Fl_Button*, void*);
126  Fl_Return_Button *favOkButton;
127  inline void cb_favOkButton_i(Fl_Return_Button*, void*);
128  static void cb_favOkButton(Fl_Return_Button*, void*);
129 public:
130  ~Fl_File_Chooser();
131  void callback(void (*cb)(Fl_File_Chooser *, void *), void *d = 0);
132  void color(Fl_Color c);
133  Fl_Color color();
134  int count();
135  void directory(const char *d);
136  char * directory();
137  void filter(const char *p);
138  const char * filter();
139  int filter_value();
140  void filter_value(int f);
141  void hide();
142  void iconsize(uchar s);
143  uchar iconsize();
144  void label(const char *l);
145  const char * label();
146  void ok_label(const char *l);
147  const char * ok_label();
148  void preview(int e);
149  int preview() const { return previewButton->value(); };
150 private:
151  void showHidden(int e);
152  void remove_hidden_files();
153 public:
154  void rescan();
155  void rescan_keep_filename();
156  void show();
157  int shown();
158  void textcolor(Fl_Color c);
159  Fl_Color textcolor();
160  void textfont(Fl_Font f);
161  Fl_Font textfont();
162  void textsize(Fl_Fontsize s);
163  Fl_Fontsize textsize();
164  void type(int t);
165  int type();
166  void * user_data() const;
167  void user_data(void *d);
168  const char *value(int f = 1);
169  void value(const char *filename);
170  int visible();
174  static const char *add_favorites_label;
178  static const char *all_files_label;
182  static const char *custom_filter_label;
186  static const char *existing_file_label;
190  static const char *favorites_label;
194  static const char *filename_label;
198  static const char *filesystems_label;
202  static const char *manage_favorites_label;
206  static const char *new_directory_label;
210  static const char *new_directory_tooltip;
214  static const char *preview_label;
218  static const char *save_label;
222  static const char *show_label;
226  static const char *hidden_label;
232 private:
233  Fl_Widget* ext_group;
234 public:
235  Fl_Widget* add_extra(Fl_Widget* gr);
236 };
237 FL_EXPORT char *fl_dir_chooser(const char *message,const char *fname,int relative=0);
238 FL_EXPORT char *fl_file_chooser(const char *message,const char *pat,const char *fname,int relative=0);
239 FL_EXPORT void fl_file_chooser_callback(void (*cb)(const char*));
240 FL_EXPORT void fl_file_chooser_ok_label(const char*l);
241 #endif
242 
243 //
244 // End of "$Id: Fl_File_Chooser.fl 10973 2015-12-19 06:35:26Z manolo $".
245 //
Fl_Widget is the base class for all widgets in FLTK.
Definition: Fl_Widget.H:101
static const char * new_directory_label
[standard text may be customized at run-time]
Definition: Fl_File_Chooser.H:206
The Fl_Tile class lets you resize its children by dragging the border between them.
Definition: Fl_Tile.H:29
static const char * show_label
[standard text may be customized at run-time]
Definition: Fl_File_Chooser.H:222
static const char * save_label
[standard text may be customized at run-time]
Definition: Fl_File_Chooser.H:218
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:92
static const char * favorites_label
[standard text may be customized at run-time]
Definition: Fl_File_Chooser.H:190
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:89
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:58
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:178
static const char * hidden_label
[standard text may be customized at run-time]
Definition: Fl_File_Chooser.H:226
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:149
Fl_Button * newButton
The "new directory" button is exported so that application developers can control the appearance and ...
Definition: Fl_File_Chooser.H:81
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:48
static const char * add_favorites_label
[standard text may be customized at run-time]
Definition: Fl_File_Chooser.H:174
static const char * new_directory_tooltip
[standard text may be customized at run-time]
Definition: Fl_File_Chooser.H:210
Fl_Preferences provides methods to store user settings between application starts.
Definition: Fl_Preferences.H:60
A button with a "checkmark" to show its status.
Definition: Fl_Check_Button.H:30
#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:167
int Fl_Fontsize
Size of a font in pixels.
Definition: Enumerations.H:906
Fl_Check_Button * showHiddenButton
When checked, hidden files (i.e., filename begins with dot) are displayed.
Definition: Fl_File_Chooser.H:97
static const char * manage_favorites_label
[standard text may be customized at run-time]
Definition: Fl_File_Chooser.H:202
A button that is used to pop up a menu.
Definition: Fl_Choice.H:83
unsigned int Fl_Color
An FLTK color value; see also Colors.
Definition: Enumerations.H:934
static const char * preview_label
[standard text may be customized at run-time]
Definition: Fl_File_Chooser.H:214
int Fl_Font
A font number is an index into the internal font table.
Definition: Enumerations.H:877
static Fl_File_Sort_F * sort
the sort function that is used when loading the contents of a directory.
Definition: Fl_File_Chooser.H:231
void fl_file_chooser_callback(void(*cb)(const char *))
Set the file chooser callback.
Definition: fl_file_dir.cxx:60
static const char * custom_filter_label
[standard text may be customized at run-time]
Definition: Fl_File_Chooser.H:182
API for common dialogs.
static const char * filesystems_label
[standard text may be customized at run-time]
Definition: Fl_File_Chooser.H:198
void fl_file_chooser_ok_label(const char *l)
Set the "OK" button label.
Definition: fl_file_dir.cxx:70
static const char * filename_label
[standard text may be customized at run-time]
Definition: Fl_File_Chooser.H:194
Buttons generate callbacks when they are clicked by the user.
Definition: Fl_Button.H:79
static const char * existing_file_label
[standard text may be customized at run-time]
Definition: Fl_File_Chooser.H:186
unsigned char uchar
unsigned char
Definition: fl_types.h:30