embedded-menu
embedded-menu copied to clipboard
Better support for dynamically built menus
Currently, dynamic lists of menu items are only possible in a very restricted way: it is not possible to arbitrarily mix and match navigation and selection items.
Unfortunately, we can't make the menu items object-safe because:
- e-g's drawables aren't object safe
- trait objects can't contain generic methods (like
draw
).
What we can do instead is to wrap menu items in an enum. We only need this to support "polymorphism" in add_items
, and there are two key questions to consider:
- ergonomics
- support user-defined menu items (i.e. easily define a wrapper enum around N specific menu item impls)
I'm not entirely sure if this is within the same vein of this issue, but is it being considered changing embedded-menu
to be immediate mode rather than the current retained mode patterns? This would enable a developer to more easily create dynamic menus without requiring embedded-menu
to develop a way to handle complex and mutable menu topology.
I've never considered immediate mode. I also don't have neither the knowledge nor enough time to make such a fundamental change to embedded-menu, unfortunately.