Add missing docos for Fl_Progress.

Add Fl_File_Chooser::directory_label, filename_label, and filter_label
static string pointers for labels (allows for I18N of the file chooser).

Fix typos in other docos.


git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@2098 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
Michael R Sweet 2002-04-18 20:37:29 +00:00
parent 9ca9171e7a
commit 7e8ec10e6d
10 changed files with 226 additions and 137 deletions

View File

@ -7,12 +7,12 @@
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <FL/Fl_File_Browser.H>
#include <FL/Fl_Button.H>
#include <FL/Fl_Return_Button.H>
#include <FL/fl_ask.H>
#include <FL/Fl_Input.H>
#include <FL/Fl_Choice.H> #include <FL/Fl_Choice.H>
#include <FL/Fl_Button.H>
#include <FL/fl_ask.H>
#include <FL/Fl_File_Browser.H>
#include <FL/Fl_Input.H>
#include <FL/Fl_Return_Button.H>
class Fl_File_Chooser { class Fl_File_Chooser {
public: public:
@ -22,28 +22,28 @@ private:
Fl_Window *window; Fl_Window *window;
inline void cb_window_i(Fl_Window*, void*); inline void cb_window_i(Fl_Window*, void*);
static void cb_window(Fl_Window*, void*); static void cb_window(Fl_Window*, void*);
Fl_File_Browser *fileList; Fl_Choice *dirMenu;
inline void cb_fileList_i(Fl_File_Browser*, void*); inline void cb_dirMenu_i(Fl_Choice*, void*);
static void cb_fileList(Fl_File_Browser*, void*); static void cb_dirMenu(Fl_Choice*, void*);
inline void cb_Cancel_i(Fl_Button*, void*);
static void cb_Cancel(Fl_Button*, void*);
Fl_Return_Button *okButton;
inline void cb_okButton_i(Fl_Return_Button*, void*);
static void cb_okButton(Fl_Return_Button*, void*);
Fl_Input *fileName;
inline void cb_fileName_i(Fl_Input*, void*);
static void cb_fileName(Fl_Input*, void*);
Fl_Button *upButton; Fl_Button *upButton;
inline void cb_upButton_i(Fl_Button*, void*); inline void cb_upButton_i(Fl_Button*, void*);
static void cb_upButton(Fl_Button*, void*); static void cb_upButton(Fl_Button*, void*);
Fl_Button *newButton; Fl_Button *newButton;
inline void cb_newButton_i(Fl_Button*, void*); inline void cb_newButton_i(Fl_Button*, void*);
static void cb_newButton(Fl_Button*, void*); static void cb_newButton(Fl_Button*, void*);
Fl_Choice *dirMenu;
inline void cb_dirMenu_i(Fl_Choice*, void*);
static void cb_dirMenu(Fl_Choice*, void*);
inline void cb__i(Fl_Button*, void*); inline void cb__i(Fl_Button*, void*);
static void cb_(Fl_Button*, void*); static void cb_(Fl_Button*, void*);
Fl_File_Browser *fileList;
inline void cb_fileList_i(Fl_File_Browser*, void*);
static void cb_fileList(Fl_File_Browser*, void*);
Fl_Input *fileName;
inline void cb_fileName_i(Fl_Input*, void*);
static void cb_fileName(Fl_Input*, void*);
Fl_Return_Button *okButton;
inline void cb_okButton_i(Fl_Return_Button*, void*);
static void cb_okButton(Fl_Return_Button*, void*);
inline void cb_Cancel_i(Fl_Button*, void*);
static void cb_Cancel(Fl_Button*, void*);
void (*callback_)(Fl_File_Chooser*, void *); void (*callback_)(Fl_File_Chooser*, void *);
void *data_; void *data_;
char directory_[1024]; char directory_[1024];
@ -80,6 +80,9 @@ public:
const char *value(int f = 1); const char *value(int f = 1);
void value(const char *filename); void value(const char *filename);
int visible(); int visible();
static const char *directory_label;
static const char *filename_label;
static const char *filter_label;
}; };
extern FL_EXPORT char *fl_dir_chooser(const char *message,const char *fname); extern FL_EXPORT char *fl_dir_chooser(const char *message,const char *fname);
extern FL_EXPORT char *fl_file_chooser(const char *message,const char *pat,const char *fname); extern FL_EXPORT char *fl_file_chooser(const char *message,const char *pat,const char *fname);

