Commit graph

32 commits

Author SHA1 Message Date
Simon Hausmann
8596cca549 Fix model length tracking in the interpreter
Added the missing tracking call and fix the test to cover this properly.
2021-10-20 15:25:28 +02:00
Simon Hausmann
7d12fd7b4e Add support for tracking the length of a model in C++
Similar to the parent commit, the model tracks changes to the rows and
marks an internal property dirty. Since we have a base class this is a
little less intrusive.

cc #98
2021-10-20 15:25:28 +02:00
Simon Hausmann
63bf1af093 Add support for tracking the length of a model in Rust
This is done by exposing the ModelNotify to the caller via the new
ModelTracker trait, which has a function that allows "hooking" into the
dirty tracking of the size.

By extension, this also works in JavaScript.

cc #98
2021-10-20 15:25:28 +02:00
James Blacklock
b409ee8cbe add license header to test case 2021-10-18 10:21:06 +02:00
James Blacklock
36f4b32506 use shared pointer in cpp test 2021-10-18 10:21:06 +02:00
James Blacklock
1f0a5a6d7c fix formatting & cpp test case 2021-10-18 10:21:06 +02:00
James Blacklock
642e4b539a (hopefully) fix cpp generation 2021-10-18 10:21:06 +02:00
James Blacklock
25f14ab58c add test case 2021-10-18 10:21:06 +02:00
Simon Hausmann
5742a122ed Fix listview not updating its geometry in Rust when the entire model is changed
The geometry tracker did not track the model property itself, so it did not become dirty.

Fixes #500
2021-09-15 08:49:27 +02:00
Olivier Goffart
5f1cf00fe7 Add test that make sure that reading from a model after writing to it works 2021-08-24 12:59:40 +02:00
Tobias Hunger
aea4ecca99 Apply pre-commit hooks to all files 2021-08-17 22:38:16 +02:00
Olivier Goffart
74bc9521b9 Fix the scope while resolving a model expression
The `self` was always referring to the `root` instead of the enclosing
element.
2021-07-26 11:08:46 +02:00
Olivier Goffart
13bd828b96 Update license date 2021-07-02 15:55:54 +02:00
Olivier Goffart
42c25248a8 Allow to give a name to for and if 2021-06-18 16:40:40 +02:00
Simon Hausmann
89c3423ec3 Fix some deprecation warnings in the tests 2021-02-03 15:09:41 +01:00
Simon Hausmann
e61529976e Issue warnings when creating bindings against deprecated properties 2021-02-02 22:42:02 +01:00
Olivier Goffart
a36edfffbe Change the C++ test API of the send_mouse_click
So that rust and C++ have the same code that can be copy pasted
2021-01-29 16:55:48 +01:00
Simon Hausmann
ecedb18333 Fix build
Don't use C++ types as field names for now
2021-01-25 14:40:02 +01:00
Simon Hausmann
d5e72b255a Fix build when structures contain models
The generated code for structs includes #[derive(Debug)],
which requires Debug for all fields. When the field is a ModelHandle
it's up to us to provide an implementation.
2021-01-25 14:20:13 +01:00
Olivier Goffart
0d2d48be4f Rename "signal" to "callback" 2020-12-18 09:51:01 +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
7047856d4e Replace FooRc with Foo and without ComponentHandle in examples and tests 2020-12-03 08:13:24 +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
d6a440aa4a Change C++ API to use the ComponentHandle 2020-11-10 19:28:34 +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
Simon Hausmann
7905285562 Change the Model API for the NodeJS Integration to use CamelCase 2020-10-20 16:40:49 +02:00
Olivier Goffart
14198052ac ArrayModel support in JS 2020-10-17 13:33:22 +02:00
Simon Hausmann
6aa292eac1 Change the names of the logical and physical pixel units
The logical pixels are now just called "px" and the less frequently
used physical pixels have the "phx" suffix.

The existing markup was adapted using the syntax updater and the
following patch:

    +    if node.kind() == SyntaxKind::NumberLiteral {
    +        if node.text().ends_with("lx") {
    +            return write!(
    +                file,
    +                "{}px",
    +                node.text().as_str().split_at(node.text().as_str().len() - 2).0
    +            );
    +        }
    +        if node.text().ends_with("px") {
    +            return write!(
    +                file,
    +                "{}phx",
    +                node.text().as_str().split_at(node.text().as_str().len() - 2).0
    +            );
    +        }
    +    }

Fixes #49
2020-10-16 07:19:40 +02:00
Olivier Goffart
13be880d66 Fix interpreter with empty model 2020-10-08 12:06:58 +02:00
Olivier Goffart
f01977ca06 Fix removing from model in C++ 2020-09-30 18:17:15 +02:00
Olivier Goffart
5fbe79006c Add test for writing to model 2020-09-30 18:15:53 +02:00
Simon Hausmann
c16f2f2185 Clean up test cases
Instead of all files collected in a flat directory, restructure them
into categories and thus sub-directories.
2020-09-29 17:00:48 +02:00