From b684f70ad75701f3d3436157b75c6f2650d6a97b Mon Sep 17 00:00:00 2001 From: Albrecht Schlosser Date: Wed, 23 Nov 2022 15:18:19 +0100 Subject: Update remaining "arrow drawing" in menus Use the new standard arrow drawing methods (whose style depends on the active scheme) for "arrows" used in Fl_Menu and Fl_Menu_Button. To do: maybe we need some "fine tuning" of arrow sizes in some of the modified widgets using the new "arrow drawing" methods. --- src/Fl_Menu_Button.cxx | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) (limited to 'src/Fl_Menu_Button.cxx') diff --git a/src/Fl_Menu_Button.cxx b/src/Fl_Menu_Button.cxx index dadbaf55c..f57b52b4e 100644 --- a/src/Fl_Menu_Button.cxx +++ b/src/Fl_Menu_Button.cxx @@ -16,6 +16,7 @@ #include #include +#include #include @@ -24,18 +25,32 @@ static Fl_Menu_Button *pressed_menu_button_ = 0; void Fl_Menu_Button::draw() { if (!box() || type()) return; + + // FIXME: size and coordinate calculation (H, X, Y) should be simplified when + // the "old code" below is entirely removed (left as is for comparison). + // AlbrechtS Nov. 23, 2022 + int H = (labelsize()-3)&-2; int X = x()+w()-H-Fl::box_dx(box())-Fl::box_dw(box())-1; int Y = y()+(h()-H)/2; + draw_box(pressed_menu_button_ == this ? fl_down(box()) : box(), color()); draw_label(x()+Fl::box_dx(box()), y(), X-x()+2, h()); if (Fl::focus() == this) draw_focus(); - // ** if (box() == FL_FLAT_BOX) return; // for XForms compatibility - // FIXME_ARROW: use fl_draw_arrow() + +#if (0) // old code: outline of an engraved down-arrow for all schemes + fl_color(active_r() ? FL_DARK3 : fl_inactive(FL_DARK3)); fl_line(X+H/2, Y+H, X, Y, X+H, Y); fl_color(active_r() ? FL_LIGHT3 : fl_inactive(FL_LIGHT3)); fl_line(X+H, Y, X+H/2, Y+H); + +#else // new code: filled down-arrow whose style dependends on the current scheme + + Fl_Color arrow_color = active_r() ? FL_DARK3 : fl_inactive(FL_DARK3); + fl_draw_arrow(Fl_Rect(X-1, Y-1, H+4, H+4), FL_ARROW_SINGLE, FL_ORIENT_DOWN, arrow_color); + +#endif } -- cgit v1.2.3