Olivier Goffart
1db34682ee
C++: fix crash when closing window
...
the m_window needs to be destroyed after the destructor of the repeater
2022-01-20 08:42:32 +01:00
Simon Hausmann
e2838a87ab
Fix missing calls to init() of native items in repeater item trees when using C++
...
Like in the Rust generator, we need to always call init_items().
2022-01-19 16:56:02 +01:00
Simon Hausmann
9bbcf16124
Fix typo
...
Co-authored-by: Olivier Goffart <ogoffart@sixtyfps.io>
2022-01-19 15:42:43 +01:00
Simon Hausmann
1fcfc58975
cpp generator: reduce surface of public C++ API
...
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.
2022-01-19 15:42:43 +01:00
Olivier Goffart
f9f90e1b4e
C++: Do not expose private types in the sixtyfps namespace
2022-01-19 11:19:47 +01:00
Simon Hausmann
12e2aa3941
cpp llr: Simplify generate() signature
...
Since the function always returns Some(), we can remove the Option from the return type.
2022-01-19 10:02:23 +01:00
Tobias Hunger
81d1c8129f
Remove some commented out code
2022-01-19 10:02:23 +01:00
Tobias Hunger
fb3d5ef263
LLR-C++: Implement ShowPopupWindow
2022-01-19 10:02:23 +01:00
Simon Hausmann
96a5682fd8
cpp llr: remove some old code that was commented out
2022-01-19 10:02:23 +01:00
Simon Hausmann
3ec6c0fc63
cpp llr: fix disappearing items when rendering repeaters
...
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.
2022-01-19 10:02:23 +01:00
Olivier Goffart
67c6a352ea
llr-cpp: fix a warning in the generated code
2022-01-19 10:02:23 +01:00
Simon Hausmann
569fee695e
cpp llr: fix use of properties of native items in if conditionals
...
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.
2022-01-19 10:02:23 +01:00
Simon Hausmann
5e5622a947
cpp llr: Implement RegisterCustomFontByMemory and RegisterCustomFontByPath
2022-01-19 10:02:23 +01:00
Simon Hausmann
4a89cc106c
llr cpp: fix initial_focus test
...
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.
2022-01-19 10:02:23 +01:00
Simon Hausmann
5631098f91
cpp llr: invoke generated sub-component init code
...
The initial focus handling generates setup code, which needs inclusion.
2022-01-19 10:02:23 +01:00
Simon Hausmann
f451e4eaf7
cpp llr: fix set_focus_item builtin method calls
...
End the function call with a semicolon.
2022-01-19 10:02:23 +01:00
Simon Hausmann
c58668a600
cpp llr: fix test_cpp_7gui_timer
...
Port commit 242dfcf7cf
to catch all conversions from numbers to string.
2022-01-19 10:02:23 +01:00
Simon Hausmann
85fa56ac32
cpp llr: minor cleanup
...
Fold unused variables into their use-site
2022-01-19 10:02:23 +01:00
Olivier Goffart
1f3620acfa
llr-cpp: fix crash computing path
...
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.
2022-01-19 10:02:23 +01:00
Olivier Goffart
35cb9ed338
llr-cpp: Fix Dialog
2022-01-19 10:02:23 +01:00
Olivier Goffart
0259c0dc9b
Give a return type to llr::Expression::ExtraBuiltinFunctionCall
...
Some code in the C++ generator needs the type of such expressions
2022-01-19 10:02:23 +01:00
Simon Hausmann
c2ae82c74f
cpp llr: fix crashes_issue_422_enclosing_component
...
Make sub-compo fields public
2022-01-19 10:02:23 +01:00
Simon Hausmann
80768fd011
cpp llr: fix color and string builtin function calls
2022-01-19 10:02:23 +01:00
Simon Hausmann
44857ff0f2
cpp llr: Fix BuiltinFunction::Debug to stream into std::cout
2022-01-19 10:02:23 +01:00
Olivier Goffart
83136f5bca
llr-cpp: fix test_cpp_properties_property_animation
2022-01-19 10:02:23 +01:00
Simon Hausmann
4a3678fe55
cpp llr: Fix support for the Close {} path element
2022-01-19 10:02:23 +01:00
Olivier Goffart
270d8ab2c7
llr-cpp: Transitions
2022-01-19 10:02:23 +01:00
Simon Hausmann
708c4a55de
cpp llr: add support for path events
2022-01-19 10:02:23 +01:00
Simon Hausmann
7e695ae4e6
cpp llr: add support for path elements
...
This is mostly covered by the cast produced by the llr lowering.
2022-01-19 10:02:23 +01:00
Olivier Goffart
1464da3a68
llr-cpp: Public API for globals
2022-01-19 10:02:23 +01:00
Olivier Goffart
23a2900b66
llr-cpp: init global bindings
2022-01-19 10:02:23 +01:00
Simon Hausmann
34825e0a2b
cpp llr: Fix ensure_updated for listview
2022-01-19 10:02:23 +01:00
Simon Hausmann
7c3f8b78cb
cpp llr: Provide access to user-defined globals
2022-01-19 10:02:23 +01:00
Olivier Goffart
37707ac98e
llr-cpp: Flickable
2022-01-19 10:02:23 +01:00
Olivier Goffart
99adc25a81
llr-cpp: Fix for
within layout
2022-01-19 10:02:23 +01:00
Simon Hausmann
f5459177f3
cpp llr: Implement ModelDataAssignment and ArrayIndexAssignment
...
Also make repeaters friends of the App, for field access.
2022-01-19 10:02:23 +01:00
Olivier Goffart
55f66b36d5
C++: Remove a bunch of commented out code that was already ported
...
Or which is still commented out somewhere else
2022-01-19 10:02:23 +01:00
Simon Hausmann
339dde64f1
cpp llr: fix test_cpp_models_for
...
Make the parent accessible to sub-components
2022-01-19 10:02:23 +01:00
Olivier Goffart
d62b788829
C++: Do wrapper to the layout function
...
That returns and take their argument in a C++-like way instead of by pointer.
2022-01-19 10:02:23 +01:00
Simon Hausmann
4b0ae4d5a1
cpp llr: Fix BuiltinFunction::ArrayLength
...
Evaluate the model only once, and invoke the lambda that tracks the row count and returns it.
2022-01-19 10:02:23 +01:00
Simon Hausmann
3fe33df56b
cpp llr: Fix -Werror errors with unused parameters in update_data for repeaters
...
Fixes three more tests
2022-01-19 10:02:23 +01:00
Simon Hausmann
f9bbe9c3a2
cpp llr: make self_weak accessible to child repeaters
2022-01-19 10:02:23 +01:00
Tobias Hunger
0999e9ccf5
C++: Implement SetFocusItem builtin
2022-01-19 10:02:23 +01:00
Olivier Goffart
708fc0b8a7
C++: Don't rely on the order of struct members
...
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.
2022-01-19 10:02:23 +01:00
Simon Hausmann
4544e4c7c1
cpp llr: extend comment about public fields in globals
2022-01-19 10:02:23 +01:00
Simon Hausmann
0969130b85
cpp llr: remove diagnostics
...
Similar to the Rust generator, the C++ generator should not produce any errors;
they should be caught at the llr lowering level if any.
2022-01-19 10:02:23 +01:00
Simon Hausmann
210355b416
cpp llr: clean up some access rights FIXMEs
...
Let generate_sub_component generate all public members, for easy use within.
Only generate_public_component makes by default everything private except for
public API.
2022-01-19 10:02:23 +01:00
Simon Hausmann
02831d2daa
cpp llr: initial implementation of PropertyReference::InParent for access_member
2022-01-19 10:02:23 +01:00
Simon Hausmann
532a3797e3
cpp llr: implement visit of dynamic children
2022-01-19 10:02:23 +01:00
Simon Hausmann
f9db59703e
c++ llr: add missing return statement
2022-01-19 10:02:23 +01:00