Commit graph

223 commits

Author SHA1 Message Date
Olivier Goffart
ba0ec058ab Make C++ build output more pretty
Avoid empty lines in stderr from the compiler, and make sure
the description from the compile line mention the output target
instead of not the source tomake it consistant with other outputs
2020-11-17 15:17:58 +01:00
Simon Hausmann
54ee7b3556 Cpp: Give each generated component a ComponentWindow
That's a counted reference to the window in the run-time and avoids the need to do the parent->parent->window dance.
2020-11-16 16:59:57 +01:00
Simon Hausmann
c258a907f0 Simplify event loop start-up
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.
2020-11-12 15:04:48 +01:00
Simon Hausmann
753ec83a05 Fix crash with VRc::borrow() on wasm32
When converting a Weak<VT, T> into Weak<VT, Dyn>, we were ignoring that
while T inside VRcInner may be at a certain offset to satisfy alignment,
the empty Dyn field may not and thus be at a different offset.

On wasm32 for example the compiler generated component struct has a
16-byte alignment, while the Dyn has none. So converting the Weak<VT,
Dyn> to a VRc<VT, Dyn> and then calling borrow() would use the wrong
instance pointer.

To fix this, this patch introduces an extra offset field that's
preserved during the casting and that's used for borrow() as well as
drop().
2020-11-12 11:04:56 +01:00
Simon Hausmann
a2dadf8fe8 Remove the component parameter from GenericWindow::process_key_input 2020-11-11 19:16:26 +01:00
Simon Hausmann
64b92df87e Initialize the component in the Window at component creation time
This will allow getting rid of the component as parameter to run()
2020-11-11 19:03:04 +01:00
Simon Hausmann
5d744c86c2 Begin passing the VRC<ComponentVTable, Dyn> into the run-time library
First by changing the signature of run() and by adding a self_weak
to the C++ struct.
2020-11-11 18:31:51 +01:00
Simon Hausmann
02904c4014 Simplify signature of Component::run
We don't need to pass the root item anymore since ComponentVTable
has now get_item_ref.
2020-11-11 15:55:03 +01:00
Olivier Goffart
7f66ca9584 Add a function in the ComponentVTable to get an ItemRef from an index
Needed to adjust vtable so it can work if the return type has a reference
2020-11-11 14:29:44 +01:00
Olivier Goffart
3886ed329f C++ docs update 2020-11-10 19:33:23 +01:00
Olivier Goffart
d6a440aa4a Change C++ API to use the ComponentHandle 2020-11-10 19:28:34 +01:00
Olivier Goffart
3194dd21ca Expose VRc to the C++ API
(Not yet in use in the code gen)
2020-11-10 12:43:19 +01:00
Olivier Goffart
95c4bac794 Add a dealloc and drop_in_place function to the ComponentVTable 2020-11-06 17:13:01 +01:00
Olivier Goffart
4910c1fdaa Fix string comparison in C++ 2020-11-03 19:42:01 +01:00
Olivier Goffart
8a95b806c7 Strawman implementation of a combo box 2020-11-03 17:55:49 +01:00
Olivier Goffart
a6dbd0d7fa Fix C++ build on MSVC 2020-11-03 17:42:34 +01:00
Olivier Goffart
11e55dd8d2 String -> Float conversions 2020-11-03 15:19:58 +01:00
Olivier Goffart
4a182ef4d0 Layout alignment 2020-11-03 12:22:34 +01:00
Olivier Goffart
a82c23fc41 Add ability for the native style to export native Globals 2020-11-02 16:13:04 +01:00
Olivier Goffart
356cd8c3ee Fix compileation with clang
The operator== must be in the same namespace as the struct for ADL to work proprerly
2020-11-01 16:09:42 +01:00
Olivier Goffart
cc85aa818d C++: implements operator== for StandardListViewItem 2020-11-01 15:56:19 +01:00
Olivier Goffart
1eb7203ec8 Also do the comperty comparison in C++ 2020-10-31 14:36:38 +01:00
Olivier Goffart
5face45c51 Rename Component::compute_layout to apply_layout
And pass the expected rectangle.
This is currently not used yet but will be needed when we can have
repeated elements within a box layout
2020-10-29 19:08:52 +01:00
Olivier Goffart
263df7dc63 Remove the www from all sixtyfps.io URL 2020-10-29 11:06:06 +01:00
Olivier Goffart
d3801e26d3 Change the syntax of structures to require the struct keyword 2020-10-27 16:09:05 +01:00
Olivier Goffart
4a702243d1 Fix C++ layouts 2020-10-27 08:16:02 +01:00
Olivier Goffart
47be71e16d Introduce layout stretching 2020-10-26 16:40:35 +01:00
Olivier Goffart
20cfb65e53 Bump version 2020-10-22 08:41:45 +02:00
Simon Hausmann
fae046cef4
Small typo fix 2020-10-21 21:35:45 +02:00
Olivier Goffart
c50b9d73d3 Document the generated C++ code 2020-10-21 11:29:25 +02:00
Olivier Goffart
a2a134725f Pin corrosion git hash
Because otherwise there could be breaking changes
2020-10-21 09:12:59 +02:00
Olivier Goffart
1de39e5769 String concatenation 2020-10-19 18:37:15 +02:00
Olivier Goffart
e4e601de83 Draw the frame properly around the native scrollview 2020-10-16 10:45:17 +02:00
Simon Hausmann
6aa292eac1 Change the names of the logical and physical pixel units
The logical pixels are now just called "px" and the less frequently
used physical pixels have the "phx" suffix.