View File

@ -1,5 +1,5 @@
// //
// "$Id: Fl_Progress.H,v 1.1.2.2 2002/01/01 15:11:28 easysw Exp $" // "$Id: Fl_Progress.H,v 1.1.2.3 2002/04/18 20:37:29 easysw Exp $"
// //
// Progress bar widget definitions. // Progress bar widget definitions.
// //
@ -40,8 +40,8 @@
class Fl_Progress : public Fl_Widget class Fl_Progress : public Fl_Widget
{ {
float value_, float value_,
minimum_, minimum_,
maximum_; maximum_;
protected: protected:
@ -64,5 +64,5 @@ class Fl_Progress : public Fl_Widget
#endif // !_Fl_Progress_H_ #endif // !_Fl_Progress_H_
// //
// End of "$Id: Fl_Progress.H,v 1.1.2.2 2002/01/01 15:11:28 easysw Exp $". // End of "$Id: Fl_Progress.H,v 1.1.2.3 2002/04/18 20:37:29 easysw Exp $".
// //

View File

@ -1043,6 +1043,11 @@ done.
<H4><A NAME="Fl.set_idle">void set_idle(void (*cb)());</A></H4> <H4><A NAME="Fl.set_idle">void set_idle(void (*cb)());</A></H4>
<P>Sets an idle callback.
<P>This method is obsolete - use the <A
HREF="#add_idle"><TT>add_idle()</TT></A> method instead.
<H4><A NAME="Fl.set_labeltype">void set_labeltype(Fl_Labeltype,Fl_Label_Draw_F*,Fl_Label_Measure_F*);<BR> <H4><A NAME="Fl.set_labeltype">void set_labeltype(Fl_Labeltype,Fl_Label_Draw_F*,Fl_Label_Measure_F*);<BR>
void set_labeltype(Fl_Labeltype, Fl_Labeltype from);</A></H4> void set_labeltype(Fl_Labeltype, Fl_Labeltype from);</A></H4>

View File

@ -67,7 +67,7 @@ w, int h, const char *label = 0)</A></H4>
The constructor creates the button using the position, size, and The constructor creates the button using the position, size, and
label. label.
<H4><A name=Fl_Button.~Fl_Button>Fl_Button::~Fl_Button(void)</A></H4> <H4><A name=Fl_Button.~Fl_Button>Fl_Button::~Fl_Button(void)</A></H4>
The destructor removed the button. The destructor removes the button.
<H4><A name=Fl_Button.clear>int Fl_Button::clear()</A></H4> <H4><A name=Fl_Button.clear>int Fl_Button::clear()</A></H4>
Same as <TT>value(0)</TT>. Same as <TT>value(0)</TT>.
<H4><A name=Fl_Button.down_box>Fl_Boxtype Fl_Button::down_box() const <H4><A name=Fl_Button.down_box>Fl_Boxtype Fl_Button::down_box() const

View File

@ -0,0 +1,65 @@
<HTML>
<BODY>
<!-- NEW PAGE -->
<H2><A name=Fl_Progress>class Fl_Progress</A></H2>
<HR>
<H3>Class Hierarchy</H3>
<UL><PRE>
<A href="Fl_Widget.html#Fl_Widget">Fl_Widget</A>
|
+----<B>Fl_Progress</B>
</PRE></UL>
<H3>Include Files</H3>
<UL><PRE>
#include &lt;FL/Fl_Progress.H&gt;
</PRE></UL>
<H3>Description</H3>
<P>The <TT>Fl_Progress</TT> widget displays a progress bar for the
user.
<H3>Methods</H3>
<UL>
<LI><A href="#Fl_Progress.Fl_Progress">Fl_Progress</A></LI>
<LI><A href="#Fl_Progress.~Fl_Progress">~Fl_Progress</A></LI>
<LI><A href="#Fl_Progress.maximum">maximum</A></LI>
<LI><A href="#Fl_Progress.minimum">minimum</A></LI>
<LI><A href="#Fl_Progress.value">value</A></LI>
</UL>
<H4><A name="Fl_Progress.Fl_Progress">Fl_Progress::Fl_Progress(int x, int y, int w, int h, const char *label = 0)</A></H4>
<P>The constructor creates the progress bar using the position,
size, and label.
<H4><A name="Fl_Progress.~Fl_Progress">Fl_Progress::~Fl_Progress(void)</A></H4>
<P>The destructor removes the progress bar.
<H4><A name="Fl_Progress.maximum">void maximum(float v);
<BR>float maximum() const;</A></H4>
<P>Gets or sets the maximum value in the progress widget.
<H4><A name="Fl_Progress.minimum">void minimum(float v);
<BR>float minimum() const;</A></H4>
<P>Gets or sets the minimum value in the progress widget.
<H4><A name="Fl_Progress.value">void value(float v);
<BR>float value() const;</A></H4>
<P>Gets or sets the current value in the progress widget.
</BODY>
</HTML>

View File

@ -9,7 +9,7 @@
| |
+----<A href=Fl_Box.html#Fl_Box>Fl_Box</A>, <A href=Fl_Browser_.html#Fl_Browser_>Fl_Browser_</A>, <A href=Fl_Button.html#Fl_Button>Fl_Button</A>, <A href=Fl_Chart.html#Fl_Chart>Fl_Chart</A>, <A href=Fl_Clock.html#Fl_Clock>Fl_Clock</A>, +----<A href=Fl_Box.html#Fl_Box>Fl_Box</A>, <A href=Fl_Browser_.html#Fl_Browser_>Fl_Browser_</A>, <A href=Fl_Button.html#Fl_Button>Fl_Button</A>, <A href=Fl_Chart.html#Fl_Chart>Fl_Chart</A>, <A href=Fl_Clock.html#Fl_Clock>Fl_Clock</A>,
<A href=Fl_Free.html#Fl_Free>Fl_Free</A>, <A href=Fl_Group.html#Fl_Group>Fl_Group</A>, <A href=Fl_Input_.html#Fl_Input_>Fl_Input_</A>, <A href=Fl_Menu_.html#Fl_Menu_>Fl_Menu_</A>, <A href=Fl_Positioner.html#Fl_Positioner>Fl_Positioner</A>, <A href=Fl_Free.html#Fl_Free>Fl_Free</A>, <A href=Fl_Group.html#Fl_Group>Fl_Group</A>, <A href=Fl_Input_.html#Fl_Input_>Fl_Input_</A>, <A href=Fl_Menu_.html#Fl_Menu_>Fl_Menu_</A>, <A href=Fl_Positioner.html#Fl_Positioner>Fl_Positioner</A>,
<A href=Fl_Timer.html#Fl_Timer>Fl_Timer</A>, <A href=Fl_Valuator.html#Fl_Valuator>Fl_Valuator</A> <A HREF="Fl_Progress.html">Fl_Progress</A>, <A href=Fl_Timer.html#Fl_Timer>Fl_Timer</A>, <A href=Fl_Valuator.html#Fl_Valuator>Fl_Valuator</A>
</PRE> </PRE>
</UL> </UL>
<H3>Include Files</H3> <H3>Include Files</H3>

View File

@ -1,4 +1,4 @@
#HTMLDOC 1.8.17 #HTMLDOC 1.8.19
-t pdf13 -f fltk.pdf --book --toclevels 2 --no-numbered --toctitle "Table of Contents" --title --titleimage FL.gif --linkstyle underline --size Universal --left 1.00in --right 0.50in --top 0.50in --bottom 0.50in --header .t. --footer h.1 --tocheader .t. --tocfooter ..i --duplex --portrait --color --no-pscommands --no-xrxcomments --compression=9 --jpeg=50 --fontsize 11.0 --fontspacing 1.2 --headingfont Helvetica --bodyfont Times --headfootsize 11.0 --headfootfont Helvetica --charset 8859-1 --links --no-truetype --pagemode outline --pagelayout single --firstpage c1 --pageeffect none --pageduration 10 --effectduration 1.0 --no-encryption --permissions all --owner-password "" --user-password "" --browserwidth 680 -t pdf13 -f fltk.pdf --book --toclevels 2 --no-numbered --toctitle "Table of Contents" --title --titleimage FL.gif --linkstyle underline --size Universal --left 1.00in --right 0.50in --top 0.50in --bottom 0.50in --header .t. --footer h.1 --tocheader .t. --tocfooter ..i --duplex --portrait --color --no-pscommands --no-xrxcomments --compression=9 --jpeg=50 --fontsize 11.0 --fontspacing 1.2 --headingfont Helvetica --bodyfont Times --headfootsize 11.0 --headfootfont Helvetica --charset 8859-1 --links --no-truetype --pagemode outline --pagelayout single --firstpage c1 --pageeffect none --pageduration 10 --effectduration 1.0 --no-encryption --permissions all --owner-password "" --user-password "" --browserwidth 680
preface.html preface.html
intro.html intro.html
@ -60,6 +60,7 @@ Fl_Pixmap.html
Fl_PNG_Image.html Fl_PNG_Image.html
Fl_PNM_Image.html Fl_PNM_Image.html
Fl_Positioner.html Fl_Positioner.html
Fl_Progress.html
Fl_Repeat_Button.html Fl_Repeat_Button.html
Fl_RGB_Image.html Fl_RGB_Image.html
Fl_Return_Button.html Fl_Return_Button.html

View File

@ -63,6 +63,7 @@ description of the <TT>fl_</TT> functions, see
<A HREF="Fl_PNG_Image.html">Fl_PNG_Image</A><BR> <A HREF="Fl_PNG_Image.html">Fl_PNG_Image</A><BR>
<A HREF="Fl_PNM_Image.html">Fl_PNM_Image</A><BR> <A HREF="Fl_PNM_Image.html">Fl_PNM_Image</A><BR>
<A HREF="Fl_Positioner.html">Fl_Positioner</A><BR> <A HREF="Fl_Positioner.html">Fl_Positioner</A><BR>
<A HREF="Fl_Progress.html">Fl_Progress</A><BR>
<A HREF="Fl_Repeat_Button.html">Fl_Repeat_Button</A><BR> <A HREF="Fl_Repeat_Button.html">Fl_Repeat_Button</A><BR>
<A HREF="Fl_Return_Button.html">Fl_Return_Button</A><BR> <A HREF="Fl_Return_Button.html">Fl_Return_Button</A><BR>
<A HREF="Fl_RGB_Image.html">Fl_RGB_Image</A><BR> <A HREF="Fl_RGB_Image.html">Fl_RGB_Image</A><BR>
@ -195,6 +196,7 @@ description of the <TT>fl_</TT> functions, see
<LI><A HREF="Fl_Menu_Button.html#Fl_Menu_Button">Fl_Menu_Button</A> <LI><A HREF="Fl_Menu_Button.html#Fl_Menu_Button">Fl_Menu_Button</A>
</UL> </UL>
<LI><A HREF="Fl_Positioner.html#Fl_Positioner">Fl_Positioner</A> <LI><A HREF="Fl_Positioner.html#Fl_Positioner">Fl_Positioner</A>
<LI><A HREF="Fl_Progress.html">Fl_Progress</A>
<LI><A HREF="Fl_Timer.html#Fl_Timer">Fl_Timer</A> <LI><A HREF="Fl_Timer.html#Fl_Timer">Fl_Timer</A>
<LI><A HREF="Fl_Valuator.html#Fl_Valuator">Fl_Valuator</A> <LI><A HREF="Fl_Valuator.html#Fl_Valuator">Fl_Valuator</A>
<UL> <UL>

View File

@ -2,6 +2,10 @@
#include "../FL/Fl_File_Chooser.H" #include "../FL/Fl_File_Chooser.H"
const char *Fl_File_Chooser::directory_label = "Directory:";
const char *Fl_File_Chooser::filename_label = "Filename:";
const char *Fl_File_Chooser::filter_label = "New Filter?";
inline void Fl_File_Chooser::cb_window_i(Fl_Window*, void*) { inline void Fl_File_Chooser::cb_window_i(Fl_Window*, void*) {
fileList->deselect(); fileList->deselect();
fileName->value(""); fileName->value("");
@ -11,38 +15,17 @@ void Fl_File_Chooser::cb_window(Fl_Window* o, void* v) {
((Fl_File_Chooser*)(o->user_data()))->cb_window_i(o,v); ((Fl_File_Chooser*)(o->user_data()))->cb_window_i(o,v);
} }
inline void Fl_File_Chooser::cb_fileList_i(Fl_File_Browser*, void*) { inline void Fl_File_Chooser::cb_dirMenu_i(Fl_Choice*, void*) {
fileListCB(); char pathname[1024];
} int i;
void Fl_File_Chooser::cb_fileList(Fl_File_Browser* o, void* v) {
((Fl_File_Chooser*)(o->parent()->user_data()))->cb_fileList_i(o,v);
}
inline void Fl_File_Chooser::cb_Cancel_i(Fl_Button*, void*) { pathname[0] = '\0';
fileList->deselect(); for (i = 1; i <= dirMenu->value(); i ++)
fileName->value(""); strcat(pathname, dirMenu->text(i));
window->hide(); directory(pathname);
} }
void Fl_File_Chooser::cb_Cancel(Fl_Button* o, void* v) { void Fl_File_Chooser::cb_dirMenu(Fl_Choice* o, void* v) {
((Fl_File_Chooser*)(o->parent()->user_data()))->cb_Cancel_i(o,v); ((Fl_File_Chooser*)(o->parent()->user_data()))->cb_dirMenu_i(o,v);
}
inline void Fl_File_Chooser::cb_okButton_i(Fl_Return_Button*, void*) {
// Do any callback that is registered...
if (callback_)
(*callback_)(this, data_);
window->hide();
}
void Fl_File_Chooser::cb_okButton(Fl_Return_Button* o, void* v) {
((Fl_File_Chooser*)(o->parent()->user_data()))->cb_okButton_i(o,v);
}
inline void Fl_File_Chooser::cb_fileName_i(Fl_Input*, void*) {
fileNameCB();
}
void Fl_File_Chooser::cb_fileName(Fl_Input* o, void* v) {
((Fl_File_Chooser*)(o->parent()->user_data()))->cb_fileName_i(o,v);
} }
inline void Fl_File_Chooser::cb_upButton_i(Fl_Button*, void*) { inline void Fl_File_Chooser::cb_upButton_i(Fl_Button*, void*) {
@ -70,22 +53,9 @@ static unsigned char idata_new[] =
\200\1\200\377\377\0\0"; \200\1\200\377\377\0\0";
static Fl_Bitmap image_new(idata_new, 16, 16); static Fl_Bitmap image_new(idata_new, 16, 16);
inline void Fl_File_Chooser::cb_dirMenu_i(Fl_Choice*, void*) {
char pathname[1024];
int i;
pathname[0] = '\0';
for (i = 1; i <= dirMenu->value(); i ++)
strcat(pathname, dirMenu->text(i));
directory(pathname);
}
void Fl_File_Chooser::cb_dirMenu(Fl_Choice* o, void* v) {
((Fl_File_Chooser*)(o->parent()->user_data()))->cb_dirMenu_i(o,v);
}
inline void Fl_File_Chooser::cb__i(Fl_Button*, void*) { inline void Fl_File_Chooser::cb__i(Fl_Button*, void*) {
const char *f; const char *f;
if ((f = fl_input("New Filter?", if ((f = fl_input(filter_label,
fileList->filter())) != NULL) fileList->filter())) != NULL)
{ {
fileList->filter(f); fileList->filter(f);
@ -100,30 +70,50 @@ static unsigned char idata_allfiles[] =
"\374?\4 \4 \4 \204!\244%\304#\364/\364/\304#\244%\204!\4 \4 \4 \374?"; "\374?\4 \4 \4 \204!\244%\304#\364/\364/\304#\244%\204!\4 \4 \4 \374?";
static Fl_Bitmap image_allfiles(idata_allfiles, 16, 16); static Fl_Bitmap image_allfiles(idata_allfiles, 16, 16);
inline void Fl_File_Chooser::cb_fileList_i(Fl_File_Browser*, void*) {
fileListCB();
}
void Fl_File_Chooser::cb_fileList(Fl_File_Browser* o, void* v) {
((Fl_File_Chooser*)(o->parent()->user_data()))->cb_fileList_i(o,v);
}
inline void Fl_File_Chooser::cb_fileName_i(Fl_Input*, void*) {
fileNameCB();
}
void Fl_File_Chooser::cb_fileName(Fl_Input* o, void* v) {
((Fl_File_Chooser*)(o->parent()->user_data()))->cb_fileName_i(o,v);
}
inline void Fl_File_Chooser::cb_okButton_i(Fl_Return_Button*, void*) {
// Do any callback that is registered...
if (callback_)
(*callback_)(this, data_);
window->hide();
}
void Fl_File_Chooser::cb_okButton(Fl_Return_Button* o, void* v) {
((Fl_File_Chooser*)(o->parent()->user_data()))->cb_okButton_i(o,v);
}
inline void Fl_File_Chooser::cb_Cancel_i(Fl_Button*, void*) {
fileList->deselect();
fileName->value("");
window->hide();
}
void Fl_File_Chooser::cb_Cancel(Fl_Button* o, void* v) {
((Fl_File_Chooser*)(o->parent()->user_data()))->cb_Cancel_i(o,v);
}
Fl_File_Chooser::Fl_File_Chooser(const char *d, const char *p, int t, const char *title) { Fl_File_Chooser::Fl_File_Chooser(const char *d, const char *p, int t, const char *title) {
Fl_Window* w; Fl_Window* w;
{ Fl_Window* o = window = new Fl_Window(375, 315, "Pick a File"); { Fl_Window* o = window = new Fl_Window(375, 315, "Pick a File");
w = o; w = o;
o->callback((Fl_Callback*)cb_window, (void*)(this)); o->callback((Fl_Callback*)cb_window, (void*)(this));
{ Fl_File_Browser* o = fileList = new Fl_File_Browser(10, 45, 355, 180); { Fl_Choice* o = dirMenu = new Fl_Choice(95, 10, 180, 25, "Directory:");
o->type(2); o->tooltip("Choose a parent directory.");
o->callback((Fl_Callback*)cb_fileList); o->down_box(FL_BORDER_BOX);
Fl_Group::current()->resizable(o); o->callback((Fl_Callback*)cb_dirMenu);
w->hotspot(o); dirMenu->label(directory_label);
}
{ Fl_Button* o = new Fl_Button(285, 280, 80, 25, "Cancel");
o->callback((Fl_Callback*)cb_Cancel);
o->label(fl_cancel);
}
{ Fl_Return_Button* o = okButton = new Fl_Return_Button(200, 280, 75, 25, "OK");
o->callback((Fl_Callback*)cb_okButton);
okButton->label(fl_ok);
}
{ Fl_Input* o = fileName = new Fl_Input(10, 245, 355, 25, "Filename:");
o->callback((Fl_Callback*)cb_fileName);
o->align(FL_ALIGN_TOP_LEFT);
o->when(FL_WHEN_ENTER_KEY);
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);
o->tooltip("Show the parent directory."); o->tooltip("Show the parent directory.");
@ -137,11 +127,6 @@ Fl_File_Chooser::Fl_File_Chooser(const char *d, const char *p, int t, const char
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:");
o->tooltip("Choose a parent directory.");
o->down_box(FL_BORDER_BOX);
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);
o->tooltip("Change the filename filter."); o->tooltip("Change the filename filter.");
o->image(image_allfiles); o->image(image_allfiles);
@ -150,6 +135,27 @@ Fl_File_Chooser::Fl_File_Chooser(const char *d, const char *p, int t, const char
o->callback((Fl_Callback*)cb_); o->callback((Fl_Callback*)cb_);
o->align(FL_ALIGN_CENTER|FL_ALIGN_INSIDE); o->align(FL_ALIGN_CENTER|FL_ALIGN_INSIDE);
} }
{ Fl_File_Browser* o = fileList = new Fl_File_Browser(10, 45, 355, 180);
o->type(2);
o->callback((Fl_Callback*)cb_fileList);
Fl_Group::current()->resizable(o);
w->hotspot(o);
}
{ Fl_Input* o = fileName = new Fl_Input(10, 245, 355, 25, "Filename:");
o->callback((Fl_Callback*)cb_fileName);
o->align(FL_ALIGN_TOP_LEFT);
o->when(FL_WHEN_ENTER_KEY);
fileName->when(FL_WHEN_CHANGED | FL_WHEN_ENTER_KEY_ALWAYS);
fileName->label(filename_label);
}
{ Fl_Return_Button* o = okButton = new Fl_Return_Button(200, 280, 75, 25, "OK");
o->callback((Fl_Callback*)cb_okButton);
okButton->label(fl_ok);
}
{ Fl_Button* o = new Fl_Button(285, 280, 80, 25, "Cancel");
o->callback((Fl_Callback*)cb_Cancel);
o->label(fl_cancel);
}
if (title) window->label(title); if (title) window->label(title);
o->set_modal(); o->set_modal();
o->end(); o->end();

View File

@ -22,19 +22,49 @@ window->hide();} open
code2 {\#include <stdlib.h>} code2 {\#include <stdlib.h>}
code3 {\#include <string.h>} modal visible code3 {\#include <string.h>} modal visible
} { } {
Fl_Choice dirMenu {
label {Directory:}
callback {char pathname[1024];
int i;
pathname[0] = '\\0';
for (i = 1; i <= dirMenu->value(); i ++)
strcat(pathname, dirMenu->text(i));
directory(pathname);} open
private tooltip {Choose a parent directory.} xywh {95 10 180 25} down_box BORDER_BOX
code0 {dirMenu->label(directory_label);}
} {}
Fl_Button upButton {
callback {up();}
private tooltip {Show the parent directory.} image {up.xbm} xywh {280 10 25 25} labelsize 8
}
Fl_Button newButton {
callback {newdir();}
private tooltip {Create a new directory.} image {new.xbm} xywh {310 10 25 25} labelsize 8
}
Fl_Button {} {
callback {const char *f;
if ((f = fl_input(filter_label,
fileList->filter())) != NULL)
{
fileList->filter(f);
rescan();
}}
private tooltip {Change the filename filter.} image {allfiles.xbm} xywh {340 10 25 25} labelsize 28 labelcolor 4 align 16
code0 {\#include <FL/fl_ask.H>}
}
Fl_Browser fileList { Fl_Browser fileList {
callback {fileListCB();} callback {fileListCB();}
private xywh {10 45 355 180} type Hold resizable hotspot private xywh {10 45 355 180} type Hold resizable hotspot
code0 {\#include <FL/Fl_File_Browser.H>} code0 {\#include <FL/Fl_File_Browser.H>}
class Fl_File_Browser class Fl_File_Browser
} }
Fl_Button {} { Fl_Input fileName {
label Cancel label {Filename:}
callback {fileList->deselect(); callback {fileNameCB();}
fileName->value(""); private xywh {10 245 355 25} align 5 when 8
window->hide();} code0 {fileName->when(FL_WHEN_CHANGED | FL_WHEN_ENTER_KEY_ALWAYS);}
private xywh {285 280 80 25} code1 {fileName->label(filename_label);}
code0 {o->label(fl_cancel);}
} }
Fl_Return_Button okButton { Fl_Return_Button okButton {
label OK label OK
@ -47,41 +77,13 @@ window->hide();}
code0 {\#include <FL/fl_ask.H>} code0 {\#include <FL/fl_ask.H>}
code1 {okButton->label(fl_ok);} code1 {okButton->label(fl_ok);}
} }
Fl_Input fileName {
label {Filename:}
callback {fileNameCB();}
private xywh {10 245 355 25} align 5 when 8
code0 {fileName->when(FL_WHEN_CHANGED | FL_WHEN_ENTER_KEY_ALWAYS);}
}
Fl_Button upButton {
callback {up();}
private tooltip {Show the parent directory.} image {up.xbm} xywh {280 10 25 25} labelsize 8
}
Fl_Button newButton {
callback {newdir();}
private tooltip {Create a new directory.} image {new.xbm} xywh {310 10 25 25} labelsize 8
}
Fl_Choice dirMenu {
label {Directory:}
callback {char pathname[1024];
int i;
pathname[0] = '\\0';
for (i = 1; i <= dirMenu->value(); i ++)
strcat(pathname, dirMenu->text(i));
directory(pathname);} open
private tooltip {Choose a parent directory.} xywh {95 10 180 25} down_box BORDER_BOX
} {}
Fl_Button {} { Fl_Button {} {
callback {const char *f; label Cancel
if ((f = fl_input("New Filter?", callback {fileList->deselect();
fileList->filter())) != NULL) fileName->value("");
{ window->hide();}
fileList->filter(f); private xywh {285 280 80 25}
rescan(); code0 {o->label(fl_cancel);}
}}
private tooltip {Change the filename filter.} image {allfiles.xbm} xywh {340 10 25 25} labelsize 28 labelcolor 4 align 16
code0 {\#include <FL/fl_ask.H>}
} }
} }
code {window->size_range(375, 315, 375); code {window->size_range(375, 315, 375);
@ -154,8 +156,7 @@ rescan();} {}
} { } {
code {window->hotspot(fileList); code {window->hotspot(fileList);
window->show(); window->show();
fileList->deselect();} {selected fileList->deselect();} {}
}
} }
Function {shown()} {return_type int Function {shown()} {return_type int
} { } {
@ -213,6 +214,12 @@ else
} { } {
code {return window->visible();} {} code {return window->visible();} {}
} }
decl {static const char *directory_label = "Directory:";} {public
}
decl {static const char *filename_label = "Filename:";} {public
}
decl {static const char *filter_label = "New Filter?";} {selected public
}
} }
decl {FL_EXPORT char *fl_dir_chooser(const char *message,const char *fname);} {public decl {FL_EXPORT char *fl_dir_chooser(const char *message,const char *fname);} {public