diff options
| author | Albrecht Schlosser <albrechts.fltk@online.de> | 2023-10-15 12:25:21 +0200 |
|---|---|---|
| committer | Albrecht Schlosser <albrechts.fltk@online.de> | 2023-10-15 12:25:21 +0200 |
| commit | 4964a15c01cb98c0996f7638cc758c0779837555 (patch) | |
| tree | bbc71f71d5a4e963a0fcf4bb98e9987ce182c759 /src | |
| parent | fd6accec247c6749a31f15ac4b5f5ef09139ab71 (diff) | |
Improve small radio buttons by using fl_draw_circle()
This removes duplicated code as intended when fl_draw_circle()
was introduced.
Diffstat (limited to 'src')
| -rw-r--r-- | src/Fl_Light_Button.cxx | 32 |
1 files changed, 5 insertions, 27 deletions
diff --git a/src/Fl_Light_Button.cxx b/src/Fl_Light_Button.cxx index 71064d9fb..9658be15a 100644 --- a/src/Fl_Light_Button.cxx +++ b/src/Fl_Light_Button.cxx @@ -1,7 +1,7 @@ // // Lighted button widget for the Fast Light Tool Kit (FLTK). // -// Copyright 1998-2015 by Bill Spitzak and others. +// Copyright 1998-2023 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 @@ -78,34 +78,12 @@ void Fl_Light_Button::draw() { tW --; fl_pie(x() + tdx - 1, y() + tdy - 1, tW + 3, tW + 3, 0.0, 360.0); fl_color(fl_color_average(FL_WHITE, FL_SELECTION_COLOR, 0.2f)); - } else fl_color(col); - - switch (tW) { - // Larger circles draw fine... - default : - fl_pie(x() + tdx, y() + tdy, tW, tW, 0.0, 360.0); - break; - - // Small circles don't draw well on many systems... - case 6 : - fl_rectf(x() + tdx + 2, y() + tdy, tW - 4, tW); - fl_rectf(x() + tdx + 1, y() + tdy + 1, tW - 2, tW - 2); - fl_rectf(x() + tdx, y() + tdy + 2, tW, tW - 4); - break; - - case 5 : - case 4 : - case 3 : - fl_rectf(x() + tdx + 1, y() + tdy, tW - 2, tW); - fl_rectf(x() + tdx, y() + tdy + 1, tW, tW - 2); - break; - - case 2 : - case 1 : - fl_rectf(x() + tdx, y() + tdy, tW, tW); - break; + } else { + fl_color(col); } + fl_draw_circle(x() + tdx, y() + tdy, tW, fl_color()); + if (Fl::is_scheme("gtk+")) { fl_color(fl_color_average(FL_WHITE, FL_SELECTION_COLOR, 0.5)); fl_arc(x() + tdx, y() + tdy, tW + 1, tW + 1, 60.0, 180.0); |
