Fixes to Fl_Choice provided by Albrecht (#978)
This addresses some border case issues in Fl_Choice wrt erco's recent Fl_Input_Choice modifications. As Albrecht writes in issue #978: - The width of the (simulated) menu button in Fl_Choice is shrunk if the height of the widget is lower than 20 for some schemes. This (a) is inconsistent, (b) doesn't look good, and (c) doesn't match the better layout of the Fl_Input_Choice widget after your patch. - The constant height (+/- 8) of the divider line in some schemes would overlap the border of the widget if the widget's height is smaller than about 19. You fixed this in your patch and I "stole" your [erco's] fix for Fl_Choice. - The divider line and the box borders of Fl_Choice and Fl_Input_Choice didn't align properly. I fixed this in my Fl_Choice patch as well (IMHO this is the right place to fix it).
This commit is contained in:
parent
5c7ba51be3
commit
438a8af9da
@ -1,7 +1,7 @@
|
||||
//
|
||||
// Choice widget for the Fast Light Tool Kit (FLTK).
|
||||
//
|
||||
// Copyright 1998-2022 by Bill Spitzak and others.
|
||||
// Copyright 1998-2024 by Bill Spitzak and others.
|
||||
//
|
||||
// This library is free software. Distribution and use rights are outlined in
|
||||
// the file "COPYING" which should have been included with this file. If this
|
||||
@ -36,9 +36,7 @@ void Fl_Choice::draw() {
|
||||
|
||||
// Arrow area
|
||||
int H = h() - 2 * dy;
|
||||
int W = Fl::is_scheme("gtk+") ? 20 : // gtk+ -- fixed size
|
||||
Fl::is_scheme("gleam") ? 20 // gleam -- fixed size
|
||||
: ((H > 20) ? 20 : H); // else: shrink if H<20
|
||||
int W = 20;
|
||||
int X = x() + w() - W - dx;
|
||||
int Y = y() + dy;
|
||||
|
||||
@ -76,14 +74,15 @@ void Fl_Choice::draw() {
|
||||
Fl::is_scheme("gleam") ||
|
||||
Fl::is_scheme("oxy")) {
|
||||
// draw the divider
|
||||
int x1 = x() + w() - 20 - dx;
|
||||
int y1 = y() + h() / 2;
|
||||
int x1 = x() + w() - W - 2 * dx;
|
||||
int y1 = y() + dy;
|
||||
int y2 = y() + h() - dy;
|
||||
|
||||
fl_color(fl_darker(color()));
|
||||
fl_yxline(x1, y1 - 8, y1 + 8);
|
||||
fl_yxline(x1, y1, y2);
|
||||
|
||||
fl_color(fl_lighter(color()));
|
||||
fl_yxline(x1 + 1, y1 - 8, y1 + 8);
|
||||
fl_yxline(x1 + 1, y1, y2);
|
||||
}
|
||||
} else { // Default scheme ("None")
|
||||
// Draw arrow box
|
||||
|
Loading…
Reference in New Issue
Block a user