Fl_File_Chooser.H 7.5 KB

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