Second take at retrieving the correct 'hanged()' value for the Fl_Input_Choice. Fl_Widget::changed() clears our flag where it should not, so we have to some trickery and set a second 'changed' flag that will not be cleared by Fl_Widget::do_callback. I did not see any side effects in doing this, but it is definetley a Kludge.

git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@5891 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
Matthias Melcher 2007-06-07 21:40:36 +00:00
parent 5d7d16cc8c
commit dc296ba4c0

View File

@ -68,7 +68,13 @@ class Fl_Input_Choice : public Fl_Group {
static void inp_cb(Fl_Widget*, void *data) {
Fl_Input_Choice *o=(Fl_Input_Choice *)data;
if (o->inp_->changed())
o->Fl_Widget::set_changed();
else
o->Fl_Widget::clear_changed();
o->do_callback();
if (o->callback() != default_callback)
o->Fl_Widget::clear_changed();
}
// Custom resize behavior -- input stretches, menu button doesn't
@ -100,13 +106,15 @@ public:
menu_->add(s);
}
int changed() const {
return inp_->changed();
return inp_->changed() | Fl_Widget::changed();
}
void clear_changed() {
return inp_->clear_changed();
inp_->clear_changed();
Fl_Widget::clear_changed();
}
void set_changed() {
return inp_->set_changed();
inp_->set_changed();
// no need to call Fl_Widget::set_changed()
}
void clear() {
menu_->clear();