Commit graph

889 commits

Author SHA1 Message Date
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
ogoffart
261614b914 Bump version number to 0.3.1 2022-09-15 14:39:51 +02:00
Olivier Goffart
419016a356 Rename the compat feature again
crates.io won't let us upload a feature with dots in it:

```
Uploading slint-interpreter v0.3.0 (/home/olivier/slint/internal/interpreter)
error: failed to publish to registry at https://crates.io

Caused by:
  the remote server responded with an error: invalid upload request: invalid value: string "compat-0.3.0", expected a valid feature name at line 1 column 2254
```
2022-09-14 15:55:57 +02:00
Simon Hausmann
8556ad0864 Refer to the release/0.3 branch instead of release/0.2 for the CMake docs 2022-09-14 15:45:16 +02:00
Tobias Hunger
e14fae45cd c++: Turn (Logical|Physical)(Size|Position)` into structs
They used to declared by `using` before, so they were too easy to
convert into.
2022-09-13 18:17:56 +02:00
Tobias Hunger
53a3c72b57
api: Change logical/physical position and size on window (#1620)
* Add `RequestedSize` and `RequestedPosition` enum to enable asking for
  logical or physical size/position.
* Rename `Window::size()` to `Window::physical_size()`
* Make `Window::set_size(...)` take an `Into<RequestedSize>`
* Rename `Window::position()` to `Window::physical_position()`
* Make `Window::set_position(...)` take an `Into<RequestedPosition>`
* Change `WindowAdapter` and related classes to be able to handle
  requests being made in the either physical or logical units.

Implement this for C++, Rust and node.
2022-09-13 08:55:31 +02:00
Simon Hausmann
012dc34975 Remove the Rust and C++ migration guides from the documentation 2022-09-09 16:53:49 +02:00
Olivier Goffart
8850959a2c Rename the backend feature flags 2022-09-07 17:11:57 +02:00
Olivier Goffart
15fa69ef55 Rename the compat-0-2-0 feature to compat-0.3.0
But keep a compat-0-2-0 fome compatibility anyway
2022-09-07 14:09:07 +02:00
Olivier Goffart
6ede77436b api: Return an error from invoke_from_event_loop and quit_event_loop 2022-09-07 10:13:58 +02:00
ogoffart
05a49da906 Bump version number to 0.3.0 2022-09-06 13:00:22 +02:00
Simon Hausmann
3a1817de3f Skia: Make it possible to explicitly select the OpenGL backend of Skia
When opting into the Skia renderer, we default to metal on macOS and D3D on Windows.
However if you want to develop a cross-platform application with Skia and
for example rely on OpenGL to be able to implement an OpenGL underlay or overlay,
then we need the ability to explicitly opt into skia's GL renderer.

cc #1445
2022-09-05 14:07:27 +02:00
Olivier Goffart
5900ec3373 Janitor: update corrosion 2022-09-01 14:03:46 +02:00
Simon Hausmann
a7121a6177 Remove erroneous mention of SLINT_FEATURE_EVENTLOOP_WINIT_ALL
We used to have SLINT_FEATURE_BACKEND_GL_ALL, but when we introduced the
renderer and event loop distinction in the features, we removed the "all" suffix from
the event loop that includes x11 and wayland support.
2022-09-01 11:25:49 +02:00
Tobias Hunger
3430a13bf8 API cleanup: Remove quit behavior parameter from run_event_loop 2022-08-30 08:34:45 +02:00
Tobias Hunger
10c3c9d16d Api cleanup: Rename some remaining platform abstractions to platform 2022-08-29 16:53:47 +02:00
Tobias Hunger
88cf874d03 API cleanup: Rename create_window to create_window_adapter 2022-08-29 16:53:47 +02:00
Tobias Hunger
1e6ffeaa0f API cleanup: Rename PlatformWindow to WindowAdapter 2022-08-29 16:53:47 +02:00
Olivier Goffart
7417422e3c Make the PlatformAbstraction not Send using a EventLoopProxy trait
This changes the way the platform abstraction is initialized
2022-08-24 11:32:21 +02:00
Olivier Goffart
2e5ab86bea Rename backend module to platform
and the Backend trait into PlatfromAbstraction trait
2022-08-23 19:39:49 +02:00
Simon Hausmann
c69437fe8f Fix build of CMake package inside Yocto build
When building against a Yocto SDK, CFLAGS isn't set, only CC. When
building inside Yocto, CC is set to just the target compiler and CFLAGS
contains the target specific options. Just like with commit
5bc56a3924 we need to cover also
HOST_CFLAGS by making them empty.
2022-08-19 17:02:30 +02:00
Simon Hausmann
1d436778c1 Remove the use of the PlatformWindowRc alias again
and use Rc<dyn PlatformWindow> instead. The alias has to stay with the ffi
functions though and the item vtable definitions,
because we don't have an Rc<> template in C++.
2022-08-19 15:07:27 +02:00
Simon Hausmann
98e1befd0d Port the C++ generator and C++ API to the new window ownership model
One key difference to the Rust way is what `slint::Window` means. In
Rust that holds the `WindowInner` and `slint::Window` is only exposed as
`&slint::Window`. This is possible because the component owns the
`Rc<dyn PlatformWindow>`, which has a function to return the
`&slint::Window`.

In C++ `slint::Window` is also exposed as `slint::Window&` in the
`window()` getter, but there's no way to get a reference to a  C++
wrapper for the Rust `&slint::Window` that the `PlatformWindow` trait
returns. Therefore in C++ `slint::Window` wraps `Rc<dyn
PlatformWindow>`.
2022-08-19 15:07:27 +02:00
Simon Hausmann
af86f36157 Invert slint:🪟:WindowInner and PlatformWindow ownership
Previously: Window is an Rc<WindowInner>, which has an Rc<dyn
PLatformWindow> - and weak references the other way around.

Now: Rc<dyn PlatformWindow> is the root of window ownership. The impl
PlatformWindow has a slint::api::Window, which just holds a WindowInner.

This change is incomplete on a few levels, mainly that neither of the
code generators nor the interpreter is ported.
2022-08-19 15:07:27 +02:00
Olivier Goffart
ca6dfc0cb5 Run clang-format over C++ files 2022-08-17 07:44:22 +02:00
Simon Hausmann
5bc56a3924 Fix Skia cross-build when using CMake
This requires a creative workaround :-)
2022-08-04 16:41:26 +02:00
Simon Hausmann
771b122198 Add skia renderer skeleton
This one can render basically just plain rectangles.
2022-08-02 12:00:56 +02:00
Simon Hausmann
70a753756d Fix cmake compat options
Use option() directly, not propagate that into the cpp crate
2022-07-26 17:43:51 +02:00
Simon Hausmann
b47eb8507a Remove the rtti-winit and rtti-qt features
These are not needed anymore, as the selector can enable the respective rtti features
in the winit and gl crate when its own rtti features is enabled.
2022-07-26 17:43:51 +02:00
Simon Hausmann
3619989fcc Rename backend feature flags to accomodate more renderers
Split backend-gl-* into eventloop-winit-* and renderer-femtovg.

The old feature names are still available.

For consistency eventloop-qt and renderer-qt are aliases for backend-qt.
2022-07-26 17:43:51 +02:00
Simon Hausmann
27bf9348e6 Rename the backend-gl crate into backend-winit 2022-07-26 17:43:51 +02:00
Olivier Goffart
8c70cd7f57
Move the fonts out of the Backend trait (#1438)
and remove the `'static`
2022-07-26 16:45:54 +02:00
Simon Hausmann
fe3d4b7177 Bump MSRV to 1.60 2022-07-26 09:20:52 +02:00