FLTK 1.3.0
|
00001 // 00002 // "$Id$" 00003 // 00004 // Fl_File_Chooser dialog for the Fast Light Tool Kit (FLTK). 00005 // 00006 // Copyright 1998-2011 by Bill Spitzak and others. 00007 // 00008 // This library is free software. Distribution and use rights are outlined in 00009 // the file "COPYING" which should have been included with this file. If this 00010 // file is missing or damaged, see the license at: 00011 // 00012 // http://www.fltk.org/COPYING.php 00013 // 00014 // Please report all bugs and problems on the following page: 00015 // 00016 // http://www.fltk.org/str.php 00017 // 00018 00019 // generated by Fast Light User Interface Designer (fluid) version 1.0300 00020 00021 #ifndef Fl_File_Chooser_H 00022 #define Fl_File_Chooser_H 00023 #include <FL/Fl.H> 00024 #include <FL/Fl_Double_Window.H> 00025 #include <stdio.h> 00026 #include <stdlib.h> 00027 #include <string.h> 00028 #include <FL/Fl_Group.H> 00029 #include <FL/Fl_Choice.H> 00030 #include <FL/Fl_Menu_Button.H> 00031 #include <FL/Fl_Button.H> 00032 #include <FL/Fl_Preferences.H> 00033 #include <FL/Fl_Tile.H> 00034 #include <FL/Fl_File_Browser.H> 00035 #include <FL/Fl_Box.H> 00036 #include <FL/Fl_Check_Button.H> 00037 #include <FL/Fl_File_Input.H> 00038 #include <FL/Fl_Return_Button.H> 00039 #include <FL/fl_ask.H> 00040 00041 class FL_EXPORT Fl_File_Chooser { 00042 public: 00043 enum { SINGLE = 0, MULTI = 1, CREATE = 2, DIRECTORY = 4 }; 00044 private: 00045 static Fl_Preferences prefs_; 00046 void (*callback_)(Fl_File_Chooser*, void *); 00047 void *data_; 00048 char directory_[FL_PATH_MAX]; 00049 char pattern_[FL_PATH_MAX]; 00050 char preview_text_[2048]; 00051 int type_; 00052 void favoritesButtonCB(); 00053 void favoritesCB(Fl_Widget *w); 00054 void fileListCB(); 00055 void fileNameCB(); 00056 void newdir(); 00057 static void previewCB(Fl_File_Chooser *fc); 00058 void showChoiceCB(); 00059 void update_favorites(); 00060 void update_preview(); 00061 public: 00062 Fl_File_Chooser(const char *d, const char *p, int t, const char *title); 00063 private: 00064 Fl_Double_Window *window; 00065 void cb_window_i(Fl_Double_Window*, void*); 00066 static void cb_window(Fl_Double_Window*, void*); 00067 Fl_Choice *showChoice; 00068 void cb_showChoice_i(Fl_Choice*, void*); 00069 static void cb_showChoice(Fl_Choice*, void*); 00070 Fl_Menu_Button *favoritesButton; 00071 void cb_favoritesButton_i(Fl_Menu_Button*, void*); 00072 static void cb_favoritesButton(Fl_Menu_Button*, void*); 00073 public: 00074 Fl_Button *newButton; 00075 private: 00076 void cb_newButton_i(Fl_Button*, void*); 00077 static void cb_newButton(Fl_Button*, void*); 00078 void cb__i(Fl_Tile*, void*); 00079 static void cb_(Fl_Tile*, void*); 00080 Fl_File_Browser *fileList; 00081 void cb_fileList_i(Fl_File_Browser*, void*); 00082 static void cb_fileList(Fl_File_Browser*, void*); 00083 Fl_Box *previewBox; 00084 public: 00085 Fl_Check_Button *previewButton; 00086 private: 00087 void cb_previewButton_i(Fl_Check_Button*, void*); 00088 static void cb_previewButton(Fl_Check_Button*, void*); 00089 public: 00090 Fl_Check_Button *showHiddenButton; 00091 private: 00092 void cb_showHiddenButton_i(Fl_Check_Button*, void*); 00093 static void cb_showHiddenButton(Fl_Check_Button*, void*); 00094 Fl_File_Input *fileName; 00095 void cb_fileName_i(Fl_File_Input*, void*); 00096 static void cb_fileName(Fl_File_Input*, void*); 00097 Fl_Return_Button *okButton; 00098 void cb_okButton_i(Fl_Return_Button*, void*); 00099 static void cb_okButton(Fl_Return_Button*, void*); 00100 Fl_Button *cancelButton; 00101 void cb_cancelButton_i(Fl_Button*, void*); 00102 static void cb_cancelButton(Fl_Button*, void*); 00103 Fl_Double_Window *favWindow; 00104 Fl_File_Browser *favList; 00105 void cb_favList_i(Fl_File_Browser*, void*); 00106 static void cb_favList(Fl_File_Browser*, void*); 00107 Fl_Button *favUpButton; 00108 void cb_favUpButton_i(Fl_Button*, void*); 00109 static void cb_favUpButton(Fl_Button*, void*); 00110 Fl_Button *favDeleteButton; 00111 void cb_favDeleteButton_i(Fl_Button*, void*); 00112 static void cb_favDeleteButton(Fl_Button*, void*); 00113 Fl_Button *favDownButton; 00114 void cb_favDownButton_i(Fl_Button*, void*); 00115 static void cb_favDownButton(Fl_Button*, void*); 00116 Fl_Button *favCancelButton; 00117 void cb_favCancelButton_i(Fl_Button*, void*); 00118 static void cb_favCancelButton(Fl_Button*, void*); 00119 Fl_Return_Button *favOkButton; 00120 void cb_favOkButton_i(Fl_Return_Button*, void*); 00121 static void cb_favOkButton(Fl_Return_Button*, void*); 00122 public: 00123 ~Fl_File_Chooser(); 00124 void callback(void (*cb)(Fl_File_Chooser *, void *), void *d = 0); 00125 void color(Fl_Color c); 00126 Fl_Color color(); 00127 int count(); 00128 void directory(const char *d); 00129 char * directory(); 00130 void filter(const char *p); 00131 const char * filter(); 00132 int filter_value(); 00133 void filter_value(int f); 00134 void hide(); 00135 void iconsize(uchar s); 00136 uchar iconsize(); 00137 void label(const char *l); 00138 const char * label(); 00139 void ok_label(const char *l); 00140 const char * ok_label(); 00141 void preview(int e); 00142 int preview() const { return previewButton->value(); }; 00143 private: 00144 void showHidden(int e); 00145 void remove_hidden_files(); 00146 public: 00147 void rescan(); 00148 void rescan_keep_filename(); 00149 void show(); 00150 int shown(); 00151 void textcolor(Fl_Color c); 00152 Fl_Color textcolor(); 00153 void textfont(Fl_Font f); 00154 Fl_Font textfont(); 00155 void textsize(Fl_Fontsize s); 00156 Fl_Fontsize textsize(); 00157 void type(int t); 00158 int type(); 00159 void * user_data() const; 00160 void user_data(void *d); 00161 const char *value(int f = 1); 00162 void value(const char *filename); 00163 int visible(); 00167 static const char *add_favorites_label; 00171 static const char *all_files_label; 00175 static const char *custom_filter_label; 00179 static const char *existing_file_label; 00183 static const char *favorites_label; 00187 static const char *filename_label; 00191 static const char *filesystems_label; 00195 static const char *manage_favorites_label; 00199 static const char *new_directory_label; 00203 static const char *new_directory_tooltip; 00207 static const char *preview_label; 00211 static const char *save_label; 00215 static const char *show_label; 00219 static const char *hidden_label; 00224 static Fl_File_Sort_F *sort; 00225 private: 00226 Fl_Widget* ext_group; 00227 public: 00228 Fl_Widget* add_extra(Fl_Widget* gr); 00229 }; 00230 FL_EXPORT char *fl_dir_chooser(const char *message,const char *fname,int relative=0); 00231 FL_EXPORT char *fl_file_chooser(const char *message,const char *pat,const char *fname,int relative=0); 00232 FL_EXPORT void fl_file_chooser_callback(void (*cb)(const char*)); 00233 FL_EXPORT void fl_file_chooser_ok_label(const char*l); 00234 #endif 00235 00236 // 00237 // End of "$Id$". 00238 //