Commit graph

190 commits

Author SHA1 Message Date
Simon Hausmann
727c9a19f7 Add basic text item support
This needs more work, but gets something onto the screen at least.
2021-01-14 08:53:13 +01:00
Olivier Goffart
9050c29305 Don't use the window through the eventloop module 2021-01-14 08:53:13 +01:00
Olivier Goffart
16f5a03c14 Run cargo fmt 2020-12-18 10:29:15 +01:00
Olivier Goffart
dfa25b96f7 Rename SharedArray to SharedVector 2020-12-18 10:26:07 +01:00
Olivier Goffart
0d2d48be4f Rename "signal" to "callback" 2020-12-18 09:51:01 +01:00
Olivier Goffart
63a0d9308b Bump version 2020-12-14 08:49:54 +01:00
Simon Hausmann
c72c2a58ff Fix Rust docs about generated API 2020-12-09 16:48:02 +01:00
Olivier Goffart
77dc3a2ca9 Update the version in the README and doc as we prepare the release 2020-12-09 15:34:41 +01:00
Olivier Goffart
125ec13f24 Bump version numbers
Note: this does not update the documentation yet
2020-12-07 15:41:29 +01:00
Simon Hausmann
26cb05724e Implement Clone for sixtyfps::Weak 2020-12-03 14:41:25 +01:00
Simon Hausmann
23d54b1b89 Improve similarity of testing APIs between C++ and Rust
Let send_mouse_click also take a component reference, like in C++.
2020-12-03 13:35:10 +01:00
Simon Hausmann
4670854500 Remove as_ref from the public API of the generated Rust component
This was only needed in our tests.
2020-12-03 13:31:58 +01:00
Simon Hausmann
47152eee89 Remove the sixtyfps::Component trait
It is not needed anymore
2020-12-03 09:16:20 +01:00
Simon Hausmann
83191c82cc Remove ComponentHandle and ComponentWeakHandle 2020-12-03 08:13:40 +01:00
Simon Hausmann
4f412dcde4 Fix up the docs of the sample component for the new wrapping API 2020-12-03 08:13:40 +01:00
Simon Hausmann
7047856d4e Replace FooRc with Foo and without ComponentHandle in examples and tests 2020-12-03 08:13:24 +01:00
Simon Hausmann
dd64226dc1 Implement sixtyfps::Weak
This is the counter-part to the strongly referencing type the compiler
generates for components.
2020-12-03 08:13:15 +01:00
Simon Hausmann
ff1d752bc6 First step towards a wrapping public component API without ComponentHandle
For now the compiler also generates FooRc next to Foo, which wraps a
strong reference (VRc) to Foo.

This is an intermediate step and at the end of the series FooRc should
replace Foo and sixtyfps::ComponentHandle.
2020-12-03 08:13:15 +01:00
Simon Hausmann
2472eb51f0 Add the plaster font to plaster theme of the slide puzzle
For regular builds this is done by adding Rust API that allows
registering a font, and for the web the font is installed into the
browser using JavaScript API.

This is an initial approach to just add this ability. It might make
sense to introduce a syntax in the `.60` file to allow for the
registration of fonts and letting the compiler generate code that
performs this embedding and registration automatically.
2020-11-27 14:29:56 +01:00
Olivier Goffart
8a64f10e84 Remove ComponentVtable::input_event
And the custom handling of the mouse grabber
2020-11-24 16:23:37 +01:00
Olivier Goffart
2e60afec39 Run cargo fmt 2020-11-23 12:08:23 +01:00
Olivier Goffart
596b740b62 Rename ARGBColor to RgbaColor 2020-11-23 11:47:47 +01:00
Olivier Goffart
20b4d8826b Make the extra documentation page a bit more visible 2020-11-23 10:55:05 +01:00
Olivier Goffart
32f23f4c3e Add semi colon on the docs.
The run statement returns `()` so it is easier to copy/paste it if it has the semicolon
2020-11-23 10:31:34 +01:00
Simon Hausmann
89e0b57627 Rework and simplify the focus handling
Instead of determining the focus item through item tree traversal and
pointer comparison and storing the intermediate indices in the
components in the tree, remember the focus item by a pair of
VWeak<ComponentVTable, Dyn> and item_index: usize.

This speeds up determining the focus item as well as delivering events,
which can now be done directly after retrieving an ItemRef with
get_item_ref.

This also fixes the duplicate line edit focus in the 7gui cells
test case.
2020-11-20 15:33:15 +01:00
Olivier Goffart
cfa9413861 More work on the state binding for transition:
When there is a transition, turn the state property into a property of StateInfo

Not yet implemented for C++
2020-11-19 12:43:28 +01:00
Olivier Goffart
0672f4b3cd Expose Timer API to rust API
And use it in the puzzle demo to implement the auto play mode
2020-11-16 12:17:02 +01:00
Simon Hausmann
a2dadf8fe8 Remove the component parameter from GenericWindow::process_key_input 2020-11-11 19:16:26 +01:00
Olivier Goffart
503567d84c Update the documentation after the changes to ComponentHandle 2020-11-09 15:08:08 +01:00
Olivier Goffart
a1f1fcb3a6 Use VRc<ComponentVTable> in the rust generated code 2020-11-09 14:58:37 +01:00
Olivier Goffart
2ece3817cc Make ModelHandle a struct
Last commit broke for structures containing models, because models are not PartialEq.
So we need to implement PartialEq for ModelHandle. Which means a struct needs to
be created
2020-10-31 13:32:19 +01:00
Olivier Goffart
263df7dc63 Remove the www from all sixtyfps.io URL 2020-10-29 11:06:06 +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
aeade826fe New runtime implementation for the box layout
Currently only horizontal layout is supported
2020-10-26 14:19:12 +01:00
Olivier Goffart
20cfb65e53 Bump version 2020-10-22 08:41:45 +02:00
Olivier Goffart
c50b9d73d3 Document the generated C++ code 2020-10-21 11:29:25 +02:00
Olivier Goffart
45e8c94535 Some more documentation for the rust backend 2020-10-21 10:35:42 +02:00
Simon Hausmann
0c8fcb5f7a Some edits to the type mappings section of the node docs
Also use a consistent section title throughout.
2020-10-21 09:44:21 +02:00
Olivier Goffart
0c253efb0d Some changes in the rust documentation and its README 2020-10-20 18:02:28 +02:00
Simon Hausmann
dd55f5205d Replace wildcard version with the released one for now 2020-10-13 15:10:24 +02:00
Olivier Goffart
a650f29abe Rename sixtyfps-rs-macro to sixtyfps-macros 2020-10-13 11:10:26 +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
4169254169 StandardListView in rust 2020-10-08 16:22:16 +02:00
Olivier Goffart
1b506a1b03 Move ther model code from the rust API to the corelib
We will need it in the dynamic component
2020-10-02 18:11:35 +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
Simon Hausmann
7ca66d62b9 Fix crash in TextInput when deleting a left-directed selection
When selecting to the left, the anchor remains to the right of the cursor.
When deleting such a selection, we fetch the cursor and anchor using a helper
method, which ensures that the anchor is to the left of the cursor.
Finally when setting the cursor then to the anchor, we need to also
set the anchor, since both were swapped.

This also add an automated test for this scenario.
2020-09-23 17:33:09 +02:00
Simon Hausmann
7053aee0c8 Pass the ComponentWindow to ItemVTable::input_event 2020-09-18 16:18:48 +02:00
Olivier Goffart
cbd8c6aefc Documentation for the newly added struct type 2020-09-17 13:14:01 +02:00