Commit graph

589 commits

Author SHA1 Message Date
Simon Hausmann
628e6fdb38 Add a BoxShadow element
This intends to provide a configurable rectangular "drop shadow". The
API is modeled after CSS/HTML5 Canvas where the element can be "bound"
to an existing rectangular shape (geometry and radius), the offset can
be used to place the shadow and color and blur configure the shadow.

The shadow's color fades into transparent.

TODO (in subsequent changes):
 * Documentation
 * Qt implementation
2021-01-26 13:56:12 +01:00
Olivier Goffart
0cb51a986f Attempt to fix MSVC build 2021-01-26 13:47:34 +01:00
Olivier Goffart
802383cd6b Propagate key event to parent if the item don't handle it
Does not work for C++ because binary compatibility issue
2021-01-26 13:17:04 +01:00
Olivier Goffart
c2982d9ab3 Add ability to get the parent item from the vtable
(still untested)
2021-01-26 10:36:37 +01:00
Olivier Goffart
1fda2e1c99 Remove unused item_parent_offset 2021-01-26 10:36:37 +01:00
Olivier Goffart
5a21f1bd81 Rename emit_ to call_ for callback
Signal was renamed to Callback, but one does not emit a callback, one calls it
2021-01-25 15:59:10 +01:00
Olivier Goffart
c2dc0cef2c Finish return statement handling 2021-01-25 15:32:00 +01:00
Olivier Goffart
962a31d8f5 Layouting documentation 2021-01-23 10:25:43 +01:00
Simon Hausmann
2801e82658 Changed the KeyEvent in .60 to be an object
This exposes the text as well as the keyboard modifiers and is a little
more extensible.
2021-01-22 18:05:34 +01:00
Simon Hausmann
ae1178dd55 Make the modifiers simple booleans in the key event
This will give a nicer API to expose to .60. If the struct weren't
repr(C) then the booleans would be nicely packed, but alas that's not
happening. On the other hand we're not keeping many instances of them
around.
2021-01-22 13:47:52 +01:00
Olivier Goffart
c7664f11ac C++: operator== for VRc 2021-01-22 13:03:02 +01:00
Simon Hausmann
9ca87ab312 Simplify KeyEvent
Fold CharacterInput into KeyPressed/KeyReleased and store the "key" as a string.

