diff options
| author | Manolo Gouy <Manolo> | 2015-12-13 09:36:14 +0000 |
|---|---|---|
| committer | Manolo Gouy <Manolo> | 2015-12-13 09:36:14 +0000 |
| commit | cf14f77a901a64f12c5a103b782954692d8f6643 (patch) | |
| tree | e4f8d9d1213233692c314cb02ee620ddf7cc7d41 /src/Fl_File_Chooser.cxx | |
| parent | 6bdb661c2af402eeb512f8d520f44e24e98e6cfb (diff) | |
Allowing to use FLTK objects in static initializers (cont'd).
For fl_file_chooser() and Fl_File_Chooser objects.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@10961 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'src/Fl_File_Chooser.cxx')
| -rw-r--r-- | src/Fl_File_Chooser.cxx | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/Fl_File_Chooser.cxx b/src/Fl_File_Chooser.cxx index a51c5c883..c5288e92a 100644 --- a/src/Fl_File_Chooser.cxx +++ b/src/Fl_File_Chooser.cxx @@ -27,6 +27,7 @@ #include "../FL/Fl_File_Chooser.H" #include <FL/fl_draw.H> +#include <FL/Fl_Bitmap.H> void Fl_File_Chooser::cb_window_i(Fl_Double_Window*, void*) { fileName->value(""); @@ -59,11 +60,9 @@ void Fl_File_Chooser::cb_newButton(Fl_Button* o, void* v) { ((Fl_File_Chooser*)(o->parent()->parent()->user_data()))->cb_newButton_i(o,v); } -#include <FL/Fl_Bitmap.H> static const unsigned char idata_new[] = {0,0,120,0,132,0,2,1,1,254,1,128,49,128,49,128,253,128,253,128,49,128,49, 128,1,128,1,128,255,255,0,0}; -static Fl_Bitmap image_new(idata_new, 16, 16); void Fl_File_Chooser::cb__i(Fl_Tile*, void*) { update_preview(); @@ -164,6 +163,11 @@ void Fl_File_Chooser::cb_favOkButton(Fl_Return_Button* o, void* v) { } Fl_File_Chooser::Fl_File_Chooser(const char *d, const char *p, int t, const char *title) { + static Fl_Bitmap *image_new = NULL; + if (!image_new) { + prefs_ = new Fl_Preferences(Fl_Preferences::USER, "fltk.org", "filechooser"); + image_new = new Fl_Bitmap(idata_new, 16, 16); + } Fl_Group *prev_current = Fl_Group::current(); { window = new Fl_Double_Window(490, 380, "Choose File"); window->callback((Fl_Callback*)cb_window, (void*)(this)); @@ -305,7 +309,7 @@ Fl_File_Chooser::Fl_File_Chooser(const char *d, const char *p, int t, const char value(d); type(t); int e; - prefs_.get("preview", e, 1); + prefs_->get("preview", e, 1); preview(e); Fl_Group::current(prev_current); ext_group=(Fl_Widget*)0; @@ -369,7 +373,7 @@ const char * Fl_File_Chooser::label() { } void Fl_File_Chooser::ok_label(const char *l) { - okButton->label(l); + if (l) okButton->label(l); int w=0, h=0; okButton->measure_label(w, h); okButton->resize(cancelButton->x() - 50 - w, cancelButton->y(), |
