Move "internal" crates into the `internal` directory. This first batch
includes most of sixtyfps_runtime but leaves the rendering backends
alone for now.
pre-commit applied some cleanups to the moved files:
- Consistent newline at end of file policy
- trimming trailing whitespace
- Formatting Cargo.toml files.
The C++ code did not compile because it couldn't deduce the template parameter
properly. Since the lambda became a bit big to be placed in one small string,
I moved it into a real function in the header
Example of error: (sorry for the long lines :-))
```
tmp/.tmpE42a4c.cpp: In member function 'void TestCase::init(const TestCase*, sixtyfps::cbindgen_private::ComponentWeak, uintptr_t, uintptr_t)':
/tmp/.tmpE42a4c.cpp:67:238: error: no match for call to '(TestCase::init(const TestCase*, sixtyfps::cbindgen_private::ComponentWeak, uintptr_t, uintptr_t)::<lambda(const std::shared_ptr<sixtyfps::Model<ModelData> >&, const auto:24&)>) (std::shared_ptr<sixtyfps::private_api::ArrayModel<2, sixtyfps::SharedString> >, int)'
67 | self->root_window_1_hello_world.set([&]<typename D>(const std::shared_ptr<sixtyfps::Model<D>> &model, const auto &index) -> D { model->track_row_data_changes(index); if (const auto v = model->row_data(index)) return *v; return D(); }(std::make_shared<sixtyfps::private_api::ArrayModel<2,sixtyfps::SharedString>>(sixtyfps::SharedString ( sixtyfps::SharedString(u8"hello") ), sixtyfps::SharedString ( sixtyfps::SharedString(u8"world") )), 1));
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/tmp/.tmpE42a4c.cpp:67:41: note: candidate: 'template<class D, class auto:24> TestCase::init(const TestCase*, sixtyfps::cbindgen_private::ComponentWeak, uintptr_t, uintptr_t)::<lambda(const std::shared_ptr<sixtyfps::Model<ModelData> >&, const auto:24&)>'
67 | self->root_window_1_hello_world.set([&]<typename D>(const std::shared_ptr<sixtyfps::Model<D>> &model, const auto &index) -> D { model->track_row_data_changes(index); if (const auto v = model->row_data(index)) return *v; return D(); }(std::make_shared<sixtyfps::private_api::ArrayModel<2,sixtyfps::SharedString>>(sixtyfps::SharedString ( sixtyfps::SharedString(u8"hello") ), sixtyfps::SharedString ( sixtyfps::SharedString(u8"world") )), 1));
| ^
/tmp/.tmpE42a4c.cpp:67:41: note: template argument deduction/substitution failed:
/tmp/.tmpE42a4c.cpp:67:238: note: mismatched types 'sixtyfps::Model<ModelData>' and 'sixtyfps::private_api::ArrayModel<2, sixtyfps::SharedString>'
67 | self->root_window_1_hello_world.set([&]<typename D>(const std::shared_ptr<sixtyfps::Model<D>> &model, const auto &index) -> D { model->track_row_data_changes(index); if (const auto v = model->row_data(index)) return *v; return D(); }(std::make_shared<sixtyfps::private_api::ArrayModel<2,sixtyfps::SharedString>>(sixtyfps::SharedString ( sixtyfps::SharedString(u8"hello") ), sixtyfps::SharedString ( sixtyfps::SharedString(u8"world") )), 1));
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
```
Change Model::row_data to return an Option<T> (rust) or std::optional<T> (c++)
Co-authored-by: Olivier Goffart <olivier@woboq.com>
Co-authored-by: Simon Hausmann <hausmann@gmail.com>
Use Access::Private as access for properties, items, helper fields (tree
index, etc.), and vtable functions of the public component.
All meanwhile added declarations for sub-components (such as popups, child repeaters)
still get access through friendship.
Creating a repeater component would use the same setup code as a public component,
which replaces the component rc in the window among other things.
Handle this in generate_item_tree just like in the Rust generator.
InNative assumed that the current sub-compo is accessed using "this",
which happens to also be part of regular binding captures. But it isn't for model binding,
for example.
Let's use "self" throughout, like everywhere else.
Don't call set_focus_item() followed by set_component() on the window, which clears the focus item again.
Like in Rust, call set_component first, then init_items() and finally all the init/setup code.
The events and point were referencing temporaries.
Fix that by passing them as argument to the lambda so the temporaries
don't get destroyed before being used.
When initializing a Type::Struct, don't use agregate initialization that
relies on the orde of fields.
This is important because the builtin layout struct are not ordered
lexicographicly.