2001-08-02 20:17:04 +04:00
|
|
|
// generated by Fast Light User Interface Designer (fluid) version 1.0100
|
2001-08-02 01:24:49 +04:00
|
|
|
|
2001-09-29 18:38:59 +04:00
|
|
|
#include "../FL/Fl_File_Chooser.H"
|
2001-08-02 01:24:49 +04:00
|
|
|
|
2001-09-29 18:38:59 +04:00
|
|
|
inline void Fl_File_Chooser::cb_window_i(Fl_Window*, void*) {
|
2001-08-02 01:24:49 +04:00
|
|
|
fileList->deselect();
|
2001-08-02 20:17:04 +04:00
|
|
|
fileName->value("");
|
|
|
|
window->hide();
|
2001-08-02 01:24:49 +04:00
|
|
|
}
|
2001-09-29 18:38:59 +04:00
|
|
|
void Fl_File_Chooser::cb_window(Fl_Window* o, void* v) {
|
|
|
|
((Fl_File_Chooser*)(o->user_data()))->cb_window_i(o,v);
|
2001-08-02 01:24:49 +04:00
|
|
|
}
|
|
|
|
|
2001-09-29 18:38:59 +04:00
|
|
|
inline void Fl_File_Chooser::cb_fileList_i(Fl_File_Browser*, void*) {
|
2001-08-02 20:17:04 +04:00
|
|
|
fileListCB();
|
2001-08-02 01:24:49 +04:00
|
|
|
}
|
2001-09-29 18:38:59 +04:00
|
|
|
void Fl_File_Chooser::cb_fileList(Fl_File_Browser* o, void* v) {
|
|
|
|
((Fl_File_Chooser*)(o->parent()->user_data()))->cb_fileList_i(o,v);
|
2001-08-02 20:17:04 +04:00
|
|
|
}
|
|
|
|
|
2001-09-29 18:38:59 +04:00
|
|
|
inline void Fl_File_Chooser::cb_Cancel_i(Fl_Button*, void*) {
|
2001-08-02 20:17:04 +04:00
|
|
|
fileList->deselect();
|
|
|
|
fileName->value("");
|
|
|
|
window->hide();
|
|
|
|
}
|
2001-09-29 18:38:59 +04:00
|
|
|
void Fl_File_Chooser::cb_Cancel(Fl_Button* o, void* v) {
|
|
|
|
((Fl_File_Chooser*)(o->parent()->user_data()))->cb_Cancel_i(o,v);
|
2001-08-02 20:17:04 +04:00
|
|
|
}
|
|
|
|
|
2001-09-29 18:38:59 +04:00
|
|
|
inline void Fl_File_Chooser::cb_okButton_i(Fl_Return_Button*, void*) {
|
2001-08-04 16:21:34 +04:00
|
|
|
// Do any callback that is registered...
|
|
|
|
if (callback_)
|
|
|
|
(*callback_)(this, data_);
|
|
|
|
|
|
|
|
window->hide();
|
2001-08-02 20:17:04 +04:00
|
|
|
}
|
2001-09-29 18:38:59 +04:00
|
|
|
void Fl_File_Chooser::cb_okButton(Fl_Return_Button* o, void* v) {
|
|
|
|
((Fl_File_Chooser*)(o->parent()->user_data()))->cb_okButton_i(o,v);
|
2001-08-02 20:17:04 +04:00
|
|
|
}
|
|
|
|
|
2001-09-29 18:38:59 +04:00
|
|
|
inline void Fl_File_Chooser::cb_fileName_i(Fl_Input*, void*) {
|
2001-08-02 20:17:04 +04:00
|
|
|
fileNameCB();
|
|
|
|
}
|
2001-09-29 18:38:59 +04:00
|
|
|
void Fl_File_Chooser::cb_fileName(Fl_Input* o, void* v) {
|
|
|
|
((Fl_File_Chooser*)(o->parent()->user_data()))->cb_fileName_i(o,v);
|
2001-08-02 01:24:49 +04:00
|
|
|
}
|
|
|
|
|
2001-09-29 18:38:59 +04:00
|
|
|
inline void Fl_File_Chooser::cb_upButton_i(Fl_Button*, void*) {
|
2001-08-02 01:24:49 +04:00
|
|
|
up();
|
|
|
|
}
|
2001-09-29 18:38:59 +04:00
|
|
|
void Fl_File_Chooser::cb_upButton(Fl_Button* o, void* v) {
|
|
|
|
((Fl_File_Chooser*)(o->parent()->user_data()))->cb_upButton_i(o,v);
|
2001-08-02 01:24:49 +04:00
|
|
|
}
|
|
|
|
|
2001-08-02 20:17:04 +04:00
|
|
|
#include <FL/Fl_Bitmap.H>
|
2001-12-11 19:03:13 +03:00
|
|
|
static unsigned char idata_up[] =
|
2001-08-02 01:24:49 +04:00
|
|
|
"\0\0x\0\204\0\2\1""1\376y\200\375\200""1\200""1\200""1\200""1\200""1\200\1\
|
|
|
|
\200\1\200\377\377\0\0";
|
2001-12-11 19:03:13 +03:00
|
|
|
static Fl_Bitmap image_up(idata_up, 16, 16);
|
2001-08-02 01:24:49 +04:00
|
|
|
|
2001-09-29 18:38:59 +04:00
|
|
|
inline void Fl_File_Chooser::cb_newButton_i(Fl_Button*, void*) {
|
2001-08-02 01:24:49 +04:00
|
|
|
newdir();
|
|
|
|
}
|
2001-09-29 18:38:59 +04:00
|
|
|
void Fl_File_Chooser::cb_newButton(Fl_Button* o, void* v) {
|
|
|
|
((Fl_File_Chooser*)(o->parent()->user_data()))->cb_newButton_i(o,v);
|
2001-08-02 01:24:49 +04:00
|
|
|
}
|
|
|
|
|
2001-12-11 19:03:13 +03:00
|
|
|
static unsigned char idata_new[] =
|
2001-08-02 01:24:49 +04:00
|
|
|
"\0\0x\0\204\0\2\1\1\376\1\200""1\200""1\200\375\200\375\200""1\200""1\200\1\
|
|
|
|
\200\1\200\377\377\0\0";
|
2001-12-11 19:03:13 +03:00
|
|
|
static Fl_Bitmap image_new(idata_new, 16, 16);
|
2001-08-02 01:24:49 +04:00
|
|
|
|
2001-09-29 18:38:59 +04:00
|
|
|
inline void Fl_File_Chooser::cb_dirMenu_i(Fl_Choice*, void*) {
|
2001-08-02 01:24:49 +04:00
|
|
|
char pathname[1024];
|
2001-08-02 20:17:04 +04:00
|
|
|
int i;
|
2001-08-02 01:24:49 +04:00
|
|
|
|
2001-08-02 20:17:04 +04:00
|
|
|
pathname[0] = '\0';
|
|
|
|
for (i = 1; i <= dirMenu->value(); i ++)
|
|
|
|
strcat(pathname, dirMenu->text(i));
|
|
|
|
directory(pathname);
|
2001-08-02 01:24:49 +04:00
|
|
|
}
|
2001-09-29 18:38:59 +04:00
|
|
|
void Fl_File_Chooser::cb_dirMenu(Fl_Choice* o, void* v) {
|
|
|
|
((Fl_File_Chooser*)(o->parent()->user_data()))->cb_dirMenu_i(o,v);
|
2001-08-02 01:24:49 +04:00
|
|
|
}
|
|
|
|
|
2001-09-29 18:38:59 +04:00
|
|
|
inline void Fl_File_Chooser::cb__i(Fl_Button*, void*) {
|
2001-08-02 20:17:04 +04:00
|
|
|
const char *f;
|
|
|
|
if ((f = fl_input("New Filter?",
|
|
|
|
fileList->filter())) != NULL)
|
|
|
|
{
|
|
|
|
fileList->filter(f);
|
|
|
|
rescan();
|
|
|
|
};
|
2001-08-02 01:24:49 +04:00
|
|
|
}
|
2001-09-29 18:38:59 +04:00
|
|
|
void Fl_File_Chooser::cb_(Fl_Button* o, void* v) {
|
|
|
|
((Fl_File_Chooser*)(o->parent()->user_data()))->cb__i(o,v);
|
2001-08-02 01:24:49 +04:00
|
|
|
}
|
|
|
|
|
2001-12-11 19:03:13 +03:00
|
|
|
static unsigned char idata_allfiles[] =
|
2001-08-02 20:17:04 +04:00
|
|
|
"\374?\4 \4 \4 \204!\244%\304#\364/\364/\304#\244%\204!\4 \4 \4 \374?";
|
2001-12-11 19:03:13 +03:00
|
|
|
static Fl_Bitmap image_allfiles(idata_allfiles, 16, 16);
|
2001-08-02 20:17:04 +04:00
|
|
|
|
2001-09-29 18:38:59 +04:00
|
|
|
Fl_File_Chooser::Fl_File_Chooser(const char *d, const char *p, int t, const char *title) {
|
2001-08-02 20:17:04 +04:00
|
|
|
Fl_Window* w;
|
2001-08-02 01:24:49 +04:00
|
|
|
{ Fl_Window* o = window = new Fl_Window(375, 315, "Pick a File");
|
2001-08-02 20:17:04 +04:00
|
|
|
w = o;
|
2001-08-02 01:24:49 +04:00
|
|
|
o->callback((Fl_Callback*)cb_window, (void*)(this));
|
2001-09-29 18:38:59 +04:00
|
|
|
{ Fl_File_Browser* o = fileList = new Fl_File_Browser(10, 45, 355, 180);
|
2001-08-02 20:17:04 +04:00
|
|
|
o->type(2);
|
2001-08-02 01:24:49 +04:00
|
|
|
o->callback((Fl_Callback*)cb_fileList);
|
|
|
|
Fl_Group::current()->resizable(o);
|
2001-08-02 20:17:04 +04:00
|
|
|
w->hotspot(o);
|
|
|
|
}
|
|
|
|
{ Fl_Button* o = new Fl_Button(285, 280, 80, 25, "Cancel");
|
|
|
|
o->callback((Fl_Callback*)cb_Cancel);
|
2001-08-03 22:46:57 +04:00
|
|
|
o->label(fl_cancel);
|
2001-08-02 20:17:04 +04:00
|
|
|
}
|
2001-08-03 22:46:57 +04:00
|
|
|
{ Fl_Return_Button* o = okButton = new Fl_Return_Button(200, 280, 75, 25, "OK");
|
2001-08-02 20:17:04 +04:00
|
|
|
o->callback((Fl_Callback*)cb_okButton);
|
2001-08-03 22:46:57 +04:00
|
|
|
okButton->label(fl_ok);
|
2001-08-02 01:24:49 +04:00
|
|
|
}
|
2001-08-02 20:17:04 +04:00
|
|
|
{ Fl_Input* o = fileName = new Fl_Input(10, 245, 355, 25, "Filename:");
|
2001-08-02 01:24:49 +04:00
|
|
|
o->callback((Fl_Callback*)cb_fileName);
|
2001-08-02 20:17:04 +04:00
|
|
|
o->align(FL_ALIGN_TOP_LEFT);
|
2001-08-02 01:24:49 +04:00
|
|
|
o->when(FL_WHEN_ENTER_KEY);
|
|
|
|
fileName->when(FL_WHEN_CHANGED | FL_WHEN_ENTER_KEY_ALWAYS);
|
|
|
|
}
|
2001-08-02 20:17:04 +04:00
|
|
|
{ Fl_Button* o = upButton = new Fl_Button(280, 10, 25, 25);
|
2001-09-30 02:59:45 +04:00
|
|
|
o->tooltip("Show the parent directory.");
|
2001-12-11 19:03:13 +03:00
|
|
|
o->image(image_up);
|
2001-08-02 20:17:04 +04:00
|
|
|
o->labelsize(8);
|
|
|
|
o->callback((Fl_Callback*)cb_upButton);
|
2001-08-02 01:24:49 +04:00
|
|
|
}
|
2001-08-02 20:17:04 +04:00
|
|
|
{ Fl_Button* o = newButton = new Fl_Button(310, 10, 25, 25);
|
2001-09-30 02:59:45 +04:00
|
|
|
o->tooltip("Create a new directory.");
|
2001-12-11 19:03:13 +03:00
|
|
|
o->image(image_new);
|
2001-08-02 20:17:04 +04:00
|
|
|
o->labelsize(8);
|
|
|
|
o->callback((Fl_Callback*)cb_newButton);
|
|
|
|
}
|
|
|
|
{ Fl_Choice* o = dirMenu = new Fl_Choice(95, 10, 180, 25, "Directory:");
|
2001-09-30 02:59:45 +04:00
|
|
|
o->tooltip("Choose a parent directory.");
|
2001-09-29 10:40:06 +04:00
|
|
|
o->down_box(FL_BORDER_BOX);
|
2001-08-02 20:17:04 +04:00
|
|
|
o->callback((Fl_Callback*)cb_dirMenu);
|
|
|
|
}
|
|
|
|
{ Fl_Button* o = new Fl_Button(340, 10, 25, 25);
|
2001-09-30 02:59:45 +04:00
|
|
|
o->tooltip("Change the filename filter.");
|
2001-12-11 19:03:13 +03:00
|
|
|
o->image(image_allfiles);
|
2001-08-02 20:17:04 +04:00
|
|
|
o->labelsize(28);
|
|
|
|
o->labelcolor(4);
|
2001-09-29 10:40:06 +04:00
|
|
|
o->callback((Fl_Callback*)cb_);
|
2001-08-02 20:17:04 +04:00
|
|
|
o->align(FL_ALIGN_CENTER|FL_ALIGN_INSIDE);
|
2001-08-02 01:24:49 +04:00
|
|
|
}
|
|
|
|
if (title) window->label(title);
|
|
|
|
o->set_modal();
|
|
|
|
o->end();
|
|
|
|
}
|
2001-12-11 19:03:13 +03:00
|
|
|
window->size_range(375, 315, 375);
|
2001-08-02 01:24:49 +04:00
|
|
|
fileList->filter(p);
|
|
|
|
type(t);
|
|
|
|
value(d);
|
2001-08-04 16:21:34 +04:00
|
|
|
callback_ = 0;
|
|
|
|
data_ = 0;
|
|
|
|
}
|
|
|
|
|
2001-09-29 18:38:59 +04:00
|
|
|
void Fl_File_Chooser::callback(void (*cb)(Fl_File_Chooser *, void *), void *d) {
|
2001-08-04 16:21:34 +04:00
|
|
|
callback_ = cb;
|
|
|
|
data_ = d;
|
2001-08-02 01:24:49 +04:00
|
|
|
}
|
|
|
|
|
2001-09-29 18:38:59 +04:00
|
|
|
void Fl_File_Chooser::color(Fl_Color c) {
|
2001-08-02 01:24:49 +04:00
|
|
|
fileList->color(c);
|
|
|
|
}
|
|
|
|
|
2001-09-29 18:38:59 +04:00
|
|
|
Fl_Color Fl_File_Chooser::color() {
|
2001-08-02 01:24:49 +04:00
|
|
|
return (fileList->color());
|
|
|
|
}
|
|
|
|
|
2001-09-29 18:38:59 +04:00
|
|
|
char * Fl_File_Chooser::directory() {
|
2001-08-02 01:24:49 +04:00
|
|
|
return directory_;
|
|
|
|
}
|
|
|
|
|
2001-09-29 18:38:59 +04:00
|
|
|
void Fl_File_Chooser::filter(const char *p) {
|
2001-08-02 01:24:49 +04:00
|
|
|
fileList->filter(p);
|
|
|
|
rescan();
|
|
|
|
}
|
|
|
|
|
2001-09-29 18:38:59 +04:00
|
|
|
const char * Fl_File_Chooser::filter() {
|
2001-08-02 01:24:49 +04:00
|
|
|
return (fileList->filter());
|
|
|
|
}
|
|
|
|
|
2001-09-29 18:38:59 +04:00
|
|
|
void Fl_File_Chooser::hide() {
|
2001-08-02 01:24:49 +04:00
|
|
|
window->hide();
|
|
|
|
}
|
|
|
|
|
2001-09-29 18:38:59 +04:00
|
|
|
void Fl_File_Chooser::iconsize(uchar s) {
|
2001-08-02 01:24:49 +04:00
|
|
|
fileList->iconsize(s);
|
|
|
|
}
|
|
|
|
|
2001-09-29 18:38:59 +04:00
|
|
|
uchar Fl_File_Chooser::iconsize() {
|
2001-08-02 01:24:49 +04:00
|
|
|
return (fileList->iconsize());
|
|
|
|
}
|
|
|
|
|
2001-09-29 18:38:59 +04:00
|
|
|
void Fl_File_Chooser::label(const char *l) {
|
2001-08-02 01:24:49 +04:00
|
|
|
window->label(l);
|
|
|
|
}
|
|
|
|
|
2001-09-29 18:38:59 +04:00
|
|
|
const char * Fl_File_Chooser::label() {
|
2001-08-02 01:24:49 +04:00
|
|
|
return (window->label());
|
|
|
|
}
|
|
|
|
|
2001-09-29 18:38:59 +04:00
|
|
|
void Fl_File_Chooser::show() {
|
2001-08-02 20:17:04 +04:00
|
|
|
window->show();
|
2001-08-02 01:24:49 +04:00
|
|
|
fileList->deselect();
|
|
|
|
}
|
|
|
|
|
2001-09-29 18:38:59 +04:00
|
|
|
void Fl_File_Chooser::textcolor(Fl_Color c) {
|
2001-08-02 01:24:49 +04:00
|
|
|
fileList->textcolor(c);
|
|
|
|
}
|
|
|
|
|
2001-09-29 18:38:59 +04:00
|
|
|
Fl_Color Fl_File_Chooser::textcolor() {
|
2001-08-02 01:24:49 +04:00
|
|
|
return (fileList->textcolor());
|
|
|
|
}
|
|
|
|
|
2001-09-29 18:38:59 +04:00
|
|
|
void Fl_File_Chooser::textfont(uchar f) {
|
2001-08-02 20:17:04 +04:00
|
|
|
fileList->textfont(f);
|
2001-08-02 01:24:49 +04:00
|
|
|
}
|
|
|
|
|
2001-09-29 18:38:59 +04:00
|
|
|
uchar Fl_File_Chooser::textfont() {
|
2001-08-02 20:17:04 +04:00
|
|
|
return (fileList->textfont());
|
2001-08-02 01:24:49 +04:00
|
|
|
}
|
|
|
|
|
2001-09-29 18:38:59 +04:00
|
|
|
void Fl_File_Chooser::textsize(uchar s) {
|
2001-08-02 20:17:04 +04:00
|
|
|
fileList->textsize(s);
|
2001-08-02 01:24:49 +04:00
|
|
|
}
|
|
|
|
|
2001-09-29 18:38:59 +04:00
|
|
|
uchar Fl_File_Chooser::textsize() {
|
2001-08-02 01:24:49 +04:00
|
|
|
return (fileList->textsize());
|
|
|
|
}
|
|
|
|
|
2001-09-29 18:38:59 +04:00
|
|
|
void Fl_File_Chooser::type(int t) {
|
2001-08-02 01:24:49 +04:00
|
|
|
type_ = t;
|
2001-09-29 18:38:59 +04:00
|
|
|
if (t & MULTI)
|
2001-08-02 01:24:49 +04:00
|
|
|
fileList->type(FL_MULTI_BROWSER);
|
|
|
|
else
|
|
|
|
fileList->type(FL_HOLD_BROWSER);
|
2001-09-29 18:38:59 +04:00
|
|
|
if (t & CREATE)
|
2001-08-02 01:24:49 +04:00
|
|
|
newButton->deactivate();
|
|
|
|
else
|
|
|
|
newButton->activate();
|
2001-09-29 18:38:59 +04:00
|
|
|
if (t & DIRECTORY)
|
|
|
|
fileList->filetype(Fl_File_Browser::DIRECTORIES);
|
|
|
|
else
|
|
|
|
fileList->filetype(Fl_File_Browser::FILES);
|
2001-08-02 01:24:49 +04:00
|
|
|
}
|
|
|
|
|
2001-09-29 18:38:59 +04:00
|
|
|
int Fl_File_Chooser::type() {
|
2001-08-02 01:24:49 +04:00
|
|
|
return (type_);
|
|
|
|
}
|
|
|
|
|
2001-09-29 18:38:59 +04:00
|
|
|
int Fl_File_Chooser::visible() {
|
2001-08-02 01:24:49 +04:00
|
|
|
return window->visible();
|
|
|
|
}
|
2001-09-30 21:37:06 +04:00
|
|
|
FL_EXPORT char *fl_dir_chooser(const char *message,const char *fname);
|
|
|
|
FL_EXPORT char *fl_file_chooser(const char *message,const char *pat,const char *fname);
|
|
|
|
FL_EXPORT void fl_file_chooser_callback(void (*cb)(const char*));
|