FLTK 1.4.4: Fl_File_Chooser.H Source File

FLTK 1.4.4

Loading...
Searching...
No Matches
Fl_File_Chooser.H
1//
2// Fl_File_Chooser dialog for the Fast Light Tool Kit (FLTK).
3//
4// Copyright 1998-2024 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.0404
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 <FL/Fl_Group.H>
31#include <FL/Fl_Choice.H>
32#include <FL/Fl_Menu_Button.H>
33#include <FL/Fl_Button.H>
34#include <FL/Fl_Preferences.H>
35#include <FL/Fl_Tile.H>
36#include <FL/Fl_File_Browser.H>
37#include <FL/Fl_Box.H>
38#include <FL/Fl_Check_Button.H>
39#include <FL/Fl_File_Input.H>
40#include <FL/Fl_Return_Button.H>
41#include <FL/fl_ask.H>
42
43 class FL_EXPORT Fl_File_Chooser {
44public:
49 enum Type {
50 SINGLE = 0,
51 MULTI = 1,
52 CREATE = 2,
55 DIRECTORY = 4
56 };
57private:
58 static Fl_Preferences *prefs_;
59 void (*callback_)(Fl_File_Chooser*, void *);
60 void *data_;
61 char directory_[FL_PATH_MAX];
62 char pattern_[FL_PATH_MAX];
63 char preview_text_[2048];
64 int type_;
65 void favoritesButtonCB();
66 void favoritesCB(Fl_Widget *w);
67 void fileListCB();
68 void fileNameCB();
69 void newdir();
70 static void previewCB(Fl_File_Chooser *fc);
71 void showChoiceCB();
72 void update_favorites();
73 void update_preview();
74public:
75 Fl_File_Chooser(const char *pathname, const char *pattern, int type_val, const char *title);
76private:
77 Fl_Double_Window *window;
78 inline void cb_window_i(Fl_Double_Window*, void*);
79 static void cb_window(Fl_Double_Window*, void*);
80 Fl_Choice *showChoice;
81 inline void cb_showChoice_i(Fl_Choice*, void*);
82 static void cb_showChoice(Fl_Choice*, void*);
83 Fl_Menu_Button *favoritesButton;
84 inline void cb_favoritesButton_i(Fl_Menu_Button*, void*);
85 static void cb_favoritesButton(Fl_Menu_Button*, void*);
86public:
87 Fl_Button *newButton;
88private:
89 inline void cb_newButton_i(Fl_Button*, void*);
90 static void cb_newButton(Fl_Button*, void*);
91 inline void cb__i(Fl_Tile*, void*);
92 static void cb_(Fl_Tile*, void*);
93 Fl_File_Browser *fileList;
94 inline void cb_fileList_i(Fl_File_Browser*, void*);
95 static void cb_fileList(Fl_File_Browser*, void*);
96 Fl_Box *errorBox;
97 Fl_Box *previewBox;
98public:
99 Fl_Check_Button *previewButton;
100private:
101 inline void cb_previewButton_i(Fl_Check_Button*, void*);
102 static void cb_previewButton(Fl_Check_Button*, void*);
103public:
104 Fl_Check_Button *showHiddenButton;
105private:
106 inline void cb_showHiddenButton_i(Fl_Check_Button*, void*);
107 static void cb_showHiddenButton(Fl_Check_Button*, void*);
108 Fl_File_Input *fileName;
109 inline void cb_fileName_i(Fl_File_Input*, void*);
110 static void cb_fileName(Fl_File_Input*, void*);
111 Fl_Return_Button *okButton;
112 inline void cb_okButton_i(Fl_Return_Button*, void*);
113 static void cb_okButton(Fl_Return_Button*, void*);
114 Fl_Button *cancelButton;
115 inline void cb_cancelButton_i(Fl_Button*, void*);
116 static void cb_cancelButton(Fl_Button*, void*);
117 Fl_Double_Window *favWindow;
118 Fl_File_Browser *favList;
119 inline void cb_favList_i(Fl_File_Browser*, void*);
120 static void cb_favList(Fl_File_Browser*, void*);
121 Fl_Button *favUpButton;
122 inline void cb_favUpButton_i(Fl_Button*, void*);
123 static void cb_favUpButton(Fl_Button*, void*);
124 Fl_Button *favDeleteButton;
125 inline void cb_favDeleteButton_i(Fl_Button*, void*);
126 static void cb_favDeleteButton(Fl_Button*, void*);
127 Fl_Button *favDownButton;
128 inline void cb_favDownButton_i(Fl_Button*, void*);
129 static void cb_favDownButton(Fl_Button*, void*);
130 Fl_Button *favCancelButton;
131 inline void cb_favCancelButton_i(Fl_Button*, void*);
132 static void cb_favCancelButton(Fl_Button*, void*);
133 Fl_Return_Button *favOkButton;
134 inline void cb_favOkButton_i(Fl_Return_Button*, void*);
135 static void cb_favOkButton(Fl_Return_Button*, void*);
136public:
137 ~Fl_File_Chooser();
138 void callback(void (*cb)(Fl_File_Chooser *, void *), void *d = 0);
139 void color(Fl_Color c);
140 Fl_Color color();
141 int count();
142 void directory(const char *d);
143 char * directory();
144 void filter(const char *p);
145 const char * filter();
146 int filter_value();
147 void filter_value(int f);
148 void iconsize(uchar s);
149 uchar iconsize();
150 void label(const char *l);
151 const char * label();
152 void ok_label(const char *l);
153 const char * ok_label();
154 void preview(int e);
155 int preview() const { return previewButton->value(); }
156private:
157 void showHidden(int e);
158 void remove_hidden_files();
159public:
160 void rescan();
161 void rescan_keep_filename();
162 void show();
163 void hide();
164 int shown();
165 void textcolor(Fl_Color c);
166 Fl_Color textcolor();
167 void textfont(Fl_Font f);
168 Fl_Font textfont();
169 void textsize(Fl_Fontsize s);
170 Fl_Fontsize textsize();
171 void type(int t);
172 int type();
173 void * user_data() const;
174 void user_data(void *d);
175 const char *value(int f = 1);
176 void value(const char *filename);
177 int visible();
178 void position(int x, int y);
179 int x() const;
180 int y() const;
181 int w() const;
182 int h() const;
183 void size(int w, int h);
184 void resize(int x, int y, int w, int h);
188 static const char *add_favorites_label;
192 static const char *all_files_label;
196 static const char *custom_filter_label;
200 static const char *existing_file_label;
204 static const char *favorites_label;
208 static const char *filename_label;
212 static const char *filesystems_label;
216 static const char *manage_favorites_label;
220 static const char *new_directory_label;
224 static const char *new_directory_tooltip;
228 static const char *preview_label;
232 static const char *save_label;
236 static const char *show_label;
240 static const char *hidden_label;
245 static Fl_File_Sort_F *sort;
246private:
247 Fl_Widget* ext_group;
248public:
249 Fl_Widget* add_extra(Fl_Widget* gr);
250protected:
251 void show_error_box(int val);
252};
253FL_EXPORT char *fl_dir_chooser(const char *message,const char *fname,int relative=0);
254FL_EXPORT char *fl_file_chooser(const char *message,const char *pat,const char *fname,int relative=0);
255FL_EXPORT void fl_file_chooser_callback(void (*cb)(const char*));
256FL_EXPORT void fl_file_chooser_ok_label(const char*l);
257#endif
Fl_Font
int Fl_Font
A font number is an index into the internal font table.
Definition Enumerations.H:1063
Fl_Color
unsigned int Fl_Color
An FLTK color value; see also Colors.
Definition Enumerations.H:1120
Fl_Fontsize
int Fl_Fontsize
Size of a font in pixels.
Definition Enumerations.H:1092
Fl.H
Fl static class.
Fl_Box.H
Fl_Box widget.
Fl_Group.H
Fl_Group and Fl_End classes.
Fl_Box
This widget simply draws its box, and possibly its label.
Definition Fl_Box.H:34
Fl_Button
Buttons generate callbacks when they are clicked by the user.
Definition Fl_Button.H:76
Fl_Check_Button
A button with a "checkmark" to show its status.
Definition Fl_Check_Button.H:28
Fl_Choice
A button that is used to pop up a menu.
Definition Fl_Choice.H:104
Fl_Double_Window
The Fl_Double_Window provides a double-buffered window.
Definition Fl_Double_Window.H:31
Fl_File_Browser
The Fl_File_Browser widget displays a list of filenames, optionally with file-specific icons.
Definition Fl_File_Browser.H:37
Fl_File_Chooser
The Fl_File_Chooser widget displays a standard file selection dialog that supports various selection ...
Definition Fl_File_Chooser.H:43
Fl_File_Chooser::preview_label
static const char * preview_label
[standard text may be customized at run-time]
Definition Fl_File_Chooser.H:228
Fl_File_Chooser::add_extra
Fl_Widget * add_extra(Fl_Widget *gr)
Adds an extra widget at the bottom of the Fl_File_Chooser window.
Definition Fl_File_Chooser.cxx:482
Fl_File_Chooser::favorites_label
static const char * favorites_label
[standard text may be customized at run-time]
Definition Fl_File_Chooser.H:204
Fl_File_Chooser::callback
void callback(void(*cb)(Fl_File_Chooser *, void *), void *d=0)
Sets the file chooser callback cb and associated data d.
Definition Fl_File_Chooser.cxx:335
Fl_File_Chooser::hidden_label
static const char * hidden_label
[standard text may be customized at run-time]
Definition Fl_File_Chooser.H:240
Fl_File_Chooser::filter_value
int filter_value()
Gets the current filename filter selection.
Definition Fl_File_Chooser.cxx:356
Fl_File_Chooser::manage_favorites_label
static const char * manage_favorites_label
[standard text may be customized at run-time]
Definition Fl_File_Chooser.H:216
Fl_File_Chooser::preview
int preview() const
Returns the current state of the preview box.
Definition Fl_File_Chooser.H:155
Fl_File_Chooser::new_directory_label
static const char * new_directory_label
[standard text may be customized at run-time]
Definition Fl_File_Chooser.H:220
Fl_File_Chooser::add_favorites_label
static const char * add_favorites_label
[standard text may be customized at run-time]
Definition Fl_File_Chooser.H:188
Fl_File_Chooser::color
void color(Fl_Color c)
Sets the background color of the Fl_File_Browser list.
Definition Fl_File_Chooser.cxx:340
Fl_File_Chooser::all_files_label
static const char * all_files_label
[standard text may be customized at run-time]
Definition Fl_File_Chooser.H:192
Fl_File_Chooser::filesystems_label
static const char * filesystems_label
[standard text may be customized at run-time]
Definition Fl_File_Chooser.H:212
Fl_File_Chooser::ok_label
void ok_label(const char *l)
Sets the label for the "ok" button in the Fl_File_Chooser.
Definition Fl_File_Chooser.cxx:381
Fl_File_Chooser::filename_label
static const char * filename_label
[standard text may be customized at run-time]
Definition Fl_File_Chooser.H:208
Fl_File_Chooser::showHiddenButton
Fl_Check_Button * showHiddenButton
When checked, hidden files (i.e., filename begins with dot) are displayed.
Definition Fl_File_Chooser.H:104
Fl_File_Chooser::show_label
static const char * show_label
[standard text may be customized at run-time]
Definition Fl_File_Chooser.H:236
Fl_File_Chooser::iconsize
void iconsize(uchar s)
Sets the size of the icons in the Fl_File_Browser.
Definition Fl_File_Chooser.cxx:365
Fl_File_Chooser::show_error_box
void show_error_box(int val)
Show error box if val=1, hide if val=0.
Definition Fl_File_Chooser.cxx:512
Fl_File_Chooser::custom_filter_label
static const char * custom_filter_label
[standard text may be customized at run-time]
Definition Fl_File_Chooser.H:196
Fl_File_Chooser::directory
void directory(const char *d)
Sets the current directory.
Definition Fl_File_Chooser2.cxx:425
Fl_File_Chooser::previewButton
Fl_Check_Button * previewButton
The "preview" button is exported so that application developers can control the appearance and use.
Definition Fl_File_Chooser.H:99
Fl_File_Chooser::Fl_File_Chooser
Fl_File_Chooser(const char *pathname, const char *pattern, int type_val, const char *title)
The constructor creates the Fl_File_Chooser dialog shown.
Definition Fl_File_Chooser.cxx:168
Fl_File_Chooser::count
int count()
Returns the number of selected files.
Definition Fl_File_Chooser2.cxx:391
Fl_File_Chooser::sort
static Fl_File_Sort_F * sort
the sort function that is used when loading the contents of a directory.
Definition Fl_File_Chooser.H:245
Fl_File_Chooser::newButton
Fl_Button * newButton
The "new directory" button is exported so that application developers can control the appearance and ...
Definition Fl_File_Chooser.H:87
Fl_File_Chooser::filter
void filter(const char *p)
Sets the current filename filter patterns.
Definition Fl_File_Chooser2.cxx:959
Fl_File_Chooser::new_directory_tooltip
static const char * new_directory_tooltip
[standard text may be customized at run-time]
Definition Fl_File_Chooser.H:224
Fl_File_Chooser::Type
Type
Determines the type of file chooser presented to the user.
Definition Fl_File_Chooser.H:49
Fl_File_Chooser::DIRECTORY
@ DIRECTORY
Select a single, existing directory. Can be combined with CREATE.
Definition Fl_File_Chooser.H:55
Fl_File_Chooser::SINGLE
@ SINGLE
Select a single, existing file.
Definition Fl_File_Chooser.H:50
Fl_File_Chooser::MULTI
@ MULTI
Select one or more existing files.
Definition Fl_File_Chooser.H:51
Fl_File_Chooser::CREATE
@ CREATE
When used alone, select a single, existing file or specify a new filename.
Definition Fl_File_Chooser.H:52
Fl_File_Chooser::existing_file_label
static const char * existing_file_label
[standard text may be customized at run-time]
Definition Fl_File_Chooser.H:200
Fl_File_Chooser::preview
void preview(int e)
Enable or disable the preview tile.
Definition Fl_File_Chooser2.cxx:1038
Fl_File_Chooser::save_label
static const char * save_label
[standard text may be customized at run-time]
Definition Fl_File_Chooser.H:232
Fl_File_Chooser::label
void label(const char *l)
Sets the title bar text for the Fl_File_Chooser.
Definition Fl_File_Chooser.cxx:373
Fl_File_Input
This widget displays a pathname in a text input field.
Definition Fl_File_Input.H:45
Fl_Preferences
Fl_Preferences store user settings between application starts.
Definition Fl_Preferences.H:125
Fl_Return_Button
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
Fl_Tile
The Fl_Tile class lets you resize its children by dragging the border between them.
Definition Fl_Tile.H:27
Fl_Widget
Fl_Widget is the base class for all widgets in FLTK.
Definition Fl_Widget.H:112
fl_ask.H
API for common dialogs.
uchar
unsigned char uchar
unsigned char
Definition fl_types.h:30
FL_PATH_MAX
#define FL_PATH_MAX
all path buffers should use this length
Definition filename.H:45
Fl_File_Sort_F
int Fl_File_Sort_F(struct dirent **, struct dirent **)
File sorting function.
Definition filename.H:114