Fl_File_Chooser.H 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238
  1. //
  2. // "$Id: Fl_File_Chooser.H 8864 2011-07-19 04:49:30Z greg.ercolano $"
  3. //
  4. // Fl_File_Chooser dialog for the Fast Light Tool Kit (FLTK).
  5. //
  6. // Copyright 1998-2011 by Bill Spitzak and others.
  7. //
  8. // This library is free software. Distribution and use rights are outlined in
  9. // the file "COPYING" which should have been included with this file. If this
  10. // file is missing or damaged, see the license at:
  11. //
  12. // http://www.fltk.org/COPYING.php
  13. //
  14. // Please report all bugs and problems on the following page:
  15. //
  16. // http://www.fltk.org/str.php
  17. //
  18. // generated by Fast Light User Interface Designer (fluid) version 1.0300
  19. #ifndef Fl_File_Chooser_H
  20. #define Fl_File_Chooser_H
  21. #include <FL/Fl.H>
  22. #include <FL/Fl_Double_Window.H>
  23. #include <stdio.h>
  24. #include <stdlib.h>
  25. #include <string.h>
  26. #include <FL/Fl_Group.H>
  27. #include <FL/Fl_Choice.H>
  28. #include <FL/Fl_Menu_Button.H>
  29. #include <FL/Fl_Button.H>
  30. #include <FL/Fl_Preferences.H>
  31. #include <FL/Fl_Tile.H>
  32. #include <FL/Fl_File_Browser.H>
  33. #include <FL/Fl_Box.H>
  34. #include <FL/Fl_Check_Button.H>
  35. #include <FL/Fl_File_Input.H>
  36. #include <FL/Fl_Return_Button.H>
  37. #include <FL/fl_ask.H>
  38. class FL_EXPORT Fl_File_Chooser {
  39. public:
  40. enum { SINGLE = 0, MULTI = 1, CREATE = 2, DIRECTORY = 4 };
  41. private:
  42. static Fl_Preferences prefs_;
  43. void (*callback_)(Fl_File_Chooser*, void *);
  44. void *data_;
  45. char directory_[FL_PATH_MAX];
  46. char pattern_[FL_PATH_MAX];
  47. char preview_text_[2048];
  48. int type_;
  49. void favoritesButtonCB();
  50. void favoritesCB(Fl_Widget *w);
  51. void fileListCB();
  52. void fileNameCB();
  53. void newdir();
  54. static void previewCB(Fl_File_Chooser *fc);
  55. void showChoiceCB();
  56. void update_favorites();
  57. void update_preview();
  58. public:
  59. Fl_File_Chooser(const char *d, const char *p, int t, const char *title);
  60. private:
  61. Fl_Double_Window *window;
  62. void cb_window_i(Fl_Double_Window*, void*);
  63. static void cb_window(Fl_Double_Window*, void*);
  64. Fl_Choice *showChoice;
  65. void cb_showChoice_i(Fl_Choice*, void*);
  66. static void cb_showChoice(Fl_Choice*, void*);
  67. Fl_Menu_Button *favoritesButton;
  68. void cb_favoritesButton_i(Fl_Menu_Button*, void*);
  69. static void cb_favoritesButton(Fl_Menu_Button*, void*);
  70. public:
  71. Fl_Button *newButton;
  72. private:
  73. void cb_newButton_i(Fl_Button*, void*);
  74. static void cb_newButton(Fl_Button*, void*);
  75. void cb__i(Fl_Tile*, void*);
  76. static void cb_(Fl_Tile*, void*);
  77. Fl_File_Browser *fileList;
  78. void cb_fileList_i(Fl_File_Browser*, void*);
  79. static void cb_fileList(Fl_File_Browser*, void*);
  80. Fl_Box *previewBox;
  81. public:
  82. Fl_Check_Button *previewButton;
  83. private:
  84. void cb_previewButton_i(Fl_Check_Button*, void*);
  85. static void cb_previewButton(Fl_Check_Button*, void*);
  86. public:
  87. Fl_Check_Button *showHiddenButton;
  88. private:
  89. void cb_showHiddenButton_i(Fl_Check_Button*, void*);
  90. static void cb_showHiddenButton(Fl_Check_Button*, void*);
  91. Fl_File_Input *fileName;
  92. void cb_fileName_i(Fl_File_Input*, void*);
  93. static void cb_fileName(Fl_File_Input*, void*);
  94. Fl_Return_Button *okButton;
  95. void cb_okButton_i(Fl_Return_Button*, void*);
  96. static void cb_okButton(Fl_Return_Button*, void*);
  97. Fl_Button *cancelButton;
  98. void cb_cancelButton_i(Fl_Button*, void*);
  99. static void cb_cancelButton(Fl_Button*, void*);
  100. Fl_Double_Window *favWindow;
  101. Fl_File_Browser *favList;
  102. void cb_favList_i(Fl_File_Browser*, void*);
  103. static void cb_favList(Fl_File_Browser*, void*);
  104. Fl_Button *favUpButton;
  105. void cb_favUpButton_i(Fl_Button*, void*);
  106. static void cb_favUpButton(Fl_Button*, void*);
  107. Fl_Button *favDeleteButton;
  108. void cb_favDeleteButton_i(Fl_Button*, void*);
  109. static void cb_favDeleteButton(Fl_Button*, void*);
  110. Fl_Button *favDownButton;
  111. void cb_favDownButton_i(Fl_Button*, void*);
  112. static void cb_favDownButton(Fl_Button*, void*);
  113. Fl_Button *favCancelButton;
  114. void cb_favCancelButton_i(Fl_Button*, void*);
  115. static void cb_favCancelButton(Fl_Button*, void*);
  116. Fl_Return_Button *favOkButton;
  117. void cb_favOkButton_i(Fl_Return_Button*, void*);
  118. static void cb_favOkButton(Fl_Return_Button*, void*);
  119. public:
  120. ~Fl_File_Chooser();
  121. void callback(void (*cb)(Fl_File_Chooser *, void *), void *d = 0);
  122. void color(Fl_Color c);
  123. Fl_Color color();
  124. int count();
  125. void directory(const char *d);
  126. char * directory();
  127. void filter(const char *p);
  128. const char * filter();
  129. int filter_value();
  130. void filter_value(int f);
  131. void hide();
  132. void iconsize(uchar s);
  133. uchar iconsize();
  134. void label(const char *l);
  135. const char * label();
  136. void ok_label(const char *l);
  137. const char * ok_label();
  138. void preview(int e);
  139. int preview() const { return previewButton->value(); };
  140. private:
  141. void showHidden(int e);
  142. void remove_hidden_files();
  143. public:
  144. void rescan();
  145. void rescan_keep_filename();
  146. void show();
  147. int shown();
  148. void textcolor(Fl_Color c);
  149. Fl_Color textcolor();
  150. void textfont(Fl_Font f);
  151. Fl_Font textfont();
  152. void textsize(Fl_Fontsize s);
  153. Fl_Fontsize textsize();
  154. void type(int t);
  155. int type();
  156. void * user_data() const;
  157. void user_data(void *d);
  158. const char *value(int f = 1);
  159. void value(const char *filename);
  160. int visible();
  161. /**
  162. [standard text may be customized at run-time]
  163. */
  164. static const char *add_favorites_label;
  165. /**
  166. [standard text may be customized at run-time]
  167. */
  168. static const char *all_files_label;
  169. /**
  170. [standard text may be customized at run-time]
  171. */
  172. static const char *custom_filter_label;
  173. /**
  174. [standard text may be customized at run-time]
  175. */
  176. static const char *existing_file_label;
  177. /**
  178. [standard text may be customized at run-time]
  179. */
  180. static const char *favorites_label;
  181. /**
  182. [standard text may be customized at run-time]
  183. */
  184. static const char *filename_label;
  185. /**
  186. [standard text may be customized at run-time]
  187. */
  188. static const char *filesystems_label;
  189. /**
  190. [standard text may be customized at run-time]
  191. */
  192. static const char *manage_favorites_label;
  193. /**
  194. [standard text may be customized at run-time]
  195. */
  196. static const char *new_directory_label;
  197. /**
  198. [standard text may be customized at run-time]
  199. */
  200. static const char *new_directory_tooltip;
  201. /**
  202. [standard text may be customized at run-time]
  203. */
  204. static const char *preview_label;
  205. /**
  206. [standard text may be customized at run-time]
  207. */
  208. static const char *save_label;
  209. /**
  210. [standard text may be customized at run-time]
  211. */
  212. static const char *show_label;
  213. /**
  214. [standard text may be customized at run-time]
  215. */
  216. static const char *hidden_label;
  217. /**
  218. the sort function that is used when loading
  219. the contents of a directory.
  220. */
  221. static Fl_File_Sort_F *sort;
  222. private:
  223. Fl_Widget* ext_group;
  224. public:
  225. Fl_Widget* add_extra(Fl_Widget* gr);
  226. };
  227. FL_EXPORT char *fl_dir_chooser(const char *message,const char *fname,int relative=0);
  228. FL_EXPORT char *fl_file_chooser(const char *message,const char *pat,const char *fname,int relative=0);
  229. FL_EXPORT void fl_file_chooser_callback(void (*cb)(const char*));
  230. FL_EXPORT void fl_file_chooser_ok_label(const char*l);
  231. #endif
  232. //
  233. // End of "$Id: Fl_File_Chooser.H 8864 2011-07-19 04:49:30Z greg.ercolano $".
  234. //