Commit graph

179 commits

Author SHA1 Message Date
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
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
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
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
919cc3065f C++: Fix remaining doxygen warnings in sixtyfps.h 2021-06-25 20:33:03 +02:00
Simon Hausmann
929dd8dbf4 Fix various doxygen warnings
and hide some internal members from doxygen
2021-06-25 20:26:33 +02:00
Simon Hausmann
2e4abc61e0 C++: Hide internal macros from documentation
That's SIXTYFPS_GET_ITEM_VTABLE, SIXTYFPS_DLL_IMPORT and
SIXTYFPS_QT_INTEGRATION
2021-06-22 08:27:08 +02:00
Simon Hausmann
51bc21c9a5 C++: Hide AbstractRepeaterView, Repeater and ModelPeer
These are not public API.
2021-06-21 15:50:58 +02:00
Simon Hausmann
7f8f1b3105 Hide Property<T> and PropertyTracker<T> from the public C++ API
Move those two classes into the private_api namespace, which is excluded
from the API reference documentation.

For generate code the explicit qualification of Property<T> is changed,
for the cbindgen generated item types the private_api namespace is
pulled into the cbindgen_private namespace.
2021-06-21 15:50:58 +02:00
Simon Hausmann
3587d49445 Hide sixtyfps::Repeater::RepeaterInner from the C++ docs 2021-06-18 17:15:39 +02:00
Olivier Goffart
a0bea36e43 Fix preferred size of the Window with a layout
A few problem:
 - the horizontal and vertical property were swapped
 - The implementation of the "preferred_xxx" property was not materialized properly
   because the `bindings` were borrowed in the materialize_fake_properties pass
 - Since the Window has a stretch factor of 0., the preferred size of the inner layout
   was not taken into account when merging the LayoutInfo.  I believe taking the
   maximum preferred size is the right solution when merging them.
2021-06-18 13:51:25 +02:00
Olivier Goffart
cfc04bb4ab C++: adapt to the layout horizontal/vertical split 2021-06-16 15:14:07 +02:00
Olivier Goffart
4584c40544 Rename items::Image to ImageItem
Because there will be soon a sixtyfps::Image and the names
can't clash
2021-05-28 17:05:16 +02:00
Olivier Goffart
aabd320e83 C++ Api to run a functor from a thread 2021-05-11 16:42:59 +02:00
Olivier Goffart
ba1aff84d0 Layout refactoring: C++ part 2021-05-11 14:59:57 +02:00
Olivier Goffart
720001a223 Remove the solve_layout from the component vtable
no longer required
2021-05-11 14:59:57 +02:00
Simon Hausmann
c6a4841cd4 Simplify item vtable retrieval in C++
Use a macro instead of a template function to make the getter vs. global
symbol choice.
2021-05-11 07:55:51 +02:00
Simon Hausmann
28701d2f90 Fix item vtable usage on Windows
The item tree is intended to be initialized with pointers to the item
vtables, which are implemented using data relocation records that
resolve to the symbols exported by the sixtyfps_cpp shared library.

On windows, according to

    https://docs.microsoft.com/en-us/cpp/c-language/rules-and-limitations-for-dllimport-dllexport?view=msvc-160

such data relocations are not supported, so this patch implements the
fallback through getter functions.
2021-05-10 22:54:06 +02:00
Simon Hausmann
4198513832 Add a dummy indirection in C++ for the item vtable access
This will allow for a compile-time decision in the future whether
to use the vtable symbol or getter function.
2021-05-10 22:54:06 +02:00
Simon Hausmann
98a91ec3e5 Generate item vtable symbol declarations via cbindgen xtask
... instead of declaring them by hand in sixtyfps.h

This will make it easier to introduce an indirection in one place.
2021-05-10 22:54:06 +02:00
Olivier Goffart
e7f5578617 Also make the repeater's is_dirty as Property in C++ 2021-04-27 11:24:19 +02:00
Olivier Goffart
ba2f2d5719 Add an Opacity element that does nothing 2021-04-15 10:17:52 +02:00
Simon Hausmann
afe3df6381 Remove the public API for registering fonts by path or memory chunk
This is not needed anymore in the light of being able to write `import "blah.ttf"` in .60 markup
2021-04-14 10:01:33 +02:00
Simon Hausmann
b8e621a76b Fix C++ build
Add the preferred size merging logic also to C++ LayoutInfo::merge.

