Simon Hausmann
fc6c35bb3f
Fix formatting of generated code
...
Second attempt, remove all trialing spaces
2020-08-13 13:59:05 +02:00
Simon Hausmann
c394a10a85
Remove trailing spaces
2020-08-13 13:51:00 +02:00
Simon Hausmann
b96b627a4f
Release graphics resources of items when destroying components
...
This is only implemented for Rust at the moment.
2020-08-13 13:31:29 +02:00
Olivier Goffart
7e1af72a2e
Implement minimum/maximum width/height properties
2020-08-12 14:00:51 +02:00
Olivier Goffart
092411ccef
Attempt to merge the layout code between rust and C++
...
This does not actually merge so much but it is better than nothing.
I was not able to merge the code from the interpreter because of the life time issues
2020-08-12 11:53:39 +02:00
Simon Hausmann
b21aa4f9e7
Rename PropertyListenerScope to PropertyTracker
2020-08-12 11:31:33 +02:00
Simon Hausmann
aafb96cb93
Get rid of abi::datastructures::WindowProperties
...
Instead, pass a reference to the root item when mapping the window,
at which point we can downcast to the new Window item. If we have one,
then we'll read its width/height (for initial values) and install
bindings to keep them up-to-date.
2020-08-12 09:44:42 +02:00
Simon Hausmann
9fd7d35b0d
Remove stray scale_factor properties
2020-08-11 15:10:43 +02:00
Simon Hausmann
c1f91e38ca
Move the window scale factor into GraphicsWindow
2020-08-11 13:42:51 +02:00
Simon Hausmann
f2eec61968
Add a window to the top-level component
...
This means that we always have a window and for the C++
API we don't require this ComponentWindow use anymore.
2020-08-11 13:38:38 +02:00
Olivier Goffart
36243ccdf7
Traverse item front to back for input events
2020-08-10 10:45:02 +02:00
Olivier Goffart
0a56912d0f
Mouse grab in rust
2020-08-07 16:06:49 +02:00
Olivier Goffart
5aa7ee86fe
Use a newtype for VisitChildrenResult instead of just isize
...
Makes the code easier to unserstand
2020-08-07 16:06:49 +02:00
Olivier Goffart
55ec533c40
WIP input events
...
Compile and passes tests. But the mouse event are currently not working
2020-08-07 16:06:49 +02:00
Simon Hausmann
829990f9b1
WIP
...
Co-authored-by: Olivier Goffart <ogoffart@woboq.com>
2020-08-07 16:06:49 +02:00
Simon Hausmann
5b9c41b76b
Add referenced image resources to the dependencies for the rust build
2020-08-07 13:35:44 +02:00
Simon Hausmann
fcc819e395
Add support for enums to the compiler
...
This replaces the duplicated text alignment enums
2020-08-07 13:15:43 +02:00
Simon Hausmann
aecf6a8878
Center text in buttons in the demo and gallery
...
This adds horizontal_alignment/vertical_alignment properties, along with
width/height to Text.
This still uses a hard-coded enumeration in the compiler, which is meant
to go away in favor of general enum support.
2020-08-07 10:02:52 +02:00
Olivier Goffart
479173c22f
Implement spacing in GridLayout
2020-08-05 15:42:38 +02:00
Simon Hausmann
5dfb9aa875
Fix initialize size of printer demo
...
Map it to 800x600 logical pixels for a better initial look.
This implements respecting the initial values for width/height and tries
to apply them to the window begin created.
The PinnedOptionalProp wrapper is needed because while cbindgen mapped
the previous Option<&...> to a raw pointer, the new Option<Pin<&...>> is
not detected as a pointer.
2020-08-05 13:22:53 +02:00
Simon Hausmann
254df328d0
Add support for images (resources) in models
...
This also allows replacing the emojis (not working due to lack of fallback) with images
2020-08-04 16:09:33 +02:00
Simon Hausmann
ee3765e115
Print out the type we failed to convert to rust if it happens
2020-08-04 15:10:58 +02:00
Simon Hausmann
41671e3efb
Represent the window scale factor conversions in the IR
...
That means less code in the generators and easier to extend in the
future with more built-in functions.
2020-08-04 12:49:37 +02:00
Simon Hausmann
4f0bf0b982
Rename dpi to (window) scale_factor
2020-08-04 09:01:30 +02:00
Olivier Goffart
da11b33e9b
Version check
...
Compilation error when the compiler and the runtime are not on the same version
2020-08-03 18:44:36 +02:00
Olivier Goffart
1bfd708784
Change the field_offsets() function to a FIELD_OFFSETS associated const
2020-08-03 16:04:55 +02:00
Olivier Goffart
de188e0a54
Add the as_weak to rust generated component
2020-08-03 15:36:54 +02:00
Olivier Goffart
b8d440a6db
Rust: default visibility of everything to private
2020-08-03 15:01:10 +02:00
Olivier Goffart
8aef208340
Rust: add on_* to set signal handler
2020-08-03 15:01:10 +02:00
Olivier Goffart
cb67e40c32
Rename WeakPin -> PinWeak
2020-07-31 18:19:26 +02:00
Simon Hausmann
480a8470f5
Remove dead code
2020-07-30 19:51:33 +02:00
Simon Hausmann
884af3c88f
Implement support for nested layouts in the Rust generator
2020-07-30 19:41:29 +02:00
Olivier Goffart
9760cf4969
Begin to implement a Flickable
...
The implementation is still very rough and will need to be improved
2020-07-30 14:36:21 +02:00
Simon Hausmann
e881d89bf9
Get rid of visible x/y properties in GridLayout
...
It doesn't really make sense to have them in the API, the grid layout is
supposed to "own" the surrounding space. That can be an element and then
it should be a (0, 0) and distribute the element's width/height, or in
the future it can be a cell of a grid layout. Then there's an (x/y), but
that's implicit / hidden.
2020-07-29 18:52:22 +02:00
Simon Hausmann
4fccbba29d
Prepare for "virtualizing" the grid layout's width/height
...
Instead of storing the "within" element that we unconditionally take the
"width" and "height" properties from, let's pass through a property
reference expression to the width/height to use. For now that's still
the layout parent's width/height, but with this it can be replaced in
the future to refer to a "virtual" property that belongs to parent cell.
2020-07-29 18:52:22 +02:00
Simon Hausmann
00271a3746
Extend the layout data structure in the compiler to allow nesting
2020-07-29 18:52:22 +02:00
Simon Hausmann
f853843bc4
Store layouts in a common enum and vector
...
That'll make it easier later to allow for nesting them.
2020-07-29 18:52:02 +02:00
Olivier Goffart
46a011683f
Implement easing curve in the runtime
2020-07-29 15:20:28 +02:00
Olivier Goffart
feec73674f
Start implementing easing curve
2020-07-29 15:19:41 +02:00
Olivier Goffart
b57f3775c9
Refactor GridLayout
2020-07-28 10:31:05 +02:00
Simon Hausmann
88fb491837
Add support for mapping elements to different native classes
...
The Rectangle element has properties for a border outline. If those are
used, then the generated code should use BorderRectangle. But if they are
not used, then we can fall back to just generating a Rectangle.
2020-07-24 17:48:19 +02:00
Simon Hausmann
6c27451761
Begin separating builtin elements from the underlying types
...
This uses a NativeClass type in the registry to represent the underlying
Rust/C++ types.
2020-07-24 16:11:46 +02:00
Olivier Goffart
f87a3e2c13
Assignment operator
2020-07-24 11:43:23 +02:00
Olivier Goffart
05c5f7c53d
Test and fix animations on properties
...
The animation should not start when the property is initialized, only when the
property is set by the setter
2020-07-23 11:45:34 +02:00
Olivier Goffart
1a1d3dbec0
Store two consecutive read of the same variable in a temporary variable
...
Avoid to create too many dependencies when not required.
Especially the state transformation can create a lots of read to the same property
2020-07-22 17:24:26 +02:00
Simon Hausmann
f8c0eb0bd6
Prepare for passing passing more information from syntax node to diagnostics
...
Let the bulk of the push_error() calls take a Spanned trait impl, so
that we can pass node on the call sites. Then when later change the
underyling trait to pass something that can also provide the source file
and we don't have to change all call sites again.
2020-07-20 16:01:15 +02:00
Simon Hausmann
0cb59381e4
Fix type of PropertyDeclaration::type_location
...
In preparation for passing through the source file, avoid storing the Span
in the object tree and instead store the syntax node.
2020-07-20 15:36:17 +02:00
Olivier Goffart
6c54dfb67d
Layout the item in a PathLayout if they are part of a repeater
2020-07-17 15:00:12 +02:00
Simon Hausmann
ada5f68908
Add aggregating BuildDiagnostics
...
This type aggregates different per-file diagnostics into a similar interface,
in preparation for reporting diagnostics from multiple source files.
2020-07-17 12:10:25 +02:00
Simon Hausmann
e914715d88
Rename Diagnostics to FileDiagnostics
...
As this structure holds the diagnostics just for one file.
2020-07-16 18:25:42 +02:00