File chooser update with new FLUID.

git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@1591 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
Michael R Sweet 2001-09-29 06:40:06 +00:00
parent 4c97599917
commit de6c7f66ee
3 changed files with 17 additions and 19 deletions

View File

@ -42,8 +42,8 @@ private:
Fl_Choice *dirMenu; Fl_Choice *dirMenu;
inline void cb_dirMenu_i(Fl_Choice*, void*); inline void cb_dirMenu_i(Fl_Choice*, void*);
static void cb_dirMenu(Fl_Choice*, void*); static void cb_dirMenu(Fl_Choice*, void*);
inline void cb_allfiles_i(Fl_Button*, void*); inline void cb__i(Fl_Button*, void*);
static void cb_allfiles(Fl_Button*, void*); static void cb_(Fl_Button*, void*);
void (*callback_)(Fl_FileChooser*, void *); void (*callback_)(Fl_FileChooser*, void *);
void *data_; void *data_;
char directory_[1024]; char directory_[1024];

View File

@ -83,7 +83,7 @@ void Fl_FileChooser::cb_dirMenu(Fl_Choice* o, void* v) {
((Fl_FileChooser*)(o->parent()->user_data()))->cb_dirMenu_i(o,v); ((Fl_FileChooser*)(o->parent()->user_data()))->cb_dirMenu_i(o,v);
} }
inline void Fl_FileChooser::cb_allfiles_i(Fl_Button*, void*) { inline void Fl_FileChooser::cb__i(Fl_Button*, void*) {
const char *f; const char *f;
if ((f = fl_input("New Filter?", if ((f = fl_input("New Filter?",
fileList->filter())) != NULL) fileList->filter())) != NULL)
@ -92,8 +92,8 @@ if ((f = fl_input("New Filter?",
rescan(); rescan();
}; };
} }
void Fl_FileChooser::cb_allfiles(Fl_Button* o, void* v) { void Fl_FileChooser::cb_(Fl_Button* o, void* v) {
((Fl_FileChooser*)(o->parent()->user_data()))->cb_allfiles_i(o,v); ((Fl_FileChooser*)(o->parent()->user_data()))->cb__i(o,v);
} }
static unsigned char bits_allfiles[] = static unsigned char bits_allfiles[] =
@ -127,23 +127,24 @@ Fl_FileChooser::Fl_FileChooser(const char *d, const char *p, int t, const char *
fileName->when(FL_WHEN_CHANGED | FL_WHEN_ENTER_KEY_ALWAYS); fileName->when(FL_WHEN_CHANGED | FL_WHEN_ENTER_KEY_ALWAYS);
} }
{ Fl_Button* o = upButton = new Fl_Button(280, 10, 25, 25); { Fl_Button* o = upButton = new Fl_Button(280, 10, 25, 25);
bitmap_up.label(o); o->image(bitmap_up);
o->labelsize(8); o->labelsize(8);
o->callback((Fl_Callback*)cb_upButton); o->callback((Fl_Callback*)cb_upButton);
} }
{ Fl_Button* o = newButton = new Fl_Button(310, 10, 25, 25); { Fl_Button* o = newButton = new Fl_Button(310, 10, 25, 25);
bitmap_new.label(o); o->image(bitmap_new);
o->labelsize(8); o->labelsize(8);
o->callback((Fl_Callback*)cb_newButton); o->callback((Fl_Callback*)cb_newButton);
} }
{ Fl_Choice* o = dirMenu = new Fl_Choice(95, 10, 180, 25, "Directory:"); { Fl_Choice* o = dirMenu = new Fl_Choice(95, 10, 180, 25, "Directory:");
o->down_box(FL_BORDER_BOX);
o->callback((Fl_Callback*)cb_dirMenu); o->callback((Fl_Callback*)cb_dirMenu);
} }
{ Fl_Button* o = new Fl_Button(340, 10, 25, 25); { Fl_Button* o = new Fl_Button(340, 10, 25, 25);
bitmap_allfiles.label(o); o->image(bitmap_allfiles);
o->labelsize(28); o->labelsize(28);
o->labelcolor(4); o->labelcolor(4);
o->callback((Fl_Callback*)cb_allfiles); o->callback((Fl_Callback*)cb_);
o->align(FL_ALIGN_CENTER|FL_ALIGN_INSIDE); o->align(FL_ALIGN_CENTER|FL_ALIGN_INSIDE);
} }
if (title) window->label(title); if (title) window->label(title);

View File

@ -16,7 +16,7 @@ class Fl_FileChooser {open
callback {fileList->deselect(); callback {fileList->deselect();
fileName->value(""); fileName->value("");
window->hide();} open window->hide();} open
private xywh {250 430 375 315} resizable hotspot private xywh {99 225 375 315} resizable hotspot
code0 {if (title) window->label(title);} code0 {if (title) window->label(title);}
code1 {\#include <stdio.h>} code1 {\#include <stdio.h>}
code2 {\#include <stdlib.h>} code2 {\#include <stdlib.h>}
@ -54,14 +54,12 @@ window->hide();}
code0 {fileName->when(FL_WHEN_CHANGED | FL_WHEN_ENTER_KEY_ALWAYS);} code0 {fileName->when(FL_WHEN_CHANGED | FL_WHEN_ENTER_KEY_ALWAYS);}
} }
Fl_Button upButton { Fl_Button upButton {
label {up.xbm} callback {up();} selected
callback {up();} private image {up.xbm} xywh {280 10 25 25} labelsize 8
private xywh {280 10 25 25} labeltype image labelsize 8
} }
Fl_Button newButton { Fl_Button newButton {
label {new.xbm}
callback {newdir();} callback {newdir();}
private xywh {310 10 25 25} labeltype image labelsize 8 private image {new.xbm} xywh {310 10 25 25} labelsize 8
} }
Fl_Choice dirMenu { Fl_Choice dirMenu {
label {Directory:} label {Directory:}
@ -72,10 +70,9 @@ pathname[0] = '\\0';
for (i = 1; i <= dirMenu->value(); i ++) for (i = 1; i <= dirMenu->value(); i ++)
strcat(pathname, dirMenu->text(i)); strcat(pathname, dirMenu->text(i));
directory(pathname);} open directory(pathname);} open
private xywh {95 10 180 25} private xywh {95 10 180 25} down_box BORDER_BOX
} {} } {}
Fl_Button {} { Fl_Button {} {
label {allfiles.xbm}
callback {const char *f; callback {const char *f;
if ((f = fl_input("New Filter?", if ((f = fl_input("New Filter?",
fileList->filter())) != NULL) fileList->filter())) != NULL)
@ -83,7 +80,7 @@ if ((f = fl_input("New Filter?",
fileList->filter(f); fileList->filter(f);
rescan(); rescan();
}} }}
private xywh {340 10 25 25} labeltype image labelsize 28 labelcolor 4 align 16 private image {allfiles.xbm} xywh {340 10 25 25} labelsize 28 labelcolor 4 align 16
code0 {\#include <FL/fl_ask.H>} code0 {\#include <FL/fl_ask.H>}
} }
} }
@ -102,7 +99,7 @@ data_ = 0;} {}
decl {void fileNameCB();} {} decl {void fileNameCB();} {}
decl {void newdir();} {} decl {void newdir();} {}
decl {void up();} {} decl {void up();} {}
Function {callback(void (*cb)(Fl_FileChooser *, void *), void *d)} {selected return_type void Function {callback(void (*cb)(Fl_FileChooser *, void *), void *d)} {return_type void
} { } {
code {callback_ = cb; code {callback_ = cb;
data_ = d;} {} data_ = d;} {}