Commit graph

1092 commits

Author SHA1 Message Date
Lukas Jung
87fe9fe836 Set the mouse-cursor when hovering a TouchArea 2021-12-07 22:41:24 +01:00
Lukas Jung
f0a47ff154 Add mouse-cursor property to TouchArea 2021-12-07 22:41:24 +01:00
Simon Hausmann
0a60cb1a66 Fix clipping optimiztion for box rectangles
The geometry of the box shadow element does not include the offset and
the blur. So our clipping may ignore the shadow when it shouldn't. This
could be changed by making geometry() return bounds that include the
blur and offset, but that in turn will add a visual offset when a
repeated rectangle has a shadow, because the shadow because the root of
the repeated element and the previous rectangle a child.

Fixes #713
2021-12-07 13:06:31 +01:00
Olivier Goffart
cd47ef1100 Mark properties that we know are never modified as constant,
so that we don't need to register dependencies when accessing them
2021-12-04 22:00:12 +01:00
Olivier Goffart
a90013983b Add a way to debug the properties behind a configuration flag
I used a `#[cfg(..)]` instead of a feature flag because then it is enabled
for both the compiler and the lib at the same time, and since it is only a debug stuff
it does not need to be enabled within the project. So one must enable it with
`RUSTFLAGS='--cfg sixtyfps_debug_property'`
2021-12-04 22:00:12 +01:00
Olivier Goffart
ffe561f8d8 Use SharedVector internally in SharedString
Get rid of the triomphe dependency
2021-12-02 12:42:30 +01:00
Simon Hausmann
6ca63aac9c Make it possible to delegate the timer handling to the backend
When building with no_std, the backend can provide the global
instant.
2021-11-30 17:27:55 +01:00
Simon Hausmann
bf84bb2ab6 Make floating point operations compile with no_std
Use num_traits and libm instead, also for euclid.
2021-11-30 15:33:50 +01:00
Simon Hausmann
e8302452b5 Make it possible to compile sharedvector and sharedstring with atomic-polyfill 2021-11-30 15:32:47 +01:00
Simon Hausmann
855ef6375e Minor no_std build fix
Use core::time::Duration instead of std::time
2021-11-30 12:57:45 +01:00
Olivier Goffart
5a5e87e3cb Even more fix to no_std thread_local 2021-11-30 09:52:14 +01:00
Olivier Goffart
9a7387e2a6 Another small fix for no_std 2021-11-30 09:38:33 +01:00
Olivier Goffart
4149563817 More fixes with no_std regarding statics and thread_locals 2021-11-30 09:33:39 +01:00
Olivier Goffart
e8271b8f1d Make corelib work without thread_local in no_std 2021-11-29 21:00:35 +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
a5ea6dd087 Models: re-implement the internal of model tracking
Don't rely on the weak-table that does not work with no_std,
instead, use the same data structure as for the property dependency
tracking
2021-11-29 17:15:56 +01:00
Olivier Goffart
d335ef01c6 Fix sixtyfps-corelib tests when they are run standalone 2021-11-29 17:15:56 +01:00
Olivier Goffart
d8e4c6a887 Properties: Refactor the Dependency tracking in a module
So it will be re-used by the models
2021-11-29 17:15:56 +01:00
RustemB
baa5e53fe9 Cut text using Ctrl+x 2021-11-29 16:29:07 +01:00
Olivier Goffart
844c5cf7ec Gate the Path item behind the 'std' feature 2021-11-25 16:53:07 +01:00
Olivier Goffart
5b4d6e8ece Disable the default-features of a bunch of crates 2021-11-25 12:02:16 +01:00
Olivier Goffart
763065fd0e Disable the std feature from strum
also use its derive feature
2021-11-25 12:02:16 +01:00
Olivier Goffart
80c0602277 WIP: start making the corelib crate a no_std crate
Does not compile yet with no_std because of the lack of
alternative for thread_local
2021-11-25 12:02:16 +01:00
ogoffart
3278b39549 Bump version number to 0.1.6 2021-11-24 14:19:09 +00:00
Olivier Goffart
d1cae710df preprocess the images at compile time
For the MCU port, we need to proccess the image to save them in the binary
in a convenient format.
This patch start this work by trying to anaylyze what format should an image
be using, and saving it as a texture in the binary.

