FLTK logo

STR #2896

FLTK matrix user chat room
(using Element browser app)   FLTK gitter user chat room   GitHub FLTK Project   FLTK News RSS Feed  
  FLTK Apps      FLTK Library      Forums      Links     Login 
 Home  |  Articles & FAQs  |  Bugs & Features  |  Documentation  |  Download  |  Screenshots  ]
 

Return to Bugs & Features | Roadmap 1.3 | Post Text | Post File | SVN ⇄ GIT ]

STR #2896

Application:FLTK Library
Status:5 - New
Priority:1 - Request for Enhancement, e.g. asking for a feature
Scope:3 - Applies to all machines and operating systems
Subsystem:Core Library
Summary:Better looking menu dividers
Version:1.3-feature
Created By:ajapted
Assigned To:Unassigned
Fix Version:Unassigned
Update Notification:

Receive EMails Don't Receive EMails

Trouble Report Files:

Post File ]
Name/Time/Date Filename/Size  
 
#1 ajapted
03:13 Dec 04, 2012
better_menu.png
18k
 
     

Trouble Report Comments:

Post Text ]
Name/Time/Date Text  
 
#1 ajapted
03:13 Dec 04, 2012
The following patch supports making nicer looking menu
dividers, as shown by the attached image.

It does not affect the API or ABI of FLTK, and is unlikely
to affect existing programs (or if it does, harmlessly).
The patch merely vertically centers the dividing line in a menu
when the text is an empty string ("") and FL_MENU_INACTIVE is set.

Cheers,
-- Andrew


=== modified file 'src/Fl_Menu.cxx'
--- src/Fl_Menu.cxx 2012-12-04 10:41:23 +0000
+++ src/Fl_Menu.cxx 2012-12-04 10:49:26 +0000
@@ -467,10 +467,14 @@
   }
 
   if (m->flags & FL_MENU_DIVIDER) {
+    int ofs = hh;
+    // center the dividing line if inactive and text == ""
+    if ((m->flags & FL_MENU_INACTIVE) && m->text && !m->text[0])
+      ofs = hh/2;
     fl_color(FL_DARK3);
-    fl_xyline(BW-1, yy+hh+(LEADING-2)/2, W-2*BW+2);
+    fl_xyline(BW-1, yy+ofs+(LEADING-2)/2, W-2*BW+2);
     fl_color(FL_LIGHT3);
-    fl_xyline(BW-1, yy+hh+((LEADING-2)/2+1), W-2*BW+2);
+    fl_xyline(BW-1, yy+ofs+((LEADING-2)/2+1), W-2*BW+2);
   }
 }
 
 
#2 matt
06:17 Jan 20, 2023
I have put hours into this, and it does not work that easily. The menu code relies on every menu entry to have the same height, n matter if it has a divider or not. I proposed a solution that would also adapt to menu font height, but that was rejected from a few core devs. I know that this entry is a decade old and fell to the wayside, but at least it's nice to see that I am not the only one who dislikes the menu layout ;-)  
     

Return to Bugs & Features | Post Text | Post File ]

 
 

Comments are owned by the poster. All other content is copyright 1998-2024 by Bill Spitzak and others. This project is hosted by The FLTK Team. Please report site problems to 'erco@seriss.com'.