Skip to content

Menus redesign #3855

Open
Open
@kekekeks

Description

@kekekeks

The old way of always rendering menus manually isn't really cross-platform. Right now we have a way to define the global menu for the window, but the API looks like it was attached with a piece of a duct tape (fortunately, the blue one).

It also doesn't cover context menus that are also expected to match platform's look and feel.

So the proposed change it to make the NativeMenu model class to be the primary way of defining menus while still keeping the support for complex custom menu layouts for apps that need those.

The new classes would be:

  • Menu = old NativeMenu - a visual-less list of menu items
  • MenuItem = old NativeMenuItem - a visual-less representation of menu item: text, icon, check state, submenu
  • TemplatedMenu,TemplatedMenuItem = refactored old Menu classes changed to accomodate
    Menu and MenuItem separation.

Control.ContextMenu should accept both Menu and TemplatedMenu and display Menu as native menu if platform supports it, or create a TemplatedMenu to display it as our custom-rendered menu

Window will now have Window.Menu property which accepts both Menu and TemplatedMenu. WindowMenuBar control will export Menu as the window menu or create a TemplatedMenu instance and render it instead.

The current Menu control will be replaced by TemplatedMenuBar that has Menu property which should also accept both Menu and TemplatedMenu classes.

That way we do the native menu drawing by default, fall back to our own menu implementations if native menus are unavailable and still keep a way to enforce customized menus while having a unified API.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions