mirror of
https://github.com/fltk/fltk.git
synced 2026-05-28 03:15:21 +08:00
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:
@@ -3,6 +3,8 @@ CHANGES IN FLTK 1.1.7
|
|||||||
- Documentation fixes (STR #571, STR #648, STR #692, STR
|
- Documentation fixes (STR #571, STR #648, STR #692, STR
|
||||||
#730, STR #744, STR #745, STR #931, STR #942, STR #960,
|
#730, STR #744, STR #745, STR #931, STR #942, STR #960,
|
||||||
STR #969)
|
STR #969)
|
||||||
|
- Pressing a Fl_Menu_Button widget now draws it pressed
|
||||||
|
in (STR #1140)
|
||||||
- The threads demo would display negative prime numbers
|
- The threads demo would display negative prime numbers
|
||||||
on MacOS X; this appears to be a MacOS X bug, but we
|
on MacOS X; this appears to be a MacOS X bug, but we
|
||||||
added a workaround to "fix" this (STR #1138)
|
added a workaround to "fix" this (STR #1138)
|
||||||
|
|||||||
@@ -29,9 +29,12 @@
|
|||||||
#include <FL/Fl_Menu_Button.H>
|
#include <FL/Fl_Menu_Button.H>
|
||||||
#include <FL/fl_draw.H>
|
#include <FL/fl_draw.H>
|
||||||
|
|
||||||
|
|
||||||
|
static Fl_Menu_Button *pressed_menu_button_ = 0;
|
||||||
|
|
||||||
void Fl_Menu_Button::draw() {
|
void Fl_Menu_Button::draw() {
|
||||||
if (!box() || type()) return;
|
if (!box() || type()) return;
|
||||||
draw_box(box(), color());
|
draw_box(pressed_menu_button_ == this ? fl_down(box()) : box(), color());
|
||||||
draw_label();
|
draw_label();
|
||||||
if (Fl::focus() == this) draw_focus();
|
if (Fl::focus() == this) draw_focus();
|
||||||
if (box() == FL_FLAT_BOX) return; // for XForms compatability
|
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* Fl_Menu_Button::popup() {
|
||||||
const Fl_Menu_Item* m;
|
const Fl_Menu_Item* m;
|
||||||
|
pressed_menu_button_ = this;
|
||||||
|
redraw();
|
||||||
if (!box() || type()) {
|
if (!box() || type()) {
|
||||||
m = menu()->popup(Fl::event_x(), Fl::event_y(), label(), mvalue(), this);
|
m = menu()->popup(Fl::event_x(), Fl::event_y(), label(), mvalue(), this);
|
||||||
} else {
|
} else {
|
||||||
m = menu()->pulldown(x(), y(), w(), h(), 0, this);
|
m = menu()->pulldown(x(), y(), w(), h(), 0, this);
|
||||||
}
|
}
|
||||||
picked(m);
|
picked(m);
|
||||||
|
pressed_menu_button_ = 0;
|
||||||
|
redraw();
|
||||||
return m;
|
return m;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user