diff options
| author | Michael R Sweet <michael.r.sweet@gmail.com> | 2001-11-17 18:18:53 +0000 |
|---|---|---|
| committer | Michael R Sweet <michael.r.sweet@gmail.com> | 2001-11-17 18:18:53 +0000 |
| commit | c63083837ff47b891c2c833125c82addcbe4b521 (patch) | |
| tree | eecf422f03a604a9aabaa22556e4a18657fdaf3e /src/Fl_Choice.cxx | |
| parent | e5db11fd430d31a23d9fb5315910dc64b2e974d0 (diff) | |
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
Diffstat (limited to 'src/Fl_Choice.cxx')
| -rw-r--r-- | src/Fl_Choice.cxx | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/src/Fl_Choice.cxx b/src/Fl_Choice.cxx index bc79d6f6b..4239a3980 100644 --- a/src/Fl_Choice.cxx +++ b/src/Fl_Choice.cxx @@ -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). // @@ -38,13 +38,14 @@ void Fl_Choice::draw() { int dx = Fl::box_dx(FL_DOWN_BOX); int dy = Fl::box_dy(FL_DOWN_BOX); 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 w1 = (H - 4) / 3; if (w1 < 1) w1 = 1; - int x1 = X + (H - 2 * w1 - 1) / 2; + int w1 = (W - 4) / 3; if (w1 < 1) w1 = 1; + int x1 = X + (W - 2 * 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_polygon(x1, y1, x1 + w1, y1 + w1, x1 + 2 * w1, y1); @@ -52,9 +53,9 @@ void Fl_Choice::draw() { if (mvalue()) { Fl_Menu_Item m = *mvalue(); 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 - 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_draw_shortcut = 0; 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 $". // |
