Olivier Goffart
53775465dc
C++: add version macro
...
Fixes #705
2021-12-06 15:36:16 +01:00
Olivier Goffart
e4bd6bbfb8
Native style: respond to the StyleChange event
...
So that color scheme is updated when switching to the dark style, for example
Fixes #687
2021-11-29 17:18:23 +01:00
Olivier Goffart
c15a59892a
C++: use the const version of begin and end from SharedVector::clear
2021-11-26 15:12:21 +01:00
Olivier Goffart
d9637816bb
Fix memory leak in the C++ SharedVector
...
detaching in the destructor is not a good idea, make sure to use the const version
2021-11-26 15:02:46 +01:00
Olivier Goffart
789ac719eb
Make the parent_item function work with repeater component
2021-11-01 16:11:38 +01:00
Olivier Goffart
d26e95fb95
C++: Fixed sixtyfps::blocking_invoke_from_main_loop
when the callable returns void
...
Fixes #623
2021-11-01 10:51:13 +01:00
Simon Hausmann
096fbab93d
Simplify the destructor of generated C++ components
...
Similar to the parent commit, avoid creating an array of item refs and pass the item tree instead
to a run-time helper function.
2021-11-01 10:19:17 +01:00
Olivier Goffart
567c644a5f
Fix PopupWindow position when all elements are not inlined
...
Pass a reference to the parent item in the show_popup function
so we can compute the exact location at runtime.
2021-10-28 15:52:29 +02:00
Simon Hausmann
d420d5efd7
internal cleanup: Rename Property::set_dirty() to mark_dirty()
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
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