summaryrefslogtreecommitdiff
path: root/src/Fl_Menu.cxx
diff options
context:
space:
mode:
authorAlbrecht Schlosser <albrechts.fltk@online.de>2023-01-03 19:40:37 +0100
committerAlbrecht Schlosser <albrechts.fltk@online.de>2023-01-05 01:06:25 +0100
commit4d1a508c7e4d28fd53129da79f068a275d7160bd (patch)
treeaa34c8312fc197f5bfd18a16b6537ddce380afbc /src/Fl_Menu.cxx
parentb5b88d5f0dcb682df1ad80ac8939fcfc1f6671da (diff)
Refactor drawing small circles: add fl_draw_circle()
This method can be used to draw small circles as part of the GUI. It is independent of the current scheme. Very small circles are approximated by drawing several rectangles.
Diffstat (limited to 'src/Fl_Menu.cxx')
-rw-r--r--src/Fl_Menu.cxx32
1 files changed, 5 insertions, 27 deletions
diff --git a/src/Fl_Menu.cxx b/src/Fl_Menu.cxx
index d726a692b..e50393e7a 100644
--- a/src/Fl_Menu.cxx
+++ b/src/Fl_Menu.cxx
@@ -1,7 +1,7 @@
//
// Menu code for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2022 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
@@ -245,34 +245,12 @@ void Fl_Menu_Item::draw(int x, int y, int w, int h, const Fl_Menu_* m,
tW --;
fl_pie(x + td + 1, y + d + td - 1, tW + 3, tW + 3, 0.0, 360.0);
fl_color(fl_color_average(FL_WHITE, FL_SELECTION_COLOR, 0.2f));
- } else fl_color(labelcolor_);
-
- switch (tW) {
- // Larger circles draw fine...
- default :
- fl_pie(x + td + 2, y + d + td, tW, tW, 0.0, 360.0);
- break;
-
- // Small circles don't draw well on many systems...
- case 6 :
- fl_rectf(x + td + 4, y + d + td, tW - 4, tW);
- fl_rectf(x + td + 3, y + d + td + 1, tW - 2, tW - 2);
- fl_rectf(x + td + 2, y + d + td + 2, tW, tW - 4);
- break;
-
- case 5 :
- case 4 :
- case 3 :
- fl_rectf(x + td + 3, y + d + td, tW - 2, tW);
- fl_rectf(x + td + 2, y + d + td + 1, tW, tW - 2);
- break;
-
- case 2 :
- case 1 :
- fl_rectf(x + td + 2, y + d + td, tW, tW);
- break;
+ } else {
+ fl_color(labelcolor_);
}
+ fl_draw_circle(x + td + 2, y + d + td, tW, fl_color());
+
if (Fl::is_scheme("gtk+")) {
fl_color(fl_color_average(FL_WHITE, FL_SELECTION_COLOR, 0.5));
fl_arc(x + td + 2, y + d + td, tW + 1, tW + 1, 60.0, 180.0);