Commit graph

871 commits

Author SHA1 Message Date
Simon Hausmann
25a71afa53 doc: fix missing types mapping table in C++ 2023-01-11 15:40:51 +01:00
Simon Hausmann
3c65c6177d Fix C++ memory game tutorial not starting out of the box on Windows
After commit 3e5aa212d5 the Slint DLLs
aren't placed in the `bin/` directory by default anymore. Since the
tutorial builds Slint as an external sub-project, it is entirely
isolated and the CMAKE_*_OUTPUT_DIRECTORY variables do not propagate. On
macOS and Linux, the program still runs due to rpath. On Windows, the
instructions said to put `bin` into `%PATH%`, but that doesn't work
anymore, the dll is now in `_deps/slint-build`.

Instead of adjusting `%PATH%`, this change adjusts the documentation to
recommend the use of a custom command on Windows using
$<TARGET_RUNTIME_DLLS:tgt> to copy the DLL across. This is guarded with
WIN32 due to https://gitlab.kitware.com/cmake/cmake/-/issues/23543 ,
where the proposed solution requires CMake 3.26 (not released yet).
2023-01-09 13:30:13 +01:00
Simon Hausmann
ad0aaa4759 Fix crash when using repeaters in C++ on 32-bit architectures
The abort in the repeated item traversal is represented as 64-bit unsigned value with all bits set, not just 32-bits.

Fixes #2039
2023-01-09 13:00:25 +01:00
Olivier Goffart
629a64ba89 C++ interpreter: do the renaming invoke_callback -> invoke 2023-01-02 23:55:47 +01:00
ogoffart
ce07d078ce Bump version number to 0.3.4 2022-12-16 09:36:15 +00:00
Simon Hausmann
c4d5f079b5 Partial fix for cmake build with Skia against Yocto
Latest corrosion handles quoting differently and would escape the empty quoted
string, so pass an empty string instead, for the host cflags.
2022-12-14 11:40:03 +01:00
Simon Hausmann
a63c7bcada Use the fresh new corrosion release 2022-12-13 12:10:16 +01:00
Simon Hausmann
61dc5e31b4 Fix running of tests with multi-config generators
Now that the binaries are placed in their respective
CMAKE_RUNTIME_OUTPUT_DIRECTORY, that's config suffixed, let's use the
ctest signature that accepts a cmake target and thus automatically
figures out the correct location of the executable.
2022-12-13 11:39:34 +01:00
Simon Hausmann
3e5aa212d5 Remove workaround for slint DLL placement for examples
We can now use the standard CMake variables to make sure that a copy of
the DLL lands next to the executables for Windows.
2022-12-13 11:39:34 +01:00
Simon Hausmann
53b05c426c Upgrade corrision to a git snapshot
This includes support for placing build artefacts into output directories
using standard cmake variables.
2022-12-13 11:39:34 +01:00
Simon Hausmann
8145d10b5b janitor: adaptor -> adapter 2022-12-13 08:35:20 +01:00
Simon Hausmann
6a87a07e12 Add support for showing the renderer on macOS with AppKit 2022-12-12 17:02:11 +01:00
Olivier Goffart
fe0e881418 C++ wrapper for the Skia backend 2022-12-12 17:02:11 +01:00
Olivier Goffart
10d1595f3a Janitor: cleanup C++ AbstractWindowAdapter
- virtual destructor can be = default
 - rules of 3 for AbstractWindowAdapter
 - Since WindowAdapter inherit AbstractWindowAdapter, it is already no-copy
