From 438a8af9daf022f89cffe286f4bbf190bdce17e5 Mon Sep 17 00:00:00 2001 From: Greg Ercolano Date: Wed, 26 Jun 2024 15:46:36 -0700 Subject: [PATCH] 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). --- src/Fl_Choice.cxx | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/src/Fl_Choice.cxx b/src/Fl_Choice.cxx index 66bd57ab6..a4c6b0a2b 100644 --- a/src/Fl_Choice.cxx +++ b/src/Fl_Choice.cxx @@ -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