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
This commit is contained in:
Michael R Sweet 2006-01-15 02:21:19 +00:00
parent 31700097b3
commit 2b293afe37
2 changed files with 10 additions and 1 deletions

View File

@ -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)

View File

@ -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;
}