The current graphical backend and the C++ frontend are not yet supported
2021-11-19 15:54:45 +01:00
Olivier Goffart
6bf224c9de Bump version of strum 2021-11-18 11:16:24 +01:00
Olivier Goffart
1bde79e884 Fix native widgets with C++ on windows
The function that expose the vtable was not exported because the declare_item_vtable
expanded to a `#[cfg(feature = "ffi")]` with the intention to be the ffi feature
of the corelib crate. But when this macro is used from the qt backend, the ffi
feature was not set
2021-11-18 10:23:06 +01:00
Olivier Goffart
a6425300fb Fix documentation warning
In wasm, the documentation eed to be repeated
2021-11-15 17:03:47 +01:00
Simon Hausmann
ad1b251966 Internal cleanup
Centralize the setting of the width/height on the window item in the core library.
2021-11-11 11:47:54 +01:00
Simon Hausmann
a10f832a93 Remove unused dependency 2021-11-10 10:54:56 +01:00
Olivier Goffart
973964c2e3 Fix warning in documentation because of a typo 2021-11-09 17:00:43 +01:00
Philipp Gesang
cd3717af9a handle tab keycode in backend
Treating the Tab key as text disallows handling Shift-Tab because
the shift modifier will not be passed down. This makes the
handling of Tab analogous to Escape, Return and other non-text
keycodes.
2021-11-08 16:04:37 +01:00
Simon Hausmann
13de800ba3 Internal cleanup: Rename layouting_info to layout_info
That's making the call on the Component VTable consistent(ish) with the Item VTable.
2021-11-08 10:24:30 +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
Simon Hausmann
67579ec560 Simplify drop implementation of generated components
Avoid creating an intermediate array of items to free the graphics resources.
Instead call run-time function with the item tree as a parameter, which is traversed.

It's practically the same data structure that was previously created, except
that it is shared/global and has little holes for the dynamic tree items, but those are easy to skip.
2021-11-01 08:58:53 +01:00
Simon Hausmann
d57edfbb7c Simplify free_graphics_resources API in the backend
Take an iterator reference instead of a slice, so that we can change the call sites in the future.
2021-10-30 13:03:52 +02: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
ogoffart
b25ae6fbcd Bump version number to 0.1.5 2021-10-26 07:36:54 +00:00
Simon Hausmann
7b687d020c Fix compatibility of attach_peer on ModelHandle for older models
If the model doesn't implement `model_tracker` then we must
forward `attach_peer`.
2021-10-21 13:39:38 +02:00
Olivier Goffart
cc1205742d Move the image dependency down in the dependency tree
Corelib only need the image crate for doc test
the Qt bakcned don't use the image crate
2021-10-21 12:42:04 +02:00
Olivier Goffart
56d592100e Update a few dependencies 2021-10-21 12:24:48 +02:00
Simon Hausmann
2ba469cf2a Fix vector model example docs
Re-implement model_tracker instead of attach_peer.
2021-10-20 15:33:37 +02:00
Simon Hausmann
d420d5efd7 internal cleanup: Rename Property::set_dirty() to mark_dirty() 2021-10-20 15:25:28 +02:00
Simon Hausmann
a494eafa9c Make Property::set_dirty public
Property is not public API yet, there's not much value in playing hide and seek.

Co-authored-by: Olivier Goffart <ogoffart@sixtyfps.io>
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
Olivier Goffart
e3d9abb1f7 ListView: Attempt to account for ListView with different item height
As an attempt to fix part of https://github.com/sixtyfpsui/cargo-ui/issues/10
2021-10-20 14:10:19 +02:00
Olivier Goffart
bb4e5d8b55 Fix animation not starting when set from a callback
Two problems:
 - We were not marking the property as dirty, so dependent property would not
   update themselves
 - In the generated rust/c++ code, we would not call set_animated_value
2021-10-13 14:33:40 +02:00
Olivier Goffart
b74ab8969e Implement Model::set_row_data for ModelHandle 2021-10-12 14:05:33 +02:00
Robert Broketa
c3c7765f80 Add no-frame property for a borderless/frameless window 2021-10-11 10:21:21 +02:00