Simon Hausmann
bd79bb6ac8
Fix init order of generated C++ code
...
Like in commit 625eb733d3
for the
interpreter, call `set_component` on the Window before running the setup
code that might set the focus_item.
2021-04-06 13:42:15 +02:00
Olivier Goffart
5dfa2549c8
Put the named reference in a Rc so it will be easier to compute the use count and suck
2021-03-29 15:16:41 +02:00
Olivier Goffart
3db3400951
Rename the Object type to Struct in the compiler
2021-03-16 12:38:53 +01:00
Simon Hausmann
8372d3f6d8
Rename call_*
to invoke_*
for callbacks
...
Fixes #187
2021-03-15 17:01:05 +01:00
Olivier Goffart
014e13b05f
Make Diagnostic field private
2021-03-15 10:37:24 +01:00
Olivier Goffart
730b1ccff2
Refactor diagnostic: Merge BuildDiagnostic and FileDiagnostic
2021-03-12 19:32:50 +01:00
Olivier Goffart
11e0be5130
Add the SourceLocation into the Diagnostic
2021-03-12 12:49:19 +01:00
Olivier Goffart
fc35d101d9
Rename diagnostics::level to DiagnosticLevel
2021-03-11 16:27:40 +01:00
Olivier Goffart
436d113b1e
Rename ResourceReference
to ImageReference
in the compiler
2021-03-11 10:29:05 +01:00
Olivier Goffart
6f88d78303
Rename Resource
to ImageReference
in the runtime
2021-03-11 10:06:23 +01:00
Olivier Goffart
c840b046ae
Rename the "resource" type to "image"
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
Olivier Goffart
5727a4cf02
implement square root
2021-02-20 08:53:08 +01:00
Simon Hausmann
8b28c4d792
Fix compilation with empty image urls when resource embedding is enabled
...
`@image-url("")` should translate to `Resource::None` instead of
`Resource::AbsolutePath` to avoid that the rust compiler tries to
include a directory when embedding images.
2021-02-17 16:01:54 +01:00
Olivier Goffart
68de483f30
Ensure that the repeater are updated when we compute the layouts
...
Fixes #167
2021-02-12 10:07:33 +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
2ce672bd68
Reduce dependencies
...
Use only specific lyon packages instead of pulling all of them in.
This slightly speeds up compilation as well as for example lyon_tesselation
doesn't need to be compiled anymore.
2021-02-09 17:22:01 +01:00
Olivier Goffart
d49532182a
Fix test_cpp_expr_trigo on windows
...
Too difficult to access PI in C++ in a cross platform way.
It is simpler get the value from rust.
2021-02-08 14:59:54 +01:00
Olivier Goffart
431ce88326
sin/cos/tan and asin/acos/atan
2021-02-08 12:23:31 +01:00
Olivier Goffart
55726cc10d
fix two way binding when they are declared twice
...
Fix the galery's disable button not disabling most widgets
2021-02-05 18:33: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
Olivier Goffart
4643706409
Make sure linear gradiant always have all its stops
2021-02-03 15:42:35 +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
1d54947de9
Fix compilation of @linear-gradient with brush properties in C++
2021-02-03 13:22:44 +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
1f091cb1c0
Rename Rectangle.color to Rectangle.background
...
Add support for built-in property aliases and rename `color` to
`background` - in preparation for it also changing to type brush.
Right now the alias is silent, a deprecation and overall change
will come in a subsequent change.
2021-02-02 17:01:12 +01:00
Olivier Goffart
ad1e18764a
Make angle its own type
2021-02-01 14:49:25 +01:00
Olivier Goffart
2d12e118ac
Resolve linear gradients
2021-02-01 14:25:27 +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
e2db0e49dc
Fix explicit size in box layouts using for
...
Fixes #147
2021-01-29 16:35:59 +01:00
Olivier Goffart
e0e3a1aaad
Fix parent_item()
...
We need to skip over the DynamicItem
2021-01-26 17:05:30 +01:00
Olivier Goffart
a4abb86782
Don't return the ItemWeak by value
...
It is not working in C++ because ItemWeak has a destructor
2021-01-26 13:17:24 +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
b22bbb1c0f
WIP: Implement the return statement
2021-01-25 15:32:00 +01:00
Olivier Goffart
788a882c80
C++ Use u8"" string
2021-01-22 12:33:26 +01:00
Simon Hausmann
f7ea2a9dce
Forward focus() calls on items that have initial-focus
defined
...
This also makes the focus() method available as a member function on any
item, but the resolve_element_reference_in_set_focus_calls() pass will
check if the elements are valid.
The check for `has-focus` to determine a focusable item was replaced
with an annotation on the built-in elements, so that `has-focus` can
later be implemented as a built-in function through the run-time,
without the need for a boolean property.
2021-01-20 14:31:01 +01:00
Olivier Goffart
f454c5cd8e
C++: properly escape non-printable characters
2021-01-20 09:53:55 +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
Simon Hausmann
5dc7468b8a
Remove stray line
2021-01-15 20:53:57 +01:00
Simon Hausmann
58768bf70a
Add default bindings for width/height for Image and Text to their implicit size
2021-01-15 17:58:32 +01:00
Olivier Goffart
dc0a59a713
C++, Windows: Fix escaping slashes in resource name
2021-01-14 10:34:18 +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
0d2d48be4f
Rename "signal" to "callback"
2020-12-18 09:51:01 +01:00
Olivier Goffart
7f04301bca
C++: Do not set the window root in the component creation
...
Set it when calling run on the window.
Otherwise the last created component becomes the root
2020-12-10 11:35:38 +01:00
Olivier Goffart
7f78bea8b5
Fix a bunch of cargo clippy warnings in the compiler
2020-12-07 12:54:38 +01:00