summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMichael R Sweet <michael.r.sweet@gmail.com>2002-04-18 20:37:29 +0000
committerMichael R Sweet <michael.r.sweet@gmail.com>2002-04-18 20:37:29 +0000
commit7e8ec10e6d9a50ea7a4cea0d00cf7566135c8a15 (patch)
treed8d7e5e749739ac9a8115b1f9aba62a8bc65a890 /src
parent9ca9171e7a35f4a2b3b6c8b52bdc966218b8137f (diff)
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
Diffstat (limited to 'src')
-rw-r--r--src/Fl_File_Chooser.cxx142
-rw-r--r--src/Fl_File_Chooser.fl91
2 files changed, 123 insertions, 110 deletions
diff --git a/src/Fl_File_Chooser.cxx b/src/Fl_File_Chooser.cxx
index ac62bc549..ce636f75b 100644
--- a/src/Fl_File_Chooser.cxx
+++ b/src/Fl_File_Chooser.cxx
@@ -2,6 +2,10 @@
#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*) {
fileList->deselect();
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);
}
-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_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);
-}
-
-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_dirMenu_i(Fl_Choice*, void*) {
+ char pathname[1024];
+int i;
-inline void Fl_File_Chooser::cb_fileName_i(Fl_Input*, void*) {
- fileNameCB();
+pathname[0] = '\0';
+for (i = 1; i <= dirMenu->value(); i ++)
+ strcat(pathname, dirMenu->text(i));
+directory(pathname);
}
-void Fl_File_Chooser::cb_fileName(Fl_Input* o, void* v) {
- ((Fl_File_Chooser*)(o->parent()->user_data()))->cb_fileName_i(o,v);
+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_upButton_i(Fl_Button*, void*) {
@@ -70,22 +53,9 @@ static unsigned char idata_new[] =
\200\1\200\377\377\0\0";
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*) {
const char *f;
-if ((f = fl_input("New Filter?",
+if ((f = fl_input(filter_label,
fileList->filter())) != NULL)
{
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?";
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_Window* w;
{ Fl_Window* o = window = new Fl_Window(375, 315, "Pick a File");
w = o;
o->callback((Fl_Callback*)cb_window, (void*)(this));
- { 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_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_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);
+ dirMenu->label(directory_label);
}
{ Fl_Button* o = upButton = new Fl_Button(280, 10, 25, 25);
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->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);
o->tooltip("Change the filename filter.");
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->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);
o->set_modal();
o->end();
diff --git a/src/Fl_File_Chooser.fl b/src/Fl_File_Chooser.fl
index 456e5af00..f29b6f6c2 100644
--- a/src/Fl_File_Chooser.fl
+++ b/src/Fl_File_Chooser.fl
@@ -22,45 +22,6 @@ window->hide();} open
code2 {\#include <stdlib.h>}
code3 {\#include <string.h>} modal visible
} {
- Fl_Browser fileList {
- callback {fileListCB();}
- private xywh {10 45 355 180} type Hold resizable hotspot
- code0 {\#include <FL/Fl_File_Browser.H>}
- class Fl_File_Browser
- }
- Fl_Button {} {
- label Cancel
- callback {fileList->deselect();
-fileName->value("");
-window->hide();}
- private xywh {285 280 80 25}
- code0 {o->label(fl_cancel);}
- }
- Fl_Return_Button okButton {
- label OK
- callback {// Do any callback that is registered...
-if (callback_)
- (*callback_)(this, data_);
-
-window->hide();}
- private xywh {200 280 75 25}
- code0 {\#include <FL/fl_ask.H>}
- 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];
@@ -71,10 +32,19 @@ 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("New Filter?",
+if ((f = fl_input(filter_label,
fileList->filter())) != NULL)
{
fileList->filter(f);
@@ -83,6 +53,38 @@ if ((f = fl_input("New Filter?",
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 {
+ callback {fileListCB();}
+ private xywh {10 45 355 180} type Hold resizable hotspot
+ code0 {\#include <FL/Fl_File_Browser.H>}
+ class Fl_File_Browser
+ }
+ 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);}
+ code1 {fileName->label(filename_label);}
+ }
+ Fl_Return_Button okButton {
+ label OK
+ callback {// Do any callback that is registered...
+if (callback_)
+ (*callback_)(this, data_);
+
+window->hide();}
+ private xywh {200 280 75 25}
+ code0 {\#include <FL/fl_ask.H>}
+ code1 {okButton->label(fl_ok);}
+ }
+ Fl_Button {} {
+ label Cancel
+ callback {fileList->deselect();
+fileName->value("");
+window->hide();}
+ private xywh {285 280 80 25}
+ code0 {o->label(fl_cancel);}
+ }
}
code {window->size_range(375, 315, 375);
fileList->filter(p);
@@ -154,8 +156,7 @@ rescan();} {}
} {
code {window->hotspot(fileList);
window->show();
-fileList->deselect();} {selected
- }
+fileList->deselect();} {}
}
Function {shown()} {return_type int
} {
@@ -213,6 +214,12 @@ else
} {
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