Commit graph

22 commits

Author SHA1 Message Date
npwoods
0becb6a4ce
muda: On Windows, force the menu bar to be redrawn after menus are rebuilt (#9435)
This fixes #9430
2025-09-16 13:51:29 +02:00
U-ALDEBERAN\Nate
465740a0c3 Windows: Use WM_SETREDRAW to disable redraw when rebuilding muda menus
When the state of menus are changed, the `muda` representation of menus is completely torn down and rebuilt.  On Windows, this can create a slight flicker unless the act of redrawing the window is disabled.  With this change, we use `WM_SETREDRAW` to disable redrawing while the menus are being reconstructed.

It isn't clear to me if other platforms have a similar problem.
2025-09-03 20:22:26 +02:00
npwoods
19d8350273
support for menus with checkmarks (#9056)
Added `checkable` property to `MenuItem` and `MenuEntry`

ChangeLog:  Added `checkable` and `checked` property to MenuEntry
2025-08-21 09:07:01 +02:00
npwoods
bf37131d36
Fixing issue with when muda context menus are used with muda menubars (#9052)
`MenuEvent::set_event_handler()` seems to use a `OnceCell` internally.  The implications of this is that `MenuEvent::set_event_handler()` can really only be called safely a single time.  The previous `muda` code seemed to rely on being able to call `MenuEvent::set_event_handler()` at will (I think I missed this because I wasn't using a menu bar :-|).  With these changes, we now only call `MenuEvent::set_event_handler()` a single time.  This required encoding the `MudaType` onto `MenuId` rather than snaking it separately.
2025-08-05 08:16:07 +02:00
Olivier Goffart
46ba646ba7 muda context menu: fallback to non-native on macOs 2025-07-29 16:53:57 +02:00
U-ALDEBERAN\Nate
7acb7ec404 - Changed muda infrastructure to use VRc<MenuVTable> instead of `VBox<MenuVTable>
-- Problem: is using `vtable::VRc::borrow(&menubar)` the correct approach?
-- Problem: `VTableMetaDropInPlace` is not properly implemented for `MenuVTable`
-- Problem: Codegen for menus has not been updated yet

- Updated Context Menu code to use `VRc` so both sides are supported
2025-07-29 16:53:57 +02:00
U-ALDEBERAN\Nate
da2e175ac4 Various improvements:
- Removed `ContextMenuFromItemTree`
- Moved `MudaType` to `internal/backends/winit/muda.rs`
- Stopped unnecessary use of `Option` when creating `context_menu_item_tree`
2025-07-29 16:53:57 +02:00
U-ALDEBERAN\Nate
3a45789921 Fixing issue that caused root items to be submenus 2025-07-29 16:53:57 +02:00
U-ALDEBERAN\Nate
8137230e7b NOT FUNCTIONAL: muda context menu support
This represents the better part of a day of trying to implement native context menu support with `muda`.  I've been able to get a context menu to appear, with the following caveats:
- Only the Rust code generator is supported
- Only Windows is supported
- Menu activation is `todo!()`
- Root menu items seem to display a subitem whether they have items or not

I've been finding it challenging navigating the Slint object model, particularly in the context of code generation, and I'm sure in some cases I'm overlooking simpler solutions.  So I was hoping that I could get some feedback (perhaps what objects I need to "lock on to") about how to pull this over the finish line.

Thanks in advance, I'm really looking forward to having a native context menu in Slint!
2025-07-29 16:53:57 +02:00
Joshua Goins
c09ed19a85 Menu: Add icon property
This adds an icon that is displayed to the left of the title, and is
also shown for Menus are inside of a parent menu.

Closes #7791

ChangeLog: Added icon property to MenuItem and Menu
2025-06-26 18:45:37 +02:00
Simon Hausmann
0002df2520
slint crate: Expose parts of the winit backend's previously private API (#8315)
Similar to the wgpu access, the `unstable-winit-030` feature exposes a
`slint::winit_030` module, which in turn re-exports `winit` but also
provides access to the `WinitWindowAccessor` trait. The
`BackendSelector` is extended to provide a way to hook into window
attribute creation as well as providing a custom event loop builder,
similar to what `i_slint_backend_winit::BackendBuilder` provides.
2025-05-02 09:21:13 +02:00
Olivier Goffart
ce904dd518 muda: Implement the enabled flag
Follow-up of https://github.com/slint-ui/slint/pull/8145
2025-04-15 08:54:10 +02:00
Simon Hausmann
3116ccf6d5
winit: separate menubar vbox from muda adapter (#8109)
The latter's life time is tied to the winit window and should live in WinitWindowOrNone.

Co-authored-by: Olivier Goffart <olivier.goffart@slint.dev>
2025-04-11 13:02:34 +02:00
Olivier Goffart
23aa4ed8c6 Fixup menu separator with muda 2025-04-03 15:49:35 +02:00
Olivier Goffart
e5289af154 Introduce MenuSeparator
Fixes #7790
2025-04-02 11:50:45 +02:00
Simon Hausmann
b4b1d329b6 Fix build on macOS
The tracker is optional for when there's no app supplied menu bar.
2025-02-24 14:12:51 +01:00
Olivier Goffart
f30c9ad2a0 Add a property tracker for the Muda Menu 2025-02-24 14:12:51 +01:00
Simon Hausmann
d855b44668 Always create an app menu for the menubar
This is the discussed stop-gap for macOS for the 1.10 release.
2025-02-06 14:42:20 +01:00
Olivier Goffart
e75415554a Create a menus module in i-slint-corelib 2025-01-30 10:08:22 +01:00
Simon Hausmann
5acd931966 Enable muda macOS menubar on macOS
Hide the winit menu bar and provide a fallback if the app doesn't
provide one. Also, activate per window to fix support for multiple
windows.
2025-01-10 10:49:26 +01:00
Olivier Goffart
6b4c822a4a MenuBar: C++/Rust native menubar implementation
introduce a SetupMenuBar builtin function to ease C++/Rust lowering
2025-01-08 21:16:17 +01:00
Olivier Goffart
846664ad45 WIP: native menubar using muda
Only the interpreter is implemented so far

MacOs won't work yet because we don't disable the default winit menubar

The viewer don't support removing the MenuBar yet
2025-01-08 14:05:35 +01:00