STR 1719: fixed inconsistencies with FL_WHEN_NOT_CHANGED
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@6031 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
parent
97c408f1d2
commit
dc0ab1d06c
1
CHANGES
1
CHANGES
@ -6,6 +6,7 @@ CHANGES IN FLTK 1.1.8
|
||||
STR #1742, STR #1777, STR #1794, STR #1827, STR #1843,
|
||||
STR #1796, STR #1815, STR #1726, STR #1753, STR #1855,
|
||||
STR #1862, STR #1867, STR #1874)
|
||||
- Fixed inconsistencies with CHANGED flags (STR #1719)
|
||||
- Fixed message sent to hidden widgets (STR #1849)
|
||||
- Fixed width calculation in Fl_Help_ViewA (STR #1868)
|
||||
- Fixed offset bug in OS X pixmap code (STR #1856)
|
||||
|
@ -38,6 +38,7 @@
|
||||
#include <FL/Fl_Input.H>
|
||||
#include <FL/Fl_Menu_Button.H>
|
||||
#include <FL/fl_draw.H>
|
||||
#include <string.h>
|
||||
|
||||
class Fl_Input_Choice : public Fl_Group {
|
||||
// Private class to handle slightly 'special' behavior of menu button
|
||||
@ -60,19 +61,41 @@ class Fl_Input_Choice : public Fl_Group {
|
||||
static void menu_cb(Fl_Widget*, void *data) {
|
||||
Fl_Input_Choice *o=(Fl_Input_Choice *)data;
|
||||
const Fl_Menu_Item *item = o->menubutton()->mvalue();
|
||||
if ( item && item->flags & (FL_SUBMENU|FL_SUBMENU_POINTER) ) return; // ignore submenus
|
||||
o->inp_->value(o->menu_->text());
|
||||
o->inp_->set_changed();
|
||||
o->do_callback();
|
||||
if (item && item->flags & (FL_SUBMENU|FL_SUBMENU_POINTER)) return; // ignore submenus
|
||||
if (!strcmp(o->inp_->value(), o->menu_->text()))
|
||||
{
|
||||
o->Fl_Widget::clear_changed();
|
||||
if (o->when() & FL_WHEN_NOT_CHANGED)
|
||||
o->do_callback();
|
||||
}
|
||||
else
|
||||
{
|
||||
o->inp_->value(o->menu_->text());
|
||||
o->inp_->set_changed();
|
||||
o->Fl_Widget::set_changed();
|
||||
if (o->when() & (FL_WHEN_CHANGED|FL_WHEN_RELEASE))
|
||||
o->do_callback();
|
||||
}
|
||||
|
||||
if (o->callback() != default_callback)
|
||||
{
|
||||
o->Fl_Widget::clear_changed();
|
||||
o->inp_->clear_changed();
|
||||
}
|
||||
}
|
||||
|
||||
static void inp_cb(Fl_Widget*, void *data) {
|
||||
Fl_Input_Choice *o=(Fl_Input_Choice *)data;
|
||||
if (o->inp_->changed())
|
||||
if (o->inp_->changed()) {
|
||||
o->Fl_Widget::set_changed();
|
||||
else
|
||||
if (o->when() & (FL_WHEN_CHANGED|FL_WHEN_RELEASE))
|
||||
o->do_callback();
|
||||
} else {
|
||||
o->Fl_Widget::clear_changed();
|
||||
o->do_callback();
|
||||
if (o->when() & FL_WHEN_NOT_CHANGED)
|
||||
o->do_callback();
|
||||
}
|
||||
|
||||
if (o->callback() != default_callback)
|
||||
o->Fl_Widget::clear_changed();
|
||||
}
|
||||
@ -96,6 +119,7 @@ public:
|
||||
inp_w(), inp_h());
|
||||
inp_->callback(inp_cb, (void*)this);
|
||||
inp_->box(FL_FLAT_BOX); // cosmetic
|
||||
inp_->when(FL_WHEN_CHANGED|FL_WHEN_NOT_CHANGED);
|
||||
menu_ = new InputMenuButton(menu_x(), menu_y(),
|
||||
menu_w(), menu_h());
|
||||
menu_->callback(menu_cb, (void*)this);
|
||||
|
@ -85,7 +85,10 @@ int Fl_Button::handle(int event) {
|
||||
if (type() == FL_RADIO_BUTTON) newval = 1;
|
||||
else newval = !oldval;
|
||||
} else
|
||||
{
|
||||
clear_changed();
|
||||
newval = oldval;
|
||||
}
|
||||
if (newval != value_) {
|
||||
value_ = newval;
|
||||
set_changed();
|
||||
@ -103,6 +106,7 @@ int Fl_Button::handle(int event) {
|
||||
else if (type() == FL_TOGGLE_BUTTON) oldval = value_;
|
||||
else {
|
||||
value(oldval);
|
||||
set_changed();
|
||||
if (when() & FL_WHEN_CHANGED) do_callback();
|
||||
}
|
||||
if (when() & FL_WHEN_RELEASE) do_callback();
|
||||
|
@ -409,9 +409,10 @@ int Fl_Input::handle(int event) {
|
||||
// user double or triple clicked to select word or whole text
|
||||
copy(0);
|
||||
}
|
||||
// For output widgets, do the callback so the app knows the user
|
||||
// did something with the mouse...
|
||||
if (readonly()) do_callback();
|
||||
|
||||
// perform the RELEASE callback
|
||||
if (when() & FL_WHEN_RELEASE)
|
||||
maybe_do_callback();
|
||||
return 1;
|
||||
|
||||
case FL_DND_ENTER:
|
||||
|
@ -715,7 +715,9 @@ int Fl_Input_::handletext(int event, int X, int Y, int W, int H) {
|
||||
} else //if (Fl::selection_owner() != this)
|
||||
minimal_update(mark_, position_);
|
||||
case FL_HIDE:
|
||||
if (when() & FL_WHEN_RELEASE) maybe_do_callback();
|
||||
if (!readonly() &&
|
||||
(when() & (FL_WHEN_RELEASE | FL_WHEN_NOT_CHANGED)))
|
||||
maybe_do_callback();
|
||||
return 1;
|
||||
|
||||
case FL_PUSH:
|
||||
|
Loading…
Reference in New Issue
Block a user