Commit graph

362 commits

Author SHA1 Message Date
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
Olivier Goffart
e3459f39d4 Parse two ways bindings 2020-09-23 14:06:08 +02:00
Olivier Goffart
315fd7a881 Start doing a ScrollArea element
Unfortunately something is wrong with the Qt style, it looks like the Qt style
does not respect the rect given for the sub components

Also Input is not handled yet.
2020-09-22 20:05:41 +02:00
Olivier Goffart
b36a9004ef Move the RepeaterInner in a Rc and use that for the ModelPeer 2020-09-21 15:23:24 +02:00
Simon Hausmann
93a08c5207 Add a LineEdit widget to the ugly and native style 2020-09-18 18:54:37 +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
cbd8c6aefc Documentation for the newly added struct type 2020-09-17 13:14:01 +02:00
Olivier Goffart
8134fe5088 Support for named type as property 2020-09-17 13:14:01 +02:00
Simon Hausmann
3e8e357dec Reformat sixtyfps_properties.h
Further changes coming up
2020-09-16 16:56:54 +02:00
Olivier Goffart
913d680333 Recactor rust Model after first round of API review
- Remove EmptyModel and use an Option
 - Make ModelRc a type alias
 - Rename ArrayModel into VecModel
2020-09-16 14:25:57 +02:00
Simon Hausmann
2150d1784e Prospective MSVC build fix
Use the std type instead of uint, that seems to be not known to MSVC without additional includes?
2020-09-16 13:56:28 +02:00
Simon Hausmann
ad77896312 Change the way Text's default color is implemented
Instead of via an item constructor, implement support for default
bindings in the compiler.
2020-09-16 13:41:18 +02:00
Simon Hausmann
b99e4817cd Reformat the file
(to reduce diff in further changes)
2020-09-16 08:56:29 +02:00
Simon Hausmann
625cb6c6b8 Add a constructor to Text and let the color default to black
We really shouldn't require specifying a color for every Text {} element just in order
to see *some* text.

For Rectangle OTOH transparent is a good default (and thus for Color), hence
this change just to Text.

Right now the constructor bit is also a bit repetitive, this could
perhaps be folded into BuiltinItem to generate the ffi, default impl and
forward to an init function if it exists.
2020-09-16 08:20:13 +02:00
Olivier Goffart
4da5f5eee6 C++: Make a model based on a SharedArray like in C++
And make the SharedArray editable
2020-09-15 15:01:33 +02:00
Olivier Goffart
2ae4f1757b Rename model method to match the rust API 2020-09-15 14:10:07 +02:00
Olivier Goffart
4a0a65f113 C++ model that can be changed 2020-09-15 12:18:36 +02:00
Simon Hausmann
546818ee55 Add key event data structures and event function boiler plate 2020-09-15 11:16:55 +02:00
Olivier Goffart
b41e80b7db C++ Tests add an assert_eq macro
More consistency with rusts tests
2020-09-15 10:19:22 +02:00
Olivier Goffart
0d8a38577d Todo example: make the "add todo" button do something 2020-09-14 16:38:45 +02:00
Olivier Goffart
4de2e57175 Use a Model trait in the rust backend 2020-09-14 14:02:34 +02:00
Simon Hausmann
26ae1bfdb2 Add From<String> and Into<String> for SharedString 2020-09-14 08:49:41 +02:00
Simon Hausmann
0dc81895ed Exclude SharedArray::SharedArrayHeader from the C++ docs 2020-09-11 18:35:27 +02:00
Simon Hausmann
29a9bd05eb Remove Pin, etc. typedefs from C++ docs
Exclude everything from vtable.h, and apply the same logic for sixtyfps::testing.
2020-09-11 18:16:17 +02:00
Simon Hausmann
dd6c931237 Hide sixtyfps::testing* from the C++ docs 2020-09-11 18:12:34 +02:00
Simon Hausmann
a3f917652a Exclude VOffset and VRefMut from the C++ docs 2020-09-11 18:11:56 +02:00
Simon Hausmann
831cf902fe C++: Add constructors to and from ARGBColor/Color 2020-09-11 18:08:37 +02:00
Simon Hausmann
520df89e2c Add the same (a)rgb_(uint8/float) functions in C++ Color as in Rust 2020-09-11 17:55:52 +02:00
Simon Hausmann
3c2172d043 Use new-style intra-crate rust-doc links instead of relying on .html links 2020-09-09 18:53:59 +02:00
Olivier Goffart
8761ca80a3 Add SharedArray::push and adjust a bit the API 2020-09-09 18:47:15 +02:00
Olivier Goffart
42aa91e3eb Support for signal with arguments in the interpreter 2020-09-09 11:27:58 +02:00
Simon Hausmann
8a70651038 Provide docs for C++ SharedString 2020-09-09 08:34:52 +02:00
Simon Hausmann
e87a650c46 Add SharedArray to the public Rust API 2020-09-08 22:54:58 +02:00
Simon Hausmann
25584317e8 Implement ARGBColor<T> for the C++ API
As discussed in the last API review.
2020-09-08 22:52:40 +02:00
Simon Hausmann
52b19606d1 Provide red/green/blue/alpha getters for Rust and C++ Color
And fix up the C++ class docs.
2020-09-08 22:32:15 +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
Simon Hausmann
02b3bce6dc Reformat sixtyfps_color.h 2020-09-08 22:13:17 +02:00
Simon Hausmann
19cce012a0 Add ARGBColor<T> to the color API
As discussed in the last API review, this replaces the as_rgba_f32/u8
"accessor" functions by returning a struct with named fields.
2020-09-08 22:11:23 +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
Simon Hausmann
6f8018127a Fix standalone node api build
Right now the code calls print() on the diagnostics, so we do need the display-diagnostics feature of the compiler lib.
2020-09-07 20:40:06 +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
3f45b545ff C++: Don't return model data by const value
Prevetn warning
2020-09-07 12:50:08 +02:00
Simon Hausmann
ccce46748f Remove trailing slash from docs symlink
Windows git seems to like that better
2020-09-07 11:22:55 +02:00
Olivier Goffart
72df23637d CMake: on windows need to add the IMPORTED_IMPLIB 2020-09-06 14:54:05 +02:00
Olivier Goffart
8465773b9b More fix for windows, make sure that slashes are escaped in the sixtyfps macro 2020-09-05 18:34:04 +02:00
Olivier Goffart
ae90a59513 Attempt to fix the window build by bringing a git version of neon 2020-09-05 17:26:09 +02:00
Simon Hausmann
49cf743a15 Fix wasm interpreter build 2020-09-04 21:53:17 +02:00