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
Simon Hausmann
13f845ee4f
Add support for property<percent>
2020-10-16 18:56:54 +02:00
Olivier Goffart
58193ff1c3
Fix resizing of listview should recompute the layout
2020-10-16 11:09:12 +02:00
Olivier Goffart
d57ad389e0
Default to the native style in the viewer if it is available
2020-10-14 14:51:47 +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
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
518c4ccf3d
ListView in the interpreter
2020-10-02 21:27:10 +02:00
Olivier Goffart
2314e59ab2
Refactor the repeater in the interpreter
...
Use the same Repeater as the rust backend
2020-10-02 21:26:47 +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
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
60cf022b69
Fix the two ways binding being flacky in the interpreter
...
The two way binding must be set at the end.
It is flacky because the order currently depends on the order in the Hashmap
2020-09-25 17:07:22 +02:00
Olivier Goffart
2d4f3ff50b
Two way bindings in the interpreter
2020-09-25 16:21:48 +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
0cb827a901
Two ways binding with optimized public property in the interpreter
2020-09-25 09:50:03 +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
2da84fee46
Add a boilerplate TextInput item
2020-09-18 16:34:24 +02:00
Simon Hausmann
7053aee0c8
Pass the ComponentWindow to ItemVTable::input_event
2020-09-18 16:18:48 +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
42aa91e3eb
Support for signal with arguments in the interpreter
2020-09-09 11:27:58 +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
Olivier Goffart
d924ec6bd9
Fix a bug when using layout within a for loop
2020-09-07 14:03:46 +02:00
Simon Hausmann
ff9c118e07
Propagate warnings to the end of the compilation step and print them
2020-09-04 20:34:20 +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
f5032ab0f8
Allow array as property
...
Also fix the lookup rules for the model property in a repeated element
2020-09-03 18:05:20 +02:00
Olivier Goffart
b2b5645195
Allow property of type object, and conversion between objects
2020-09-03 08:39:23 +02:00
Olivier Goffart
f1ad78bc25
Qt style support for the rust backend
...
Need to set the SIXTYFPS_STYLE=native env variable while compiling
2020-09-01 12:25:11 +02:00
Olivier Goffart
6d41b1981d
Move the Qt style to a new backend: the Qt backend
...
Currently the Qt backend still redirect everything to the GL backend,
but the goal is to use QPainter and QWindow
This also adds a "default" backend, whose goal is to select the proper
backend at compile time
2020-08-31 17:26:04 +02:00
Simon Hausmann
5dbd0b213c
Add support for grid layout padding
2020-08-28 15:06:14 +02:00
Simon Hausmann
7976a4057f
Improve handling of nested layouts
...
We support directly nested layouts, but we did not support indirect
nesting:
GridLayout {
Rectangle {
l2 := GridLayout { ... }
}
}
This patch fixes that by detecting this scenario and merging the layout
info of the element (Rectangle) and the layout inside (l2). This makes
it much easier to create re-usable components that use layouts
themselves and allows placing them in layouts.
2020-08-28 15:06:14 +02:00
Simon Hausmann
2806633254
Minor cleanup for grid layout handling in the interpreter
...
Let's re-use the evaluated spacing from the earlier layout
tree traversal.
2020-08-28 12:55:56 +02:00
Olivier Goffart
80dd7dcb04
Allow to specify the canvas id when creating a new window with wasm
2020-08-26 17:01:17 +02:00
Olivier Goffart
58cdaeb8dd
Update license header to mention that commertial option are available
2020-08-26 13:23:42 +02:00
Simon Hausmann
2823f32692
Apply license headers to all non-binary/non-json sources
2020-08-17 17:55:20 +02:00
Simon Hausmann
3a463fa104
Closes: Free GL resources when destroying items in the interpreter #12
2020-08-13 17:56:18 +02:00
Olivier Goffart
7e1af72a2e
Implement minimum/maximum width/height properties
2020-08-12 14:00:51 +02:00
Simon Hausmann
d3a474af26
Move corelib::Component and friends back into their dedicated component module
2020-08-12 11:39:07 +02:00
Simon Hausmann
b21aa4f9e7
Rename PropertyListenerScope to PropertyTracker
2020-08-12 11:31:33 +02:00
Simon Hausmann
0df86d7eeb
Move corelib::abi::datastructures::Component to corelib
2020-08-12 10:53:03 +02:00
Simon Hausmann
62a8b15f09
Move ItemVTable and frieds to corelib::items
...
To avoid ambiguities regarding the use of FieldOffset, the BuiltinItem
proc-macro uses fully-qualified type names now.
2020-08-12 10:10:51 +02:00
Simon Hausmann
aafb96cb93
Get rid of abi::datastructures::WindowProperties
...
Instead, pass a reference to the root item when mapping the window,
at which point we can downcast to the new Window item. If we have one,
then we'll read its width/height (for initial values) and install
bindings to keep them up-to-date.
2020-08-12 09:44:42 +02:00
Simon Hausmann
9fd7d35b0d
Remove stray scale_factor properties
2020-08-11 15:10:43 +02:00
Simon Hausmann
c1f91e38ca
Move the window scale factor into GraphicsWindow
2020-08-11 13:42:51 +02:00
Simon Hausmann
f2eec61968
Add a window to the top-level component
...
This means that we always have a window and for the C++
API we don't require this ComponentWindow use anymore.
2020-08-11 13:38:38 +02:00
Olivier Goffart
e013ea6c50
Refactor the interpreter by trying to use FieldOffset insdead of usize for offsets
...
Give a unique identifier lifetime to instance so that they cannot be mixed safely
2020-08-11 10:22:16 +02:00