Commit graph

411 commits

Author SHA1 Message Date
Simon Hausmann
f5fb0bf297 Prospective Qt linkage fix for macOS
Try adding an LC_RPATH command to the cdylib that we're building (for example libsixtyfps_cpp.dylib),
to fix linkage against Qt, which uses `@rpath/QtCore.framework/XXX` for inter-library linkage dependencies.
2021-03-17 14:02:33 +01:00
Simon Hausmann
8e72d29669 Expose Value::to_string() conversion and construction in C++ 2021-03-17 13:28:53 +01:00
Olivier Goffart
6e9d4f9e8d Fix linking of the interpreter
I don't know why, byt the 'crate-type = "lib"' seem to fix the problem
2021-03-17 12:38:05 +01:00
Simon Hausmann
cf2b02c9fa Add the initial C++ header file for the interpreter with the start of Value 2021-03-17 12:10:12 +01:00
Simon Hausmann
a06f0b22fa Add a debug message to see what's set in the CI 2021-03-17 11:57:19 +01:00
Olivier Goffart
dbf06f73cc Link the C++ lib against the interpreter 2021-03-17 11:44:45 +01:00
Simon Hausmann
372ba09741 Prospective fix for ctest on macOS in the CI
Try manually to propagate the local environment variable for the dyld framework path

It might not get propagated across the process boundaries by itself the way github actions set it in the local environment.
2021-03-17 11:34:34 +01:00
Simon Hausmann
c68405d4dd Prospective fix for macos ctest not finding Qt
Not sure how this could happen, but we should be able to limit the rpath workaround to Linux
2021-03-17 08:52:52 +01:00
Olivier Goffart
29f930d733 Workaround test problem
Looks like the test executable need to be run from the cmake root build directory,
because it hardcodes a relative path to the library  api/sixtyfps-cpp/libsixtyfps_cpp.so
This might actually be a corrosion bug.
2021-03-16 19:49:29 +01:00
Olivier Goffart
35cce45cbc Add a fii feature so that we don't compile in the ffi code if not required 2021-03-16 18:09:57 +01:00
Simon Hausmann
cff1e7751d Link against SixtyFPS in the C++ unit tests 2021-03-16 16:51:01 +01:00
Olivier Goffart
ca93d12cf8 Fix cpack 2021-03-16 16:47:03 +01:00
Olivier Goffart
0e351de1a6 Create a new crate to expose the C++ 2021-03-16 16:34:02 +01:00
Simon Hausmann
ec1775f9ae Add skeleton for C++ API tests 2021-03-16 16:30:54 +01:00
Simon Hausmann
8372d3f6d8 Rename call_* to invoke_* for callbacks
Fixes #187
2021-03-15 17:01:05 +01:00
Olivier Goffart
4f115edb87 Fix cmake install 2021-03-11 11:34:09 +01:00
Olivier Goffart
6f88d78303 Rename Resource to ImageReference in the runtime 2021-03-11 10:06:23 +01:00
Olivier Goffart
44e81a40d6 Fixup C++ build 2021-03-10 17:24:31 +01:00
Simon Hausmann
391d0152f0 Add Color::brighter/darker functions
These are exposed in .60 as well as in Rust and C++ and implemented by
converting to HSV color space and adjusting the brightness (value).
2021-02-24 10:49:27 +01:00
Simon Hausmann
1b870959e6 Use the Noto fonts from the C++ build of the printer demo
This adds API to register a font by path from C++
2021-02-22 11:17:39 +01:00
Olivier Goffart
b34a34cea0 C++ Make sure that the layout is properly updated when the model of a for or if changes
The problem is that the backend is using the `meta_property_listener` to know
if the layout must be updated, but the C++ code would not register a dependency

NOTE about the test: The test doesn't really test that it works because
the test backend don't have a meta_property_listener and apply the layout
inconditionally in sixtyfps_send_mouse_click
2021-02-18 09:40:12 +01:00
Simon Hausmann
500919745e Add an internal Rotate element
This is just a starting point, to be turned into a real Transform
element later, along with syntactic sugar to turn rotation, etc.  into a
transform matrix in the generated output.
2021-02-12 17:31:06 +01:00
Olivier Goffart
096f55e365 Change behavior of percent sice within the layout
So that size with percentages don't affect the maximum/minimum size

