Limit width of drop-down button in Fl_Choice widgets.

Fix tooltip bug where the wrong tooltip would be shown.


git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@1692 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
Michael R Sweet 2001-11-17 18:18:53 +00:00
parent e5db11fd43
commit c63083837f
3 changed files with 17 additions and 12 deletions

View File

@ -30,6 +30,10 @@ CHANGES IN FLTK 1.1.0b6
"-kbd" and "-nokbd" options in Fl::args() processing "-kbd" and "-nokbd" options in Fl::args() processing
to control whether keyboard focus is shown and handled to control whether keyboard focus is shown and handled
by non-text widgets. by non-text widgets.
- The wrong tooltip could be shown if the user moved the
mouse over adjacent widgets with tooltips.
- The drop-down button on Fl_Choice widgets was not
limited in width.
CHANGES IN FLTK 1.1.0b5 CHANGES IN FLTK 1.1.0b5

View File

@ -1,5 +1,5 @@
// //
// "$Id: Fl_Choice.cxx,v 1.10.2.5.2.3 2001/11/03 19:24:22 easysw Exp $" // "$Id: Fl_Choice.cxx,v 1.10.2.5.2.4 2001/11/17 18:18:53 easysw Exp $"
// //
// Choice widget for the Fast Light Tool Kit (FLTK). // Choice widget for the Fast Light Tool Kit (FLTK).
// //
@ -38,13 +38,14 @@ void Fl_Choice::draw() {
int dx = Fl::box_dx(FL_DOWN_BOX); int dx = Fl::box_dx(FL_DOWN_BOX);
int dy = Fl::box_dy(FL_DOWN_BOX); int dy = Fl::box_dy(FL_DOWN_BOX);
int H = h() - 2 * dy; int H = h() - 2 * dy;
int X = x() + w() - h() + dx; int W = (H > 20) ? 20 : H;
int X = x() + w() - W - dx;
int Y = y() + dy; int Y = y() + dy;
int w1 = (H - 4) / 3; if (w1 < 1) w1 = 1; int w1 = (W - 4) / 3; if (w1 < 1) w1 = 1;
int x1 = X + (H - 2 * w1 - 1) / 2; int x1 = X + (W - 2 * w1 - 1) / 2;
int y1 = Y + (H - w1 - 1) / 2; int y1 = Y + (H - w1 - 1) / 2;
draw_box(FL_UP_BOX,X,Y,H,H,FL_GRAY); draw_box(FL_UP_BOX,X,Y,W,H,FL_GRAY);
fl_color(active_r() ? labelcolor() : fl_inactive(labelcolor())); fl_color(active_r() ? labelcolor() : fl_inactive(labelcolor()));
fl_polygon(x1, y1, x1 + w1, y1 + w1, x1 + 2 * w1, y1); fl_polygon(x1, y1, x1 + w1, y1 + w1, x1 + 2 * w1, y1);
@ -52,9 +53,9 @@ void Fl_Choice::draw() {
if (mvalue()) { if (mvalue()) {
Fl_Menu_Item m = *mvalue(); Fl_Menu_Item m = *mvalue();
if (active_r()) m.activate(); else m.deactivate(); if (active_r()) m.activate(); else m.deactivate();
fl_clip(x() + dx, y() + dy + 1, w() - h() - 2 * dx, H - 2); fl_clip(x() + dx, y() + dy + 1, w() - W, H - 2);
fl_draw_shortcut = 2; // hack value to make '&' disappear fl_draw_shortcut = 2; // hack value to make '&' disappear
m.draw(x() + dx, y() + dy + 1, w() - h() - 2 * dx, H - 2, this, m.draw(x() + dx, y() + dy + 1, w() - W, H - 2, this,
Fl::focus() == this); Fl::focus() == this);
fl_draw_shortcut = 0; fl_draw_shortcut = 0;
fl_pop_clip(); fl_pop_clip();
@ -116,5 +117,5 @@ int Fl_Choice::handle(int e) {
} }
// //
// End of "$Id: Fl_Choice.cxx,v 1.10.2.5.2.3 2001/11/03 19:24:22 easysw Exp $". // End of "$Id: Fl_Choice.cxx,v 1.10.2.5.2.4 2001/11/17 18:18:53 easysw Exp $".
// //

View File

@ -1,5 +1,5 @@
// //
// "$Id: Fl_Tooltip.cxx,v 1.38.2.4 2001/10/29 03:44:32 easysw Exp $" // "$Id: Fl_Tooltip.cxx,v 1.38.2.5 2001/11/17 18:18:53 easysw Exp $"
// //
// Tooltip source file for the Fast Light Tool Kit (FLTK). // Tooltip source file for the Fast Light Tool Kit (FLTK).
// //
@ -110,7 +110,6 @@ public:
// when the pointer enters them // when the pointer enters them
void void
Fl_Tooltip::enter(Fl_Widget *w) { Fl_Tooltip::enter(Fl_Widget *w) {
// printf("Fl_Tooltip::enter(%p)\n", w);
if ((!w || !w->tooltip()) && tooltip_callback_ && window) { if ((!w || !w->tooltip()) && tooltip_callback_ && window) {
Fl::remove_timeout(tooltip_callback_); Fl::remove_timeout(tooltip_callback_);
window->hide(); window->hide();
@ -118,6 +117,7 @@ Fl_Tooltip::enter(Fl_Widget *w) {
return; return;
} }
if (!tooltip_callback_ || !w || !w->tooltip()) return; if (!tooltip_callback_ || !w || !w->tooltip()) return;
Fl::remove_timeout(tooltip_callback_);
Fl::add_timeout(delay_, tooltip_callback_, w); Fl::add_timeout(delay_, tooltip_callback_, w);
} }
@ -127,7 +127,7 @@ Fl_Tooltip::enter(Fl_Widget *w) {
// the widget // the widget
void void
Fl_Tooltip::exit(Fl_Widget *w) { Fl_Tooltip::exit(Fl_Widget *w) {
// printf("Fl_Tooltip::exit(%p)\n", w); printf("Fl_Tooltip::exit(%p)\n", w);
if (tooltip_exit_) tooltip_exit_(w); if (tooltip_exit_) tooltip_exit_(w);
} }
@ -189,5 +189,5 @@ Fl_Tooltip::tooltip_timeout(void *v) {
// //
// End of "$Id: Fl_Tooltip.cxx,v 1.38.2.4 2001/10/29 03:44:32 easysw Exp $". // End of "$Id: Fl_Tooltip.cxx,v 1.38.2.5 2001/11/17 18:18:53 easysw Exp $".
// //