Commit graph

132 commits

Author SHA1 Message Date
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
Jonathan Johnson
285c92f82b
Root tab order fix, Spacebar widget activiation
Closes #99

Disclose now accepts focus and responds to spacebar as a result of this.
2023-12-28 15:48:34 -08:00
Jonathan Johnson
a0478e266a
Added Disclose widget 2023-12-28 14:12:26 -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
a9dcee38a6
Validation callbacks are now cleaned up
Closes #105
2023-12-27 14:25:14 -08:00
Jonathan Johnson
8a9fb24fe0
Added PendingWindow
Closes #107

This answers the question of how a window can close itself.
2023-12-27 09:47:58 -08:00
Jonathan Johnson
4379565e3d
Label/Input caches invalidate across windows
When combined with changes in Kludgine, this should round out support
for sharing content between multiple windows.

Closes #110
2023-12-26 13:57:23 -08:00
Jonathan Johnson
564b9e5a96
Added comments to multi-window
Also made it open a second window before startup
2023-12-21 15:41:34 -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
4e145d7f35
Removed UnwindSafe bounds
appit wasn't supposed to pass along this requirement
2023-12-20 11:35:19 -08:00
Jonathan Johnson
25d1caa1ea
Added background-tasks example 2023-12-19 16:23:07 -08:00
Marli Frost
f9d0203ff5 Add API for tracking checked to the inner_size of a window
This matched the apis used for focused and occluded
properties. I've added an example to demonstrate usage.
2023-12-19 13:51:28 +00:00
Jonathan Johnson
4a68fa08f8
Updated README and Cargo.toml
Also removed example that wasn't ever completed.
2023-12-18 09:56:37 -08:00
Jonathan Johnson
02d6b343f1
Widget docs + refactoring
- MakeWidgetWithId::make_with_id -> MakeWidgetWithTag::make_With_tag
- ManagedWidget -> MountedWidget
- *_refresh -> *_redraw, standardized on terminology
- get_tracked -> get_tracking_redraw
2023-12-17 07:38:31 -08:00
Jonathan Johnson
01e04a4eb9
Improving the readmes a bit 2023-12-15 14:31:44 -08:00
Jonathan Johnson
7ae4374411
ColorSource picker 2023-12-15 14:01:31 -08:00
Jonathan Johnson
0fd7c8fd5c
Implemented Wrap
Closes #59
2023-12-14 10:48:35 -08:00
Jonathan Johnson
aa996a090b
Tooltips
Closes #37
2023-12-13 16:30:34 -08:00
Jonathan Johnson
353db9dc39
Added Opacity component
Closes #87
2023-12-13 14:02:39 -08:00
Jonathan Johnson
0adb43a234
Implemented local styles
Closes #86
2023-12-13 10:44:34 -08:00
Jonathan Johnson
5c720e6009
Align + Overlay + Shadow fixes
- Blur no longer expands the shadow geometry, but instead is clamped to
  avoid overlapping drawing calls.
- Overlay now handles hit tests correctly with regards to the original
  relative widget.
- Align was using an Into conversion that wasn't actually correct,
  causing the contents to not actually get aligned in some situations.
2023-12-13 08:26:09 -08:00
Jonathan Johnson
79a09ee614
Shadow blur now can cause expansion
Rather than clip or cause shadows to be weirdly shaped, the shape is
adjusted if the blur radius is too large for the given geometry. This
ensures the shadows always draw correctly, but it also forces shadows to
render their full blur + spread gradients.
2023-12-12 19:27:41 -08:00
Jonathan Johnson
a7efe9a3d5
Container Shadows 2023-12-12 13:49:03 -08:00
Jonathan Johnson
c4151d649c
Added Spinner widget
Closes #80
2023-12-10 15:05:59 -08:00
Jonathan Johnson
35576f9214
Image widget
Closes #23

(Feels good to close a 3 year old issue!)
2023-12-09 13:18:46 -08:00
Jonathan Johnson
95555ce928
Tilemap updates 2023-12-09 08:20:18 -08:00
Jonathan Johnson
16af20269e
Updated figures + kludgine 2023-12-07 15:49:03 -08:00
Jonathan Johnson
2fe08fc9e9
Added hover support to OverlayLayer 2023-12-07 09:51:07 -08:00
Jonathan Johnson
0d34924ddf
OverlayLayer
Refs #37
2023-12-06 15:53:25 -08:00
Jonathan Johnson
288119a831
Added Layers 2023-12-05 08:51:55 -08:00
Jonathan Johnson
17847d6947
Various fixes/improvements
- On Linux, `fm-match` is used to query for the default fonts.
- DynamicComponents now have their own trait and can now be specified
  with a constant or dynamic.
- Roboto Flex is now always loaded when the feature is enabled.
  Overriding the default sans serif font prefers the overridden value,
  then roboto, then the result of fc-match/fontdb's default.
- Button now supports background colors being set on a transparent
  button.
2023-12-03 15:35:37 -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
a3e45d1d86
Small improvements
- Caching font family resolution to avoid scanning the database over and
  over. The db should still be cached, but this makes repeated setting
  free.
- into_switcher rename for Dynamic<WidgetInstance> to avoid conflicting
  with Switchable::switcher()
- Dynamic debugging is less verbose
- IntoDynamic<Validation> for Result<T,E>
- Input no longer blinks cursor when disabled.
2023-12-01 12:52:46 -08:00
Jonathan Johnson
8f99ae19fd
Implemented a basic grid
Refs #14
2023-11-30 18:19:53 -08:00
Jonathan Johnson
8a4c66e73b
Refactored to MakeWidgetWithId 2023-11-30 09:14:19 -08:00
Jonathan Johnson
03e93adb15
Select buttons 2023-11-29 17:14:42 -08:00
Jonathan Johnson
63a4549f29
Tested buttons in buttons 2023-11-29 15:42:06 -08:00
Jonathan Johnson
ce6935a7a7
Making it easier to draw focus correctly 2023-11-29 15:08:12 -08:00
Jonathan Johnson
8e19a89bca
Added font size + heading helpers 2023-11-28 10:14:55 -08:00
Jonathan Johnson
66fd9ba766
Finished mouse handling for tile map 2023-11-26 19:31:03 -08:00
Jonathan Johnson
273aac65bb
Merge branch 'main' into feature/world-coords 2023-11-26 19:11:49 -08:00
Jonathan Johnson
e15ae59c5c
Refactored root resize behavior
Closes #84, Closes #77, Closes #78
2023-11-25 12:00:59 -08:00
Jonathan Johnson
0fd8a9487f
Validations 2023-11-25 07:43:04 -08:00
Jonathan Johnson
f107267409
Validations 2023-11-24 14:29:06 -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
15480ba68b
Added Collapse widget
Also tweaked progress bar animation
2023-11-22 15:46:58 -08:00
Jonathan Johnson
3e651c2964
CursorIcon + disabled refactoring
Input can now accept focus while disabled, and all controls should do
the right thing with regard to cursor icons now.
2023-11-22 12:06:29 -08:00