Fixes #117
2021-02-11 20:32:26 +01:00
Simon Hausmann
2dd5ea61bb Add support for Path.fill-rule
For some reason it's not working with the Qt renderer though
2021-02-10 14:08:32 +01:00
Simon Hausmann
57d3a34996 Prospective fix for doc errors
In the nightly it appears that `no_mangle` is now considered "unsafe",
so we need to allow that in the ffi modules. For the layout code this
patch also creates that ffi module with prefixed function names, like in
the other modules and only allows unsafe in there.
2021-02-10 11:26:28 +01:00
Simon Hausmann
50d9211e0a Fix failing default_color.60 test
Allow converting a brush to a color. In the case of a gradient, the color of the first stop is returned.

For the C++ generator this requires adding the extra case of explicitly
calling the `Brush(const Color &)` constructor, despite it being implicit,
in order to generate the correct code when we have IR that casts twice:

```
   Expression::Cast {
       from: Expression::Cast {
           from: Expression::Cast {
               from: Expression::NumberLiteral(...),
               to: Type::Color,
           }
           to: Type::Brush,
       },
       to: Type::Color,
   }
```
2021-02-04 13:44:10 +01:00
Simon Hausmann
262eb00af4 Allow an implicit conversion from a color or a linear gradient to Brush in C++ 2021-02-03 14:42:21 +01:00
Simon Hausmann
7982325da4 Change Rectangle::background's type to be a brush
This also introduces the brush type in the compiler and generators. At the
moment only conversion from Color is implemented.
2021-02-03 12:49:44 +01:00
Olivier Goffart
d90fce9c1d Generate linear gradient in C++ 2021-02-03 10:16:23 +01:00
Simon Hausmann
40847a5563 Expose LinearGradientBrush also in C++ 2021-02-02 08:44:53 +01:00
Olivier Goffart
54c979d9e6 Make it so that you don't need to run xtask through cargo 2021-02-02 08:39:06 +01:00
Simon Hausmann
9b1fd52231 Fix class vs. struct mismatch 2021-02-01 20:36:08 +01:00
Simon Hausmann
efb496fc25 Add C++ constructors for sixtyfps::Brush 2021-02-01 20:33:40 +01:00
Simon Hausmann
8c3ab3608a Fix corrision build
Set CARGO_MANIFEST_DIR for the bindgen xtask as when run through cargo
2021-02-01 20:27:55 +01:00
Simon Hausmann
f33b26fa93 Make Brush compile for C++
A few changes were required:

 * `LinearGradient(LinearGradient)` as enum variant unfortunately
    won't compile because the cbindgen generated constructor
    function (`LinearGradient()`) will try to also instantiate the
    variant type inside (`LinearGradient`) and that won't find the type
    but the function itself and error out. So the inner type is now
    called `LinearGradientBrush`.

 * The same name dance was required for `Color`, where the enum variant
   instead is called `SolidColor`

 * `BrushInner` was removed in favor of just `Brush`. The nicer Rust
    API will be the public variant, and for cbindgen we can just put
    the generated enum into an internal namespace, like we do for
    Resource for example

 * A `NoBrush` variant was added. Maybe that name could be improved?
2021-02-01 16:51:04 +01:00
Olivier Goffart
a36edfffbe Change the C++ test API of the send_mouse_click
So that rust and C++ have the same code that can be copy pasted
2021-01-29 16:55:48 +01:00
Olivier Goffart
98d40e291d Missing version update 2021-01-28 16:37:52 +01:00
Olivier Goffart
fea2478859 Update version number everywhere 2021-01-28 16:34:13 +01:00
Simon Hausmann
6a4f2aa572 Added the two missing path sub-elements for quadratic and cubic curves 2021-01-28 14:14:24 +01:00
Simon Hausmann
a6fbc4c05d Add missing MoveTo sub-element for Path 2021-01-28 13:16:25 +01:00
Olivier Goffart
647f7effcd Add TextWrap and TextOverflow enum and corresponding property in Text
Although they ar enot working yet
2021-01-27 11:40:09 +01:00
Olivier Goffart
9de5af75ce Allow FocusScope to reject the events 2021-01-26 17:05:31 +01:00
Olivier Goffart
2e23b5bbdd Handle native callbacks with return value 2021-01-26 17:05:30 +01:00
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
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
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