diff options
| -rw-r--r-- | CHANGES | 2 | ||||
| -rw-r--r-- | src/Fl_Menu_Button.cxx | 9 |
2 files changed, 10 insertions, 1 deletions
@@ -3,6 +3,8 @@ CHANGES IN FLTK 1.1.7 - Documentation fixes (STR #571, STR #648, STR #692, STR #730, STR #744, STR #745, STR #931, STR #942, STR #960, STR #969) + - Pressing a Fl_Menu_Button widget now draws it pressed + in (STR #1140) - The threads demo would display negative prime numbers on MacOS X; this appears to be a MacOS X bug, but we added a workaround to "fix" this (STR #1138) diff --git a/src/Fl_Menu_Button.cxx b/src/Fl_Menu_Button.cxx index 9b06f5895..c90ed9c9d 100644 --- a/src/Fl_Menu_Button.cxx +++ b/src/Fl_Menu_Button.cxx @@ -29,9 +29,12 @@ #include <FL/Fl_Menu_Button.H> #include <FL/fl_draw.H> + +static Fl_Menu_Button *pressed_menu_button_ = 0; + void Fl_Menu_Button::draw() { if (!box() || type()) return; - draw_box(box(), color()); + draw_box(pressed_menu_button_ == this ? fl_down(box()) : box(), color()); draw_label(); if (Fl::focus() == this) draw_focus(); if (box() == FL_FLAT_BOX) return; // for XForms compatability @@ -46,12 +49,16 @@ void Fl_Menu_Button::draw() { const Fl_Menu_Item* Fl_Menu_Button::popup() { const Fl_Menu_Item* m; + pressed_menu_button_ = this; + redraw(); if (!box() || type()) { m = menu()->popup(Fl::event_x(), Fl::event_y(), label(), mvalue(), this); } else { m = menu()->pulldown(x(), y(), w(), h(), 0, this); } picked(m); + pressed_menu_button_ = 0; + redraw(); return m; } |
