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