Implement `sixtyfps::ComponentHandle` for `ComponentInstance`, instead of providing a copy of the API.
This also removes `WeakComponentInstance` and enables the use of `sixtyfps::Weak` for weak handles. This has the advantage that `sixtyfps:Weak`'s `upgrade_in_event_loop` becomes available with the interpreter, and the
weak handle is Send.
This patch is mostly a rename now, but also contains a few small
cleanups.
SharedModel implements the Model trait itself and gracefully falls back
to an empty model is no Model was provided. This allows for some small
simplifications.
Also make sure to use the same comparision for SharedModels everywhere.
This fixes the last remaining clippy errors we had.
The options in sixtyfps-viewer --help used to look like this:
```
OPTIONS:
--backend <backend> The rendering backend [default: ]
-I <include path for other .60 files>...
--load-data <load data file> Load properties from a json file ('-' for stdin)
--save-data <save data file> Store properties values in a json file at exit ('-' for stdout)
--style <style name> The style name ('native', 'fluent', or 'ugly') [default: ]
```
This patch removes the useless "[default: ]" part. These are options,
so even without this text it should be very obvious that the `--style`
and the `--backend` parameters are indeed optional.
Remove the `application` infix from `register_application_font`, to
reduce the changes that it might be interpreted to be a function that
also changes the default font in all text elements.
This allows creating multiple windows for example, and it will allow for
showing windows in those tests that require a mapped window.
As a bonus, the run() function on generated components is not consuming
anymore.
We need to embed resources in wasm builds. Unfortunately we can't detect
that we're called by say wasm-pack and "TARGET"/"HOST" only works inside
build.rs. So instead, to keep things simple, this change always embeds
the image resources when targeting Rust.
The `SIXTYFPS_EMBED_RESOURCES` environment variable can be used to
override this anywhere for any language.
Fixes#130
Move the layout constraint tracker into the window where we can apply
the constraints right before drawing, instead of doing that from within
the event loop. This allows to remove the component parameter from the
run function.
This will allow the online editor to load imports from URL asynchroniously later
Since currently the compiler is only working on a single thread, and that we
never await on a future that could block, it is allowed to use the spin_on executor
Currently the Qt backend still redirect everything to the GL backend,
but the goal is to use QPainter and QWindow
This also adds a "default" backend, whose goal is to select the proper
backend at compile time