summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael R Sweet <michael.r.sweet@gmail.com>2006-01-15 02:21:19 +0000
committerMichael R Sweet <michael.r.sweet@gmail.com>2006-01-15 02:21:19 +0000
commit2b293afe37ccf6a9698487ce676cf9fc5f8d6337 (patch)
tree6f4b869337dc1bd54ad7e0c13526030d27b9cf68
parent31700097b32494693a818941932c354c21e6da84 (diff)
Pressing a Fl_Menu_Button widget now draws it pressed in (STR
#1140) git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@4746 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
-rw-r--r--CHANGES2
-rw-r--r--src/Fl_Menu_Button.cxx9
2 files changed, 10 insertions, 1 deletions
diff --git a/CHANGES b/CHANGES
index 11d31bf1b..046ac9e86 100644
--- a/CHANGES
+++ b/CHANGES
@@ -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;
}