summaryrefslogtreecommitdiff
path: root/src/Fl_File_Chooser.fl
blob: 943c9f9fbe751c01533edfd8013a557e31af0b44 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
# data file for the Fltk User Interface Designer (fluid)
version 1.0107 
header_name {../FL/Fl_File_Chooser.H} 
code_name {.cxx}
comment {//
// "$Id: Fl_File_Chooser.fl 4723 2005-12-30 10:13:17Z matt $"
//
// Fl_File_Chooser dialog for the Fast Light Tool Kit (FLTK).
//
// Copyright 1998-2005 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
// License as published by the Free Software Foundation; either
// version 2 of the License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
// Library General Public License for more details.
//
// You should have received a copy of the GNU Library General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
// USA.
//
// Please report all bugs and problems on the following page:
//
//     http://www.fltk.org/str.php
//
} {in_source in_header
} 

decl {\#include <FL/fl_draw.H>} {} 

class FL_EXPORT Fl_File_Chooser {open
} {
  decl {enum { SINGLE = 0, MULTI = 1, CREATE = 2, DIRECTORY = 4 };} {public
  }
  decl {static Fl_Preferences prefs_;} {}
  decl {void (*callback_)(Fl_File_Chooser*, void *);} {}
  decl {void *data_;} {}
  decl {char directory_[1024];} {}
  decl {char pattern_[1024];} {}
  decl {char preview_text_[2048];} {}
  decl {int type_;} {}
  decl {void favoritesButtonCB();} {}
  decl {void favoritesCB(Fl_Widget *w);} {}
  decl {void fileListCB();} {}
  decl {void fileNameCB();} {}
  decl {void newdir();} {}
  decl {static void previewCB(Fl_File_Chooser *fc);} {}
  decl {void showChoiceCB();} {}
  decl {void update_favorites();} {}
  decl {void update_preview();} {}
  Function {Fl_File_Chooser(const char *d, const char *p, int t, const char *title)} {open
  } {
    Fl_Window window {
      label {Choose File}
      callback {fileName->value("");
fileList->deselect();
Fl::remove_timeout((Fl_Timeout_Handler)previewCB, this);
window->hide();}
      private xywh {368 285 490 380} type Double resizable
      code0 {if (title) window->label(title);}
      code1 {\#include <stdio.h>}
      code2 {\#include <stdlib.h>}
      code3 {\#include <string.h>} modal visible
    } {
      Fl_Group {} {
        private xywh {10 10 470 25}
      } {
        Fl_Choice showChoice {
          label {Show:}
          callback {showChoiceCB();} open
          private xywh {65 10 215 25} down_box BORDER_BOX labelfont 1 resizable
          code0 {showChoice->label(show_label);}
        } {}
        Fl_Menu_Button favoritesButton {
          label Favorites
          callback {favoritesButtonCB();} open
          private xywh {290 10 155 25} down_box BORDER_BOX align 20
          code0 {favoritesButton->label(favorites_label);}
        } {}
        Fl_Button newButton {
          callback {newdir();}
          image {new.xbm} xywh {455 10 25 25} labelsize 8
          code0 {\#include <FL/Fl_Preferences.H>}
          code1 {o->tooltip(new_directory_tooltip);}
        }
      }
      Fl_Tile {} {
        callback {update_preview();}
        private xywh {10 45 470 225} resizable
      } {
        Fl_File_Browser fileList {
          callback {fileListCB();}
          private xywh {10 45 295 225} type Hold hotspot
          code0 {\#include <FL/Fl_File_Browser.H>}
        }
        Fl_Box previewBox {
          label {?}
          private xywh {305 45 175 225} box DOWN_BOX labelsize 100 align 80
        }
      }
      Fl_Group {} {
        private xywh {10 275 470 95}
      } {
        Fl_Group {} {open
          private xywh {10 275 470 20}
        } {
          Fl_Check_Button previewButton {
            label Preview
            callback {preview(previewButton->value());}
            xywh {10 275 73 20} down_box DOWN_BOX shortcut 0x80070 value 1
            code0 {previewButton->label(preview_label);}
          }
          Fl_Box {} {
            private xywh {115 275 365 20} resizable
          }
        }
        Fl_File_Input fileName {
          callback {fileNameCB();}
          private xywh {115 300 365 35} labelfont 1 when 8 resizable
          code0 {fileName->when(FL_WHEN_CHANGED | FL_WHEN_ENTER_KEY_ALWAYS);}
        }
        Fl_Box {} {
          label {Filename:}
          private xywh {10 310 105 25} labelfont 1 align 24
          code0 {o->label(filename_label);}
        }
        Fl_Group {} {open
          private xywh {10 345 470 25}
        } {
          Fl_Return_Button okButton {
            label OK
            callback {// Do any callback that is registered...
if (callback_)
  (*callback_)(this, data_);

window->hide();}
            private xywh {313 345 85 25}
            code0 {\#include <FL/fl_ask.H>}
            code1 {okButton->label(fl_ok);}
          }
          Fl_Button cancelButton {
            label Cancel
            callback {fileName->value("");
fileList->deselect();
Fl::remove_timeout((Fl_Timeout_Handler)previewCB, this);
window->hide();}
            private xywh {408 345 72 25}
            code0 {o->label(fl_cancel);}
          }
          Fl_Box {} {
            private xywh {10 345 30 25} resizable
          }
        }
      }
    }
    Fl_Window favWindow {
      label {Manage Favorites}
      private xywh {421 56 355 150} type Double resizable
      code0 {favWindow->label(manage_favorites_label);} modal size_range {181 150 0 0} visible
    } {
      Fl_File_Browser favList {
        callback {favoritesCB(favList);}
        private xywh {10 10 300 95} type Hold resizable
      }
      Fl_Group {} {open
        xywh {320 10 25 95}
      } {
        Fl_Button favUpButton {
          label {@8>}
          callback {favoritesCB(favUpButton);}
          private xywh {320 10 25 25}
        }
        Fl_Button favDeleteButton {
          label X
          callback {favoritesCB(favDeleteButton);}
          private xywh {320 45 25 25} labelfont 1 resizable
        }
        Fl_Button favDownButton {
          label {@2>}
          callback {favoritesCB(favDownButton);}
          private xywh {320 80 25 25}
        }
      }
      Fl_Group {} {open
        xywh {10 113 335 29}
      } {
        Fl_Button favCancelButton {
          label Cancel
          callback {favWindow->hide();}
          private xywh {273 115 72 25}
          code0 {favCancelButton->label(fl_cancel);}
        }
        Fl_Return_Button favOkButton {
          label Save
          callback {favoritesCB(favOkButton);}
          private xywh {181 115 79 25}
          code0 {\#include <FL/fl_ask.H>}
          code1 {favOkButton->label(save_label);}
        }
        Fl_Box {} {
          xywh {10 115 161 25} resizable
        }
      }
    }
    code {callback_ = 0;
data_ = 0;
directory_[0] = 0;
window->size_range(window->w(), window->h(), Fl::w(), Fl::h());
type(t);
filter(p);
update_favorites();
value(d);
type(t);
int e;
prefs_.get("preview", e, 1);
preview(e);} {}
  }
  Function {~Fl_File_Chooser()} {} {
    code {Fl::remove_timeout((Fl_Timeout_Handler)previewCB, this);
delete window;
delete favWindow;} {}
  }
  Function {callback(void (*cb)(Fl_File_Chooser *, void *), void *d = 0)} {return_type void
  } {
    code {callback_ = cb;
data_     = d;} {}
  }
  Function {color(Fl_Color c)} {} {
    code {fileList->color(c);} {}
  }
  Function {color()} {return_type Fl_Color
  } {
    code {return (fileList->color());} {}
  }
  decl {int count();} {public
  }
  decl {void directory(const char *d);} {public
  }
  Function {directory()} {return_type {char *}
  } {
    code {return directory_;} {}
  }
  decl {void filter(const char *p);} {public
  }
  Function {filter()} {return_type {const char *}
  } {
    code {return (fileList->filter());} {}
  }
  Function {filter_value()} {return_type int
  } {
    code {return showChoice->value();} {}
  }
  Function {filter_value(int f)} {return_type void
  } {
    code {showChoice->value(f);
showChoiceCB();} {}
  }
  Function {hide()} {return_type void
  } {
    code {window->hide();} {}
  }
  Function {iconsize(uchar s)} {return_type void
  } {
    code {fileList->iconsize(s);} {}
  }
  Function {iconsize()} {return_type uchar
  } {
    code {return (fileList->iconsize());} {}
  }
  Function {label(const char *l)} {return_type void
  } {
    code {window->label(l);} {}
  }
  Function {label()} {return_type {const char *}
  } {
    code {return (window->label());} {}
  }
  Function {ok_label(const char *l)} {return_type void
  } {
    code {okButton->label(l);
int w=0, h=0;
okButton->measure_label(w, h);
okButton->resize(cancelButton->x() - 50 - w, cancelButton->y(),
                 w + 40, 25);
okButton->parent()->init_sizes();} {}
  }
  Function {ok_label()} {return_type {const char *}
  } {
    code {return (okButton->label());} {}
  }
  decl {void preview(int e);} {public
  }
  decl {int preview() const { return previewButton->value(); }} {public
  }
  decl {void rescan();} {public
  }
  decl {void rescan_keep_filename();} {public
  }
  Function {show()} {open return_type void
  } {
    code {window->hotspot(fileList);
window->show();
Fl::flush();
fl_cursor(FL_CURSOR_WAIT);
rescan_keep_filename();
fl_cursor(FL_CURSOR_DEFAULT);
fileName->take_focus();} {selected
    }
  }
  Function {shown()} {return_type int
  } {
    code {return window->shown();} {}
  }
  Function {textcolor(Fl_Color c)} {return_type void
  } {
    code {fileList->textcolor(c);} {}
  }
  Function {textcolor()} {return_type Fl_Color
  } {
    code {return (fileList->textcolor());} {}
  }
  Function {textfont(uchar f)} {return_type void
  } {
    code {fileList->textfont(f);} {}
  }
  Function {textfont()} {return_type uchar
  } {
    code {return (fileList->textfont());} {}
  }
  Function {textsize(uchar s)} {return_type void
  } {
    code {fileList->textsize(s);} {}
  }
  Function {textsize()} {return_type uchar
  } {
    code {return (fileList->textsize());} {}
  }
  Function {type(int t)} {return_type void
  } {
    code {type_ = t;
if (t & MULTI)
  fileList->type(FL_MULTI_BROWSER);
else
  fileList->type(FL_HOLD_BROWSER);
if (t & CREATE)
  newButton->activate();
else
  newButton->deactivate();
if (t & DIRECTORY)
  fileList->filetype(Fl_File_Browser::DIRECTORIES);
else
  fileList->filetype(Fl_File_Browser::FILES);} {}
  }
  Function {type()} {return_type int
  } {
    code {return (type_);} {}
  }
  Function {user_data() const} {return_type {void *}
  } {
    code {return (data_);} {}
  }
  Function {user_data(void *d)} {return_type void
  } {
    code {data_ = d;} {}
  }
  decl {const char *value(int f = 1);} {public
  }
  decl {void value(const char *filename);} {public
  }
  Function {visible()} {return_type int
  } {
    code {return window->visible();} {}
  }
  decl {static const char *add_favorites_label;} {public
  }
  decl {static const char *all_files_label;} {public
  }
  decl {static const char *custom_filter_label;} {public
  }
  decl {static const char *existing_file_label;} {public
  }
  decl {static const char *favorites_label;} {public
  }
  decl {static const char *filename_label;} {public
  }
  decl {static const char *filesystems_label;} {public
  }
  decl {static const char *manage_favorites_label;} {public
  }
  decl {static const char *new_directory_label;} {public
  }
  decl {static const char *new_directory_tooltip;} {public
  }
  decl {static const char *preview_label;} {public
  }
  decl {static const char *save_label;} {public
  }
  decl {static const char *show_label;} {public
  }
  decl {static Fl_File_Sort_F *sort;} {public
  }
} 

decl {FL_EXPORT char *fl_dir_chooser(const char *message,const char *fname,int relative=0);} {public
} 

decl {FL_EXPORT char *fl_file_chooser(const char *message,const char *pat,const char *fname,int relative=0);} {public
} 

decl {FL_EXPORT void fl_file_chooser_callback(void (*cb)(const char*));} {public
} 

decl {FL_EXPORT void fl_file_chooser_ok_label(const char*l);} {public
} 

comment {
//
// End of "$Id: Fl_File_Chooser.fl 4723 2005-12-30 10:13:17Z matt $".
//} {in_source in_header
}