Amends commit 843f52b3c5
2021-04-08 13:16:06 +02:00
Simon Hausmann
7ab518786f Re-run clang-format on sixtyfps.h 2021-04-08 13:10:41 +02:00
Simon Hausmann
d4178e0935 Avoid duplicate symbols when linking .o files
Mark some functions as inline to avoid generating symbols that would
produce duplicate errors when linking multiple .o files that include the
SixtyFPS headers.
2021-03-31 08:42:54 +02:00
Simon Hausmann
4cbcf2611f Fix recurring C++ timers
* sixtyfps_timer_start needs to *take* the timer id out of the Rust
  timer to avoid that the subsequent drop stops the timer again
* For the Qt event loop, call `timer_event()` once before entering
  QCoreApplication::exec(), to schedule any timers that were started
  beforehand.
* Added a way to quit the event loop gently, in order to use that
  from the C++ unit test.
2021-03-25 20:07:12 +01:00
Olivier Goffart
0e351de1a6 Create a new crate to expose the C++ 2021-03-16 16:34:02 +01:00
Simon Hausmann
1b870959e6 Use the Noto fonts from the C++ build of the printer demo
This adds API to register a font by path from C++
2021-02-22 11:17:39 +01:00
Olivier Goffart
b34a34cea0 C++ Make sure that the layout is properly updated when the model of a for or if changes
The problem is that the backend is using the `meta_property_listener` to know
if the layout must be updated, but the C++ code would not register a dependency

NOTE about the test: The test doesn't really test that it works because
the test backend don't have a meta_property_listener and apply the layout
inconditionally in sixtyfps_send_mouse_click
2021-02-18 09:40:12 +01:00
Simon Hausmann
500919745e Add an internal Rotate element
This is just a starting point, to be turned into a real Transform
element later, along with syntactic sugar to turn rotation, etc.  into a
transform matrix in the generated output.
2021-02-12 17:31:06 +01:00
Olivier Goffart
096f55e365 Change behavior of percent sice within the layout
So that size with percentages don't affect the maximum/minimum size

Fixes #117
2021-02-11 20:32:26 +01:00
Simon Hausmann
2dd5ea61bb Add support for Path.fill-rule
For some reason it's not working with the Qt renderer though
2021-02-10 14:08:32 +01:00
Simon Hausmann
57d3a34996 Prospective fix for doc errors
In the nightly it appears that `no_mangle` is now considered "unsafe",
so we need to allow that in the ffi modules. For the layout code this
patch also creates that ffi module with prefixed function names, like in
the other modules and only allows unsafe in there.
2021-02-10 11:26:28 +01:00
Olivier Goffart
647f7effcd Add TextWrap and TextOverflow enum and corresponding property in Text
Although they ar enot working yet
2021-01-27 11:40:09 +01:00
Olivier Goffart
9de5af75ce Allow FocusScope to reject the events 2021-01-26 17:05:31 +01:00
Simon Hausmann
628e6fdb38 Add a BoxShadow element
This intends to provide a configurable rectangular "drop shadow". The
API is modeled after CSS/HTML5 Canvas where the element can be "bound"
to an existing rectangular shape (geometry and radius), the offset can
be used to place the shadow and color and blur configure the shadow.

The shadow's color fades into transparent.

TODO (in subsequent changes):
 * Documentation
 * Qt implementation
2021-01-26 13:56:12 +01:00
Olivier Goffart
0cb51a986f Attempt to fix MSVC build 2021-01-26 13:47:34 +01:00
Olivier Goffart
c2982d9ab3 Add ability to get the parent item from the vtable
(still untested)
2021-01-26 10:36:37 +01:00
Olivier Goffart
c2dc0cef2c Finish return statement handling 2021-01-25 15:32:00 +01:00
Simon Hausmann
2801e82658 Changed the KeyEvent in .60 to be an object
This exposes the text as well as the keyboard modifiers and is a little
more extensible.
2021-01-22 18:05:34 +01:00
Olivier Goffart
094287697a Add a FocusScope
C++ part not working because the Callback with arguments are not yet supported with C++
2021-01-20 10:00:19 +01:00
Simon Hausmann
5f265ffc09 Split up ComponentWindow::run() into show(), hide() and sixtyfps::run_event_loop()
This allows creating multiple windows for example, and it will allow for
showing windows in those tests that require a mapped window.

As a bonus, the run() function on generated components is not consuming
anymore.
2021-01-19 09:50:22 +01:00