Hide window before doing callback for OK button (STR #1565)

git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@5644 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
Michael R Sweet
2007-01-28 19:41:56 +00:00
parent 84fe87f472
commit 48a997d0ad
4 changed files with 139 additions and 141 deletions
+2
View File
@@ -1,5 +1,7 @@
CHANGES IN FLTK 1.1.8 CHANGES IN FLTK 1.1.8
- Fl_File_Chooser now hides the window before doing a callback
when the user clicks on the OK button (STR #1565)
- Fixed indentation of nested HTML elements (STR #1549) - Fixed indentation of nested HTML elements (STR #1549)
- Made layout of Fl_Help_Dialog consistent with other - Made layout of Fl_Help_Dialog consistent with other
help windows and web browsers. help windows and web browsers.
+1 -1
View File
@@ -25,7 +25,7 @@
// http://www.fltk.org/str.php // http://www.fltk.org/str.php
// //
// generated by Fast Light User Interface Designer (fluid) version 1.0107 // generated by Fast Light User Interface Designer (fluid) version 1.0108
#ifndef Fl_File_Chooser_H #ifndef Fl_File_Chooser_H
#define Fl_File_Chooser_H #define Fl_File_Chooser_H
+89 -92
View File
@@ -25,7 +25,7 @@
// http://www.fltk.org/str.php // http://www.fltk.org/str.php
// //
// generated by Fast Light User Interface Designer (fluid) version 1.0107 // generated by Fast Light User Interface Designer (fluid) version 1.0108
#include "../FL/Fl_File_Chooser.H" #include "../FL/Fl_File_Chooser.H"
#include <FL/fl_draw.H> #include <FL/fl_draw.H>
@@ -96,11 +96,11 @@ void Fl_File_Chooser::cb_fileName(Fl_File_Input* o, void* v) {
} }
void Fl_File_Chooser::cb_okButton_i(Fl_Return_Button*, void*) { void Fl_File_Chooser::cb_okButton_i(Fl_Return_Button*, void*) {
window->hide();
// Do any callback that is registered... // Do any callback that is registered...
if (callback_) if (callback_)
(*callback_)(this, data_); (*callback_)(this, data_);
window->hide();
} }
void Fl_File_Chooser::cb_okButton(Fl_Return_Button* o, void* v) { void Fl_File_Chooser::cb_okButton(Fl_Return_Button* o, void* v) {
((Fl_File_Chooser*)(o->parent()->parent()->parent()->user_data()))->cb_okButton_i(o,v); ((Fl_File_Chooser*)(o->parent()->parent()->parent()->user_data()))->cb_okButton_i(o,v);
@@ -159,134 +159,131 @@ 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) { Fl_File_Chooser::Fl_File_Chooser(const char *d, const char *p, int t, const char *title) {
Fl_Double_Window* w; { window = new Fl_Double_Window(490, 380, "Choose File");
{ Fl_Double_Window* o = window = new Fl_Double_Window(490, 380, "Choose File"); window->callback((Fl_Callback*)cb_window, (void*)(this));
w = o;
o->callback((Fl_Callback*)cb_window, (void*)(this));
{ Fl_Group* o = new Fl_Group(10, 10, 470, 25); { Fl_Group* o = new Fl_Group(10, 10, 470, 25);
{ Fl_Choice* o = showChoice = new Fl_Choice(65, 10, 215, 25, "Show:"); { showChoice = new Fl_Choice(65, 10, 215, 25, "Show:");
o->down_box(FL_BORDER_BOX); showChoice->down_box(FL_BORDER_BOX);
o->labelfont(1); showChoice->labelfont(1);
o->callback((Fl_Callback*)cb_showChoice); showChoice->callback((Fl_Callback*)cb_showChoice);
Fl_Group::current()->resizable(o); Fl_Group::current()->resizable(showChoice);
showChoice->label(show_label); showChoice->label(show_label);
} } // Fl_Choice* showChoice
{ Fl_Menu_Button* o = favoritesButton = new Fl_Menu_Button(290, 10, 155, 25, "Favorites"); { favoritesButton = new Fl_Menu_Button(290, 10, 155, 25, "Favorites");
o->down_box(FL_BORDER_BOX); favoritesButton->down_box(FL_BORDER_BOX);
o->callback((Fl_Callback*)cb_favoritesButton); favoritesButton->callback((Fl_Callback*)cb_favoritesButton);
o->align(FL_ALIGN_LEFT|FL_ALIGN_INSIDE); favoritesButton->align(FL_ALIGN_LEFT|FL_ALIGN_INSIDE);
favoritesButton->label(favorites_label); favoritesButton->label(favorites_label);
} } // Fl_Menu_Button* favoritesButton
{ Fl_Button* o = newButton = new Fl_Button(455, 10, 25, 25); { Fl_Button* o = newButton = new Fl_Button(455, 10, 25, 25);
o->image(image_new); newButton->image(image_new);
o->labelsize(8); newButton->labelsize(8);
o->callback((Fl_Callback*)cb_newButton); newButton->callback((Fl_Callback*)cb_newButton);
o->tooltip(new_directory_tooltip); o->tooltip(new_directory_tooltip);
} } // Fl_Button* newButton
o->end(); o->end();
} } // Fl_Group* o
{ Fl_Tile* o = new Fl_Tile(10, 45, 470, 225); { Fl_Tile* o = new Fl_Tile(10, 45, 470, 225);
o->callback((Fl_Callback*)cb_); o->callback((Fl_Callback*)cb_);
{ Fl_File_Browser* o = fileList = new Fl_File_Browser(10, 45, 295, 225); { fileList = new Fl_File_Browser(10, 45, 295, 225);
o->type(2); fileList->type(2);
o->callback((Fl_Callback*)cb_fileList); fileList->callback((Fl_Callback*)cb_fileList);
w->hotspot(o); fileList->window()->hotspot(fileList);
} } // Fl_File_Browser* fileList
{ Fl_Box* o = previewBox = new Fl_Box(305, 45, 175, 225, "?"); { previewBox = new Fl_Box(305, 45, 175, 225, "?");
o->box(FL_DOWN_BOX); previewBox->box(FL_DOWN_BOX);
o->labelsize(100); previewBox->labelsize(100);
o->align(FL_ALIGN_CLIP|FL_ALIGN_INSIDE); previewBox->align(FL_ALIGN_CLIP|FL_ALIGN_INSIDE);
} } // Fl_Box* previewBox
o->end(); o->end();
Fl_Group::current()->resizable(o); Fl_Group::current()->resizable(o);
} } // Fl_Tile* o
{ Fl_Group* o = new Fl_Group(10, 275, 470, 95); { Fl_Group* o = new Fl_Group(10, 275, 470, 95);
{ Fl_Group* o = new Fl_Group(10, 275, 470, 20); { Fl_Group* o = new Fl_Group(10, 275, 470, 20);
{ Fl_Check_Button* o = previewButton = new Fl_Check_Button(10, 275, 73, 20, "Preview"); { previewButton = new Fl_Check_Button(10, 275, 73, 20, "Preview");
o->down_box(FL_DOWN_BOX); previewButton->down_box(FL_DOWN_BOX);
o->value(1); previewButton->value(1);
o->shortcut(0x80070); previewButton->shortcut(0x80070);
o->callback((Fl_Callback*)cb_previewButton); previewButton->callback((Fl_Callback*)cb_previewButton);
previewButton->label(preview_label); previewButton->label(preview_label);
} } // Fl_Check_Button* previewButton
{ Fl_Box* o = new Fl_Box(115, 275, 365, 20); { Fl_Box* o = new Fl_Box(115, 275, 365, 20);
Fl_Group::current()->resizable(o); Fl_Group::current()->resizable(o);
} } // Fl_Box* o
o->end(); o->end();
} } // Fl_Group* o
{ Fl_File_Input* o = fileName = new Fl_File_Input(115, 300, 365, 35); { fileName = new Fl_File_Input(115, 300, 365, 35);
o->labelfont(1); fileName->labelfont(1);
o->callback((Fl_Callback*)cb_fileName); fileName->callback((Fl_Callback*)cb_fileName);
o->when(FL_WHEN_ENTER_KEY); fileName->when(FL_WHEN_ENTER_KEY);
Fl_Group::current()->resizable(o); Fl_Group::current()->resizable(fileName);
fileName->when(FL_WHEN_CHANGED | FL_WHEN_ENTER_KEY_ALWAYS); fileName->when(FL_WHEN_CHANGED | FL_WHEN_ENTER_KEY_ALWAYS);
} } // Fl_File_Input* fileName
{ Fl_Box* o = new Fl_Box(10, 310, 105, 25, "Filename:"); { Fl_Box* o = new Fl_Box(10, 310, 105, 25, "Filename:");
o->labelfont(1); o->labelfont(1);
o->align(FL_ALIGN_RIGHT|FL_ALIGN_INSIDE); o->align(FL_ALIGN_RIGHT|FL_ALIGN_INSIDE);
o->label(filename_label); o->label(filename_label);
} } // Fl_Box* o
{ Fl_Group* o = new Fl_Group(10, 345, 470, 25); { Fl_Group* o = new Fl_Group(10, 345, 470, 25);
{ Fl_Return_Button* o = okButton = new Fl_Return_Button(313, 345, 85, 25, "OK"); { okButton = new Fl_Return_Button(313, 345, 85, 25, "OK");
o->callback((Fl_Callback*)cb_okButton); okButton->callback((Fl_Callback*)cb_okButton);
okButton->label(fl_ok); okButton->label(fl_ok);
} } // Fl_Return_Button* okButton
{ Fl_Button* o = cancelButton = new Fl_Button(408, 345, 72, 25, "Cancel"); { Fl_Button* o = cancelButton = new Fl_Button(408, 345, 72, 25, "Cancel");
o->callback((Fl_Callback*)cb_cancelButton); cancelButton->callback((Fl_Callback*)cb_cancelButton);
o->label(fl_cancel); o->label(fl_cancel);
} } // Fl_Button* cancelButton
{ Fl_Box* o = new Fl_Box(10, 345, 30, 25); { Fl_Box* o = new Fl_Box(10, 345, 30, 25);
Fl_Group::current()->resizable(o); Fl_Group::current()->resizable(o);
} } // Fl_Box* o
o->end(); o->end();
} } // Fl_Group* o
o->end(); o->end();
} } // Fl_Group* o
if (title) window->label(title); if (title) window->label(title);
o->set_modal(); window->set_modal();
o->end(); window->end();
} } // Fl_Double_Window* window
{ Fl_Double_Window* o = favWindow = new Fl_Double_Window(355, 150, "Manage Favorites"); { favWindow = new Fl_Double_Window(355, 150, "Manage Favorites");
w = o; favWindow->user_data((void*)(this));
o->user_data((void*)(this)); { favList = new Fl_File_Browser(10, 10, 300, 95);
{ Fl_File_Browser* o = favList = new Fl_File_Browser(10, 10, 300, 95); favList->type(2);
o->type(2); favList->callback((Fl_Callback*)cb_favList);
o->callback((Fl_Callback*)cb_favList); Fl_Group::current()->resizable(favList);
Fl_Group::current()->resizable(o); } // Fl_File_Browser* favList
}
{ Fl_Group* o = new Fl_Group(320, 10, 25, 95); { Fl_Group* o = new Fl_Group(320, 10, 25, 95);
{ Fl_Button* o = favUpButton = new Fl_Button(320, 10, 25, 25, "@8>"); { favUpButton = new Fl_Button(320, 10, 25, 25, "@8>");
o->callback((Fl_Callback*)cb_favUpButton); favUpButton->callback((Fl_Callback*)cb_favUpButton);
} } // Fl_Button* favUpButton
{ Fl_Button* o = favDeleteButton = new Fl_Button(320, 45, 25, 25, "X"); { favDeleteButton = new Fl_Button(320, 45, 25, 25, "X");
o->labelfont(1); favDeleteButton->labelfont(1);
o->callback((Fl_Callback*)cb_favDeleteButton); favDeleteButton->callback((Fl_Callback*)cb_favDeleteButton);
Fl_Group::current()->resizable(o); Fl_Group::current()->resizable(favDeleteButton);
} } // Fl_Button* favDeleteButton
{ Fl_Button* o = favDownButton = new Fl_Button(320, 80, 25, 25, "@2>"); { favDownButton = new Fl_Button(320, 80, 25, 25, "@2>");
o->callback((Fl_Callback*)cb_favDownButton); favDownButton->callback((Fl_Callback*)cb_favDownButton);
} } // Fl_Button* favDownButton
o->end(); o->end();
} } // Fl_Group* o
{ Fl_Group* o = new Fl_Group(10, 113, 335, 29); { Fl_Group* o = new Fl_Group(10, 113, 335, 29);
{ Fl_Button* o = favCancelButton = new Fl_Button(273, 115, 72, 25, "Cancel"); { favCancelButton = new Fl_Button(273, 115, 72, 25, "Cancel");
o->callback((Fl_Callback*)cb_favCancelButton); favCancelButton->callback((Fl_Callback*)cb_favCancelButton);
favCancelButton->label(fl_cancel); favCancelButton->label(fl_cancel);
} } // Fl_Button* favCancelButton
{ Fl_Return_Button* o = favOkButton = new Fl_Return_Button(181, 115, 79, 25, "Save"); { favOkButton = new Fl_Return_Button(181, 115, 79, 25, "Save");
o->callback((Fl_Callback*)cb_favOkButton); favOkButton->callback((Fl_Callback*)cb_favOkButton);
favOkButton->label(save_label); favOkButton->label(save_label);
} } // Fl_Return_Button* favOkButton
{ Fl_Box* o = new Fl_Box(10, 115, 161, 25); { Fl_Box* o = new Fl_Box(10, 115, 161, 25);
Fl_Group::current()->resizable(o); Fl_Group::current()->resizable(o);
} } // Fl_Box* o
o->end(); o->end();
} } // Fl_Group* o
favWindow->label(manage_favorites_label); favWindow->label(manage_favorites_label);
o->set_modal(); favWindow->set_modal();
o->size_range(181, 150); favWindow->size_range(181, 150);
o->end(); favWindow->end();
} } // Fl_Double_Window* favWindow
callback_ = 0; callback_ = 0;
data_ = 0; data_ = 0;
directory_[0] = 0; directory_[0] = 0;
+6 -7
View File
@@ -1,5 +1,5 @@
# data file for the Fltk User Interface Designer (fluid) # data file for the Fltk User Interface Designer (fluid)
version 1.0107 version 1.0108
header_name {../FL/Fl_File_Chooser.H} header_name {../FL/Fl_File_Chooser.H}
code_name {.cxx} code_name {.cxx}
comment {// comment {//
@@ -134,11 +134,11 @@ window->hide();}
} { } {
Fl_Return_Button okButton { Fl_Return_Button okButton {
label OK label OK
callback {// Do any callback that is registered... callback {window->hide();
if (callback_)
(*callback_)(this, data_);
window->hide();} // Do any callback that is registered...
if (callback_)
(*callback_)(this, data_);} selected
private xywh {313 345 85 25} private xywh {313 345 85 25}
code0 {\#include <FL/fl_ask.H>} code0 {\#include <FL/fl_ask.H>}
code1 {okButton->label(fl_ok);} code1 {okButton->label(fl_ok);}
@@ -309,8 +309,7 @@ Fl::flush();
fl_cursor(FL_CURSOR_WAIT); fl_cursor(FL_CURSOR_WAIT);
rescan_keep_filename(); rescan_keep_filename();
fl_cursor(FL_CURSOR_DEFAULT); fl_cursor(FL_CURSOR_DEFAULT);
fileName->take_focus();} {selected fileName->take_focus();} {}
}
} }
Function {shown()} {return_type int Function {shown()} {return_type int
} { } {