Commit graph

323 commits

Author SHA1 Message Date
Jonathan Johnson
7bd13e2a0a
Added for_each_subsequent
Refs #156

The ForEach trait currently doesn't have a subsequent version, but given
the discussion in the related issue I think that's OK.
2024-06-07 09:08:14 -07:00
Jonathan Johnson
8c8dca63ba
Clarified some window builder documentation
Really the functions should be renamed -- see #155
2024-05-17 15:00:24 -07:00
Jonathan Johnson
3da08bca62
Fixed a crash in Switcher
I'm not sure exactly what caused this that other simpler cases were not,
but essentially nodes were already removed once by the time this loop is
evaluated, so we can skip adding them back to the list again.
2024-05-13 08:39:43 -07:00
Jonathan Johnson
774a846210
animate_mouse_button + more example recordings 2024-05-12 19:12:01 -07:00
Jonathan Johnson
568f2ca327
Added plotters example capture + animate_keypress 2024-05-12 14:23:29 -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
997cc9586f
Simplifying drop shadow
Also making example regeneration automatic in CI for the guide
2024-05-12 06:57:41 -07:00
Jonathan Johnson
b57188f80f
Added optional tokio integration
Closes #147
2024-05-11 21:25:54 -07:00
Jonathan Johnson
7f55b352b4
Export Menu + Finish Guide Stubs 2024-05-11 19:30:36 -07:00
Jonathan Johnson
07f1febe9f
Removed ChosenMenuItem
Also updated the changelog
2024-05-10 12:15:33 -07:00
Jonathan Johnson
c5f1832b3e
Disabled menu item support 2024-05-10 10:16:47 -07:00
Jonathan Johnson
b8410cd4ba
Separators in menus 2024-05-10 09:51:02 -07:00
Jonathan Johnson
38cdea9816
Submenu support in context menus 2024-05-10 09:10:39 -07:00
Jonathan Johnson
8b96966031
Basic context menus
Missing a ton of functionality (separators, keyboard accessibility,
submenus), but the basic concept is working.
2024-05-09 08:16:34 -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
46c4eb9ed8
winit 0.30 2024-05-01 12:49:03 -07:00
Jonathan Johnson
5e266f1551
Optimizing label text recaching
I had previously had similar logic in here, but I realized I couldn't
reliably detect if cosmic_text had done any wrapping or not. After a
discussion prompted me to see if recaching was happening while
scrolling, I realized I could at least allow the width to be >= the
measured text size and <= the requested layout width.

This prevents recaching while scrolling.
2024-04-07 14:33:50 -07:00
Jonathan Johnson
20ae2b7c72
map_each deadlock prevention
map_each previously was written such that if a chain of mappings fed
each other, a deadlock could occur because while the first one was
mapped, the second callback gets invoked and tries to update the first
value while it's still being held.

This refactor switches from std Mutex to parking_lot, allowing me to
remove a workaround for needing to run drop callbacks in a separate
thread during the drop of a DynamicGuard.

In addition to that change, the lower level `map_generational` calls now
take a DynamicGuard as their parameter. This allows these functions to
drop ownership of the referenced data during the callback.

The map_each implementation takes advantage of this by ensuring that the
guard is dropped before set is invoked, minimizing potential lock overlaps.

With this refactor, some old code of mine with complex validations now works
again.
2024-04-05 16:14:26 -07:00
Jonathan Johnson
beede55f0a
Added winit accessor
I originally removed this API to ensure no Cushy widgets were using
winit directly, but I've reintroduced it so that third party widgets can
still interact with winit if needed.
2024-04-03 09:13:36 -07:00
Jonathan Johnson
44759d4812
Fix when replacing an overlay
When an overlay handle dropped directly after pushing a new overlay, it
was possible for new overlays to be popped off improperly, causing a
subtraction overflow panic later.
2024-03-21 11:26:34 -07:00
Jonathan Johnson
abbf8d94d8
More Modifier helpers 2024-03-21 11:26:23 -07:00
Jonathan Johnson
173fb2d540
Allowing changing multisampling on all windows 2024-03-21 09:02:07 -07:00
Jonathan Johnson
74034760ce
OverlayLayer::dismiss_all 2024-03-20 11:40:20 -07:00
Jonathan Johnson
a63af0f9de
Exposing ModifiersExt 2024-03-19 10:17:28 -07:00
Jonathan Johnson
18abfc66f2
Added ability to disable vsync 2024-03-17 08:44:02 -07:00
Jonathan Johnson
3762bc6dc1
Dynamic font loading
Closes #145
2024-03-06 16:53:36 -08:00
Jonathan Johnson
9c4ae939e1
Implemented nested widget unmounted events
Closes #138

