Commit graph

6 commits

Author SHA1 Message Date
Jonathan Johnson
1c8d4e0176
ButtonClick + Overlays at locations
The overlay example now supports right-clicking to open overlays at the
clicked location, showing how a context menu widget can begin being
built.
2024-05-08 08:38:26 -07:00
Jonathan Johnson
46c4eb9ed8
winit 0.30 2024-05-01 12:49:03 -07:00
Jonathan Johnson
83e44912ee
ReadOnly<T>, Owned<T>, IntoSource<T>, more
Closes #98

This finishes my initial refactoring of the dynamic system to add
support for several dataflows including:

- Pure data sources that can be implemented using an `Owned<T>` at the
  root of a graph of `Dynamic<U>`/`DynamicReader<U>`s.
- Read-only data sinks. I thought this would be more useful across other
  widgets, but in general, Progress and Label seem like the only types
  that this applies to currently.
- The ability to mix/match Dynamic/DynamicReader in tuple-based
  for_each/map_each.
2024-01-02 14:36:53 -08:00
Jonathan Johnson
e70e92726c
Source<T> + Destination<T> (breaking)
Refs #98

This refactor overhauls the reactive system to move all the reactive
methods to traits. The side effect of this change is that now
DynamicReader's API is the same as Dynamic's API, but because it only
implements Source<T>, DynamicReader does not offer any mutation
functions.

While it's unfortunate to have more traits to include to use Cushy, this
seems like the best option, and it offers a path to try to integrate
this into the tuple ForEach/MapEach traits. Unfortunately, my attempt at
doing those in this set of changes led to issues specifying generic
associated lifetimes for the DynamicGuard. But, I was also in the middle
of this larger refactoring, so it might be that a fresh attempt will
succeed.
2024-01-02 09:00:29 -08:00
Jonathan Johnson
9e4e079bf5
WindowLocal + Custom Observers
This cascaded into a lot more work than expected. However, in general,
if one clones a `WidgetInstance` and shares it between two windows, it
should now work. Widget authors must ensure that when they cache
information, they do so with either a `WidgetCacheKey` or use a
`WindowLocal<T>` if per-window state is desired.

This is demonstrated in the debug-window example, where the counter of
open windows is next to a clone of the same button from the main window
that opens a new window.
2023-12-29 13:21:39 -08:00
Jonathan Johnson
3fc49d2424
Initial DebugContext implementation 2023-12-28 21:30:25 -08:00