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
Olivier Goffart
abe24e2e9e
C++ two way bindings
2020-09-25 15:21:37 +02:00
Olivier Goffart
9d53c45291
Implement two ways binding in rust
2020-09-25 12:57:08 +02:00
Simon Hausmann
e5dfb3a4c0
Implement basic focus handling
...
Similar to the mouse_grabber, we use a VisitChildrenResult field to
track the focus item within a component. Unlike the mouse grabber
however, it is set/cleared using dedicated focus events.
The key event now routes the key event directly to the focus item.
The focus can be requested via set_focus_item on a window, which the
TextItem does.
2020-09-25 10:43:47 +02:00
Simon Hausmann
aa5babffe1
Prepare for key event delivery to a specific focus item
...
Begin by routing key events through the component. In the future that
will direct the event to the focus item.
2020-09-25 10:06:15 +02:00
Simon Hausmann
2b76e9277a
Prepare for allowing an item mouse handler to request focus
...
In the future the TextInput will request focus on mouse click,for
example.
Pass the outer-most component through to ItemVTable's input_event.
For the purpose of disambiguating this component from any nested
component instantiated by a repeater or so, it's called the
app_component.
The ComponentVTable takes a reference to a ComponentRefPin instead of a
ComponentRefPin by value, as the vtable macro gets confused otherwise
and thinks it's a self argument.
2020-09-25 10:06:15 +02:00
Olivier Goffart
8361ef4019
Start code egeneration for the two ways binding
...
This is only meant to include the cases in which the property are optimized.
Does not work yet for the dynamic component
2020-09-24 14:37:16 +02:00
Olivier Goffart
4981c3ca75
Some check for the two way bindings
2020-09-23 14:06:08 +02:00
Olivier Goffart
2ee861365c
Flickable: expose the viewport property as viewport_*
...
The code generator forward that the the viewport
2020-09-22 13:52:27 +02:00
Simon Hausmann
7053aee0c8
Pass the ComponentWindow to ItemVTable::input_event
2020-09-18 16:18:48 +02:00
Simon Hausmann
72ee03a1a5
Fix build with clang
...
Similar to the issue fixed in commit
de74ae4534
, clang appears to assume that
the float literal is a double our object literals and aggregate
initialization to float members (like the level of InkLevel) requires an
explicit cast.
I don't know of a way to determine the type of a struct field by index easily,
so this build fix instead uses C++17 destructuring to initialize the fields by index.
So
InkLevel{ std::get<0>(o), std::get<1>(0) }
(^^ fails when get returns double and
field is float)
becomes
InkLevel s; auto& [f1, f2] = s; f1 = std::get<0>(o); f2 = std:get<1>(o); return s;
2020-09-17 16:40:05 +02:00
Olivier Goffart
bfe2bf2478
Ability to read properties of a struct
2020-09-17 13:53:00 +02:00
Olivier Goffart
8134fe5088
Support for named type as property
2020-09-17 13:14:01 +02:00
Simon Hausmann
79ba5d9de8
Provide a window reference in various ItemVTable functions
...
Access to the window, in particular the scale factor, will be needed in a few places.
2020-09-15 15:55:47 +02:00
Olivier Goffart
4a0a65f113
C++ model that can be changed
2020-09-15 12:18:36 +02:00
Simon Hausmann
09142beac4
Make C++'s Color consistent with Rust's Color
...
sixtyfps::Color shall have the same minimal API by providing from_argb_encoded and as_argb_encoded.
2020-09-08 22:19:58 +02:00
Olivier Goffart
6065127581
Some progress towards signal with arguments
...
Generated code compile, but i haven't tested if it works yet
2020-09-08 17:41:20 +02:00
Olivier Goffart
a6504ee61b
Start implementing some code that passes argument to functions and signals
2020-09-08 14:37:44 +02:00
Olivier Goffart
a192ffe283
Make the C++ Signal class templated on the arguments
2020-09-08 13:11:32 +02:00
Olivier Goffart
e10ed650ee
Lookup of signal argument within a signal handler
2020-09-08 12:12:01 +02:00
Olivier Goffart
9f026c820d
Parse declaration of signal with arguments
2020-09-07 17:41:24 +02:00
Olivier Goffart
16f5cf42e3
Actually compute the layout of elements within a for loop
2020-09-07 14:04:14 +02:00
Simon Hausmann
ec36a50a25
Add support for warning diagnostics
...
They're emitted via codemap_diagnostics. For the Rust proc-macro we
generate a funny warning symbol until the proper APIs are stable.
2020-09-04 20:28:43 +02:00
Olivier Goffart
f6c8ea0f20
Make the Model/Repeater type safe in C++
2020-09-04 19:02:56 +02:00
Olivier Goffart
f5aeb9ba60
Only the computation of the model needs to be done in the evaluation scope for it
...
Otherwise any change in any of the properties of the delegate will cause
the model to be reset.
2020-09-04 15:37:38 +02:00
Olivier Goffart
9fbb40d91b
Start working on a debug statement
2020-09-03 19:10:07 +02:00
Simon Hausmann
fab3d9355d
Remove ItemVisitorRefMut and ComponentRef from the public C++ API
...
It's only for internal use and just typedefs to private types anyway.
2020-09-03 15:44:36 +02:00
Olivier Goffart
a36cb2d9b4
Layout: add a padding shorthand property
...
Also fix a bug in the C++ code generator where two layout have padding
in the same component
2020-09-01 13:29:13 +02:00