This implementation works around most of the locking issues that arose
the first few times I tried fixing this. Unfortunately it's been just
long enough for me to forget how I triggered some catastrophic issues in
the past, but all of the current examples that would invoke this
behavior continue to work, and some of the side projects that have some
weird usages also still work.
2024-03-06 09:50:29 -08:00
Jonathan Johnson
0e02a513bb
Updating dependencies
This makes the lockfile build against the new release of wgpu.
2024-03-06 09:21:43 -08:00
Roland Fredenhagen
641f4bf52d
Add MakeWidgetList
Adds functions to convert `impl IntoIterator<Item = impl MakeWidget>`
directly into `Stack`, `Layers`, etc.
2024-02-05 23:17:33 +01:00
Jonathan Johnson
0e5976de10
Dynamic::try_lock
Plus other minor changes.
2024-01-26 18:13:42 -08:00
Jonathan Johnson
3f8fed65c3
Added Chinese ListStyles
This may seem like a lot of options, but here's the reasoning:

- The CSS spec offers four variations: Simplified/Traditional and
  Formal/Informal. This spec defines a character set for all for
  variations, and it also associates rules for omitting digits in the
  informal variants.
- The chinese_number crate does not implement a variant that includes
  the tens digit, as required by the cSS spec for the formal variants.

To be able to provide the enumerations that the CSS spec offers *and* to
provide the variations that the chinese_number crate supports, I've aded
8 total list styles for selecting a specific Chinese variation.

Technically nominals supports even more options, but the myriad counting
scale coveres u128::MAX and seems to be the most common counting style.
2024-01-18 15:06:54 -08:00
Jonathan Johnson
e2e5085b1f
Added List widget 2024-01-18 13:29:50 -08:00
Jonathan Johnson
76a42e2788
Updated to wgpu 0.19.0
Most of the changes were figures-related. Go figure.
2024-01-18 06:37:29 -08:00
Jonathan Johnson
570cfc6d94
Missing docs 2024-01-13 06:10:36 -08:00
Jonathan Johnson
c2bd9911ca
Started a List widget
a la HTML's <ul> tag.
2024-01-13 06:04:41 -08:00
Jonathan Johnson
1b97b39857
Label for CowString 2024-01-13 06:02:22 -08:00
Jonathan Johnson
0c36abf28e
Remving debugs 2024-01-13 06:02:10 -08:00
Jonathan Johnson
9bd78c648b
Switcher now unmounts
This isn't quite perfect, as a Switcher shared with multiple windows
will only unmount in one window.
2024-01-13 05:55:07 -08:00
Jonathan Johnson
02e90e48c6
Image aspect scaling now requests sizes 2024-01-13 05:54:51 -08:00
Jonathan Johnson
c242009cb8
Fixing set_font_family to not be sticky 2024-01-13 05:52:27 -08:00
Jonathan Johnson
f8cb7e7f32
Added the Delimiter widget 2024-01-12 15:44:18 -08:00
Jonathan Johnson
cc207fbf8c
Added optional plotters integration
Closes #133

The real work was done in Kludgine.
2024-01-11 20:52:40 -08:00
Jonathan Johnson
e2f8e04670
Fixing infintite loop in ColorSchemeBuilder
`generate_error` can technically fail to generate a contrasting color if
the primary color is desaturated too much. This is beacuse we never
increase the saturation.

This change makes the color scheme builder stop one iteration shy of a
full circle.
2024-01-11 14:58:27 -08:00
Jonathan Johnson
bd13003cbb
Finishing sentence in docs 2024-01-11 09:53:03 -08:00
Jonathan Johnson
956e4109f9
Added InvalidationBatch 2024-01-11 09:47:51 -08:00
Jonathan Johnson
64ad120be6
Clipping the checkerboard pattern 2024-01-11 07:17:38 -08:00
Jonathan Johnson
d701e179ae
Fixing ComponentPicker<Alpha>'s loupe coloring
The previous fix was a fix in contrast_between. However, I then
convinced myself that the selected color was changing when it wasn't
purely because the alpha picker utilizes a checkeboard pattern, and I
was specifically testing grayscale values.

Aka, I was reproducing the "different grays" optical illusion using the
loupe outline color and driving myself crazy trying to figure out what
my code was doing, when in reality it wasn't doing anything.

The real fix? Don't ask for contrast between two similar colors.
OutlineColor and TextColor are both meant to be contrasting colors to
SurfaceColor, which is the background color. The loupe color really
should have switched between any surface-type color and any
foreground-type color, but it instead was asking for two different
foreground colors.
2024-01-11 07:10:45 -08:00
Jonathan Johnson
6958c6863c
Fixing Color::contrast_between
While working on the color pickers, I was noticing the contrast_between
choices seem a little off.
2024-01-11 07:09:17 -08:00
Jonathan Johnson
8a274df730
Added more color pickers
This set of changes is making me think of adding Rgb/Rgba types and
having our own color enum.
2024-01-10 13:27:12 -08:00
Jonathan Johnson
246352fed2
Added HslPicker 2024-01-10 08:17:09 -08:00