... and call that during key event delivery.
Add `capture_key_pressed` and `capture_key_released` callbacks
to `FocusScope` to expose this functionality.
Add a simple test to make sure Interception of key events works as
expected.
Related to: #102, #6390
-- 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
- Removed `ContextMenuFromItemTree`
- Moved `MudaType` to `internal/backends/winit/muda.rs`
- Stopped unnecessary use of `Option` when creating `context_menu_item_tree`
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!
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
This broke the build on zephyr
```
/usr/bin/ld: /home/runner/work/slint/slint/build/zephyr/NSI/home/runner/work/slint/slint/build/zephyr/zephyr.elf.loc_cpusw.o:(.data.DW.ref.rust_eh_personality[DW.ref.rust_eh_personality]+0x0): undefined reference to `rust_eh_personality'
```
To be compatible with the 2024 edition, we need to wrap the
`no_mangle` attribute in `unsafe()`.
The parsing for that in cbindgen was only added in the version 0.28,
but we couldn't upgrade cbindgen before because of a regression in
cbindgen 0.27 that prevented us from upgrading.
Now that cbindgen 0.29 is released with a fix, we can prepare for the
2024 edition
... by changing the resolution for the `WindowItem` to traverse the
item tree from the current item, instead of going to the window.
This doesn't quite fix#4298 because `rem` resolution is still missing.
That requires the built-in default font size function to be fixed as
well, which is non-trivial.
cc #4298
By default it's enabled, of course. This property is not only added to
MenuItem, but Menu as well - since they can be nested. It's also
possible to select a disabled item, but it's hard to modify that since
it's logic is written in Slint. You should be prevented from activating
it with a tap or key press at least.
See #7791