You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

248 lines
7.4KB

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