Commit graph

236 commits

Author SHA1 Message Date
Olivier Goffart
7967a074fb Fix accessing struct declared in a different file 2020-11-17 12:02:21 +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
Olivier Goffart
dd4435fe5d Add round/ceil/floor 2020-11-16 12:52:01 +01:00
Olivier Goffart
b45a14bd7a modulo 2020-11-13 16:07:18 +01:00
Olivier Goffart
d499e86640 Implement cubic-bezier 2020-11-13 13:36:32 +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
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
d6a440aa4a Change C++ API to use the ComponentHandle 2020-11-10 19:28:34 +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
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
661982e747 Fix bindings on animation duration 2020-11-02 21:15:22 +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
232d59bf24 Ensure that the repeater are updated when layouting box layout 2020-11-02 11:37:04 +01:00
Olivier Goffart
1eb7203ec8 Also do the comperty comparison in C++ 2020-10-31 14:36:38 +01:00
Olivier Goffart
ab14978fa8 Support for in box layout in the C++ backtend 2020-10-31 09:10:16 +01:00
Olivier Goffart
a4b476bdf3 implement Component::layout_info in C++ 2020-10-29 19:08:52 +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
1479bc956e Support for global in the interpreter 2020-10-29 11:01:04 +01:00
Olivier Goffart
7f7bf6acb4 Access of global items from C++ 2020-10-29 11:01:04 +01:00
Olivier Goffart
70d6648880 Remove some remains of code that allowed to use Component as Object 2020-10-27 16:25:21 +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
333c96fd79 Change Type::Object to be able to hold a name
Internally, structure will be represented with a Type::Object with a name
instead of a Component with a void base type
2020-10-27 16:09:05 +01:00
Olivier Goffart
4a702243d1 Fix C++ layouts 2020-10-27 08:16:02 +01:00
Olivier Goffart
9ec2013a3a Layout refactor: move the constraints dirrectly into the layout item 2020-10-26 17:17:29 +01:00
Olivier Goffart
47be71e16d Introduce layout stretching 2020-10-26 16:40:35 +01:00
Olivier Goffart
7ff0b4b73f Vertical layout 2020-10-26 14:19:12 +01:00
Olivier Goffart
aeade826fe New runtime implementation for the box layout
Currently only horizontal layout is supported
2020-10-26 14:19:12 +01:00
Olivier Goffart
537051a1e4 Refactor get_layout_info_ref to contains the constraints 2020-10-26 14:19:12 +01:00
Olivier Goffart
c659c4369a Refactor the Layout generation code 2020-10-26 10:07:31 +01:00
Olivier Goffart
de17702a38 Layout: Attempt to reduce code duplication between rust and c++ codegen 2020-10-24 12:15:21 +02:00
Olivier Goffart
ed01d8369a Start working on VerticalLayout/HorizontalLayout 2020-10-23 14:08:58 +02:00
Olivier Goffart
27a6ff1227 Move Type and related concepts in a different module
Leaving only the TypeRegister in the typeregister module
2020-10-23 11:17:14 +02:00
Olivier Goffart
4fb87f401e Some fixes for the initializations of two way bindings within sub components
There are still more issues
2020-10-20 14:33:06 +02:00
Olivier Goffart
837cc769eb Fix conversion to void in cpp
The test test_cpp_conditional_stm was failing because it was trying to return void
2020-10-19 20:37:11 +02:00
Simon Hausmann
071ab9fda1 Prepare for use of percentages as widths in layouts
Delay the conversion of percentage to the float to code generation type
by inserting the multiplication into the syntax tree. That way we will
be able to detect plain uses of percetages and interpret them
differently.
2020-10-16 15:38:35 +02:00
Simon Hausmann
d8459ef00e GridLayout cleanup
Separate out the padding and spacing parameter handling. A separate data
holds these and the code generation is also split out into
helper functions in the C++ and Rust generator. This will allow re-use in the future.
2020-10-13 22:52:04 +02:00
Simon Hausmann
0b78a782b7 Minor C++ grid layout codegen cleanup
We don't need to use local variables for the layout width/height
2020-10-13 22:45:22 +02:00
Simon Hausmann
e5b8e5d64d Prepare for more code sharing in layout handling
Move layout constraints for layout items into a separate
helper struct.
2020-10-13 18:17:47 +02:00
Simon Hausmann
1b4317a93a Minor cleanup in the layout code in the compiler
Free the term "Layout Constraints" for use later for the actual constraints
of layouts.
2020-10-13 18:00:54 +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
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
Simon Hausmann
7e0e7b43f0 Add support for calling focus() on TextInput elements
This allows activating text inputs in signal handlers connected for
example to buttons.

This implements parts of #55
2020-10-01 08:52:45 +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
Olivier Goffart
2050f08f1e Ability to make change to the model property 2020-09-30 15:04:32 +02:00
Olivier Goffart
2d01b92c84 Ability to change part of objects from the .60 syntax 2020-09-30 11:33:36 +02:00
Simon Hausmann
1e1476108a Fix valgrind error in test_cpp_focus_change
TextInput has a Cell<bool> which becomes a plain bool in the cbindgen generated C++ struct.
When declaring the members in our generated code, make sure to explictly initialize them.
That way we get the same defaults as in Rust (or
at least should).
2020-09-29 15:01:01 +02:00
Olivier Goffart
f4f4775a19 Refactor the C++ Repeater to do the same as the Rust one 2020-09-29 14:20:43 +02:00
Olivier Goffart
3b6679ed4b Two ways binding works also work as three ways binding and more
A side effect is that the order of calling set_binding and link_two_ways is no longer relevant
2020-09-28 10:42:27 +02:00