The existing markup was adapted using the syntax updater and the
following patch:

    +    if node.kind() == SyntaxKind::NumberLiteral {
    +        if node.text().ends_with("lx") {
    +            return write!(
    +                file,
    +                "{}px",
    +                node.text().as_str().split_at(node.text().as_str().len() - 2).0
    +            );
    +        }
    +        if node.text().ends_with("px") {
    +            return write!(
    +                file,
    +                "{}phx",
    +                node.text().as_str().split_at(node.text().as_str().len() - 2).0
    +            );
    +        }
    +    }

Fixes #49
2020-10-16 07:19:40 +02:00
Simon Hausmann
8835e25ccd Advocate the CMake FetchContent approach for the C++ Integration
This may be slightly easier to use than the separate build & install sequence.
2020-10-15 16:00:49 +02:00
Simon Hausmann
48602c3b5c Fix MSVC warning about #pragma GCC
Only use the pragma with GCC and Clang
2020-10-13 23:00:12 +02:00
Simon Hausmann
a37d42fa0e Add an init function to the Item vtable
This will be called by the run-time and will allow items to set up
bindings that rely on internals that should not be exposed to the
compiler/runtime.
2020-10-12 16:49:44 +02:00
Olivier Goffart
7bd77f698f cmake: use the newly introduced CRATES option from corrosion 2020-10-12 06:57:03 +02:00
Olivier Goffart
9d106c6830 Some changes in the README 2020-10-09 13:49:39 +02:00
Olivier Goffart
d8f7139f48 Fix Native StandardListView with C++ 2020-10-08 17:18:22 +02:00
Olivier Goffart
4bdf447b11 C++ build documentation and README 2020-10-08 12:25:12 +02:00
Olivier Goffart
11d367467a Fix install when using a config + debug configuration 2020-10-08 11:28:42 +02:00
Olivier Goffart
2837bf3a5f CI: generate packages 2020-10-08 11:28:42 +02:00
Olivier Goffart
07c4b6cb3d CMake: Fix installation 2020-10-07 18:20:55 +02:00
Olivier Goffart
3040885c6d Fixup C++ build 2020-10-07 11:48:22 +02:00
Olivier Goffart
8b02568b4b Refactor the cmake C++ build 2020-10-07 11:40:34 +02:00
Olivier Goffart
58b176d10c ListView in C++
This make sure the layout is correct, but does not implement the
optimization to only instentiate visible items
2020-10-05 11:32:43 +02:00
Olivier Goffart
6d9af3449a C++ model for the todo example in C++ 2020-09-30 18:30:19 +02:00
Olivier Goffart
f01977ca06 Fix removing from model in C++ 2020-09-30 18:17:15 +02:00
Simon Hausmann
9ad8968529 Add support for the initial_focus synthetic property
Setting it will translate to a set_focus_item call in the constructor.

This implements parts of #55
2020-09-30 15:11:01 +02:00