2022-12-12 15:00:55 +01:00
Simon Hausmann
2d72781f9f Fix warning about missing virtual destructor 2022-12-12 14:40:07 +01:00
Olivier Goffart
f1fb4e16bb C++ platform API: remove the template parameter in Platform 2022-12-12 14:04:33 +01:00
Olivier Goffart
8d686637f4
Experimental platform API from C++ 2022-12-12 12:54:31 +01:00
Olivier Goffart
ccf3e8e9e9 C++: Generate image texture data for software renderer 2022-12-09 09:25:48 +01:00
Simon Hausmann
1162ebbb79
Reduce the amount of re-creation of cells in repeaters when the model changes (#1954)
Re-use the cells but mark them as dirty, instead of re-creating them every time.
In the included test-case that provides behavior that's
more intuitive.
2022-12-06 18:43:55 +01:00
Simon Hausmann
11f46906a2 Centralize rust-version in Cargo.toml
Require 1.64 in the workspace and inherit the setting in package
Cargo.toml files.
2022-12-05 12:39:14 +01:00
Simon Hausmann
7e77a2a4cc Bump MSRV to 1.64
... due to rust-skia bindings requiring a feature (ffi related).
2022-12-04 19:39:35 +01:00
ogoffart
fb02b4118b Bump version number to 0.3.3 2022-11-28 13:11:11 +00:00
Simon Hausmann
4308ed921d
Add documentation about the available widget styles and how to select them (#1910) 2022-11-25 14:53:20 +01:00
Simon Hausmann
d8a1f2cf01 Introduce a rem unit in the type system
This allows specifying font sizes relative to the Window's
default-font-size, similar to CSS rem.
2022-11-24 11:33:38 +01:00
Simon Hausmann
907b58161c Add support for invoking an init callback on component and element construction
This enables imperative code to be run. To be used sparingly :-)
2022-11-17 10:12:08 +01:00
Florian Blasius
61c39b5fa1 Add support for dispatching key events through the public platform API
This change adds `KeyPress` and `KeyRelease` variants to the
`WindowEvent` enum, along with the new `slint::Key` enum, that allows
encoding keys.
2022-11-15 10:34:17 +01:00
Olivier Goffart
f1c96a391c C++ docs: mention we need to set the PATH 2022-11-10 07:45:08 +01:00
Simon Hausmann
e9db914fb1
Add is_visible to NodeJS and C++ Window types (#1816)
Amends commit 82278a5742
2022-11-04 16:24:24 +01:00
Jonathan Schwender
4ade9faa0d Update Corrosion to v0.3
This requires the following changes:
- Delay configuring SlintConfig.cmake:
  Corrosion sets the `IMPORTED` locations late to allow us to set
  OUTPUT_DIRECTORY target properties. The configuration of
  SlintConfig.cmake must be deferred until after Corrosion set the
  locations. Since we are writing to a config file Generator expressions
  are not an option.
- Remove BUILD_TYPE mapping from SlintConfig.cmake:
  As discussed in https://github.com/slint-ui/slint/pull/1785#issuecomment-1294630845
  remove the mapping of the build types since corrosion now always sets
  the `IMPORTED_LOCATION` property.

User facing improvements enabled by the update:
- Corrosion will not fail anymore if the user has a Rust toolchain >=1.60
  installed, but the default toolchain is < 1.60.
- Corrosion will respect OUTPUT_DIRECTORY properties and move target
  artifacts to the expected locations
2022-11-02 21:38:39 +01:00
Simon Hausmann
a1f9e39054 doc: prospective fix for rendering of example snippet in C++ generated code docs
The sample component in the docs has nothing to see, disable preview.
2022-11-02 09:54:03 +01:00
Simon Hausmann
41e3e27bff doc: Fix rendering of slint::interpreter::ComponentInstance::set_global_callback
Don't use a preview for the Slint snippet that just shows a global. There's
nothing to render.
2022-11-02 09:51:12 +01:00
Simon Hausmann
fa8959c7bc doc: Fix rendering of generated docs for restart()
The `--` was converted into a HTML entity, which was escaped again and shown raw.
2022-11-02 09:48:02 +01:00
Simon Hausmann
34b39a2a60 Remove slint::testing from the C++ API Docs
We already avoid parsing `slint_testing.h`. But we have a variant of
`send_keyboard_string_sequence` in `slint_interpreter.h` because the
function takes a ComponentInstance. Exclude all symbols from that
namespace from the docs to continue the intent.
2022-11-01 15:34:35 +01:00
ogoffart
2171773a3e Bump version number to 0.3.2 2022-10-28 09:30:14 +00:00
Olivier Goffart
f055afd2de New syntax: allow to create component without base 2022-10-26 18:09:57 +02:00
Florian Blasius
a4313c3e32
API changes for SortModel and FilterModel (rust and cpp) (#1768)
* Rust SortModel: Rename parameter `S` to `F`
* Rust SortModel: Rename parameter `apply_sorting` to `reset`
* Rust FilterModel: Rename parameter `apply_filter` to `reset`
* C++ SortModel: Rename parameter `sort_fn` to `comp`
* C++ SortModel: Add pub reset function
* C++ FilterModel: Rename parameter `apply_filter` to `reset`
2022-10-26 11:16:12 +02:00
Simon Hausmann
c16253d29f Use Property<LogicalLength> instead of Property<Coord>
This removes the special code for the generated property getters and
ensures type safety in the run-time library for property value setting.

In the Rust generated code we continue to do arithmetic on the scalar
values, that means we immediately extract the scalar, do arithmetic and
rely on the compiler to only allow compatible units.

Danger zone alert: In the interpreter Value::Number can now be converted
to LogicalLength as-is.
2022-10-24 12:49:37 +02:00
Olivier Goffart
6ee932883a Rename stark-style to dark-color-scheme
That's the term used by CSS
2022-10-19 15:23:41 +02:00
Olivier Goffart
0ba468c236 Use a builtin function to access the dark-style
instead of a property on NativeStyleMetrics
2022-10-19 15:23:41 +02:00
Simon Hausmann
38a55f87a4 Change internal MouseEvent to use logical points 2022-10-13 17:02:18 +02:00
Simon Hausmann
c11b4305c1 Change Item::geometry() to return a LogicalRect 2022-10-13 17:02:18 +02:00
Florian Blasius
129ee0acae
Florian/sort todo (#1721)
Implement `set_row_data` for `SortModel` and `FilterModel` (rust and cpp). Add sort and filter example to the todo example.
2022-10-11 18:58:00 +02:00
Simon Hausmann
6df60fa723
Add a C++ Sort Model class (#1688)
This allows automatically sorting a model.
2022-09-28 10:03:05 +02:00
Simon Hausmann
cfbdce735f
Add a C++ Map Model class (#1687)
* Add a C++ Map Model class

This matches the MapModel in the Rust API.
2022-09-27 16:03:56 +02:00
Simon Hausmann
388cf32770 C++ FilterModel: Fix mix of unique_ptr and shared_ptr
The inner is sorted in a shared_ptr and should be created using make_shared.
2022-09-27 14:15:38 +02:00
Simon Hausmann
56983482b9 Rename C++'s internal AbstractRepeaterView to ModelChangeListener
For consistency with the Rust model implementation.
2022-09-27 10:26:55 +02:00
Simon Hausmann
5b95466fa6
Add a C++ Filter Model class (#1685)
Add a C++ Filter Model class

This matches the FilterModel in the Rust API.
2022-09-27 10:24:47 +02:00
Simon Hausmann
a24c33b8ea Fix Yocto cross build
After renaming the features, the if conditions need to be adjusted.
2022-09-23 14:12:21 +02:00
Simon Hausmann
f54cebf3d6 Don't build Skia with CMake by default
We also don't build it with Cargo by default
2022-09-22 12:56:18 +02:00
Simon Hausmann
5e4abec477 Add a backends section to the CMake docs
That's derived from the backends section of the Slint API crate (Cargo.toml)
2022-09-22 12:56:18 +02:00