Commit graph

24 commits

Author SHA1 Message Date
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
Olivier Goffart
98309972da MenuBar: allow it to be in a if
Fixes #8282
2025-08-18 11:17:57 +02:00
Tobias Hunger
749abeabe0 core: Add capture_key_event function into items
... 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
2025-08-01 20:24:24 +02:00
Olivier Goffart
ab674f33fb C++: adapt to menu bar API change
The MenuVTable is now a VRc (and it was a Box before)
2025-07-29 16:53:57 +02:00
U-ALDEBERAN\Nate
9ba4c26e6c Proper implementation of VTableMetaDropInPlace for MenuVTable 2025-07-29 16:53:57 +02:00
autofix-ci[bot]
e61c27f6b4 [autofix.ci] apply automated fixes 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
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
Olivier Goffart
47a556d0e7 Core: Pass the MouseEvent by reference
(Prepare to add non-copy data in it)
2025-06-26 15:39:18 +02:00
Olivier Goffart
8db7db9571 core: Revert the change to use "C-unwind" calling convention
Some checks are pending
CI / tree-sitter (push) Blocked by required conditions
CI / mcu-embassy (push) Blocked by required conditions
CI / ffi_32bit_build (push) Blocked by required conditions
CI / updater_test (0.3.0) (push) Blocked by required conditions
CI / esp-idf-quick (push) Blocked by required conditions
CI / build_and_test (--exclude ffmpeg --exclude gstreamer-player, windows-2022, stable) (push) Blocked by required conditions
CI / build_and_test (ubuntu-22.04, nightly) (push) Blocked by required conditions
CI / node_test (macos-14) (push) Blocked by required conditions
CI / node_test (ubuntu-22.04) (push) Blocked by required conditions
CI / node_test (windows-2022) (push) Blocked by required conditions
CI / python_test (macos-14) (push) Blocked by required conditions
CI / python_test (ubuntu-22.04) (push) Blocked by required conditions
CI / python_test (windows-2022) (push) Blocked by required conditions
CI / cpp_test_driver (macos-13) (push) Blocked by required conditions
CI / cpp_test_driver (ubuntu-22.04) (push) Blocked by required conditions
CI / cpp_test_driver (windows-2022) (push) Blocked by required conditions
CI / wasm (push) Blocked by required conditions
CI / cpp_cmake (macos-14, 1.82) (push) Blocked by required conditions
CI / cpp_cmake (ubuntu-22.04, stable) (push) Blocked by required conditions
CI / cpp_cmake (windows-2022, nightly) (push) Blocked by required conditions
CI / cpp_package_test (push) Blocked by required conditions
CI / wasm_demo (push) Blocked by required conditions
CI / vsce_build_test (push) Blocked by required conditions
CI / mcu (pico-st7789, thumbv6m-none-eabi) (push) Blocked by required conditions
CI / mcu (pico2-st7789, thumbv8m.main-none-eabihf) (push) Blocked by required conditions
CI / mcu (stm32h735g, thumbv7em-none-eabihf) (push) Blocked by required conditions
CI / fmt_test (push) Blocked by required conditions
CI / android (push) Blocked by required conditions
CI / miri (push) Blocked by required conditions
CI / test-figma-inspector (push) Blocked by required conditions
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'
```
2025-06-12 15:29:23 +02:00
Olivier Goffart
af573e6401 vtable: Don't automatically add extern C
Some checks are pending
CI / node_test (ubuntu-22.04) (push) Blocked by required conditions
CI / build_and_test (ubuntu-22.04, nightly) (push) Blocked by required conditions
CI / node_test (macos-14) (push) Blocked by required conditions
CI / node_test (windows-2022) (push) Blocked by required conditions
CI / python_test (macos-14) (push) Blocked by required conditions
CI / python_test (ubuntu-22.04) (push) Blocked by required conditions
CI / python_test (windows-2022) (push) Blocked by required conditions
CI / cpp_test_driver (macos-13) (push) Blocked by required conditions
CI / cpp_test_driver (ubuntu-22.04) (push) Blocked by required conditions
CI / cpp_test_driver (windows-2022) (push) Blocked by required conditions
CI / cpp_cmake (macos-14, 1.82) (push) Blocked by required conditions
CI / cpp_cmake (ubuntu-22.04, stable) (push) Blocked by required conditions
CI / cpp_cmake (windows-2022, nightly) (push) Blocked by required conditions
CI / cpp_package_test (push) Blocked by required conditions
CI / vsce_build_test (push) Blocked by required conditions
CI / mcu (pico-st7789, thumbv6m-none-eabi) (push) Blocked by required conditions
CI / mcu (pico2-st7789, thumbv8m.main-none-eabihf) (push) Blocked by required conditions
CI / mcu (stm32h735g, thumbv7em-none-eabihf) (push) Blocked by required conditions
CI / mcu-embassy (push) Blocked by required conditions
CI / ffi_32bit_build (push) Blocked by required conditions
CI / docs (push) Blocked by required conditions
CI / wasm (push) Blocked by required conditions
CI / wasm_demo (push) Blocked by required conditions
CI / tree-sitter (push) Blocked by required conditions
CI / updater_test (0.3.0) (push) Blocked by required conditions
CI / fmt_test (push) Blocked by required conditions
CI / esp-idf-quick (push) Blocked by required conditions
CI / android (push) Blocked by required conditions
CI / miri (push) Blocked by required conditions
CI / test-figma-inspector (push) Blocked by required conditions
2025-06-06 14:47:46 +02:00
Olivier Goffart
23962b3e25
Upgrade cbindgen and use unsafe(no_mangle) attributes (#8539)
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
2025-05-26 11:21:33 +02:00
Simon Hausmann
eb825f2e95 Support default-font-* properties in Live-Preview
... 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
2025-04-24 09:18:45 +02:00
Joshua Goins
d1f2fef430
Menu: Add enabled property (#8145)
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
2025-04-15 08:08:11 +02:00
Olivier Goffart
e5289af154 Introduce MenuSeparator
Fixes #7790
2025-04-02 11:50:45 +02:00
Simon Hausmann
8372cd6412
Convey clipping of children to accesskit (#7587)
and while at it, move is_clipping_item() that casts a function of the ItemVTable.

Fixes #2341
Fixes #7382
2025-02-10 13:42:10 +01:00
Olivier Goffart
094ff8f56b Refrersh the menubar when one of the property get changed
Install a PropertyTracker to update the shadow tree if something changes
2025-01-30 17:43:33 +01:00
Simon Hausmann
a4709b211e Cleanup: Rename bounding_rect_for_geometry to bounding_rect 2025-01-30 10:55:28 +01:00
Simon Hausmann
4a6b4d9dfa Add support for bounding text rendering with the partial renderer
cc #7247
2025-01-30 10:55:28 +01:00
Simon Hausmann
58ea5389f8 Add support for box shadows with the partial renderer
cc #7247

Fix comment in partial renderer's filter_item() about dependency tracking

Co-authored-by: Olivier Goffart <olivier.goffart@slint.dev>
2025-01-30 10:55:28 +01:00
Olivier Goffart
010126992e MenuItem with for and if 2025-01-30 10:08:22 +01:00
Olivier Goffart
e75415554a Create a menus module in i-slint-corelib 2025-01-30 10:08:22 +01:00