# data file for the Fltk User Interface Designer (fluid)
version 1.0400
header_name {../FL/Fl_File_Chooser.H}
code_name {.cxx}
comment {//
// Fl_File_Chooser dialog for the Fast Light Tool Kit (FLTK).
//
// Copyright 1998-2021 by Bill Spitzak and others.
//
// This library is free software. Distribution and use rights are outlined in
// the file "COPYING" which should have been included with this file.  If this
// file is missing or damaged, see the license at:
//
//     https://www.fltk.org/COPYING.php
//
// Please see the following page on how to report bugs and issues:
//
//     https://www.fltk.org/bugs.php
//
// =======================================================================
//  DO NOT EDIT FL/Fl_File_Chooser.H and src/Fl_File_Chooser.cxx !!!
// =======================================================================
//  Please use fluid to change src/Fl_File_Chooser.fl interactively
//  and then use fluid to "write code" or edit and use fluid -c .
// =======================================================================
//
} {in_source in_header
}

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

class FL_EXPORT Fl_File_Chooser {open
} {
  decl {enum { SINGLE = 0, MULTI = 1, CREATE = 2, DIRECTORY = 4 };} {public local
  }
  decl {static Fl_Preferences *prefs_;} {private local
  }
  decl {void (*callback_)(Fl_File_Chooser*, void *);} {private local
  }
  decl {void *data_;} {private local
  }
  decl {char directory_[FL_PATH_MAX];} {private local
  }
  decl {char pattern_[FL_PATH_MAX];} {private local
  }
  decl {char preview_text_[2048];} {private local
  }
  decl {int type_;} {private local
  }
  decl {void favoritesButtonCB();} {private local
  }
  decl {void favoritesCB(Fl_Widget *w);} {private local
  }
  decl {void fileListCB();} {private local
  }
  decl {void fileNameCB();} {selected private local
  }
  decl {void newdir();} {private local
  }
  decl {static void previewCB(Fl_File_Chooser *fc);} {private local
  }
  decl {void showChoiceCB();} {private local
  }
  decl {void update_favorites();} {private local
  }
  decl {void update_preview();} {private local
  }
  Function {Fl_File_Chooser(const char *d, const char *p, int t, const char *title)} {open
  } {
    code {if (!prefs_) {
  prefs_ = new Fl_Preferences(Fl_Preferences::CORE_USER, "fltk.org", "filechooser");
}} {}
    code {Fl_Group *prev_current = Fl_Group::current();} {}
    Fl_Window window {
      label {Choose File}
      callback {fileName->value("");
fileList->deselect();
Fl::remove_timeout((Fl_Timeout_Handler)previewCB, this);
window->hide();} open
      private xywh {1171 438 490 380} type Double hide resizable
      code0 {if (title) window->label(title);} modal
    } {
      Fl_Group {} {open
        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();} open
        private xywh {10 45 470 225} resizable
      } {
        Fl_File_Browser fileList {
          callback {fileListCB();}
          private xywh {10 45 295 225} type Hold box DOWN_BOX hotspot
          code0 {\#include <FL/Fl_File_Browser.H>}
        }
        Fl_Box errorBox {
          label {dynamic error display}
          private xywh {10 45 295 225} box DOWN_BOX color 7 labelsize 18 labelcolor 1 align 149 hide
        }
        Fl_Box previewBox {
          label {?}
          private xywh {305 45 175 225} box DOWN_BOX labelsize 100 align 80
        }
      }
      Fl_Group {} {open
        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_Check_Button showHiddenButton {
            label {Show hidden files}
            callback {showHidden(showHiddenButton->value());}
            xywh {115 275 165 20} down_box DOWN_BOX
            code0 {showHiddenButton->label(hidden_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 {window->hide();

// Do any callback that is registered...
if (callback_)
  (*callback_)(this, data_);}
            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 {413 100 355 150} type Double hide resizable
      code0 {favWindow->label(manage_favorites_label);} modal size_range {181 150 0 0}
    } {
      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);
Fl_Group::current(prev_current);} {}
    code {ext_group=(Fl_Widget*)0;} {}
  }
  Function {~Fl_File_Chooser()} {open
  } {
    code {Fl::remove_timeout((Fl_Timeout_Handler)previewCB, this);
if(ext_group)window->remove(ext_group);
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 local
  }
  decl {void directory(const char *d);} {public local
  }
  Function {directory()} {return_type {char *}
  } {
    code {return directory_;} {}
  }
  decl {void filter(const char *p);} {public local
  }
  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 {if (l) 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 local
  }
  decl {int preview() const { return previewButton->value(); }} {public local
  }
  decl {void showHidden(int e);} {private local
  }
  decl {void remove_hidden_files();} {private local
  }
  decl {void rescan();} {public local
  }
  decl {void rescan_keep_filename();} {public local
  }
  decl {void show();} {public local
  }
  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(Fl_Font f)} {return_type void
  } {
    code {fileList->textfont(f);} {}
  }
  Function {textfont()} {return_type Fl_Font
  } {
    code {return (fileList->textfont());} {}
  }
  Function {textsize(Fl_Fontsize s)} {return_type void
  } {
    code {fileList->textsize(s);} {}
  }
  Function {textsize()} {return_type Fl_Fontsize
  } {
    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;} {selected
    }
  }
  decl {const char *value(int f = 1);} {public local
  }
  decl {void value(const char *filename);} {public local
  }
  Function {visible()} {return_type int
  } {
    code {return window->visible();} {}
  }
  Function {position(int x, int y)} {return_type void
  } {
    code {window->position(x, y);} {}
  }
  Function {x() const} {return_type int
  } {
    code {return window->x();} {}
  }
  Function {y() const} {return_type int
  } {
    code {return window->y();} {}
  }
  Function {w() const} {return_type int
  } {
    code {return window->w();} {}
  }
  Function {h() const} {return_type int
  } {
    code {return window->h();} {}
  }
  Function {size(int w, int h)} {open return_type void
  } {
    code {window->size(w, h);} {}
  }
  Function {resize(int x, int y, int w, int h)} {open return_type void
  } {
    code {window->resize(x, y, w, h);} {}
  }
  decl {static const char *add_favorites_label;} {
    comment {[standard text may be customized at run-time]} public local
  }
  decl {static const char *all_files_label;} {
    comment {[standard text may be customized at run-time]} public local
  }
  decl {static const char *custom_filter_label;} {
    comment {[standard text may be customized at run-time]} public local
  }
  decl {static const char *existing_file_label;} {
    comment {[standard text may be customized at run-time]} public local
  }
  decl {static const char *favorites_label;} {
    comment {[standard text may be customized at run-time]} public local
  }
  decl {static const char *filename_label;} {
    comment {[standard text may be customized at run-time]} public local
  }
  decl {static const char *filesystems_label;} {
    comment {[standard text may be customized at run-time]} public local
  }
  decl {static const char *manage_favorites_label;} {
    comment {[standard text may be customized at run-time]} public local
  }
  decl {static const char *new_directory_label;} {
    comment {[standard text may be customized at run-time]} public local
  }
  decl {static const char *new_directory_tooltip;} {
    comment {[standard text may be customized at run-time]} public local
  }
  decl {static const char *preview_label;} {
    comment {[standard text may be customized at run-time]} public local
  }
  decl {static const char *save_label;} {
    comment {[standard text may be customized at run-time]} public local
  }
  decl {static const char *show_label;} {
    comment {[standard text may be customized at run-time]} public local
  }
  decl {static const char *hidden_label;} {
    comment {[standard text may be customized at run-time]} public local
  }
  decl {static Fl_File_Sort_F *sort;} {
    comment {the sort function that is used when loading
the contents of a directory.} public local
  }
  decl {Fl_Widget* ext_group;} {private local
  }
  Function {add_extra(Fl_Widget* gr)} {open return_type {Fl_Widget*}
  } {
    code {Fl_Widget* ret=ext_group;} {}
    codeblock {if (gr==ext_group)} {open
    } {
      code {return ret;} {}
    }
    codeblock {if (ext_group)} {open
    } {
      code {int sh=ext_group->h()+4;
Fl_Widget* svres=window->resizable();
window->resizable(NULL);
window->size(window->w(),window->h()-sh);
window->remove(ext_group);
ext_group=NULL;
window->resizable(svres);} {}
    }
    codeblock {if (gr)} {open
    } {
      code {int nh=window->h()+gr->h()+4;
Fl_Widget* svres=window->resizable();
window->resizable(NULL);
window->size(window->w(),nh);
gr->position(2,okButton->y()+okButton->h()+2);
window->add(gr);
ext_group=gr;
window->resizable(svres);} {}
    }
    code {return ret;} {}
  }
  Function {show_error_box(int val)} {
    comment {Show error box if val=1, hide if val=0} open protected return_type void
  } {
    code {if ( val ) {
  errorBox->color(fileList->color()); // inherit fileList's bg color
  errorBox->show();
  fileList->hide();
} else {
  errorBox->hide();
  fileList->show();
}} {}
  }
}

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

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

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

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