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.

480 lines
14KB

  1. # data file for the Fltk User Interface Designer (fluid)
  2. version 1.0300
  3. header_name {../FL/Fl_File_Chooser.H}
  4. code_name {.cxx}
  5. comment {//
  6. // "$Id: Fl_File_Chooser.fl 8786 2011-06-07 11:41:36Z manolo $"
  7. //
  8. // Fl_File_Chooser dialog for the Fast Light Tool Kit (FLTK).
  9. //
  10. // Copyright 1998-2011 by Bill Spitzak and others.
  11. //
  12. // This library is free software; you can redistribute it and/or
  13. // modify it under the terms of the GNU Library General Public
  14. // License as published by the Free Software Foundation; either
  15. // version 2 of the License, or (at your option) any later version.
  16. //
  17. // This library is distributed in the hope that it will be useful,
  18. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  19. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  20. // Library General Public License for more details.
  21. //
  22. // You should have received a copy of the GNU Library General Public
  23. // License along with this library; if not, write to the Free Software
  24. // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
  25. // USA.
  26. //
  27. // Please report all bugs and problems on the following page:
  28. //
  29. // http://www.fltk.org/str.php
  30. //
  31. } {in_source in_header
  32. }
  33. decl {\#include <FL/fl_draw.H>} {}
  34. class FL_EXPORT Fl_File_Chooser {open
  35. } {
  36. decl {enum { SINGLE = 0, MULTI = 1, CREATE = 2, DIRECTORY = 4 };} {public
  37. }
  38. decl {static Fl_Preferences prefs_;} {}
  39. decl {void (*callback_)(Fl_File_Chooser*, void *);} {}
  40. decl {void *data_;} {}
  41. decl {char directory_[FL_PATH_MAX];} {}
  42. decl {char pattern_[FL_PATH_MAX];} {}
  43. decl {char preview_text_[2048];} {}
  44. decl {int type_;} {}
  45. decl {void favoritesButtonCB();} {}
  46. decl {void favoritesCB(Fl_Widget *w);} {}
  47. decl {void fileListCB();} {}
  48. decl {void fileNameCB();} {}
  49. decl {void newdir();} {}
  50. decl {static void previewCB(Fl_File_Chooser *fc);} {}
  51. decl {void showChoiceCB();} {}
  52. decl {void update_favorites();} {}
  53. decl {void update_preview();} {}
  54. Function {Fl_File_Chooser(const char *d, const char *p, int t, const char *title)} {} {
  55. code {Fl_Group *prev_current = Fl_Group::current();} {}
  56. Fl_Window window {
  57. label {Choose File}
  58. callback {fileName->value("");
  59. fileList->deselect();
  60. Fl::remove_timeout((Fl_Timeout_Handler)previewCB, this);
  61. window->hide();} open
  62. private xywh {507 327 490 380} type Double resizable
  63. code0 {if (title) window->label(title);}
  64. code1 {\#include <stdio.h>}
  65. code2 {\#include <stdlib.h>}
  66. code3 {\#include <string.h>} modal visible
  67. } {
  68. Fl_Group {} {open
  69. private xywh {10 10 470 25}
  70. } {
  71. Fl_Choice showChoice {
  72. label {Show:}
  73. callback {showChoiceCB();} open
  74. private xywh {65 10 215 25} down_box BORDER_BOX labelfont 1 resizable
  75. code0 {showChoice->label(show_label);}
  76. } {}
  77. Fl_Menu_Button favoritesButton {
  78. label Favorites
  79. callback {favoritesButtonCB();} open
  80. private xywh {290 10 155 25} down_box BORDER_BOX align 20
  81. code0 {favoritesButton->label(favorites_label);}
  82. } {}
  83. Fl_Button newButton {
  84. callback {newdir();}
  85. image {new.xbm} xywh {455 10 25 25} labelsize 8
  86. code0 {\#include <FL/Fl_Preferences.H>}
  87. code1 {o->tooltip(new_directory_tooltip);}
  88. }
  89. }
  90. Fl_Tile {} {
  91. callback {update_preview();}
  92. private xywh {10 45 470 225} resizable
  93. } {
  94. Fl_File_Browser fileList {
  95. callback {fileListCB();}
  96. private xywh {10 45 295 225} type Hold hotspot
  97. code0 {\#include <FL/Fl_File_Browser.H>}
  98. }
  99. Fl_Box previewBox {
  100. label {?}
  101. private xywh {305 45 175 225} box DOWN_BOX labelsize 100 align 80
  102. }
  103. }
  104. Fl_Group {} {open
  105. private xywh {10 275 470 95}
  106. } {
  107. Fl_Group {} {open
  108. private xywh {10 275 470 20}
  109. } {
  110. Fl_Check_Button previewButton {
  111. label Preview
  112. callback {preview(previewButton->value());}
  113. xywh {10 275 73 20} down_box DOWN_BOX shortcut 0x80070 value 1
  114. code0 {previewButton->label(preview_label);}
  115. }
  116. Fl_Check_Button showHiddenButton {
  117. label {Show hidden files}
  118. callback {showHidden(showHiddenButton->value());}
  119. xywh {115 275 165 20} down_box DOWN_BOX
  120. code0 {showHiddenButton->label(hidden_label);}
  121. }
  122. Fl_Box {} {
  123. private xywh {115 275 365 20} resizable
  124. }
  125. }
  126. Fl_File_Input fileName {
  127. callback {fileNameCB();}
  128. private xywh {115 300 365 35} labelfont 1 when 8 resizable
  129. code0 {fileName->when(FL_WHEN_CHANGED | FL_WHEN_ENTER_KEY);}
  130. }
  131. Fl_Box {} {
  132. label {Filename:}
  133. private xywh {10 310 105 25} labelfont 1 align 24
  134. code0 {o->label(filename_label);}
  135. }
  136. Fl_Group {} {open
  137. private xywh {10 345 470 25}
  138. } {
  139. Fl_Return_Button okButton {
  140. label OK
  141. callback {window->hide();
  142. // Do any callback that is registered...
  143. if (callback_)
  144. (*callback_)(this, data_);}
  145. private xywh {313 345 85 25}
  146. code0 {\#include <FL/fl_ask.H>}
  147. code1 {okButton->label(fl_ok);}
  148. }
  149. Fl_Button cancelButton {
  150. label Cancel
  151. callback {fileName->value("");
  152. fileList->deselect();
  153. Fl::remove_timeout((Fl_Timeout_Handler)previewCB, this);
  154. window->hide();}
  155. private xywh {408 345 72 25}
  156. code0 {o->label(fl_cancel);}
  157. }
  158. Fl_Box {} {
  159. private xywh {10 345 30 25} resizable
  160. }
  161. }
  162. }
  163. }
  164. Fl_Window favWindow {
  165. label {Manage Favorites}
  166. private xywh {413 100 355 150} type Double resizable
  167. code0 {favWindow->label(manage_favorites_label);} modal size_range {181 150 0 0} visible
  168. } {
  169. Fl_File_Browser favList {
  170. callback {favoritesCB(favList);}
  171. private xywh {10 10 300 95} type Hold resizable
  172. }
  173. Fl_Group {} {open
  174. xywh {320 10 25 95}
  175. } {
  176. Fl_Button favUpButton {
  177. label {@8>}
  178. callback {favoritesCB(favUpButton);}
  179. private xywh {320 10 25 25}
  180. }
  181. Fl_Button favDeleteButton {
  182. label X
  183. callback {favoritesCB(favDeleteButton);}
  184. private xywh {320 45 25 25} labelfont 1 resizable
  185. }
  186. Fl_Button favDownButton {
  187. label {@2>}
  188. callback {favoritesCB(favDownButton);}
  189. private xywh {320 80 25 25}
  190. }
  191. }
  192. Fl_Group {} {open
  193. xywh {10 113 335 29}
  194. } {
  195. Fl_Button favCancelButton {
  196. label Cancel
  197. callback {favWindow->hide();}
  198. private xywh {273 115 72 25}
  199. code0 {favCancelButton->label(fl_cancel);}
  200. }
  201. Fl_Return_Button favOkButton {
  202. label Save
  203. callback {favoritesCB(favOkButton);}
  204. private xywh {181 115 79 25}
  205. code0 {\#include <FL/fl_ask.H>}
  206. code1 {favOkButton->label(save_label);}
  207. }
  208. Fl_Box {} {
  209. xywh {10 115 161 25} resizable
  210. }
  211. }
  212. }
  213. code {callback_ = 0;
  214. data_ = 0;
  215. directory_[0] = 0;
  216. window->size_range(window->w(), window->h(), Fl::w(), Fl::h());
  217. type(t);
  218. filter(p);
  219. update_favorites();
  220. value(d);
  221. type(t);
  222. int e;
  223. prefs_.get("preview", e, 1);
  224. preview(e);
  225. Fl_Group::current(prev_current);} {}
  226. code {ext_group=(Fl_Widget*)0;} {}
  227. }
  228. Function {~Fl_File_Chooser()} {open
  229. } {
  230. code {Fl::remove_timeout((Fl_Timeout_Handler)previewCB, this);
  231. if(ext_group)window->remove(ext_group);
  232. delete window;
  233. delete favWindow;} {}
  234. }
  235. Function {callback(void (*cb)(Fl_File_Chooser *, void *), void *d = 0)} {return_type void
  236. } {
  237. code {callback_ = cb;
  238. data_ = d;} {}
  239. }
  240. Function {color(Fl_Color c)} {} {
  241. code {fileList->color(c);} {}
  242. }
  243. Function {color()} {return_type Fl_Color
  244. } {
  245. code {return (fileList->color());} {}
  246. }
  247. decl {int count();} {public
  248. }
  249. decl {void directory(const char *d);} {public
  250. }
  251. Function {directory()} {return_type {char *}
  252. } {
  253. code {return directory_;} {}
  254. }
  255. decl {void filter(const char *p);} {public
  256. }
  257. Function {filter()} {return_type {const char *}
  258. } {
  259. code {return (fileList->filter());} {}
  260. }
  261. Function {filter_value()} {return_type int
  262. } {
  263. code {return showChoice->value();} {}
  264. }
  265. Function {filter_value(int f)} {return_type void
  266. } {
  267. code {showChoice->value(f);
  268. showChoiceCB();} {}
  269. }
  270. Function {hide()} {return_type void
  271. } {
  272. code {window->hide();} {}
  273. }
  274. Function {iconsize(uchar s)} {return_type void
  275. } {
  276. code {fileList->iconsize(s);} {}
  277. }
  278. Function {iconsize()} {return_type uchar
  279. } {
  280. code {return (fileList->iconsize());} {}
  281. }
  282. Function {label(const char *l)} {return_type void
  283. } {
  284. code {window->label(l);} {}
  285. }
  286. Function {label()} {return_type {const char *}
  287. } {
  288. code {return (window->label());} {}
  289. }
  290. Function {ok_label(const char *l)} {return_type void
  291. } {
  292. code {okButton->label(l);
  293. int w=0, h=0;
  294. okButton->measure_label(w, h);
  295. okButton->resize(cancelButton->x() - 50 - w, cancelButton->y(),
  296. w + 40, 25);
  297. okButton->parent()->init_sizes();} {}
  298. }
  299. Function {ok_label()} {return_type {const char *}
  300. } {
  301. code {return (okButton->label());} {}
  302. }
  303. decl {void preview(int e);} {public
  304. }
  305. decl {int preview() const { return previewButton->value(); }} {public
  306. }
  307. decl {void showHidden(int e);} {private
  308. }
  309. decl {void remove_hidden_files();} {private
  310. }
  311. decl {void rescan();} {public
  312. }
  313. decl {void rescan_keep_filename();} {public
  314. }
  315. decl {void show();} {public
  316. }
  317. Function {shown()} {return_type int
  318. } {
  319. code {return window->shown();} {}
  320. }
  321. Function {textcolor(Fl_Color c)} {return_type void
  322. } {
  323. code {fileList->textcolor(c);} {}
  324. }
  325. Function {textcolor()} {return_type Fl_Color
  326. } {
  327. code {return (fileList->textcolor());} {}
  328. }
  329. Function {textfont(Fl_Font f)} {return_type void
  330. } {
  331. code {fileList->textfont(f);} {}
  332. }
  333. Function {textfont()} {selected return_type Fl_Font
  334. } {
  335. code {return (fileList->textfont());} {}
  336. }
  337. Function {textsize(Fl_Fontsize s)} {return_type void
  338. } {
  339. code {fileList->textsize(s);} {}
  340. }
  341. Function {textsize()} {return_type Fl_Fontsize
  342. } {
  343. code {return (fileList->textsize());} {}
  344. }
  345. Function {type(int t)} {return_type void
  346. } {
  347. code {type_ = t;
  348. if (t & MULTI)
  349. fileList->type(FL_MULTI_BROWSER);
  350. else
  351. fileList->type(FL_HOLD_BROWSER);
  352. if (t & CREATE)
  353. newButton->activate();
  354. else
  355. newButton->deactivate();
  356. if (t & DIRECTORY)
  357. fileList->filetype(Fl_File_Browser::DIRECTORIES);
  358. else
  359. fileList->filetype(Fl_File_Browser::FILES);} {}
  360. }
  361. Function {type()} {return_type int
  362. } {
  363. code {return (type_);} {}
  364. }
  365. Function {user_data() const} {return_type {void *}
  366. } {
  367. code {return (data_);} {}
  368. }
  369. Function {user_data(void *d)} {return_type void
  370. } {
  371. code {data_ = d;} {}
  372. }
  373. decl {const char *value(int f = 1);} {public
  374. }
  375. decl {void value(const char *filename);} {public
  376. }
  377. Function {visible()} {return_type int
  378. } {
  379. code {return window->visible();} {}
  380. }
  381. decl {static const char *add_favorites_label;} {
  382. comment {[standard text may be customized at run-time]} public
  383. }
  384. decl {static const char *all_files_label;} {
  385. comment {[standard text may be customized at run-time]} public
  386. }
  387. decl {static const char *custom_filter_label;} {
  388. comment {[standard text may be customized at run-time]} public
  389. }
  390. decl {static const char *existing_file_label;} {
  391. comment {[standard text may be customized at run-time]} public
  392. }
  393. decl {static const char *favorites_label;} {
  394. comment {[standard text may be customized at run-time]} public
  395. }
  396. decl {static const char *filename_label;} {
  397. comment {[standard text may be customized at run-time]} public
  398. }
  399. decl {static const char *filesystems_label;} {
  400. comment {[standard text may be customized at run-time]} public
  401. }
  402. decl {static const char *manage_favorites_label;} {
  403. comment {[standard text may be customized at run-time]} public
  404. }
  405. decl {static const char *new_directory_label;} {
  406. comment {[standard text may be customized at run-time]} public
  407. }
  408. decl {static const char *new_directory_tooltip;} {
  409. comment {[standard text may be customized at run-time]} public
  410. }
  411. decl {static const char *preview_label;} {
  412. comment {[standard text may be customized at run-time]} public
  413. }
  414. decl {static const char *save_label;} {
  415. comment {[standard text may be customized at run-time]} public
  416. }
  417. decl {static const char *show_label;} {
  418. comment {[standard text may be customized at run-time]} public
  419. }
  420. decl {static const char *hidden_label;} {
  421. comment {[standard text may be customized at run-time]} public
  422. }
  423. decl {static Fl_File_Sort_F *sort;} {
  424. comment {the sort function that is used when loading
  425. the contents of a directory.} public
  426. }
  427. decl {Fl_Widget* ext_group;} {}
  428. Function {add_extra(Fl_Widget* gr)} {open return_type {Fl_Widget*}
  429. } {
  430. code {Fl_Widget* ret=ext_group;} {}
  431. codeblock {if (gr==ext_group)} {open
  432. } {
  433. code {return ret;} {}
  434. }
  435. codeblock {if (ext_group)} {open
  436. } {
  437. code {int sh=ext_group->h()+4;
  438. Fl_Widget* svres=window->resizable();
  439. window->resizable(NULL);
  440. window->size(window->w(),window->h()-sh);
  441. window->remove(ext_group);
  442. ext_group=NULL;
  443. window->resizable(svres);} {}
  444. }
  445. codeblock {if (gr)} {open
  446. } {
  447. code {int nh=window->h()+gr->h()+4;
  448. Fl_Widget* svres=window->resizable();
  449. window->resizable(NULL);
  450. window->size(window->w(),nh);
  451. gr->position(2,okButton->y()+okButton->h()+2);
  452. window->add(gr);
  453. ext_group=gr;
  454. window->resizable(svres);} {}
  455. }
  456. code {return ret;} {}
  457. }
  458. }
  459. decl {FL_EXPORT char *fl_dir_chooser(const char *message,const char *fname,int relative=0);} {public
  460. }
  461. decl {FL_EXPORT char *fl_file_chooser(const char *message,const char *pat,const char *fname,int relative=0);} {public
  462. }
  463. decl {FL_EXPORT void fl_file_chooser_callback(void (*cb)(const char*));} {public
  464. }
  465. decl {FL_EXPORT void fl_file_chooser_ok_label(const char*l);} {public
  466. }
  467. comment {
  468. //
  469. // End of "$Id: Fl_File_Chooser.fl 8786 2011-06-07 11:41:36Z manolo $".
  470. //} {in_source in_header
  471. }