2005-03-25 18:20:26 +03:00
|
|
|
//
|
|
|
|
// Fl_File_Chooser dialog for the Fast Light Tool Kit (FLTK).
|
|
|
|
//
|
2024-01-14 03:42:05 +03:00
|
|
|
// Copyright 1998-2024 by Bill Spitzak and others.
|
2005-03-25 18:20:26 +03:00
|
|
|
//
|
2011-07-19 08:49:30 +04:00
|
|
|
// This library is free software. Distribution and use rights are outlined in
|
|
|
|
// the file "COPYING" which should have been included with this file. If this
|
|
|
|
// file is missing or damaged, see the license at:
|
|
|
|
//
|
2020-07-01 19:03:10 +03:00
|
|
|
// https://www.fltk.org/COPYING.php
|
2005-03-25 18:20:26 +03:00
|
|
|
//
|
2020-07-01 19:03:10 +03:00
|
|
|
// Please see the following page on how to report bugs and issues:
|
2005-03-25 18:20:26 +03:00
|
|
|
//
|
2020-07-01 19:03:10 +03:00
|
|
|
// https://www.fltk.org/bugs.php
|
2005-03-25 18:20:26 +03:00
|
|
|
//
|
2016-09-20 16:35:44 +03:00
|
|
|
// =======================================================================
|
2014-10-05 15:28:29 +04:00
|
|
|
// DO NOT EDIT FL/Fl_File_Chooser.H and src/Fl_File_Chooser.cxx !!!
|
2016-09-20 16:35:44 +03:00
|
|
|
// =======================================================================
|
2014-10-05 15:28:29 +04:00
|
|
|
// Please use fluid to change src/Fl_File_Chooser.fl interactively
|
|
|
|
// and then use fluid to "write code" or edit and use fluid -c .
|
2016-09-20 16:35:44 +03:00
|
|
|
// =======================================================================
|
2014-10-05 15:28:29 +04:00
|
|
|
//
|
2005-03-25 18:20:26 +03:00
|
|
|
|
2016-01-30 03:56:42 +03:00
|
|
|
// generated by Fast Light User Interface Designer (fluid) version 1.0400
|
2001-08-02 01:24:49 +04:00
|
|
|
|
2001-09-29 18:38:59 +04:00
|
|
|
#ifndef Fl_File_Chooser_H
|
|
|
|
#define Fl_File_Chooser_H
|
2001-08-02 01:24:49 +04:00
|
|
|
#include <FL/Fl.H>
|
2003-09-08 21:11:45 +04:00
|
|
|
#include <FL/Fl_Double_Window.H>
|
2002-06-07 19:06:32 +04:00
|
|
|
#include <FL/Fl_Group.H>
|
2002-04-19 00:37:29 +04:00
|
|
|
#include <FL/Fl_Choice.H>
|
2002-06-07 19:06:32 +04:00
|
|
|
#include <FL/Fl_Menu_Button.H>
|
2001-08-02 20:17:04 +04:00
|
|
|
#include <FL/Fl_Button.H>
|
2002-06-07 19:06:32 +04:00
|
|
|
#include <FL/Fl_Preferences.H>
|
|
|
|
#include <FL/Fl_Tile.H>
|
2002-04-19 00:37:29 +04:00
|
|
|
#include <FL/Fl_File_Browser.H>
|
2002-06-07 19:06:32 +04:00
|
|
|
#include <FL/Fl_Box.H>
|
|
|
|
#include <FL/Fl_Check_Button.H>
|
2002-05-01 01:50:16 +04:00
|
|
|
#include <FL/Fl_File_Input.H>
|
2002-04-19 00:37:29 +04:00
|
|
|
#include <FL/Fl_Return_Button.H>
|
2002-06-07 19:06:32 +04:00
|
|
|
#include <FL/fl_ask.H>
|
2001-08-02 01:24:49 +04:00
|
|
|
|
2002-07-15 01:25:39 +04:00
|
|
|
class FL_EXPORT Fl_File_Chooser {
|
2001-08-02 01:24:49 +04:00
|
|
|
public:
|
2023-12-04 05:10:33 +03:00
|
|
|
/**
|
2023-12-05 19:54:01 +03:00
|
|
|
\enum Type
|
|
|
|
Determines the type of file chooser presented to the user.
|
2023-12-04 05:10:33 +03:00
|
|
|
*/
|
|
|
|
enum Type {
|
|
|
|
SINGLE = 0, ///< Select a single, existing file.
|
|
|
|
MULTI = 1, ///< Select one or more existing files.
|
|
|
|
CREATE = 2, ///< When used alone, select a single, existing file or specify a new filename.
|
|
|
|
///< Can be combined with DIRECTORY (e.g. CREATE|DIRECTORY) to have the same
|
|
|
|
///< effect for directories.
|
|
|
|
DIRECTORY = 4 ///< Select a single, existing directory. Can be combined with CREATE.
|
|
|
|
};
|
2002-06-07 19:06:32 +04:00
|
|
|
private:
|
2020-07-01 19:03:10 +03:00
|
|
|
static Fl_Preferences *prefs_;
|
|
|
|
void (*callback_)(Fl_File_Chooser*, void *);
|
|
|
|
void *data_;
|
|
|
|
char directory_[FL_PATH_MAX];
|
|
|
|
char pattern_[FL_PATH_MAX];
|
|
|
|
char preview_text_[2048];
|
|
|
|
int type_;
|
|
|
|
void favoritesButtonCB();
|
|
|
|
void favoritesCB(Fl_Widget *w);
|
|
|
|
void fileListCB();
|
|
|
|
void fileNameCB();
|
|
|
|
void newdir();
|
|
|
|
static void previewCB(Fl_File_Chooser *fc);
|
|
|
|
void showChoiceCB();
|
|
|
|
void update_favorites();
|
|
|
|
void update_preview();
|
2002-06-07 19:06:32 +04:00
|
|
|
public:
|
2023-12-06 23:14:45 +03:00
|
|
|
Fl_File_Chooser(const char *pathname, const char *pattern, int type_val, const char *title);
|
2001-08-02 01:24:49 +04:00
|
|
|
private:
|
2003-09-08 21:11:45 +04:00
|
|
|
Fl_Double_Window *window;
|
2014-10-05 15:28:29 +04:00
|
|
|
inline void cb_window_i(Fl_Double_Window*, void*);
|
2003-09-08 21:11:45 +04:00
|
|
|
static void cb_window(Fl_Double_Window*, void*);
|
2002-06-07 19:06:32 +04:00
|
|
|
Fl_Choice *showChoice;
|
2014-10-05 15:28:29 +04:00
|
|
|
inline void cb_showChoice_i(Fl_Choice*, void*);
|
2002-06-07 19:06:32 +04:00
|
|
|
static void cb_showChoice(Fl_Choice*, void*);
|
|
|
|
Fl_Menu_Button *favoritesButton;
|
2014-10-05 15:28:29 +04:00
|
|
|
inline void cb_favoritesButton_i(Fl_Menu_Button*, void*);
|
2002-06-07 19:06:32 +04:00
|
|
|
static void cb_favoritesButton(Fl_Menu_Button*, void*);
|
2002-07-23 19:14:17 +04:00
|
|
|
public:
|
2001-08-02 20:17:04 +04:00
|
|
|
Fl_Button *newButton;
|
2002-07-23 19:14:17 +04:00
|
|
|
private:
|
2014-10-05 15:28:29 +04:00
|
|
|
inline void cb_newButton_i(Fl_Button*, void*);
|
2001-08-02 20:17:04 +04:00
|
|
|
static void cb_newButton(Fl_Button*, void*);
|
2014-10-05 15:28:29 +04:00
|
|
|
inline void cb__i(Fl_Tile*, void*);
|
2002-06-07 19:06:32 +04:00
|
|
|
static void cb_(Fl_Tile*, void*);
|
2002-04-19 00:37:29 +04:00
|
|
|
Fl_File_Browser *fileList;
|
2014-10-05 15:28:29 +04:00
|
|
|
inline void cb_fileList_i(Fl_File_Browser*, void*);
|
2002-04-19 00:37:29 +04:00
|
|
|
static void cb_fileList(Fl_File_Browser*, void*);
|
2020-07-11 07:49:00 +03:00
|
|
|
Fl_Box *errorBox;
|
2002-06-07 19:06:32 +04:00
|
|
|
Fl_Box *previewBox;
|
2002-07-23 19:14:17 +04:00
|
|
|
public:
|
2002-06-07 19:06:32 +04:00
|
|
|
Fl_Check_Button *previewButton;
|
2002-07-23 19:14:17 +04:00
|
|
|
private:
|
2014-10-05 15:28:29 +04:00
|
|
|
inline void cb_previewButton_i(Fl_Check_Button*, void*);
|
2002-06-07 19:06:32 +04:00
|
|
|
static void cb_previewButton(Fl_Check_Button*, void*);
|
2011-06-06 20:11:22 +04:00
|
|
|
public:
|
|
|
|
Fl_Check_Button *showHiddenButton;
|
|
|
|
private:
|
2014-10-05 15:28:29 +04:00
|
|
|
inline void cb_showHiddenButton_i(Fl_Check_Button*, void*);
|
2011-06-06 20:11:22 +04:00
|
|
|
static void cb_showHiddenButton(Fl_Check_Button*, void*);
|
2002-05-01 01:50:16 +04:00
|
|
|
Fl_File_Input *fileName;
|
2014-10-05 15:28:29 +04:00
|
|
|
inline void cb_fileName_i(Fl_File_Input*, void*);
|
2002-05-01 01:50:16 +04:00
|
|
|
static void cb_fileName(Fl_File_Input*, void*);
|
2002-04-19 00:37:29 +04:00
|
|
|
Fl_Return_Button *okButton;
|
2014-10-05 15:28:29 +04:00
|
|
|
inline void cb_okButton_i(Fl_Return_Button*, void*);
|
2002-04-19 00:37:29 +04:00
|
|
|
static void cb_okButton(Fl_Return_Button*, void*);
|
2005-03-25 18:20:26 +03:00
|
|
|
Fl_Button *cancelButton;
|
2014-10-05 15:28:29 +04:00
|
|
|
inline void cb_cancelButton_i(Fl_Button*, void*);
|
2005-03-25 18:20:26 +03:00
|
|
|
static void cb_cancelButton(Fl_Button*, void*);
|
2003-09-08 21:11:45 +04:00
|
|
|
Fl_Double_Window *favWindow;
|
2002-06-07 19:06:32 +04:00
|
|
|
Fl_File_Browser *favList;
|
2014-10-05 15:28:29 +04:00
|
|
|
inline void cb_favList_i(Fl_File_Browser*, void*);
|
2002-06-07 19:06:32 +04:00
|
|
|
static void cb_favList(Fl_File_Browser*, void*);
|
|
|
|
Fl_Button *favUpButton;
|
2014-10-05 15:28:29 +04:00
|
|
|
inline void cb_favUpButton_i(Fl_Button*, void*);
|
2002-06-07 19:06:32 +04:00
|
|
|
static void cb_favUpButton(Fl_Button*, void*);
|
|
|
|
Fl_Button *favDeleteButton;
|
2014-10-05 15:28:29 +04:00
|
|
|
inline void cb_favDeleteButton_i(Fl_Button*, void*);
|
2002-06-07 19:06:32 +04:00
|
|
|
static void cb_favDeleteButton(Fl_Button*, void*);
|
|
|
|
Fl_Button *favDownButton;
|
2014-10-05 15:28:29 +04:00
|
|
|
inline void cb_favDownButton_i(Fl_Button*, void*);
|
2002-06-07 19:06:32 +04:00
|
|
|
static void cb_favDownButton(Fl_Button*, void*);
|
|
|
|
Fl_Button *favCancelButton;
|
2014-10-05 15:28:29 +04:00
|
|
|
inline void cb_favCancelButton_i(Fl_Button*, void*);
|
2002-06-07 19:06:32 +04:00
|
|
|
static void cb_favCancelButton(Fl_Button*, void*);
|
|
|
|
Fl_Return_Button *favOkButton;
|
2014-10-05 15:28:29 +04:00
|
|
|
inline void cb_favOkButton_i(Fl_Return_Button*, void*);
|
2002-06-07 19:06:32 +04:00
|
|
|
static void cb_favOkButton(Fl_Return_Button*, void*);
|
2001-08-02 01:24:49 +04:00
|
|
|
public:
|
2002-06-07 19:06:32 +04:00
|
|
|
~Fl_File_Chooser();
|
|
|
|
void callback(void (*cb)(Fl_File_Chooser *, void *), void *d = 0);
|
2001-08-02 01:24:49 +04:00
|
|
|
void color(Fl_Color c);
|
|
|
|
Fl_Color color();
|
2020-07-01 19:03:10 +03:00
|
|
|
int count();
|
|
|
|
void directory(const char *d);
|
2001-08-02 01:24:49 +04:00
|
|
|
char * directory();
|
2020-07-01 19:03:10 +03:00
|
|
|
void filter(const char *p);
|
2001-08-02 01:24:49 +04:00
|
|
|
const char * filter();
|
2002-07-02 01:14:20 +04:00
|
|
|
int filter_value();
|
|
|
|
void filter_value(int f);
|
2001-08-02 01:24:49 +04:00
|
|
|
void iconsize(uchar s);
|
|
|
|
uchar iconsize();
|
|
|
|
void label(const char *l);
|
|
|
|
const char * label();
|
2005-03-25 18:20:26 +03:00
|
|
|
void ok_label(const char *l);
|
|
|
|
const char * ok_label();
|
2020-07-01 19:03:10 +03:00
|
|
|
void preview(int e);
|
2021-08-27 15:52:43 +03:00
|
|
|
int preview() const { return previewButton->value(); }
|
2011-06-06 20:11:22 +04:00
|
|
|
private:
|
2020-07-01 19:03:10 +03:00
|
|
|
void showHidden(int e);
|
|
|
|
void remove_hidden_files();
|
2011-06-06 20:11:22 +04:00
|
|
|
public:
|
2020-07-01 19:03:10 +03:00
|
|
|
void rescan();
|
|
|
|
void rescan_keep_filename();
|
|
|
|
void show();
|
2024-01-14 03:42:05 +03:00
|
|
|
void hide();
|
2001-12-15 18:20:54 +03:00
|
|
|
int shown();
|
2001-08-02 01:24:49 +04:00
|
|
|
void textcolor(Fl_Color c);
|
|
|
|
Fl_Color textcolor();
|
2008-04-23 23:09:28 +04:00
|
|
|
void textfont(Fl_Font f);
|
|
|
|
Fl_Font textfont();
|
2008-08-16 01:11:21 +04:00
|
|
|
void textsize(Fl_Fontsize s);
|
|
|
|
Fl_Fontsize textsize();
|
2001-08-02 01:24:49 +04:00
|
|
|
void type(int t);
|
|
|
|
int type();
|
2005-08-08 04:50:02 +04:00
|
|
|
void * user_data() const;
|
|
|
|
void user_data(void *d);
|
2020-07-01 19:03:10 +03:00
|
|
|
const char *value(int f = 1);
|
|
|
|
void value(const char *filename);
|
2001-08-02 01:24:49 +04:00
|
|
|
int visible();
|
2022-02-12 22:46:12 +03:00
|
|
|
void position(int x, int y);
|
|
|
|
int x() const;
|
|
|
|
int y() const;
|
|
|
|
int w() const;
|
|
|
|
int h() const;
|
|
|
|
void size(int w, int h);
|
|
|
|
void resize(int x, int y, int w, int h);
|
2008-10-01 02:22:49 +04:00
|
|
|
/**
|
2015-07-09 05:09:33 +03:00
|
|
|
[standard text may be customized at run-time]
|
2008-10-01 02:22:49 +04:00
|
|
|
*/
|
2020-07-01 19:03:10 +03:00
|
|
|
static const char *add_favorites_label;
|
2008-10-01 02:22:49 +04:00
|
|
|
/**
|
2015-07-09 05:09:33 +03:00
|
|
|
[standard text may be customized at run-time]
|
2008-10-01 02:22:49 +04:00
|
|
|
*/
|
2020-07-01 19:03:10 +03:00
|
|
|
static const char *all_files_label;
|
2008-10-01 02:22:49 +04:00
|
|
|
/**
|
2015-07-09 05:09:33 +03:00
|
|
|
[standard text may be customized at run-time]
|
2008-10-01 02:22:49 +04:00
|
|
|
*/
|
2020-07-01 19:03:10 +03:00
|
|
|
static const char *custom_filter_label;
|
2008-10-01 02:22:49 +04:00
|
|
|
/**
|
2015-07-09 05:09:33 +03:00
|
|
|
[standard text may be customized at run-time]
|
2008-10-01 02:22:49 +04:00
|
|
|
*/
|
2020-07-01 19:03:10 +03:00
|
|
|
static const char *existing_file_label;
|
2008-10-01 02:22:49 +04:00
|
|
|
/**
|
2015-07-09 05:09:33 +03:00
|
|
|
[standard text may be customized at run-time]
|
2008-10-01 02:22:49 +04:00
|
|
|
*/
|
2020-07-01 19:03:10 +03:00
|
|
|
static const char *favorites_label;
|
2008-10-01 02:22:49 +04:00
|
|
|
/**
|
2015-07-09 05:09:33 +03:00
|
|
|
[standard text may be customized at run-time]
|
2008-10-01 02:22:49 +04:00
|
|
|
*/
|
2020-07-01 19:03:10 +03:00
|
|
|
static const char *filename_label;
|
2008-10-01 02:22:49 +04:00
|
|
|
/**
|
2015-07-09 05:09:33 +03:00
|
|
|
[standard text may be customized at run-time]
|
2008-10-01 02:22:49 +04:00
|
|
|
*/
|
2020-07-01 19:03:10 +03:00
|
|
|
static const char *filesystems_label;
|
2008-10-01 02:22:49 +04:00
|
|
|
/**
|
2015-07-09 05:09:33 +03:00
|
|
|
[standard text may be customized at run-time]
|
2008-10-01 02:22:49 +04:00
|
|
|
*/
|
2020-07-01 19:03:10 +03:00
|
|
|
static const char *manage_favorites_label;
|
2008-10-01 02:22:49 +04:00
|
|
|
/**
|
2015-07-09 05:09:33 +03:00
|
|
|
[standard text may be customized at run-time]
|
2008-10-01 02:22:49 +04:00
|
|
|
*/
|
2020-07-01 19:03:10 +03:00
|
|
|
static const char *new_directory_label;
|
2008-10-01 02:22:49 +04:00
|
|
|
/**
|
2015-07-09 05:09:33 +03:00
|
|
|
[standard text may be customized at run-time]
|
2008-10-01 02:22:49 +04:00
|
|
|
*/
|
2020-07-01 19:03:10 +03:00
|
|
|
static const char *new_directory_tooltip;
|
2008-10-01 02:22:49 +04:00
|
|
|
/**
|
2015-07-09 05:09:33 +03:00
|
|
|
[standard text may be customized at run-time]
|
2008-10-01 02:22:49 +04:00
|
|
|
*/
|
2020-07-01 19:03:10 +03:00
|
|
|
static const char *preview_label;
|
2008-10-01 02:22:49 +04:00
|
|
|
/**
|
2015-07-09 05:09:33 +03:00
|
|
|
[standard text may be customized at run-time]
|
2008-10-01 02:22:49 +04:00
|
|
|
*/
|
2020-07-01 19:03:10 +03:00
|
|
|
static const char *save_label;
|
2008-10-01 02:22:49 +04:00
|
|
|
/**
|
2015-07-09 05:09:33 +03:00
|
|
|
[standard text may be customized at run-time]
|
2008-10-01 02:22:49 +04:00
|
|
|
*/
|
2020-07-01 19:03:10 +03:00
|
|
|
static const char *show_label;
|
2011-06-06 20:11:22 +04:00
|
|
|
/**
|
2015-07-09 05:09:33 +03:00
|
|
|
[standard text may be customized at run-time]
|
2011-06-06 20:11:22 +04:00
|
|
|
*/
|
2020-07-01 19:03:10 +03:00
|
|
|
static const char *hidden_label;
|
2008-10-01 02:22:49 +04:00
|
|
|
/**
|
2015-07-09 05:09:33 +03:00
|
|
|
the sort function that is used when loading
|
|
|
|
the contents of a directory.
|
2008-10-01 02:22:49 +04:00
|
|
|
*/
|
2020-07-01 19:03:10 +03:00
|
|
|
static Fl_File_Sort_F *sort;
|
2008-05-01 22:56:12 +04:00
|
|
|
private:
|
2020-07-01 19:03:10 +03:00
|
|
|
Fl_Widget* ext_group;
|
2008-05-01 22:56:12 +04:00
|
|
|
public:
|
|
|
|
Fl_Widget* add_extra(Fl_Widget* gr);
|
2020-07-11 07:49:00 +03:00
|
|
|
protected:
|
|
|
|
void show_error_box(int val);
|
2001-08-02 01:24:49 +04:00
|
|
|
};
|
2002-05-24 18:02:56 +04:00
|
|
|
FL_EXPORT char *fl_dir_chooser(const char *message,const char *fname,int relative=0);
|
|
|
|
FL_EXPORT char *fl_file_chooser(const char *message,const char *pat,const char *fname,int relative=0);
|
|
|
|
FL_EXPORT void fl_file_chooser_callback(void (*cb)(const char*));
|
2005-03-25 19:11:07 +03:00
|
|
|
FL_EXPORT void fl_file_chooser_ok_label(const char*l);
|
2001-08-02 01:24:49 +04:00
|
|
|
#endif
|