Simon Hausmann
c91a38cdce
Add support for embedding data in generated C++ code
...
This allows compiling with SIXTYFPS_EMBED_RESOURCES=true and
images/fonts are embedded as inline variables.
Generated data is emitted into the header file as
inline uint8_t sfps_embedded_resources_123[789] = {
0x1, 0x2, 0x3,
};
2021-10-05 15:05:50 +02:00
Olivier Goffart
2716e4b4dd
TouchArea: add the pointer-event
callback
...
... instead of `pressed-changed`
This allows to see what mouse button was pressed.
Closes #535
2021-10-04 14:39:49 +02:00
Simon Hausmann
4eef8c7688
Add API to sixtyfps::Image in Rust and C++ to access the optional path
2021-09-28 08:52:27 +02:00
Simon Hausmann
c3d0fd04af
Add C++ API to introspect exported global singletons in the interpreter
...
This adds the necessary shims to expose the same API as Rust.
2021-09-15 07:56:28 +02:00
Olivier Goffart
fafcbfde2c
Fix panic when trying to access layout cache of destroyed items
...
This can be reproduced by deleting the last item of the printer queue in the
printer demo.
It is a regression showing up because we now emit the MouseExit event after
the mouse grab as released.
The problem is that we upgrade the weak item, and call geometry() on it.
Calling geometry will re-evaluate the layout cache which will re-evaluate
the model which will result in the component being removed and the cache
entry having less item than expected.
It is ok to simply return 0. for these layout location since the item will
disapear anyway.
2021-09-08 14:42:08 +02:00
Olivier Goffart
619ce6c4f7
Struct exposed to .60 as struct need to be layed out in alphabetical order
...
because that's the order in which the C++ code generator pass the argument
to the agregate initialization
2021-09-05 09:29:00 +02:00
Olivier Goffart
092d5d551f
C++: add blocking_invoke_from_event_loop
...
A blocking version of invoke_from_event_loop
2021-09-01 23:19:13 +02:00
Olivier Goffart
e1be599bc0
Print an warning in stderr when modifying read-only model
...
... and improve the documentation of Model
2021-08-31 10:36:22 +02:00
Simon Hausmann
8de3075270
C++ docs: rework the entry points
...
Move the sixtyfps::namespace entry into a dedicated C++ integration overview
page. Also duplicate and specialize the instantiation and model bits, which
differ between the compiled code and the interpreter.
Finally, fix the generated C++ docs to not mention that there's a constructor,
instead we generate a constructor function.
2021-08-27 16:56:36 +02:00
Simon Hausmann
4b8259017b
Doc fixes
...
Try to use the term "global singleton" consistently. That's also the
term we use in the language reference.
2021-08-27 13:46:44 +02:00
Simon Hausmann
0bb586e70f
Minor documentation fixes for the globals access API
2021-08-27 13:36:48 +02:00
Olivier Goffart
70c57844b7
Add invoke_global_callback to the C++ interpreter API
2021-08-27 13:36:48 +02:00
Olivier Goffart
0fad27e23e
Add set_global_callback in the C++ interpreter API
2021-08-27 13:36:48 +02:00
Olivier Goffart
81688906f7
C++ Interpreter: add API to get/set global value
2021-08-27 13:36:48 +02:00
Olivier Goffart
59e1361388
Fix compilation with C++20
...
Fixes #428
2021-08-20 18:49:15 +02:00
Simon Hausmann
bcb200c547
Add an example for invoke_from_event_loop in C++
...
This way we can link from it from the blog and it looks maybe as good as in Rust :)
2021-08-18 10:12:34 +02:00
Tobias Hunger
aea4ecca99
Apply pre-commit hooks to all files
2021-08-17 22:38:16 +02:00
Simon Hausmann
a752c798b8
Changed C++'s SharedVector::clear() to not preserve capacity when shared
2021-08-12 13:41:08 +02:00
Simon Hausmann
511027dad0
Implement SharedVector::clear() for C++
2021-08-12 13:41:08 +02:00
Olivier Goffart
7cc13d78c3
C++ Make the stron_ref and weak_ref of VRc atomic
...
To match the equivalent in rust
2021-08-12 12:59:50 +02:00
Olivier Goffart
9b869f2dc0
C++ Add a few asserts that the non-thread safe API is not called in a thread
2021-08-12 12:59:50 +02:00
Simon Hausmann
661f23760b
Fix build: Add missing non-const arrow/deref operators for VRc/Component
2021-08-03 10:32:04 +02:00
Simon Hausmann
e97ecea480
Fix constness in generated C++ API
...
run(), show() and hide() should not be const, as well as the window() accessor.
2021-08-03 10:32:04 +02:00
Simon Hausmann
9e4b067f38
Provide sixtyfps::Window
by reference in the C++ interpreter API
2021-08-03 10:32:04 +02:00
Simon Hausmann
341387c8d0
Provide sixtyfps::Window
by reference in the generated C++ API
2021-08-03 10:32:04 +02:00
Simon Hausmann
23da97bc75
minor cleanup
...
Rename window_ to window_rc for the private window member in the generated C++ struct.
2021-08-03 10:32:04 +02:00
Simon Hausmann
66891a299c
Start a new sixtyfps::Window API for Rust, C++, the interpreters and JS
...
The generated component now provides access to a Window type
via the window() accessor function.
This is part of #333
2021-08-03 10:32:04 +02:00
Olivier Goffart
07bf0974d7
C++: Expose conversion betwen Value
and Image
...
Closes #350
2021-07-26 14:12:32 +02:00
Olivier Goffart
0a46b367e2
C++: fix creating a gradient from a const reference to a color
2021-07-22 14:38:58 +02:00
Simon Hausmann
eaddbe664e
internal cleanup: Rename ComponentWindow to WindowRc
...
That's all it is nowadays, it's a wrapper around Rc<Window>. It's not an
alias because we need to also "wrap" it to C++ via cbindgen, but that's
about it.
2021-07-21 20:33:02 +02:00
Tobias Hunger
39984b27db
Janitor: Fix spelling in comments
2021-07-03 15:49:43 +02:00
Olivier Goffart
13bd828b96
Update license date
2021-07-02 15:55:54 +02:00
Simon Hausmann
adeb192f6e
C++ API: Make LinearGradientBrush and GradientStop private API
2021-07-02 15:34:16 +02:00
Simon Hausmann
f8abd57c3b
C++ docs: For the model bits, link to the for-in and ListView docs
...
Using an rst epiloge we can define global references that are even formatted
(using rst substitutions)
2021-07-02 12:32:28 +02:00
Simon Hausmann
69bbef529c
C++ docs: Link to the section of the generated code from the namespace intro
2021-07-02 09:56:52 +02:00
Simon Hausmann
4705415642
C++ docs: First draft of a sixtyfps namespace intro
2021-07-02 09:46:48 +02:00
Olivier Goffart
9b99b558ae
Spellcheck
2021-07-01 13:54:26 +02:00
Olivier Goffart
fe81590b07
Silence a bunch of MSVC warnings
2021-07-01 13:47:22 +02:00
Olivier Goffart
0d9daa1964
C++: silence a few conversion warnings with MSVC
2021-07-01 13:04:25 +02:00
Simon Hausmann
5d58d34e84
Document run_event_loop() and quit_event_loop()
...
The C++ versions were there before, but undocumented. The Rust version
for quit() was missing.
2021-06-29 16:12:00 +02:00
Simon Hausmann
3ab287223c
Silence exhale error
...
Doxygen would still generate xml for private_api::ArrayModel and would
try to resolve a reference to iself, which is not possible because we've
excluded the namespace:
```
stderr: (!) Critical error while generating the file for [/home/vagrant/sixtyfps/target/cppdocs/api/classsixtyfps_1_1Model.rst].Traceback (most recent call last):
File "/home/vagrant/.local/share/virtualenvs/docs-4wjFCyEr/lib/python3.8/site-packages/exhale/graph.py", line 2591, in generateSingleNodeRST
gen_file.write("{0}\n".format(node.baseOrDerivedListString(
File "/home/vagrant/.local/share/virtualenvs/docs-4wjFCyEr/lib/python3.8/site-packages/exhale/graph.py", line 393, in baseOrDerivedListString
link=nodeByRefid[refid].link_name
KeyError: 'classsixtyfps_1_1private__api_1_1ArrayModel'
```
Making the entire class as \private works around it.
Oddly, this isn't needed for IntModel, perhaps because it's not a template?
2021-06-28 14:18:45 +02:00
Olivier Goffart
640d178d9d
Fix compilation of the C++ interpreter
2021-06-28 12:16:59 +02:00
Olivier Goffart
ae114cf79d
C++: don't re-export private symbol in the public API
...
Use the cbindgen_private namespace dirrectly from the generated code
2021-06-28 12:03:49 +02:00
Olivier Goffart
16ba23ae47
Move StateInfo to the private namespace
2021-06-28 11:23:44 +02:00
Olivier Goffart
daff9e8e65
Move Callback and internal Models to the private_api namespace
2021-06-28 11:23:44 +02:00
Tobias Hunger
13d7f5e7bd
Janitor: Fix typos in comments and user-facing strings
...
Also adapt tests for error messages containing the fixed strings.
No behavior change is intended!
2021-06-28 08:32:25 +02:00
Simon Hausmann
8a8ff6d2e9
Work around doxygen complaining about lack of override function
2021-06-26 09:42:56 +02:00
Simon Hausmann
25820b57d4
C++: fix remaining doxygen warnings in image.h and string.h
2021-06-25 21:07:01 +02:00
Simon Hausmann
7e3e6faa31
C++: Fix remaining warnings in callbacks.h
2021-06-25 20:59:23 +02:00
Simon Hausmann
8e729fee95
C++: Fix remaining doxygen warnings in sixyfps_interpreter.h
2021-06-25 20:41:53 +02:00