diff options
| author | Michael R Sweet <michael.r.sweet@gmail.com> | 2002-06-07 15:06:32 +0000 |
|---|---|---|
| committer | Michael R Sweet <michael.r.sweet@gmail.com> | 2002-06-07 15:06:32 +0000 |
| commit | 861ad9769b94f52e3528817c8654c572d98ce760 (patch) | |
| tree | 81868ee9e2a622094a9d873949311b3fc83ffc78 /FL | |
| parent | 5c17a15fd444acdc1c8e6bd8de2ba5669042b958 (diff) | |
New file chooser.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@2286 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'FL')
| -rw-r--r-- | FL/Fl_File_Chooser.H | 89 | ||||
| -rw-r--r-- | FL/mac.H | 16 | ||||
| -rw-r--r-- | FL/win32.H | 8 |
3 files changed, 82 insertions, 31 deletions
diff --git a/FL/Fl_File_Chooser.H b/FL/Fl_File_Chooser.H index 69f8b8d1f..1f214fdb5 100644 --- a/FL/Fl_File_Chooser.H +++ b/FL/Fl_File_Chooser.H @@ -7,35 +7,63 @@ #include <stdio.h> #include <stdlib.h> #include <string.h> +#include <FL/Fl_Group.H> #include <FL/Fl_Choice.H> +#include <FL/Fl_Menu_Button.H> #include <FL/Fl_Button.H> -#include <FL/fl_ask.H> +#include <FL/Fl_Preferences.H> +#include <FL/Fl_Tile.H> #include <FL/Fl_File_Browser.H> +#include <FL/Fl_Box.H> +#include <FL/Fl_Check_Button.H> #include <FL/Fl_File_Input.H> #include <FL/Fl_Return_Button.H> +#include <FL/fl_ask.H> class Fl_File_Chooser { public: enum { SINGLE = 0, MULTI = 1, CREATE = 2, DIRECTORY = 4 }; +private: + static Fl_Preferences prefs_; + void (*callback_)(Fl_File_Chooser*, void *); + void *data_; + char directory_[1024]; + char pattern_[1024]; + 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(); +public: Fl_File_Chooser(const char *d, const char *p, int t, const char *title); private: Fl_Window *window; inline void cb_window_i(Fl_Window*, void*); static void cb_window(Fl_Window*, void*); - Fl_Choice *dirMenu; - inline void cb_dirMenu_i(Fl_Choice*, void*); - static void cb_dirMenu(Fl_Choice*, void*); - Fl_Button *upButton; - inline void cb_upButton_i(Fl_Button*, void*); - static void cb_upButton(Fl_Button*, void*); + Fl_Choice *showChoice; + inline void cb_showChoice_i(Fl_Choice*, void*); + static void cb_showChoice(Fl_Choice*, void*); + Fl_Menu_Button *favoritesButton; + inline void cb_favoritesButton_i(Fl_Menu_Button*, void*); + static void cb_favoritesButton(Fl_Menu_Button*, void*); Fl_Button *newButton; inline void cb_newButton_i(Fl_Button*, void*); static void cb_newButton(Fl_Button*, void*); - inline void cb__i(Fl_Button*, void*); - static void cb_(Fl_Button*, void*); + inline void cb__i(Fl_Tile*, void*); + static void cb_(Fl_Tile*, void*); Fl_File_Browser *fileList; inline void cb_fileList_i(Fl_File_Browser*, void*); static void cb_fileList(Fl_File_Browser*, void*); + Fl_Box *previewBox; + Fl_Check_Button *previewButton; + inline void cb_previewButton_i(Fl_Check_Button*, void*); + static void cb_previewButton(Fl_Check_Button*, void*); Fl_File_Input *fileName; inline void cb_fileName_i(Fl_File_Input*, void*); static void cb_fileName(Fl_File_Input*, void*); @@ -44,16 +72,28 @@ private: static void cb_okButton(Fl_Return_Button*, void*); inline void cb_Cancel_i(Fl_Button*, void*); static void cb_Cancel(Fl_Button*, void*); - void (*callback_)(Fl_File_Chooser*, void *); - void *data_; - char directory_[1024]; - int type_; - void fileListCB(); - void fileNameCB(); - void newdir(); - void up(); + Fl_Window *favWindow; + Fl_File_Browser *favList; + inline void cb_favList_i(Fl_File_Browser*, void*); + static void cb_favList(Fl_File_Browser*, void*); + Fl_Button *favUpButton; + inline void cb_favUpButton_i(Fl_Button*, void*); + static void cb_favUpButton(Fl_Button*, void*); + Fl_Button *favDeleteButton; + inline void cb_favDeleteButton_i(Fl_Button*, void*); + static void cb_favDeleteButton(Fl_Button*, void*); + Fl_Button *favDownButton; + inline void cb_favDownButton_i(Fl_Button*, void*); + static void cb_favDownButton(Fl_Button*, void*); + Fl_Button *favCancelButton; + inline void cb_favCancelButton_i(Fl_Button*, void*); + static void cb_favCancelButton(Fl_Button*, void*); + Fl_Return_Button *favOkButton; + inline void cb_favOkButton_i(Fl_Return_Button*, void*); + static void cb_favOkButton(Fl_Return_Button*, void*); public: - void callback(void (*cb)(Fl_File_Chooser *, void *), void *d); + ~Fl_File_Chooser(); + void callback(void (*cb)(Fl_File_Chooser *, void *), void *d = 0); void color(Fl_Color c); Fl_Color color(); int count(); @@ -66,6 +106,8 @@ public: uchar iconsize(); void label(const char *l); const char * label(); + void preview(int e); + int preview() const { return previewButton->value(); }; void rescan(); void show(); int shown(); @@ -80,9 +122,16 @@ public: const char *value(int f = 1); void value(const char *filename); int visible(); - static const char *directory_label; + static const char *add_favorites_label; + static const char *all_files_label; + static const char *existing_file_label; + static const char *favorites_label; static const char *filename_label; - static const char *filter_label; + static const char *filesystems_label; + static const char *manage_favorites_label; + static const char *new_directory_label; + static const char *preview_label; + static const char *show_label; static Fl_File_Sort_F *sort; }; FL_EXPORT char *fl_dir_chooser(const char *message,const char *fname,int relative=0); @@ -1,5 +1,5 @@ // -// "$Id: mac.H,v 1.1.2.7 2002/04/15 12:19:00 easysw Exp $" +// "$Id: mac.H,v 1.1.2.8 2002/06/07 15:06:31 easysw Exp $" // // Mac header file for the Fast Light Tool Kit (FLTK). // @@ -27,15 +27,15 @@ // include this file if "__APPLE__" is defined. This is to encourage // portability of even the system-specific code... - -#ifndef FL_MAC_H -# define FL_MAC_H +#ifndef Fl_X_H +# error "Never use <FL/mac.H> directly; include <FL/x.H> instead." +#endif // !Fl_X_H // Standard MacOS Carbon API includes... -# include <Carbon/Carbon.h> +#include <Carbon/Carbon.h> // Now make some fixes to the headers... -# undef check // Dunno where this comes from... +#undef check // Dunno where this comes from... // Some random X equivalents typedef WindowPtr Window; @@ -114,9 +114,7 @@ extern void fl_open_display(); extern FL_EXPORT int fl_parse_color(const char* p, uchar& r, uchar& g, uchar& b); -#endif // !FL_MAC_H - // -// End of "$Id: mac.H,v 1.1.2.7 2002/04/15 12:19:00 easysw Exp $". +// End of "$Id: mac.H,v 1.1.2.8 2002/06/07 15:06:31 easysw Exp $". // diff --git a/FL/win32.H b/FL/win32.H index 59a9974a7..928d1b238 100644 --- a/FL/win32.H +++ b/FL/win32.H @@ -1,5 +1,5 @@ // -// "$Id: win32.H,v 1.15.2.3.2.6 2002/04/15 12:19:00 easysw Exp $" +// "$Id: win32.H,v 1.15.2.3.2.7 2002/06/07 15:06:31 easysw Exp $" // // WIN32 header file for the Fast Light Tool Kit (FLTK). // @@ -27,6 +27,10 @@ // include this file if WIN32 is defined. This is to encourage // portability of even the system-specific code... +#ifndef Fl_X_H +# error "Never use <FL/win32.H> directly; include <FL/x.H> instead." +#endif // !Fl_X_H + #include <windows.h> // In some of the distributions, the gcc header files are missing some stuff: #ifndef LPMINMAXINFO @@ -130,5 +134,5 @@ extern FL_EXPORT void fl_delete_bitmask(Fl_Bitmask bm); extern FL_EXPORT int fl_parse_color(const char* p, uchar& r, uchar& g, uchar& b); // -// End of "$Id: win32.H,v 1.15.2.3.2.6 2002/04/15 12:19:00 easysw Exp $". +// End of "$Id: win32.H,v 1.15.2.3.2.7 2002/06/07 15:06:31 easysw Exp $". // |