Also, instead of exposing the KeyCode we're encoding special characters
into the string.
2021-01-22 10:15:05 +01:00
Olivier Goffart
094287697a Add a FocusScope
C++ part not working because the Callback with arguments are not yet supported with C++
2021-01-20 10:00:19 +01:00
Simon Hausmann
5f265ffc09 Split up ComponentWindow::run() into show(), hide() and sixtyfps::run_event_loop()
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.
2021-01-19 09:50:22 +01:00
Olivier Goffart
f397e08abc Also update neon 2021-01-15 16:04:14 +01:00
Olivier Goffart
dcb347fb7b Move more functions from the GenericWindow to the Window 2021-01-15 15:02:55 +01:00
Olivier Goffart
547b2a7f6e Introduce Backend trait
Such that the font are properly registered when the GL backend is chosen at runtime
2021-01-15 12:20:32 +01:00
Olivier Goffart
090039094f C++: rename component_type to static_vtable
Then there is no reference to "component" in vtable.h
2021-01-14 09:39:21 +01:00
Olivier Goffart
1bcf446078 Delete the VRcInner destructor in hope this silence a MSVC warning 2021-01-14 09:31:47 +01:00
Olivier Goffart
46dbb1ee9e By default, enable the GL backend also on desktop
So it can be chosen with an env variable or if Qt is not available
2021-01-14 08:53:13 +01:00
Simon Hausmann
edb17f996f Move the entire custom application font handling into the backend
Some backends may not require a copy of the data, for example.
2021-01-14 08:53:13 +01:00
Simon Hausmann
727c9a19f7 Add basic text item support
This needs more work, but gets something onto the screen at least.
2021-01-14 08:53:13 +01:00
Olivier Goffart
9050c29305 Don't use the window through the eventloop module 2021-01-14 08:53:13 +01:00
Simon Hausmann
0e04149868 Fix single shot timer leaks in the nodejs api
As discussed, don't use the persistent context approach for single
shot timers but store the callback directly in the global object
and "delete" it afterwards.
2020-12-19 13:49:41 +01:00
Olivier Goffart
16f5a03c14 Run cargo fmt 2020-12-18 10:29:15 +01:00
Olivier Goffart
dfa25b96f7 Rename SharedArray to SharedVector 2020-12-18 10:26:07 +01:00
Olivier Goffart
0d2d48be4f Rename "signal" to "callback" 2020-12-18 09:51:01 +01:00
Olivier Goffart
002cfa76af Use PRIVATE in target_link_libraries 2020-12-16 14:29:12 +01:00
Simon Hausmann
1a3396da3b Recommend the use of Ninja when using CMake 2020-12-15 18:28:24 +01:00
Olivier Goffart
5a7fa5bf11 Add an option to generate dependency file
For issue #135
2020-12-15 18:13:16 +01:00
Olivier Goffart
743b1da753 Make sure to re-run the compiler if the compiler changes
Fixes #131
2020-12-15 15:17:46 +01:00
Simon Hausmann
d7e7a6c2ac Fix typo 2020-12-15 12:56:58 +01:00
Simon Hausmann
625978fe1a WIP: Add an image-fit property to Image/ClippedImage 2020-12-15 10:26:54 +01:00
Olivier Goffart
63a0d9308b Bump version 2020-12-14 08:49:54 +01:00
Simon Hausmann
c2a0cd7000 Added a node version of the memory puzzle game
This also implements a basic single shot timer support, which has
one caveat: it leaks the closures right now.
2020-12-11 17:17:28 +01:00
Olivier Goffart
ae2be87838 Update neon version 2020-12-11 16:53:15 +01:00
Simon Hausmann
ee2e08f98d Fix creating an image resource from JS
We allow converting strings to Type::Resource, but we have to provide a
Value::Resource then, not Value::String.
2020-12-11 13:53:04 +01:00
Simon Hausmann
6d427f5654 Fix the wasm interpreter build 2020-12-10 15:42:33 +01:00
Simon Hausmann
87e0cc7d85 Fix resource embedding doing a wasm build of a project using the sixtyfps! macro
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
2020-12-10 15:09:32 +01:00
Simon Hausmann
624113b0a2 Change the sixtyfps_build compiler configuration API
Don't expose the internal type but create a public wrapper with the
builder pattern. That makes it easier to change defaults and it hides
internals like the callback futures.
2020-12-10 14:22:14 +01:00
Olivier Goffart
a949570c57 Timer in C++ 2020-12-10 13:08:58 +01:00
Simon Hausmann
c72c2a58ff Fix Rust docs about generated API 2020-12-09 16:48:02 +01:00
Simon Hausmann
36d897b81c Bump GIT_TAG in the C++ integration 2020-12-09 15:37:29 +01:00
Olivier Goffart
77dc3a2ca9 Update the version in the README and doc as we prepare the release 2020-12-09 15:34:41 +01:00
Olivier Goffart
125ec13f24 Bump version numbers
Note: this does not update the documentation yet
2020-12-07 15:41:29 +01:00
Olivier Goffart
f373d627fe Update corrosion 2020-12-07 15:32:38 +01:00
Olivier Goffart
9d2d3e43eb Update rystc_version 2020-12-07 11:37:47 +01:00
Simon Hausmann
b13d96fed0 Improve npm package score
Add missing repository filed for the node package
2020-12-04 15:37:43 +01:00
Simon Hausmann
26cb05724e Implement Clone for sixtyfps::Weak 2020-12-03 14:41:25 +01:00
Simon Hausmann
23d54b1b89 Improve similarity of testing APIs between C++ and Rust
Let send_mouse_click also take a component reference, like in C++.
2020-12-03 13:35:10 +01:00