mirror of
https://github.com/fltk/fltk.git
synced 2026-06-05 08:06:35 +08:00
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:
+11
-3
@@ -68,7 +68,13 @@ class Fl_Input_Choice : public Fl_Group {
|
|||||||
|
|
||||||
static void inp_cb(Fl_Widget*, void *data) {
|
static void inp_cb(Fl_Widget*, void *data) {
|
||||||
Fl_Input_Choice *o=(Fl_Input_Choice *)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();
|
o->do_callback();
|
||||||
|
if (o->callback() != default_callback)
|
||||||
|
o->Fl_Widget::clear_changed();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Custom resize behavior -- input stretches, menu button doesn't
|
// Custom resize behavior -- input stretches, menu button doesn't
|
||||||
@@ -100,13 +106,15 @@ public:
|
|||||||
menu_->add(s);
|
menu_->add(s);
|
||||||
}
|
}
|
||||||
int changed() const {
|
int changed() const {
|
||||||
return inp_->changed();
|
return inp_->changed() | Fl_Widget::changed();
|
||||||
}
|
}
|
||||||
void clear_changed() {
|
void clear_changed() {
|
||||||
return inp_->clear_changed();
|
inp_->clear_changed();
|
||||||
|
Fl_Widget::clear_changed();
|
||||||
}
|
}
|
||||||
void set_changed() {
|
void set_changed() {
|
||||||
return inp_->set_changed();
|
inp_->set_changed();
|
||||||
|
// no need to call Fl_Widget::set_changed()
|
||||||
}
|
}
|
||||||
void clear() {
|
void clear() {
|
||||||
menu_->clear();
|
menu_->clear();
|
||||||
|
|||||||
Reference in New Issue
Block a user