FLTK logo

[fltk.coredev] Fl_Menu_ and Fl_Menu_Item::pulldown incremental overhaul?

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 
 All Forums  |  Back to fltk.coredev  ]
 
Previous Message ]New Message | Reply ]Next Message ]

Fl_Menu_ and Fl_Menu_Item::pulldown incremental overhaul? "'melcher.... Nov 20, 2022  
  Hi Devs,

tl;dr : I would like to overhaul the menubar code, and I would like to do it incrementally, so we can find regressions. I want to use the master branch for that, but I would like to hear you first, since that may add work.

Ok, so if you ever looked into the menu bar code (src/Fl_Menu.cxx), you know that it is really hard to maintain. It also has some shortcomings. For example, all menu items in a single menu must have the same height, which is why the divider always looks like it was squeezed in as an afterthought.

I implemented code that fixes a lot of these issues when trying to add better dividers. The code is tested and works, but if I alone test things, I may miss major regressions. I would like to push my code to master when I reach a milestone, so that I am not the only one testing. Of course, every milestone would be thoroughly tested in my branch before using it.

A bit of history:

The menubar code was probably written before the actual FLTK core became capable enough to do what the pulldown code implements in a different, undocumented, and badly named way. I would like to fix that while keeping the old API intact and adding a new way to add menus that fits the FLTK hierarchical system.

Milestone 1, flexible menu item sizes:

To implement this, I create Proxy widgets for every item that may appear in a pulldown menu. When a menu window is opened, a true FLTK widget hierarchy is created on the fly using the proxies. With proxies, every menu item now has coordinates and sizes, and we can finally have dividers that don't just draw a line, but also visually divide groups. We can no easily have the horizontal stacking, as FL_MENU_HORIZONTAL always promised, but never implemented.

Milestone 2, reducing special event handling and drawing:

Now, instead of having a three-page long loop, the menu window and proxy widgets handle events as FLTK does anyway. We can make the drawing code a lot simpler with the same results.

Milestone 3, alternative to Fl_Menu_Item arrays:

And by deriving Fl_Menu_ from Fl_Group instead of Fl_Widget, we can completely do away with the entire FL_Menu_Item array special handling. The user just adds buttons and groups to the Fl_Menu_ driver widget, and the menu window code will take care of generating the proxies and laying them out. This solves also all i18n woes, questions of ownership, and inserting menu items into arrays.

 - Matthias



--
You received this message because you are subscribed to the Google Groups "fltk.coredev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to fltkcoredev+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/fltkcoredev/db1933ad-6690-4254-9ad1-a45ae11333e2n%40googlegroups.com.
Direct Link to Message ]
 
     
Previous Message ]New Message | Reply ]Next Message ]
 
 

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'.