Commit graph

29 commits

Author SHA1 Message Date
Jonathan Johnson
ab474e2b7d
Fixing example references to dependencies
Ensuring all examples use public paths to make copy/paste more likely to
be successful.
2024-10-10 09:06:43 -07:00
Jonathan Johnson
6726855ed0
Cleaning up figures usage in examples 2024-07-26 10:34:30 -07:00
Jonathan Johnson
15b8b3e452
Moved example generation into cushy
Undocumented and unsupported, but this allows generating example images.

This push is testing that the image makes it through CI.

Refs #125
2024-05-12 07:58:09 -07:00
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
eb20133116
Reinstating weak_clone and non-weak callbacks
Somehow I missed that my changes for weak callbacks broke the theme
editor. I thought I had it working with the try_get changes, but I
discovered several flaws in this approach.

In the end, ownership has been transferred to the CallbackHandle, and a
CallbackHandle can relinquish its reference to create weak graphs. This
is how weak_clone now works.
2024-01-04 13:56:26 -08:00
Jonathan Johnson
244797110e
Added to_ variants for into_ functions 2024-01-02 15:07:06 -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
2fe28729df
Directly depending on figures
While this was a workaround for a docs.rs issue (Px/Lp are not
linked), I decided having the shorter import path would look better in
the examples.

It probably wasn't necessary to update all of the references in the
internal code, but I decided it was worth the consistency.
2023-12-28 09:35:24 -08:00
Jonathan Johnson
df479e983e
Renaming crate to Cushy
Refs #117
2023-12-27 19:02:59 -08:00
Jonathan Johnson
f1a2a711ff
Multi-window support
Closes #91

There's some details to still figure out, which are in new issues:

- #109: When opening a window, no handle is returned that gives access to the
  window from the opener. Technically this can all be wired up manually,
  with exception of requeesting the window close.
- #107: How can a window close itself? Once we have a handle type, we still
  need a mechanism to allow a button on a window request that the window
  closes gracefully. The examples that currently close the window
  call exit instad.
2023-12-21 14:57:29 -08:00
Jonathan Johnson
7ae4374411
ColorSource picker 2023-12-15 14:01:31 -08:00
Jonathan Johnson
55eea5fad3
Added Copy to Clipboard to theme editor
This also wires up the beginnings of the application type
2023-12-03 07:38:56 -08:00
Jonathan Johnson
3f8885efbe
Callback handles are now managed
Installing a callback now returns a CallbackHandle. All map-style APIs
install this handle automatically on the created dynamic, which keeps
the callback installed until the dynamic is freed. All other APIs
return the handle for the caller to either call persist() or store
somewhere.

Now, the dynamic system can be used for application-long data with
almost no fear of leaking data due to how callbacks are being installed.
Technically cycles are still possible by moving clones into the
callbacks, so a WeakDynamic type might be worth exposing.
2023-12-01 13:31:42 -08:00
Jonathan Johnson
b2fdf06e60
Dynamic now requires PartialEq
This reduces the complexity of operations capable with Dynamic, and also
makes it easier to shortcut deadlocking operations.
2023-11-23 11:53:59 -08:00
Jonathan Johnson
dd38fa7bf4
More fluent APIs 2023-11-22 05:54:35 -08:00
Jonathan Johnson
c39f8f33ad
Rewrote text input
Also implemnted secure/masked input

Closes #58
2023-11-16 15:34:26 -08:00
Jonathan Johnson
54e01f1911
Checkbox, ButtonKind, linked/linked_string + more 2023-11-14 20:39:29 -08:00
Jonathan Johnson
4c7c3be5ba
Helpers galore 2023-11-14 09:31:56 -08:00
Jonathan Johnson
b1ae9efae2
ColorScheme[Builder] 2023-11-13 16:28:20 -08:00
Jonathan Johnson
ee3813f44d
Switcher, h/v expand 2023-11-13 09:14:38 -08:00
Jonathan Johnson
96d407ddc2
Container, query_parent_style 2023-11-12 13:37:32 -08:00
Jonathan Johnson
849710dbb1
Diverging from material
Introducing two new colors:

- ColorTheme::color_dim, for dimmed/disabled primary colors
- SurfaceTheme::opaque_widget, for buttons.

In material design, a button's background color uses the Highest
Container role, which seems incorrect because then buttons wouldn't have
a different color when placed inside of the highest level container.

Rather than remove a container level, I added one more tone using the
neutral variant.

Other changes are just gut feelings to have a slightly richer dark
theme. I feel like material is a little muddy in dark mode.
2023-11-12 07:55:28 -08:00
Jonathan Johnson
d07dcdc9aa
Paired dynamics are now possible
Also sliders look better
2023-11-11 16:51:07 -08:00
Jonathan Johnson
019412543c
Lerp for ThemeMode 2023-11-11 13:47:35 -08:00
Jonathan Johnson
27d5baef5d
ThemeMode 2023-11-11 13:41:34 -08:00
Jonathan Johnson
eb4b24f4a9
Slider 2023-11-11 09:42:53 -08:00
Jonathan Johnson
d844a44b33
Refactored LabelBackground to WidgetBackground 2023-11-10 18:15:45 -08:00
Jonathan Johnson
81f6f8c4d3
Theme example reacts 2023-11-10 18:11:31 -08:00
Jonathan Johnson
89dcffdda7
Added theme visualizer example
A very good test of the stack widget.
2023-11-10 13:26:44 -08:00