Replaced Fl::readqueue() in fl_ask.cxx by real callbacks.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@7343 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
parent
f766b7930d
commit
8863c6d21f
@ -58,12 +58,19 @@ static Fl_Box *message;
|
||||
static Fl_Box *icon;
|
||||
static Fl_Button *button[3];
|
||||
static Fl_Input *input;
|
||||
static int ret_val;
|
||||
static const char *iconlabel = "?";
|
||||
Fl_Font fl_message_font_ = FL_HELVETICA;
|
||||
Fl_Fontsize fl_message_size_ = 14;
|
||||
|
||||
static char avoidRecursion = 0;
|
||||
|
||||
// sets the global return value (ret_val) and closes the window
|
||||
static void button_cb(Fl_Widget *bt, void *val) {
|
||||
ret_val = (int)val;
|
||||
message_form->hide();
|
||||
}
|
||||
|
||||
static Fl_Window *makeform() {
|
||||
if (message_form) {
|
||||
message_form->size(410,103);
|
||||
@ -87,13 +94,13 @@ static Fl_Window *makeform() {
|
||||
o->color(FL_WHITE);
|
||||
o->labelcolor(FL_BLUE);
|
||||
}
|
||||
button[0] = new Fl_Button(310, 70, 90, 23);
|
||||
// create the buttons (right to left)
|
||||
for (int b=0, x=310; b<3; b++, x -= 100) {
|
||||
button[b] = new Fl_Button(x, 70, 90, 23);
|
||||
button[b]->align(FL_ALIGN_INSIDE|FL_ALIGN_WRAP);
|
||||
button[b]->callback(button_cb,(void *)b);
|
||||
}
|
||||
button[0]->shortcut(FL_Escape);
|
||||
button[0]->align(FL_ALIGN_INSIDE|FL_ALIGN_WRAP);
|
||||
button[1] = new Fl_Return_Button(210, 70, 90, 23);
|
||||
button[1]->align(FL_ALIGN_INSIDE|FL_ALIGN_WRAP);
|
||||
button[2] = new Fl_Button(110, 70, 90, 23);
|
||||
button[2]->align(FL_ALIGN_INSIDE|FL_ALIGN_WRAP);
|
||||
w->resizable(new Fl_Box(60,10,110-60,27));
|
||||
w->end();
|
||||
w->set_modal();
|
||||
@ -218,31 +225,22 @@ static int innards(const char* fmt, va_list ap,
|
||||
else
|
||||
button[0]->shortcut(FL_Escape);
|
||||
|
||||
message_form->show();
|
||||
// deactivate Fl::grab(), because it is incompatible with Fl::readqueue()
|
||||
// deactivate Fl::grab(), because it is incompatible with modal windows
|
||||
Fl_Window* g = Fl::grab();
|
||||
if (g) Fl::grab(0);
|
||||
int r = 0;
|
||||
for (;;) {
|
||||
Fl_Widget *o = Fl::readqueue();
|
||||
if (!o) Fl::wait();
|
||||
else if (o == button[0]) {r = 0; break;}
|
||||
else if (o == button[1]) {r = 1; break;}
|
||||
else if (o == button[2]) {r = 2; break;}
|
||||
else if (o == message_form) {r = 0; break;}
|
||||
}
|
||||
message_form->show();
|
||||
while (message_form->shown()) Fl::wait();
|
||||
if (g) // regrab the previous popup menu, if there was one
|
||||
Fl::grab(g);
|
||||
message_form->hide();
|
||||
icon->label(prev_icon_label);
|
||||
|
||||
avoidRecursion = 0;
|
||||
return r;
|
||||
return ret_val;
|
||||
}
|
||||
|
||||
/** \addtogroup group_comdlg
|
||||
@{ */
|
||||
|
||||
|
||||
// pointers you can use to change FLTK to a foreign language:
|
||||
const char* fl_no = "No"; ///< string pointer used in common dialogs, you can change it to a foreign language
|
||||
const char* fl_yes= "Yes"; ///< string pointer used in common dialogs, you can change it to a foreign language
|
||||
|
||||
Loading…
Reference in New Issue
Block a user