FLTK 1.3.0
|
00001 // 00002 // "$Id$" 00003 // 00004 // Fl_File_Chooser dialog for the Fast Light Tool Kit (FLTK). 00005 // 00006 // Copyright 1998-2010 by Bill Spitzak and others. 00007 // 00008 // This library is free software; you can redistribute it and/or 00009 // modify it under the terms of the GNU Library General Public 00010 // License as published by the Free Software Foundation; either 00011 // version 2 of the License, or (at your option) any later version. 00012 // 00013 // This library is distributed in the hope that it will be useful, 00014 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00015 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00016 // Library General Public License for more details. 00017 // 00018 // You should have received a copy of the GNU Library General Public 00019 // License along with this library; if not, write to the Free Software 00020 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 00021 // USA. 00022 // 00023 // Please report all bugs and problems on the following page: 00024 // 00025 // http://www.fltk.org/str.php 00026 // 00027 00028 // generated by Fast Light User Interface Designer (fluid) version 1.0300 00029 00030 #ifndef Fl_File_Chooser_H 00031 #define Fl_File_Chooser_H 00032 #include <FL/Fl.H> 00033 #include <FL/Fl_Double_Window.H> 00034 #include <stdio.h> 00035 #include <stdlib.h> 00036 #include <string.h> 00037 #include <FL/Fl_Group.H> 00038 #include <FL/Fl_Choice.H> 00039 #include <FL/Fl_Menu_Button.H> 00040 #include <FL/Fl_Button.H> 00041 #include <FL/Fl_Preferences.H> 00042 #include <FL/Fl_Tile.H> 00043 #include <FL/Fl_File_Browser.H> 00044 #include <FL/Fl_Box.H> 00045 #include <FL/Fl_Check_Button.H> 00046 #include <FL/Fl_File_Input.H> 00047 #include <FL/Fl_Return_Button.H> 00048 #include <FL/fl_ask.H> 00049 00050 class FL_EXPORT Fl_File_Chooser { 00051 public: 00052 enum { SINGLE = 0, MULTI = 1, CREATE = 2, DIRECTORY = 4 }; 00053 private: 00054 static Fl_Preferences prefs_; 00055 void (*callback_)(Fl_File_Chooser*, void *); 00056 void *data_; 00057 char directory_[FL_PATH_MAX]; 00058 char pattern_[FL_PATH_MAX]; 00059 char preview_text_[2048]; 00060 int type_; 00061 void favoritesButtonCB(); 00062 void favoritesCB(Fl_Widget *w); 00063 void fileListCB(); 00064 void fileNameCB(); 00065 void newdir(); 00066 static void previewCB(Fl_File_Chooser *fc); 00067 void showChoiceCB(); 00068 void update_favorites(); 00069 void update_preview(); 00070 public: 00071 Fl_File_Chooser(const char *d, const char *p, int t, const char *title); 00072 private: 00073 Fl_Double_Window *window; 00074 void cb_window_i(Fl_Double_Window*, void*); 00075 static void cb_window(Fl_Double_Window*, void*); 00076 Fl_Choice *showChoice; 00077 void cb_showChoice_i(Fl_Choice*, void*); 00078 static void cb_showChoice(Fl_Choice*, void*); 00079 Fl_Menu_Button *favoritesButton; 00080 void cb_favoritesButton_i(Fl_Menu_Button*, void*); 00081 static void cb_favoritesButton(Fl_Menu_Button*, void*); 00082 public: 00083 Fl_Button *newButton; 00084 private: 00085 void cb_newButton_i(Fl_Button*, void*); 00086 static void cb_newButton(Fl_Button*, void*); 00087 void cb__i(Fl_Tile*, void*); 00088 static void cb_(Fl_Tile*, void*); 00089 Fl_File_Browser *fileList; 00090 void cb_fileList_i(Fl_File_Browser*, void*); 00091 static void cb_fileList(Fl_File_Browser*, void*); 00092 Fl_Box *previewBox; 00093 public: 00094 Fl_Check_Button *previewButton; 00095 private: 00096 void cb_previewButton_i(Fl_Check_Button*, void*); 00097 static void cb_previewButton(Fl_Check_Button*, void*); 00098 Fl_File_Input *fileName; 00099 void cb_fileName_i(Fl_File_Input*, void*); 00100 static void cb_fileName(Fl_File_Input*, void*); 00101 Fl_Return_Button *okButton; 00102 void cb_okButton_i(Fl_Return_Button*, void*); 00103 static void cb_okButton(Fl_Return_Button*, void*); 00104 Fl_Button *cancelButton; 00105 void cb_cancelButton_i(Fl_Button*, void*); 00106 static void cb_cancelButton(Fl_Button*, void*); 00107 Fl_Double_Window *favWindow; 00108 Fl_File_Browser *favList; 00109 void cb_favList_i(Fl_File_Browser*, void*); 00110 static void cb_favList(Fl_File_Browser*, void*); 00111 Fl_Button *favUpButton; 00112 void cb_favUpButton_i(Fl_Button*, void*); 00113 static void cb_favUpButton(Fl_Button*, void*); 00114 Fl_Button *favDeleteButton; 00115 void cb_favDeleteButton_i(Fl_Button*, void*); 00116 static void cb_favDeleteButton(Fl_Button*, void*); 00117 Fl_Button *favDownButton; 00118 void cb_favDownButton_i(Fl_Button*, void*); 00119 static void cb_favDownButton(Fl_Button*, void*); 00120 Fl_Button *favCancelButton; 00121 void cb_favCancelButton_i(Fl_Button*, void*); 00122 static void cb_favCancelButton(Fl_Button*, void*); 00123 Fl_Return_Button *favOkButton; 00124 void cb_favOkButton_i(Fl_Return_Button*, void*); 00125 static void cb_favOkButton(Fl_Return_Button*, void*); 00126 #ifndef WIN32 00127 Fl_Check_Button *show_hidden; 00128 static void show_hidden_cb(Fl_Check_Button*, void*); 00129 void remove_hidden_files(); 00130 #endif 00131 public: 00132 ~Fl_File_Chooser(); 00133 void callback(void (*cb)(Fl_File_Chooser *, void *), void *d = 0); 00134 void color(Fl_Color c); 00135 Fl_Color color(); 00136 int count(); 00137 void directory(const char *d); 00138 char * directory(); 00139 void filter(const char *p); 00140 const char * filter(); 00141 int filter_value(); 00142 void filter_value(int f); 00143 void hide(); 00144 void iconsize(uchar s); 00145 uchar iconsize(); 00146 void label(const char *l); 00147 const char * label(); 00148 void ok_label(const char *l); 00149 const char * ok_label(); 00150 void preview(int e); 00151 int preview() const { return previewButton->value(); }; 00152 void rescan(); 00153 void rescan_keep_filename(); 00154 void show(); 00155 int shown(); 00156 void textcolor(Fl_Color c); 00157 Fl_Color textcolor(); 00158 void textfont(Fl_Font f); 00159 Fl_Font textfont(); 00160 void textsize(Fl_Fontsize s); 00161 Fl_Fontsize textsize(); 00162 void type(int t); 00163 int type(); 00164 void * user_data() const; 00165 void user_data(void *d); 00166 const char *value(int f = 1); 00167 void value(const char *filename); 00168 int visible(); 00172 static const char *add_favorites_label; 00176 static const char *all_files_label; 00180 static const char *custom_filter_label; 00184 static const char *existing_file_label; 00188 static const char *favorites_label; 00192 static const char *filename_label; 00196 static const char *filesystems_label; 00200 static const char *manage_favorites_label; 00204 static const char *new_directory_label; 00208 static const char *new_directory_tooltip; 00212 static const char *preview_label; 00216 static const char *save_label; 00220 static const char *show_label; 00224 static const char *hidden_label; 00229 static Fl_File_Sort_F *sort; 00230 private: 00231 Fl_Widget* ext_group; 00232 public: 00233 Fl_Widget* add_extra(Fl_Widget* gr); 00234 Fl_File_Browser *browser(void) {return fileList; }; 00235 }; 00236 FL_EXPORT char *fl_dir_chooser(const char *message,const char *fname,int relative=0); 00237 FL_EXPORT char *fl_file_chooser(const char *message,const char *pat,const char *fname,int relative=0); 00238 FL_EXPORT void fl_file_chooser_callback(void (*cb)(const char*)); 00239 FL_EXPORT void fl_file_chooser_ok_label(const char*l); 00240 #endif 00241 00242 // 00243 // End of "$Id$". 00244 //