mirror of
https://github.com/danbulant/cushy
synced 2026-09-20 15:03:48 +00:00
parent
a9dcee38a6
commit
df479e983e
71 changed files with 476 additions and 473 deletions
|
|
@ -1,14 +1,14 @@
|
||||||

|

|
||||||
[](https://crates.io/crates/gooey)
|
[](https://crates.io/crates/cushy)
|
||||||
[](https://gooey.rs/main/docs/gooey/)
|
[](https://khonsu.dev/cushy/main/docs/cushy/)
|
||||||
|
|
||||||
Gooey is an experimental Graphical User Interface (GUI) crate for the Rust
|
Cushy is an experimental Graphical User Interface (GUI) crate for the Rust
|
||||||
programming language. It features a reactive data model and aims to enable
|
programming language. It features a reactive data model and aims to enable
|
||||||
easily creating responsive, efficient user interfaces. To enable easy
|
easily creating responsive, efficient user interfaces. To enable easy
|
||||||
cross-platform development, Gooey uses its own collection of consistently-styled
|
cross-platform development, Cushy uses its own collection of consistently-styled
|
||||||
[`Widget`s][widget].
|
[`Widget`s][widget].
|
||||||
|
|
||||||
Gooey is powered by:
|
Cushy is powered by:
|
||||||
|
|
||||||
- [`Kludgine`][kludgine], a 2d graphics library powered by:
|
- [`Kludgine`][kludgine], a 2d graphics library powered by:
|
||||||
- [`winit`][winit] for windowing/input
|
- [`winit`][winit] for windowing/input
|
||||||
|
|
@ -18,19 +18,19 @@ Gooey is powered by:
|
||||||
- [`arboard`][arboard] for clipboard support
|
- [`arboard`][arboard] for clipboard support
|
||||||
- [`figures`][figures] for integer-based 2d math
|
- [`figures`][figures] for integer-based 2d math
|
||||||
|
|
||||||
## Getting Started with Gooey
|
## Getting Started with Cushy
|
||||||
|
|
||||||
The [`Widget`][widget] trait is the building block of Gooey: Every user
|
The [`Widget`][widget] trait is the building block of Cushy: Every user
|
||||||
interface element implements `Widget`. The `Widget` trait
|
interface element implements `Widget`. The `Widget` trait
|
||||||
[documentation][widget] has an overview of how Gooey works. A list of built-in
|
[documentation][widget] has an overview of how Cushy works. A list of built-in
|
||||||
widgets can be found in the [`gooey::widgets`][widgets] module.
|
widgets can be found in the [`cushy::widgets`][widgets] module.
|
||||||
|
|
||||||
Gooey uses a reactive data model. To see [an example][button-example] of how
|
Cushy uses a reactive data model. To see [an example][button-example] of how
|
||||||
reactive data models work, consider this example that displays a button that
|
reactive data models work, consider this example that displays a button that
|
||||||
increments its own label:
|
increments its own label:
|
||||||
|
|
||||||
```rust,ignore
|
```rust,ignore
|
||||||
fn main() -> gooey::Result {
|
fn main() -> cushy::Result {
|
||||||
// Create a dynamic usize.
|
// Create a dynamic usize.
|
||||||
let count = Dynamic::new(0_isize);
|
let count = Dynamic::new(0_isize);
|
||||||
// Create a dynamic that contains `count.to_string()`
|
// Create a dynamic that contains `count.to_string()`
|
||||||
|
|
@ -46,8 +46,8 @@ fn main() -> gooey::Result {
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
A great way to learn more about Gooey is to explore the [examples
|
A great way to learn more about Cushy is to explore the [examples
|
||||||
directory][examples]. Nearly every feature in Gooey was initially tested by
|
directory][examples]. Nearly every feature in Cushy was initially tested by
|
||||||
creating an example.
|
creating an example.
|
||||||
|
|
||||||
## Project Status
|
## Project Status
|
||||||
|
|
@ -61,12 +61,12 @@ If you would like to contribute, bug fixes are always appreciated. Before
|
||||||
working on a new feature, please [open an issue][issues] proposing the feature
|
working on a new feature, please [open an issue][issues] proposing the feature
|
||||||
and problem it aims to solve. Doing so will help prevent friction in merging
|
and problem it aims to solve. Doing so will help prevent friction in merging
|
||||||
pull requests, as it ensures changes fit the vision the maintainers have for
|
pull requests, as it ensures changes fit the vision the maintainers have for
|
||||||
Gooey.
|
Cushy.
|
||||||
|
|
||||||
[widget]: crate::widget::Widget
|
[widget]: crate::widget::Widget
|
||||||
[widgets]: mod@crate::widgets
|
[widgets]: mod@crate::widgets
|
||||||
[button-example]: https://github.com/khonsulabs/gooey/tree/main/examples/basic-button.rs
|
[button-example]: https://github.com/khonsulabs/cushy/tree/main/examples/basic-button.rs
|
||||||
[examples]: https://github.com/khonsulabs/gooey/tree/main/examples/
|
[examples]: https://github.com/khonsulabs/cushy/tree/main/examples/
|
||||||
[kludgine]: https://github.com/khonsulabs/kludgine
|
[kludgine]: https://github.com/khonsulabs/kludgine
|
||||||
[figures]: https://github.com/khonsulabs/figures
|
[figures]: https://github.com/khonsulabs/figures
|
||||||
[wgpu]: https://github.com/gfx-rs/wgpu
|
[wgpu]: https://github.com/gfx-rs/wgpu
|
||||||
|
|
@ -75,7 +75,7 @@ Gooey.
|
||||||
[palette]: https://github.com/Ogeon/palette
|
[palette]: https://github.com/Ogeon/palette
|
||||||
[arboard]: https://github.com/1Password/arboard
|
[arboard]: https://github.com/1Password/arboard
|
||||||
[ecton]: https://github.com/khonsulabs/ecton
|
[ecton]: https://github.com/khonsulabs/ecton
|
||||||
[issues]: https://github.com/khonsulabs/gooey/issues
|
[issues]: https://github.com/khonsulabs/cushy/issues
|
||||||
|
|
||||||
## Open-source Licenses
|
## Open-source Licenses
|
||||||
|
|
||||||
|
|
|
||||||
2
.github/workflows/docs.yml
vendored
2
.github/workflows/docs.yml
vendored
|
|
@ -30,6 +30,6 @@ jobs:
|
||||||
url: ${{ secrets.DOSSIER_URL }}
|
url: ${{ secrets.DOSSIER_URL }}
|
||||||
api-key-id: ${{ secrets.DOSSIER_API_KEY_ID }}
|
api-key-id: ${{ secrets.DOSSIER_API_KEY_ID }}
|
||||||
api-key: ${{ secrets.DOSSIER_API_KEY }}
|
api-key: ${{ secrets.DOSSIER_API_KEY }}
|
||||||
project: gooey
|
project: cushy
|
||||||
from: target/doc/
|
from: target/doc/
|
||||||
to: /${{ github.ref_name }}/docs
|
to: /${{ github.ref_name }}/docs
|
||||||
|
|
@ -37,17 +37,17 @@ Configuration(
|
||||||
release: "v0.1.3",
|
release: "v0.1.3",
|
||||||
),
|
),
|
||||||
"docs": (
|
"docs": (
|
||||||
default: "https://gooey.rs/main/docs/gooey/",
|
default: "https://khonsu.dev/cushy/main/docs/cushy/",
|
||||||
release: "https://docs.rs/gooey",
|
release: "https://docs.rs/cushy",
|
||||||
),
|
),
|
||||||
"widget": (
|
"widget": (
|
||||||
default: "https://gooey.rs/main/docs/gooey/widget/trait.Widget.html",
|
default: "https://khonsu.dev/cushy/main/docs/cushy/widget/trait.Widget.html",
|
||||||
release: "https://docs.rs/gooey/*/gooey/widget/trait.Widget.html",
|
release: "https://docs.rs/cushy/*/cushy/widget/trait.Widget.html",
|
||||||
for_docs: "crate::widget::Widget",
|
for_docs: "crate::widget::Widget",
|
||||||
),
|
),
|
||||||
"widgets": (
|
"widgets": (
|
||||||
default: "https://gooey.rs/main/docs/gooey/widgets/index.html",
|
default: "https://khonsu.dev/cushy/main/docs/cushy/widgets/index.html",
|
||||||
release: "https://docs.rs/gooey/*/gooey/widgets/index.html",
|
release: "https://docs.rs/cushy/*/cushy/widgets/index.html",
|
||||||
for_docs: "mod@crate::widgets",
|
for_docs: "mod@crate::widgets",
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -1,14 +1,14 @@
|
||||||

|

|
||||||
[](https://crates.io/crates/gooey)
|
[](https://crates.io/crates/cushy)
|
||||||
[]($docs$)
|
[]($docs$)
|
||||||
|
|
||||||
Gooey is an experimental Graphical User Interface (GUI) crate for the Rust
|
Cushy is an experimental Graphical User Interface (GUI) crate for the Rust
|
||||||
programming language. It features a reactive data model and aims to enable
|
programming language. It features a reactive data model and aims to enable
|
||||||
easily creating responsive, efficient user interfaces. To enable easy
|
easily creating responsive, efficient user interfaces. To enable easy
|
||||||
cross-platform development, Gooey uses its own collection of consistently-styled
|
cross-platform development, Cushy uses its own collection of consistently-styled
|
||||||
[`Widget`s][widget].
|
[`Widget`s][widget].
|
||||||
|
|
||||||
Gooey is powered by:
|
Cushy is powered by:
|
||||||
|
|
||||||
- [`Kludgine`][kludgine], a 2d graphics library powered by:
|
- [`Kludgine`][kludgine], a 2d graphics library powered by:
|
||||||
- [`winit`][winit] for windowing/input
|
- [`winit`][winit] for windowing/input
|
||||||
|
|
@ -18,14 +18,14 @@ Gooey is powered by:
|
||||||
- [`arboard`][arboard] for clipboard support
|
- [`arboard`][arboard] for clipboard support
|
||||||
- [`figures`][figures] for integer-based 2d math
|
- [`figures`][figures] for integer-based 2d math
|
||||||
|
|
||||||
## Getting Started with Gooey
|
## Getting Started with Cushy
|
||||||
|
|
||||||
The [`Widget`][widget] trait is the building block of Gooey: Every user
|
The [`Widget`][widget] trait is the building block of Cushy: Every user
|
||||||
interface element implements `Widget`. The `Widget` trait
|
interface element implements `Widget`. The `Widget` trait
|
||||||
[documentation][widget] has an overview of how Gooey works. A list of built-in
|
[documentation][widget] has an overview of how Cushy works. A list of built-in
|
||||||
widgets can be found in the [`gooey::widgets`][widgets] module.
|
widgets can be found in the [`cushy::widgets`][widgets] module.
|
||||||
|
|
||||||
Gooey uses a reactive data model. To see [an example][button-example] of how
|
Cushy uses a reactive data model. To see [an example][button-example] of how
|
||||||
reactive data models work, consider this example that displays a button that
|
reactive data models work, consider this example that displays a button that
|
||||||
increments its own label:
|
increments its own label:
|
||||||
|
|
||||||
|
|
@ -33,8 +33,8 @@ increments its own label:
|
||||||
$../examples/basic-button.rs:readme$
|
$../examples/basic-button.rs:readme$
|
||||||
```
|
```
|
||||||
|
|
||||||
A great way to learn more about Gooey is to explore the [examples
|
A great way to learn more about Cushy is to explore the [examples
|
||||||
directory][examples]. Nearly every feature in Gooey was initially tested by
|
directory][examples]. Nearly every feature in Cushy was initially tested by
|
||||||
creating an example.
|
creating an example.
|
||||||
|
|
||||||
## Project Status
|
## Project Status
|
||||||
|
|
@ -48,12 +48,12 @@ If you would like to contribute, bug fixes are always appreciated. Before
|
||||||
working on a new feature, please [open an issue][issues] proposing the feature
|
working on a new feature, please [open an issue][issues] proposing the feature
|
||||||
and problem it aims to solve. Doing so will help prevent friction in merging
|
and problem it aims to solve. Doing so will help prevent friction in merging
|
||||||
pull requests, as it ensures changes fit the vision the maintainers have for
|
pull requests, as it ensures changes fit the vision the maintainers have for
|
||||||
Gooey.
|
Cushy.
|
||||||
|
|
||||||
[widget]: $widget$
|
[widget]: $widget$
|
||||||
[widgets]: $widgets$
|
[widgets]: $widgets$
|
||||||
[button-example]: https://github.com/khonsulabs/gooey/tree/$ref-name$/examples/basic-button.rs
|
[button-example]: https://github.com/khonsulabs/cushy/tree/$ref-name$/examples/basic-button.rs
|
||||||
[examples]: https://github.com/khonsulabs/gooey/tree/$ref-name$/examples/
|
[examples]: https://github.com/khonsulabs/cushy/tree/$ref-name$/examples/
|
||||||
[kludgine]: https://github.com/khonsulabs/kludgine
|
[kludgine]: https://github.com/khonsulabs/kludgine
|
||||||
[figures]: https://github.com/khonsulabs/figures
|
[figures]: https://github.com/khonsulabs/figures
|
||||||
[wgpu]: https://github.com/gfx-rs/wgpu
|
[wgpu]: https://github.com/gfx-rs/wgpu
|
||||||
|
|
@ -62,4 +62,4 @@ Gooey.
|
||||||
[palette]: https://github.com/Ogeon/palette
|
[palette]: https://github.com/Ogeon/palette
|
||||||
[arboard]: https://github.com/1Password/arboard
|
[arboard]: https://github.com/1Password/arboard
|
||||||
[ecton]: https://github.com/khonsulabs/ecton
|
[ecton]: https://github.com/khonsulabs/ecton
|
||||||
[issues]: https://github.com/khonsulabs/gooey/issues
|
[issues]: https://github.com/khonsulabs/cushy/issues
|
||||||
|
|
|
||||||
|
|
@ -1 +1 @@
|
||||||
# Gooey
|
# Cushy
|
||||||
|
|
|
||||||
29
CHANGELOG.md
29
CHANGELOG.md
|
|
@ -9,12 +9,15 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||||
|
|
||||||
### Breaking Changes
|
### Breaking Changes
|
||||||
|
|
||||||
|
- This crate has been renamed from `Gooey` to `Cushy`. Other than the name of
|
||||||
|
the library changing, the only type to change name is `Gooey` -> `Cushy`. This
|
||||||
|
changelog has had all references and links updated.
|
||||||
- Many bounds required `UnwindSafe` due to a misunderstanding on how to handle
|
- Many bounds required `UnwindSafe` due to a misunderstanding on how to handle
|
||||||
this trait in `appit`. All requirements for `UnwindSafe` have been removed.
|
this trait in `appit`. All requirements for `UnwindSafe` have been removed.
|
||||||
- `Gooey` no longer implements default. To gain access to a `Gooey` instance,
|
- `Cushy` no longer implements default. To gain access to a `Cushy` instance,
|
||||||
create a `PendingApp` or get a reference to the running `App`.
|
create a `PendingApp` or get a reference to the running `App`.
|
||||||
- `Window::new` no longer accepts a `Gooey` parameter. The window now adopts the
|
- `Window::new` no longer accepts a `Cushy` parameter. The window now adopts the
|
||||||
`Gooey` from the application it is opened within.
|
`Cushy` from the application it is opened within.
|
||||||
- `MakeWidget::into_window()` no longer takes any parameters.
|
- `MakeWidget::into_window()` no longer takes any parameters.
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
|
@ -61,10 +64,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||||
application.
|
application.
|
||||||
|
|
||||||
The `multi-window` example demonstates using this feature to open multiple
|
The `multi-window` example demonstates using this feature to open multiple
|
||||||
windows before starting Gooey as well as dynamically opening windows at
|
windows before starting Cushy as well as dynamically opening windows at
|
||||||
runtime.
|
runtime.
|
||||||
- `Window::on_close` sets a callback to be invoked when the window has closed.
|
- `Window::on_close` sets a callback to be invoked when the window has closed.
|
||||||
- `WindowHandle` is a handle to a Gooey window. It enables requesting that the
|
- `WindowHandle` is a handle to a Cushy window. It enables requesting that the
|
||||||
window closes, refreshing the window, or invalidating a widget contained in
|
window closes, refreshing the window, or invalidating a widget contained in
|
||||||
the window.
|
the window.
|
||||||
- `RunningWindow::handle()` returns a `WindowHandle` for the current window.
|
- `RunningWindow::handle()` returns a `WindowHandle` for the current window.
|
||||||
|
|
@ -89,10 +92,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||||
ensuring the callback stays alive as long as the dynamic has an instance
|
ensuring the callback stays alive as long as the dynamic has an instance
|
||||||
alive.
|
alive.
|
||||||
|
|
||||||
[91]: https://github.com/khonsulabs/gooey/issues/91
|
[91]: https://github.com/khonsulabs/cushy/issues/91
|
||||||
[92]: https://github.com/khonsulabs/gooey/issues/92
|
[92]: https://github.com/khonsulabs/cushy/issues/92
|
||||||
[112]: https://github.com/khonsulabs/gooey/issues/112
|
[112]: https://github.com/khonsulabs/cushy/issues/112
|
||||||
[113]: https://github.com/khonsulabs/gooey/issues/113
|
[113]: https://github.com/khonsulabs/cushy/issues/113
|
||||||
|
|
||||||
## v0.1.3 (2023-12-19)
|
## v0.1.3 (2023-12-19)
|
||||||
|
|
||||||
|
|
@ -120,14 +123,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||||
- An integer underflow has been fixed in the Grid/Stack widgets.
|
- An integer underflow has been fixed in the Grid/Stack widgets.
|
||||||
- Padding is now rounded to the nearest whole pixel when applied across widgets.
|
- Padding is now rounded to the nearest whole pixel when applied across widgets.
|
||||||
|
|
||||||
[94]: https://github.com/khonsulabs/gooey/pull/94
|
[94]: https://github.com/khonsulabs/cushy/pull/94
|
||||||
[97]: https://github.com/khonsulabs/gooey/issues/97
|
[97]: https://github.com/khonsulabs/cushy/issues/97
|
||||||
|
|
||||||
## v0.1.2 (2023-12-18)
|
## v0.1.2 (2023-12-18)
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|
||||||
- Gooey now compiles for Windows. An indirect dependency, `appit`, also needs to
|
- Cushy now compiles for Windows. An indirect dependency, `appit`, also needs to
|
||||||
be updated to v0.1.1. Running `cargo update` should be enough to update
|
be updated to v0.1.1. Running `cargo update` should be enough to update
|
||||||
`appit`.
|
`appit`.
|
||||||
|
|
||||||
|
|
@ -137,4 +140,4 @@ This release only contains fixed links in the README. No code was changed.
|
||||||
|
|
||||||
## v0.1.0 (2023-12-18)
|
## v0.1.0 (2023-12-18)
|
||||||
|
|
||||||
This is the initial alpha release of Gooey.
|
This is the initial alpha release of Cushy.
|
||||||
|
|
|
||||||
72
Cargo.lock
generated
72
Cargo.lock
generated
|
|
@ -567,6 +567,42 @@ version = "1.1.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "96a6ac251f4a2aca6b3f91340350eab87ae57c3f127ffeb585e92bd336717991"
|
checksum = "96a6ac251f4a2aca6b3f91340350eab87ae57c3f127ffeb585e92bd336717991"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "cushy"
|
||||||
|
version = "0.1.3"
|
||||||
|
dependencies = [
|
||||||
|
"ahash",
|
||||||
|
"alot",
|
||||||
|
"arboard",
|
||||||
|
"cushy-macros",
|
||||||
|
"image",
|
||||||
|
"intentional",
|
||||||
|
"interner",
|
||||||
|
"kempt",
|
||||||
|
"kludgine",
|
||||||
|
"palette",
|
||||||
|
"pollster",
|
||||||
|
"rand",
|
||||||
|
"tracing",
|
||||||
|
"tracing-subscriber",
|
||||||
|
"unicode-segmentation",
|
||||||
|
"zeroize",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "cushy-macros"
|
||||||
|
version = "0.1.0"
|
||||||
|
dependencies = [
|
||||||
|
"attribute-derive",
|
||||||
|
"insta",
|
||||||
|
"manyhow 0.10.4",
|
||||||
|
"prettyplease",
|
||||||
|
"proc-macro2",
|
||||||
|
"quote",
|
||||||
|
"quote-use 0.8.0",
|
||||||
|
"syn",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "d3d12"
|
name = "d3d12"
|
||||||
version = "0.7.0"
|
version = "0.7.0"
|
||||||
|
|
@ -897,42 +933,6 @@ dependencies = [
|
||||||
"gl_generator",
|
"gl_generator",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "gooey"
|
|
||||||
version = "0.1.3"
|
|
||||||
dependencies = [
|
|
||||||
"ahash",
|
|
||||||
"alot",
|
|
||||||
"arboard",
|
|
||||||
"gooey-macros",
|
|
||||||
"image",
|
|
||||||
"intentional",
|
|
||||||
"interner",
|
|
||||||
"kempt",
|
|
||||||
"kludgine",
|
|
||||||
"palette",
|
|
||||||
"pollster",
|
|
||||||
"rand",
|
|
||||||
"tracing",
|
|
||||||
"tracing-subscriber",
|
|
||||||
"unicode-segmentation",
|
|
||||||
"zeroize",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "gooey-macros"
|
|
||||||
version = "0.1.0"
|
|
||||||
dependencies = [
|
|
||||||
"attribute-derive",
|
|
||||||
"insta",
|
|
||||||
"manyhow 0.10.4",
|
|
||||||
"prettyplease",
|
|
||||||
"proc-macro2",
|
|
||||||
"quote",
|
|
||||||
"quote-use 0.8.0",
|
|
||||||
"syn",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "gpu-alloc"
|
name = "gpu-alloc"
|
||||||
version = "0.6.0"
|
version = "0.6.0"
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,11 @@
|
||||||
[workspace]
|
[workspace]
|
||||||
|
|
||||||
[package]
|
[package]
|
||||||
name = "gooey"
|
name = "cushy"
|
||||||
version = "0.1.3"
|
version = "0.1.3"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
description = "A wgpu-powered graphical user interface (GUI) library with a reactive data model"
|
description = "A wgpu-powered graphical user interface (GUI) library with a reactive data model"
|
||||||
repository = "https://github.com/khonsulabs/gooey"
|
repository = "https://github.com/khonsulabs/cushy"
|
||||||
license = "MIT OR Apache-2.0"
|
license = "MIT OR Apache-2.0"
|
||||||
keywords = ["gui", "ui", "widgets", "reactive"]
|
keywords = ["gui", "ui", "widgets", "reactive"]
|
||||||
categories = ["gui"]
|
categories = ["gui"]
|
||||||
|
|
@ -33,7 +33,7 @@ tracing-subscriber = { version = "0.3", optional = true, features = [
|
||||||
] }
|
] }
|
||||||
palette = "0.7.3"
|
palette = "0.7.3"
|
||||||
ahash = "0.8.6"
|
ahash = "0.8.6"
|
||||||
gooey-macros = { version = "0.1.0", path = "gooey-macros" }
|
cushy-macros = { version = "0.1.0", path = "cushy-macros" }
|
||||||
arboard = "3.2.1"
|
arboard = "3.2.1"
|
||||||
zeroize = "1.6.1"
|
zeroize = "1.6.1"
|
||||||
unicode-segmentation = "1.10.1"
|
unicode-segmentation = "1.10.1"
|
||||||
|
|
|
||||||
42
README.md
42
README.md
|
|
@ -1,16 +1,16 @@
|
||||||
# Gooey
|
# Cushy
|
||||||
|
|
||||||

|

|
||||||
[](https://crates.io/crates/gooey)
|
[](https://crates.io/crates/cushy)
|
||||||
[](https://gooey.rs/main/docs/gooey/)
|
[](https://cushy.rs/main/docs/cushy/)
|
||||||
|
|
||||||
Gooey is an experimental Graphical User Interface (GUI) crate for the Rust
|
Cushy is an experimental Graphical User Interface (GUI) crate for the Rust
|
||||||
programming language. It features a reactive data model and aims to enable
|
programming language. It features a reactive data model and aims to enable
|
||||||
easily creating responsive, efficient user interfaces. To enable easy
|
easily creating responsive, efficient user interfaces. To enable easy
|
||||||
cross-platform development, Gooey uses its own collection of consistently-styled
|
cross-platform development, Cushy uses its own collection of consistently-styled
|
||||||
[`Widget`s][widget].
|
[`Widget`s][widget].
|
||||||
|
|
||||||
Gooey is powered by:
|
Cushy is powered by:
|
||||||
|
|
||||||
- [`Kludgine`][kludgine], a 2d graphics library powered by:
|
- [`Kludgine`][kludgine], a 2d graphics library powered by:
|
||||||
- [`winit`][winit] for windowing/input
|
- [`winit`][winit] for windowing/input
|
||||||
|
|
@ -20,19 +20,19 @@ Gooey is powered by:
|
||||||
- [`arboard`][arboard] for clipboard support
|
- [`arboard`][arboard] for clipboard support
|
||||||
- [`figures`][figures] for integer-based 2d math
|
- [`figures`][figures] for integer-based 2d math
|
||||||
|
|
||||||
## Getting Started with Gooey
|
## Getting Started with Cushy
|
||||||
|
|
||||||
The [`Widget`][widget] trait is the building block of Gooey: Every user
|
The [`Widget`][widget] trait is the building block of Cushy: Every user
|
||||||
interface element implements `Widget`. The `Widget` trait
|
interface element implements `Widget`. The `Widget` trait
|
||||||
[documentation][widget] has an overview of how Gooey works. A list of built-in
|
[documentation][widget] has an overview of how Cushy works. A list of built-in
|
||||||
widgets can be found in the [`gooey::widgets`][widgets] module.
|
widgets can be found in the [`cushy::widgets`][widgets] module.
|
||||||
|
|
||||||
Gooey uses a reactive data model. To see [an example][button-example] of how
|
Cushy uses a reactive data model. To see [an example][button-example] of how
|
||||||
reactive data models work, consider this example that displays a button that
|
reactive data models work, consider this example that displays a button that
|
||||||
increments its own label:
|
increments its own label:
|
||||||
|
|
||||||
```rust,ignore
|
```rust,ignore
|
||||||
fn main() -> gooey::Result {
|
fn main() -> cushy::Result {
|
||||||
// Create a dynamic usize.
|
// Create a dynamic usize.
|
||||||
let count = Dynamic::new(0_isize);
|
let count = Dynamic::new(0_isize);
|
||||||
// Create a dynamic that contains `count.to_string()`
|
// Create a dynamic that contains `count.to_string()`
|
||||||
|
|
@ -48,8 +48,8 @@ fn main() -> gooey::Result {
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
A great way to learn more about Gooey is to explore the [examples
|
A great way to learn more about Cushy is to explore the [examples
|
||||||
directory][examples]. Nearly every feature in Gooey was initially tested by
|
directory][examples]. Nearly every feature in Cushy was initially tested by
|
||||||
creating an example.
|
creating an example.
|
||||||
|
|
||||||
## Project Status
|
## Project Status
|
||||||
|
|
@ -63,12 +63,12 @@ If you would like to contribute, bug fixes are always appreciated. Before
|
||||||
working on a new feature, please [open an issue][issues] proposing the feature
|
working on a new feature, please [open an issue][issues] proposing the feature
|
||||||
and problem it aims to solve. Doing so will help prevent friction in merging
|
and problem it aims to solve. Doing so will help prevent friction in merging
|
||||||
pull requests, as it ensures changes fit the vision the maintainers have for
|
pull requests, as it ensures changes fit the vision the maintainers have for
|
||||||
Gooey.
|
Cushy.
|
||||||
|
|
||||||
[widget]: https://gooey.rs/main/docs/gooey/widget/trait.Widget.html
|
[widget]: https://cushy.rs/main/docs/cushy/widget/trait.Widget.html
|
||||||
[widgets]: https://gooey.rs/main/docs/gooey/widgets/index.html
|
[widgets]: https://cushy.rs/main/docs/cushy/widgets/index.html
|
||||||
[button-example]: https://github.com/khonsulabs/gooey/tree/main/examples/basic-button.rs
|
[button-example]: https://github.com/khonsulabs/cushy/tree/main/examples/basic-button.rs
|
||||||
[examples]: https://github.com/khonsulabs/gooey/tree/main/examples/
|
[examples]: https://github.com/khonsulabs/cushy/tree/main/examples/
|
||||||
[kludgine]: https://github.com/khonsulabs/kludgine
|
[kludgine]: https://github.com/khonsulabs/kludgine
|
||||||
[figures]: https://github.com/khonsulabs/figures
|
[figures]: https://github.com/khonsulabs/figures
|
||||||
[wgpu]: https://github.com/gfx-rs/wgpu
|
[wgpu]: https://github.com/gfx-rs/wgpu
|
||||||
|
|
@ -77,7 +77,7 @@ Gooey.
|
||||||
[palette]: https://github.com/Ogeon/palette
|
[palette]: https://github.com/Ogeon/palette
|
||||||
[arboard]: https://github.com/1Password/arboard
|
[arboard]: https://github.com/1Password/arboard
|
||||||
[ecton]: https://github.com/khonsulabs/ecton
|
[ecton]: https://github.com/khonsulabs/ecton
|
||||||
[issues]: https://github.com/khonsulabs/gooey/issues
|
[issues]: https://github.com/khonsulabs/cushy/issues
|
||||||
|
|
||||||
## Open-source Licenses
|
## Open-source Licenses
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,9 @@
|
||||||
[package]
|
[package]
|
||||||
name = "gooey-macros"
|
name = "cushy-macros"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
description = "Macros for the Gooey GUI framework"
|
description = "Macros for the Cushy GUI framework"
|
||||||
repository = "https://github.com/khonsulabs/gooey"
|
repository = "https://github.com/khonsulabs/cushy"
|
||||||
license = "MIT OR Apache-2.0"
|
license = "MIT OR Apache-2.0"
|
||||||
readme = "./README.md"
|
readme = "./README.md"
|
||||||
|
|
||||||
5
cushy-macros/README.md
Normal file
5
cushy-macros/README.md
Normal file
|
|
@ -0,0 +1,5 @@
|
||||||
|
# cushy-macros
|
||||||
|
|
||||||
|
This crate contains procedural macros that [Cushy][cushy] exposes.
|
||||||
|
|
||||||
|
[cushy]: https://github.com/khonsulabs/cushy
|
||||||
|
|
@ -29,7 +29,7 @@ pub fn linear_interpolate(
|
||||||
let ident = ident
|
let ident = ident
|
||||||
.map(ToTokens::into_token_stream)
|
.map(ToTokens::into_token_stream)
|
||||||
.unwrap_or_else(|| proc_macro2::Literal::usize_unsuffixed(idx).into_token_stream());
|
.unwrap_or_else(|| proc_macro2::Literal::usize_unsuffixed(idx).into_token_stream());
|
||||||
quote!(#ident: ::gooey::animation::LinearInterpolate::lerp(&self.#ident, &__target.#ident, __percent),)
|
quote!(#ident: ::cushy::animation::LinearInterpolate::lerp(&self.#ident, &__target.#ident, __percent),)
|
||||||
}),
|
}),
|
||||||
};
|
};
|
||||||
doc = "# Panics\n Panics if any field's lerp panics (this should only happen on percentages outside 0..1 range).";
|
doc = "# Panics\n Panics if any field's lerp panics (this should only happen on percentages outside 0..1 range).";
|
||||||
|
|
@ -62,7 +62,7 @@ pub fn linear_interpolate(
|
||||||
let idx: Vec<_> = (0..variants.len()).collect();
|
let idx: Vec<_> = (0..variants.len()).collect();
|
||||||
doc = "# Panics\n Panics if the the enum variants are overflown (this can only happen on percentages outside 0..1 range).";
|
doc = "# Panics\n Panics if the the enum variants are overflown (this can only happen on percentages outside 0..1 range).";
|
||||||
quote! {
|
quote! {
|
||||||
# use ::gooey::animation::LinearInterpolate;
|
# use ::cushy::animation::LinearInterpolate;
|
||||||
fn variant_to_index(__v: &#item_ident) -> usize {
|
fn variant_to_index(__v: &#item_ident) -> usize {
|
||||||
match __v {
|
match __v {
|
||||||
#(#variants => #idx,)*
|
#(#variants => #idx,)*
|
||||||
|
|
@ -80,7 +80,7 @@ pub fn linear_interpolate(
|
||||||
};
|
};
|
||||||
|
|
||||||
Ok(quote! {
|
Ok(quote! {
|
||||||
impl ::gooey::animation::LinearInterpolate for #item_ident {
|
impl ::cushy::animation::LinearInterpolate for #item_ident {
|
||||||
#[doc = #doc]
|
#[doc = #doc]
|
||||||
fn lerp(&self, __target: &Self, __percent: f32) -> Self {
|
fn lerp(&self, __target: &Self, __percent: f32) -> Self {
|
||||||
#body
|
#body
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
---
|
---
|
||||||
source: gooey-macros/src/animation.rs
|
source: cushy-macros/src/animation.rs
|
||||||
expression: unparse(ok)
|
expression: unparse(ok)
|
||||||
---
|
---
|
||||||
impl ::gooey::animation::LinearInterpolate for Enum {
|
impl ::cushy::animation::LinearInterpolate for Enum {
|
||||||
/**# Panics
|
/**# Panics
|
||||||
Panics if the the enum variants are overflown (this can only happen on percentages outside 0..1 range).*/
|
Panics if the the enum variants are overflown (this can only happen on percentages outside 0..1 range).*/
|
||||||
fn lerp(&self, __target: &Self, __percent: f32) -> Self {
|
fn lerp(&self, __target: &Self, __percent: f32) -> Self {
|
||||||
|
|
@ -11,7 +11,7 @@ impl ::gooey::animation::LinearInterpolate for Enum {
|
||||||
}
|
}
|
||||||
let __self = variant_to_index(&self);
|
let __self = variant_to_index(&self);
|
||||||
let __target = variant_to_index(&self);
|
let __target = variant_to_index(&self);
|
||||||
match ::gooey::animation::LinearInterpolate::lerp(
|
match ::cushy::animation::LinearInterpolate::lerp(
|
||||||
&__self,
|
&__self,
|
||||||
&__target,
|
&__target,
|
||||||
__percent,
|
__percent,
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
---
|
---
|
||||||
source: gooey-macros/src/animation.rs
|
source: cushy-macros/src/animation.rs
|
||||||
expression: unparse(ok)
|
expression: unparse(ok)
|
||||||
---
|
---
|
||||||
impl ::gooey::animation::LinearInterpolate for Enum {
|
impl ::cushy::animation::LinearInterpolate for Enum {
|
||||||
/**# Panics
|
/**# Panics
|
||||||
Panics if the the enum variants are overflown (this can only happen on percentages outside 0..1 range).*/
|
Panics if the the enum variants are overflown (this can only happen on percentages outside 0..1 range).*/
|
||||||
fn lerp(&self, __target: &Self, __percent: f32) -> Self {
|
fn lerp(&self, __target: &Self, __percent: f32) -> Self {
|
||||||
|
|
@ -14,7 +14,7 @@ impl ::gooey::animation::LinearInterpolate for Enum {
|
||||||
}
|
}
|
||||||
let __self = variant_to_index(&self);
|
let __self = variant_to_index(&self);
|
||||||
let __target = variant_to_index(&self);
|
let __target = variant_to_index(&self);
|
||||||
match ::gooey::animation::LinearInterpolate::lerp(
|
match ::cushy::animation::LinearInterpolate::lerp(
|
||||||
&__self,
|
&__self,
|
||||||
&__target,
|
&__target,
|
||||||
__percent,
|
__percent,
|
||||||
|
|
@ -1,18 +1,18 @@
|
||||||
---
|
---
|
||||||
source: gooey-macros/src/animation.rs
|
source: cushy-macros/src/animation.rs
|
||||||
expression: unparse(ok)
|
expression: unparse(ok)
|
||||||
---
|
---
|
||||||
impl ::gooey::animation::LinearInterpolate for HelloWorld {
|
impl ::cushy::animation::LinearInterpolate for HelloWorld {
|
||||||
/**# Panics
|
/**# Panics
|
||||||
Panics if any field's lerp panics (this should only happen on percentages outside 0..1 range).*/
|
Panics if any field's lerp panics (this should only happen on percentages outside 0..1 range).*/
|
||||||
fn lerp(&self, __target: &Self, __percent: f32) -> Self {
|
fn lerp(&self, __target: &Self, __percent: f32) -> Self {
|
||||||
HelloWorld {
|
HelloWorld {
|
||||||
fielda: ::gooey::animation::LinearInterpolate::lerp(
|
fielda: ::cushy::animation::LinearInterpolate::lerp(
|
||||||
&self.fielda,
|
&self.fielda,
|
||||||
&__target.fielda,
|
&__target.fielda,
|
||||||
__percent,
|
__percent,
|
||||||
),
|
),
|
||||||
fieldb: ::gooey::animation::LinearInterpolate::lerp(
|
fieldb: ::cushy::animation::LinearInterpolate::lerp(
|
||||||
&self.fieldb,
|
&self.fieldb,
|
||||||
&__target.fieldb,
|
&__target.fieldb,
|
||||||
__percent,
|
__percent,
|
||||||
|
|
@ -1,18 +1,18 @@
|
||||||
---
|
---
|
||||||
source: gooey-macros/src/animation.rs
|
source: cushy-macros/src/animation.rs
|
||||||
expression: unparse(ok)
|
expression: unparse(ok)
|
||||||
---
|
---
|
||||||
impl ::gooey::animation::LinearInterpolate for HelloWorld {
|
impl ::cushy::animation::LinearInterpolate for HelloWorld {
|
||||||
/**# Panics
|
/**# Panics
|
||||||
Panics if any field's lerp panics (this should only happen on percentages outside 0..1 range).*/
|
Panics if any field's lerp panics (this should only happen on percentages outside 0..1 range).*/
|
||||||
fn lerp(&self, __target: &Self, __percent: f32) -> Self {
|
fn lerp(&self, __target: &Self, __percent: f32) -> Self {
|
||||||
HelloWorld {
|
HelloWorld {
|
||||||
0: ::gooey::animation::LinearInterpolate::lerp(
|
0: ::cushy::animation::LinearInterpolate::lerp(
|
||||||
&self.0,
|
&self.0,
|
||||||
&__target.0,
|
&__target.0,
|
||||||
__percent,
|
__percent,
|
||||||
),
|
),
|
||||||
1: ::gooey::animation::LinearInterpolate::lerp(
|
1: ::cushy::animation::LinearInterpolate::lerp(
|
||||||
&self.1,
|
&self.1,
|
||||||
&__target.1,
|
&__target.1,
|
||||||
__percent,
|
__percent,
|
||||||
|
|
@ -1,21 +1,21 @@
|
||||||
use std::time::Duration;
|
use std::time::Duration;
|
||||||
|
|
||||||
use gooey::animation::{AnimationHandle, AnimationTarget, IntoAnimate, Spawn};
|
use cushy::animation::{AnimationHandle, AnimationTarget, IntoAnimate, Spawn};
|
||||||
use gooey::value::Dynamic;
|
use cushy::value::Dynamic;
|
||||||
use gooey::widget::MakeWidget;
|
use cushy::widget::MakeWidget;
|
||||||
use gooey::widgets::progress::Progressable;
|
use cushy::widgets::progress::Progressable;
|
||||||
use gooey::{Run, WithClone};
|
use cushy::{Run, WithClone};
|
||||||
use kludgine::figures::units::Lp;
|
use kludgine::figures::units::Lp;
|
||||||
|
|
||||||
fn main() -> gooey::Result {
|
fn main() -> cushy::Result {
|
||||||
let animation = Dynamic::new(AnimationHandle::new());
|
let animation = Dynamic::new(AnimationHandle::new());
|
||||||
let value = Dynamic::new(50);
|
let value = Dynamic::new(50);
|
||||||
|
|
||||||
// Gooey's animation system supports using a `Duration` as a step in
|
// Cushy's animation system supports using a `Duration` as a step in
|
||||||
// animation to create a delay. This can also be used to call a function
|
// animation to create a delay. This can also be used to call a function
|
||||||
// after a specified amount of time:
|
// after a specified amount of time:
|
||||||
Duration::from_secs(1)
|
Duration::from_secs(1)
|
||||||
.on_complete(|| println!("Gooey animations are neat!"))
|
.on_complete(|| println!("Cushy animations are neat!"))
|
||||||
.launch();
|
.launch();
|
||||||
|
|
||||||
"To 0"
|
"To 0"
|
||||||
|
|
|
||||||
|
|
@ -3,18 +3,18 @@
|
||||||
|
|
||||||
use std::time::Duration;
|
use std::time::Duration;
|
||||||
|
|
||||||
use gooey::animation::ZeroToOne;
|
use cushy::animation::ZeroToOne;
|
||||||
use gooey::value::{Dynamic, Switchable};
|
use cushy::value::{Dynamic, Switchable};
|
||||||
use gooey::widget::MakeWidget;
|
use cushy::widget::MakeWidget;
|
||||||
use gooey::widgets::progress::{Progress, Progressable};
|
use cushy::widgets::progress::{Progress, Progressable};
|
||||||
use gooey::Run;
|
use cushy::Run;
|
||||||
|
|
||||||
#[derive(Debug, Default, Eq, PartialEq)]
|
#[derive(Debug, Default, Eq, PartialEq)]
|
||||||
struct Task {
|
struct Task {
|
||||||
progress: Dynamic<Progress>,
|
progress: Dynamic<Progress>,
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() -> gooey::Result {
|
fn main() -> cushy::Result {
|
||||||
let task = Dynamic::new(None::<Task>);
|
let task = Dynamic::new(None::<Task>);
|
||||||
|
|
||||||
task.switcher(|task, dynamic| {
|
task.switcher(|task, dynamic| {
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,9 @@
|
||||||
use gooey::value::Dynamic;
|
use cushy::value::Dynamic;
|
||||||
use gooey::widget::MakeWidget;
|
use cushy::widget::MakeWidget;
|
||||||
use gooey::Run;
|
use cushy::Run;
|
||||||
|
|
||||||
// begin rustme snippet: readme
|
// begin rustme snippet: readme
|
||||||
fn main() -> gooey::Result {
|
fn main() -> cushy::Result {
|
||||||
// Create a dynamic usize.
|
// Create a dynamic usize.
|
||||||
let count = Dynamic::new(0_isize);
|
let count = Dynamic::new(0_isize);
|
||||||
// Create a dynamic that contains `count.to_string()`
|
// Create a dynamic that contains `count.to_string()`
|
||||||
|
|
|
||||||
|
|
@ -16,13 +16,13 @@
|
||||||
//! ┃ ┃ ┣ clicked_button Label
|
//! ┃ ┃ ┣ clicked_button Label
|
||||||
//! ```
|
//! ```
|
||||||
|
|
||||||
use gooey::value::Dynamic;
|
use cushy::value::Dynamic;
|
||||||
use gooey::widget::MakeWidget;
|
use cushy::widget::MakeWidget;
|
||||||
use gooey::widgets::button::{ButtonHoverBackground, ButtonHoverForeground};
|
use cushy::widgets::button::{ButtonHoverBackground, ButtonHoverForeground};
|
||||||
use gooey::Run;
|
use cushy::Run;
|
||||||
use kludgine::Color;
|
use kludgine::Color;
|
||||||
|
|
||||||
fn main() -> gooey::Result {
|
fn main() -> cushy::Result {
|
||||||
let clicked_button = Dynamic::<&'static str>::default();
|
let clicked_button = Dynamic::<&'static str>::default();
|
||||||
|
|
||||||
let inner_button = "So I put buttons in your buttons"
|
let inner_button = "So I put buttons in your buttons"
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,9 @@
|
||||||
use gooey::value::Dynamic;
|
use cushy::value::Dynamic;
|
||||||
use gooey::widget::MakeWidget;
|
use cushy::widget::MakeWidget;
|
||||||
use gooey::widgets::button::ButtonKind;
|
use cushy::widgets::button::ButtonKind;
|
||||||
use gooey::Run;
|
use cushy::Run;
|
||||||
|
|
||||||
fn main() -> gooey::Result {
|
fn main() -> cushy::Result {
|
||||||
let clicked_label = Dynamic::new(String::from("Click a Button"));
|
let clicked_label = Dynamic::new(String::from("Click a Button"));
|
||||||
let default_is_outline = Dynamic::new(false);
|
let default_is_outline = Dynamic::new(false);
|
||||||
let default_button_style = default_is_outline.map_each(|is_outline| {
|
let default_button_style = default_is_outline.map_each(|is_outline| {
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,11 @@
|
||||||
use gooey::widgets::Canvas;
|
use cushy::widgets::Canvas;
|
||||||
use gooey::{Run, Tick};
|
use cushy::{Run, Tick};
|
||||||
use kludgine::figures::{Angle, IntoSigned, Point, Px2D, Rect, Size};
|
use kludgine::figures::{Angle, IntoSigned, Point, Px2D, Rect, Size};
|
||||||
use kludgine::shapes::Shape;
|
use kludgine::shapes::Shape;
|
||||||
use kludgine::text::{Text, TextOrigin};
|
use kludgine::text::{Text, TextOrigin};
|
||||||
use kludgine::{Color, DrawableExt};
|
use kludgine::{Color, DrawableExt};
|
||||||
|
|
||||||
fn main() -> gooey::Result<()> {
|
fn main() -> cushy::Result<()> {
|
||||||
let mut angle = Angle::degrees(0);
|
let mut angle = Angle::degrees(0);
|
||||||
Canvas::new(move |context| {
|
Canvas::new(move |context| {
|
||||||
angle += Angle::degrees(1);
|
angle += Angle::degrees(1);
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,9 @@
|
||||||
use gooey::value::Dynamic;
|
use cushy::value::Dynamic;
|
||||||
use gooey::widget::MakeWidget;
|
use cushy::widget::MakeWidget;
|
||||||
use gooey::widgets::checkbox::{Checkable, CheckboxState};
|
use cushy::widgets::checkbox::{Checkable, CheckboxState};
|
||||||
use gooey::Run;
|
use cushy::Run;
|
||||||
|
|
||||||
fn main() -> gooey::Result {
|
fn main() -> cushy::Result {
|
||||||
let checkbox_state = Dynamic::new(CheckboxState::Checked);
|
let checkbox_state = Dynamic::new(CheckboxState::Checked);
|
||||||
let label = checkbox_state.map_each(|state| format!("Check Me! Current: {state:?}"));
|
let label = checkbox_state.map_each(|state| format!("Check Me! Current: {state:?}"));
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,12 @@
|
||||||
use gooey::value::Dynamic;
|
use cushy::value::Dynamic;
|
||||||
use gooey::widget::MakeWidget;
|
use cushy::widget::MakeWidget;
|
||||||
use gooey::widgets::checkbox::Checkable;
|
use cushy::widgets::checkbox::Checkable;
|
||||||
use gooey::Run;
|
use cushy::Run;
|
||||||
|
|
||||||
const EXPLANATION: &str =
|
const EXPLANATION: &str =
|
||||||
"The collapse widget allows showing and hiding another widget based on a Dynamic<bool>.";
|
"The collapse widget allows showing and hiding another widget based on a Dynamic<bool>.";
|
||||||
|
|
||||||
fn main() -> gooey::Result {
|
fn main() -> cushy::Result {
|
||||||
let collapse = Dynamic::new(false);
|
let collapse = Dynamic::new(false);
|
||||||
|
|
||||||
collapse
|
collapse
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,9 @@
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
|
|
||||||
use gooey::value::{Dynamic, MapEach};
|
use cushy::value::{Dynamic, MapEach};
|
||||||
use gooey::widget::{Children, MakeWidget};
|
use cushy::widget::{Children, MakeWidget};
|
||||||
use gooey::widgets::input::InputValue;
|
use cushy::widgets::input::InputValue;
|
||||||
use gooey::Run;
|
use cushy::Run;
|
||||||
|
|
||||||
#[derive(Debug, Clone, Eq, PartialEq)]
|
#[derive(Debug, Clone, Eq, PartialEq)]
|
||||||
pub struct Contact {
|
pub struct Contact {
|
||||||
|
|
@ -13,7 +13,7 @@ pub struct Contact {
|
||||||
pub title: String,
|
pub title: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() -> gooey::Result {
|
fn main() -> cushy::Result {
|
||||||
let initial_contacts = vec![
|
let initial_contacts = vec![
|
||||||
Contact {
|
Contact {
|
||||||
id: 0,
|
id: 0,
|
||||||
|
|
|
||||||
|
|
@ -1,15 +1,15 @@
|
||||||
use gooey::styles::components::CornerRadius;
|
use cushy::styles::components::CornerRadius;
|
||||||
use gooey::styles::Dimension;
|
use cushy::styles::Dimension;
|
||||||
use gooey::value::{Dynamic, MapEachCloned};
|
use cushy::value::{Dynamic, MapEachCloned};
|
||||||
use gooey::widget::MakeWidget;
|
use cushy::widget::MakeWidget;
|
||||||
use gooey::widgets::container::ContainerShadow;
|
use cushy::widgets::container::ContainerShadow;
|
||||||
use gooey::widgets::slider::Slidable;
|
use cushy::widgets::slider::Slidable;
|
||||||
use gooey::Run;
|
use cushy::Run;
|
||||||
use kludgine::figures::units::Lp;
|
use kludgine::figures::units::Lp;
|
||||||
use kludgine::figures::{Point, Size};
|
use kludgine::figures::{Point, Size};
|
||||||
use kludgine::shapes::CornerRadii;
|
use kludgine::shapes::CornerRadii;
|
||||||
|
|
||||||
fn main() -> gooey::Result {
|
fn main() -> cushy::Result {
|
||||||
let top_left = Dynamic::new(Lp::mm(1));
|
let top_left = Dynamic::new(Lp::mm(1));
|
||||||
let top_right = Dynamic::new(Lp::mm(1));
|
let top_right = Dynamic::new(Lp::mm(1));
|
||||||
let bottom_right = Dynamic::new(Lp::mm(1));
|
let bottom_right = Dynamic::new(Lp::mm(1));
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,12 @@
|
||||||
use gooey::value::Dynamic;
|
use cushy::value::Dynamic;
|
||||||
use gooey::widget::{MakeWidget, WidgetInstance};
|
use cushy::widget::{MakeWidget, WidgetInstance};
|
||||||
use gooey::widgets::container::ContainerShadow;
|
use cushy::widgets::container::ContainerShadow;
|
||||||
use gooey::window::ThemeMode;
|
use cushy::window::ThemeMode;
|
||||||
use gooey::Run;
|
use cushy::Run;
|
||||||
use kludgine::figures::units::Lp;
|
use kludgine::figures::units::Lp;
|
||||||
use kludgine::figures::Point;
|
use kludgine::figures::Point;
|
||||||
|
|
||||||
fn main() -> gooey::Result {
|
fn main() -> cushy::Result {
|
||||||
let theme_mode = Dynamic::default();
|
let theme_mode = Dynamic::default();
|
||||||
set_of_containers(3, theme_mode.clone())
|
set_of_containers(3, theme_mode.clone())
|
||||||
.centered()
|
.centered()
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,11 @@
|
||||||
use std::string::ToString;
|
use std::string::ToString;
|
||||||
|
|
||||||
use gooey::value::Dynamic;
|
use cushy::value::Dynamic;
|
||||||
use gooey::widget::MakeWidget;
|
use cushy::widget::MakeWidget;
|
||||||
use gooey::Run;
|
use cushy::Run;
|
||||||
use kludgine::figures::units::Lp;
|
use kludgine::figures::units::Lp;
|
||||||
|
|
||||||
fn main() -> gooey::Result {
|
fn main() -> cushy::Result {
|
||||||
let counter = Dynamic::new(0i32);
|
let counter = Dynamic::new(0i32);
|
||||||
let label = counter.map_each(ToString::to_string);
|
let label = counter.map_each(ToString::to_string);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,11 @@
|
||||||
use gooey::value::Dynamic;
|
use cushy::value::Dynamic;
|
||||||
use gooey::widget::MakeWidget;
|
use cushy::widget::MakeWidget;
|
||||||
use gooey::widgets::input::InputValue;
|
use cushy::widgets::input::InputValue;
|
||||||
use gooey::widgets::Custom;
|
use cushy::widgets::Custom;
|
||||||
use gooey::Run;
|
use cushy::Run;
|
||||||
use kludgine::app::winit::window::CursorIcon;
|
use kludgine::app::winit::window::CursorIcon;
|
||||||
|
|
||||||
fn main() -> gooey::Result {
|
fn main() -> cushy::Result {
|
||||||
Custom::new(
|
Custom::new(
|
||||||
"Try hovering the mouse cursor around this window"
|
"Try hovering the mouse cursor around this window"
|
||||||
.and(
|
.and(
|
||||||
|
|
|
||||||
|
|
@ -1,15 +1,15 @@
|
||||||
//! This example shows two approaches to writing custom widgets: implementing
|
//! This example shows two approaches to writing custom widgets: implementing
|
||||||
//! traits or using the [`Custom`] widget with callbacks.
|
//! traits or using the [`Custom`] widget with callbacks.
|
||||||
|
|
||||||
use gooey::value::Dynamic;
|
use cushy::value::Dynamic;
|
||||||
use gooey::widget::{MakeWidget, MakeWidgetWithTag, Widget, WidgetInstance, WidgetTag, HANDLED};
|
use cushy::widget::{MakeWidget, MakeWidgetWithTag, Widget, WidgetInstance, WidgetTag, HANDLED};
|
||||||
use gooey::widgets::Custom;
|
use cushy::widgets::Custom;
|
||||||
use gooey::Run;
|
use cushy::Run;
|
||||||
use kludgine::figures::units::{Lp, UPx};
|
use kludgine::figures::units::{Lp, UPx};
|
||||||
use kludgine::figures::{ScreenScale, Size};
|
use kludgine::figures::{ScreenScale, Size};
|
||||||
use kludgine::Color;
|
use kludgine::Color;
|
||||||
|
|
||||||
fn main() -> gooey::Result {
|
fn main() -> cushy::Result {
|
||||||
"Inline Widgets"
|
"Inline Widgets"
|
||||||
.and(callback_widget())
|
.and(callback_widget())
|
||||||
.into_rows()
|
.into_rows()
|
||||||
|
|
@ -90,14 +90,14 @@ impl Default for Toggle {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Widget for Toggle {
|
impl Widget for Toggle {
|
||||||
fn redraw(&mut self, context: &mut gooey::context::GraphicsContext<'_, '_, '_, '_, '_>) {
|
fn redraw(&mut self, context: &mut cushy::context::GraphicsContext<'_, '_, '_, '_, '_>) {
|
||||||
context.fill(self.color.get_tracking_redraw(context));
|
context.fill(self.color.get_tracking_redraw(context));
|
||||||
}
|
}
|
||||||
|
|
||||||
fn layout(
|
fn layout(
|
||||||
&mut self,
|
&mut self,
|
||||||
available_space: Size<gooey::ConstraintLimit>,
|
available_space: Size<cushy::ConstraintLimit>,
|
||||||
context: &mut gooey::context::LayoutContext<'_, '_, '_, '_, '_>,
|
context: &mut cushy::context::LayoutContext<'_, '_, '_, '_, '_>,
|
||||||
) -> Size<UPx> {
|
) -> Size<UPx> {
|
||||||
Size::new(
|
Size::new(
|
||||||
available_space.width.min(),
|
available_space.width.min(),
|
||||||
|
|
@ -108,7 +108,7 @@ impl Widget for Toggle {
|
||||||
fn hit_test(
|
fn hit_test(
|
||||||
&mut self,
|
&mut self,
|
||||||
_location: kludgine::figures::Point<kludgine::figures::units::Px>,
|
_location: kludgine::figures::Point<kludgine::figures::units::Px>,
|
||||||
_context: &mut gooey::context::EventContext<'_, '_>,
|
_context: &mut cushy::context::EventContext<'_, '_>,
|
||||||
) -> bool {
|
) -> bool {
|
||||||
true
|
true
|
||||||
}
|
}
|
||||||
|
|
@ -118,8 +118,8 @@ impl Widget for Toggle {
|
||||||
_location: kludgine::figures::Point<kludgine::figures::units::Px>,
|
_location: kludgine::figures::Point<kludgine::figures::units::Px>,
|
||||||
_device_id: kludgine::app::winit::event::DeviceId,
|
_device_id: kludgine::app::winit::event::DeviceId,
|
||||||
_button: kludgine::app::winit::event::MouseButton,
|
_button: kludgine::app::winit::event::MouseButton,
|
||||||
_context: &mut gooey::context::EventContext<'_, '_>,
|
_context: &mut cushy::context::EventContext<'_, '_>,
|
||||||
) -> gooey::widget::EventHandling {
|
) -> cushy::widget::EventHandling {
|
||||||
self.value.toggle();
|
self.value.toggle();
|
||||||
|
|
||||||
HANDLED
|
HANDLED
|
||||||
|
|
|
||||||
|
|
@ -1,17 +1,17 @@
|
||||||
use std::process::exit;
|
use std::process::exit;
|
||||||
|
|
||||||
use gooey::value::{Dynamic, MapEach};
|
use cushy::value::{Dynamic, MapEach};
|
||||||
use gooey::widget::{MakeWidget, MakeWidgetWithTag, WidgetTag};
|
use cushy::widget::{MakeWidget, MakeWidgetWithTag, WidgetTag};
|
||||||
use gooey::widgets::grid::{Grid, GridDimension, GridWidgets};
|
use cushy::widgets::grid::{Grid, GridDimension, GridWidgets};
|
||||||
use gooey::widgets::input::{InputValue, MaskedString};
|
use cushy::widgets::input::{InputValue, MaskedString};
|
||||||
use gooey::widgets::Expand;
|
use cushy::widgets::Expand;
|
||||||
use gooey::Run;
|
use cushy::Run;
|
||||||
use kludgine::figures::units::Lp;
|
use kludgine::figures::units::Lp;
|
||||||
|
|
||||||
/// This example is the same as login, but it has an explicit tab order to
|
/// This example is the same as login, but it has an explicit tab order to
|
||||||
/// change from the default order (username, password, cancel, log in) to
|
/// change from the default order (username, password, cancel, log in) to
|
||||||
/// username, password, log in, cancel.
|
/// username, password, log in, cancel.
|
||||||
fn main() -> gooey::Result {
|
fn main() -> cushy::Result {
|
||||||
let username = Dynamic::default();
|
let username = Dynamic::default();
|
||||||
let password = Dynamic::default();
|
let password = Dynamic::default();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,12 @@
|
||||||
use gooey::value::Dynamic;
|
use cushy::value::Dynamic;
|
||||||
use gooey::widget::MakeWidget;
|
use cushy::widget::MakeWidget;
|
||||||
use gooey::widgets::input::InputValue;
|
use cushy::widgets::input::InputValue;
|
||||||
use gooey::widgets::slider::Slidable;
|
use cushy::widgets::slider::Slidable;
|
||||||
use gooey::widgets::Custom;
|
use cushy::widgets::Custom;
|
||||||
use gooey::Run;
|
use cushy::Run;
|
||||||
use kludgine::figures::units::Lp;
|
use kludgine::figures::units::Lp;
|
||||||
|
|
||||||
fn main() -> gooey::Result {
|
fn main() -> cushy::Result {
|
||||||
let allow_blur = Dynamic::new(true);
|
let allow_blur = Dynamic::new(true);
|
||||||
"Input Field"
|
"Input Field"
|
||||||
.and(Dynamic::<String>::default().into_input())
|
.and(Dynamic::<String>::default().into_input())
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,12 @@
|
||||||
use gooey::value::Dynamic;
|
use cushy::value::Dynamic;
|
||||||
use gooey::widget::{MakeWidget, HANDLED, IGNORED};
|
use cushy::widget::{MakeWidget, HANDLED, IGNORED};
|
||||||
use gooey::widgets::input::InputValue;
|
use cushy::widgets::input::InputValue;
|
||||||
use gooey::Run;
|
use cushy::Run;
|
||||||
use kludgine::app::winit::event::ElementState;
|
use kludgine::app::winit::event::ElementState;
|
||||||
use kludgine::app::winit::keyboard::{Key, NamedKey};
|
use kludgine::app::winit::keyboard::{Key, NamedKey};
|
||||||
use kludgine::Color;
|
use kludgine::Color;
|
||||||
|
|
||||||
fn main() -> gooey::Result {
|
fn main() -> cushy::Result {
|
||||||
let chat_log = Dynamic::new("Chat log goes here.\n".repeat(100));
|
let chat_log = Dynamic::new("Chat log goes here.\n".repeat(100));
|
||||||
let chat_message = Dynamic::new(String::new());
|
let chat_message = Dynamic::new(String::new());
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,14 +1,14 @@
|
||||||
use gooey::animation::ZeroToOne;
|
use cushy::animation::ZeroToOne;
|
||||||
use gooey::value::{Dynamic, MapEachCloned};
|
use cushy::value::{Dynamic, MapEachCloned};
|
||||||
use gooey::widget::MakeWidget;
|
use cushy::widget::MakeWidget;
|
||||||
use gooey::widgets::image::{Aspect, ImageScaling};
|
use cushy::widgets::image::{Aspect, ImageScaling};
|
||||||
use gooey::widgets::slider::Slidable;
|
use cushy::widgets::slider::Slidable;
|
||||||
use gooey::widgets::Image;
|
use cushy::widgets::Image;
|
||||||
use gooey::Run;
|
use cushy::Run;
|
||||||
use kludgine::figures::Size;
|
use kludgine::figures::Size;
|
||||||
use kludgine::include_texture;
|
use kludgine::include_texture;
|
||||||
|
|
||||||
fn main() -> gooey::Result {
|
fn main() -> cushy::Result {
|
||||||
let mode = Dynamic::<ScalingMode>::default();
|
let mode = Dynamic::<ScalingMode>::default();
|
||||||
let scale = Dynamic::new(1f32);
|
let scale = Dynamic::new(1f32);
|
||||||
let orientation_width = Dynamic::<ZeroToOne>::default();
|
let orientation_width = Dynamic::<ZeroToOne>::default();
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,10 @@
|
||||||
use gooey::value::Dynamic;
|
use cushy::value::Dynamic;
|
||||||
use gooey::widget::MakeWidget;
|
use cushy::widget::MakeWidget;
|
||||||
use gooey::widgets::input::{InputValue, MaskedString};
|
use cushy::widgets::input::{InputValue, MaskedString};
|
||||||
use gooey::Run;
|
use cushy::Run;
|
||||||
use kludgine::figures::units::Px;
|
use kludgine::figures::units::Px;
|
||||||
|
|
||||||
fn main() -> gooey::Result {
|
fn main() -> cushy::Result {
|
||||||
let contents = Dynamic::from("Hello World");
|
let contents = Dynamic::from("Hello World");
|
||||||
let password = Dynamic::new(MaskedString::default());
|
let password = Dynamic::new(MaskedString::default());
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,9 @@
|
||||||
use gooey::widget::MakeWidget;
|
use cushy::widget::MakeWidget;
|
||||||
use gooey::widgets::Space;
|
use cushy::widgets::Space;
|
||||||
use gooey::Run;
|
use cushy::Run;
|
||||||
use kludgine::Color;
|
use kludgine::Color;
|
||||||
|
|
||||||
fn main() -> gooey::Result {
|
fn main() -> cushy::Result {
|
||||||
Space::colored(Color::RED)
|
Space::colored(Color::RED)
|
||||||
.and("Layers stack widgets on top of each other")
|
.and("Layers stack widgets on top of each other")
|
||||||
.into_layers()
|
.into_layers()
|
||||||
|
|
|
||||||
|
|
@ -1,14 +1,14 @@
|
||||||
use std::process::exit;
|
use std::process::exit;
|
||||||
|
|
||||||
use gooey::value::{Dynamic, Validations};
|
use cushy::value::{Dynamic, Validations};
|
||||||
use gooey::widget::MakeWidget;
|
use cushy::widget::MakeWidget;
|
||||||
use gooey::widgets::input::{InputValue, MaskedString};
|
use cushy::widgets::input::{InputValue, MaskedString};
|
||||||
use gooey::widgets::layers::OverlayLayer;
|
use cushy::widgets::layers::OverlayLayer;
|
||||||
use gooey::widgets::Expand;
|
use cushy::widgets::Expand;
|
||||||
use gooey::Run;
|
use cushy::Run;
|
||||||
use kludgine::figures::units::Lp;
|
use kludgine::figures::units::Lp;
|
||||||
|
|
||||||
fn main() -> gooey::Result {
|
fn main() -> cushy::Result {
|
||||||
let tooltips = OverlayLayer::default();
|
let tooltips = OverlayLayer::default();
|
||||||
let username = Dynamic::default();
|
let username = Dynamic::default();
|
||||||
let password = Dynamic::default();
|
let password = Dynamic::default();
|
||||||
|
|
|
||||||
|
|
@ -3,9 +3,9 @@
|
||||||
|
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
|
|
||||||
use gooey::value::{Dynamic, Switchable};
|
use cushy::value::{Dynamic, Switchable};
|
||||||
use gooey::widget::MakeWidget;
|
use cushy::widget::MakeWidget;
|
||||||
use gooey::Run;
|
use cushy::Run;
|
||||||
|
|
||||||
#[derive(Debug, Eq, PartialEq, Clone, Hash)]
|
#[derive(Debug, Eq, PartialEq, Clone, Hash)]
|
||||||
enum Tab {
|
enum Tab {
|
||||||
|
|
@ -14,7 +14,7 @@ enum Tab {
|
||||||
Missing,
|
Missing,
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() -> gooey::Result {
|
fn main() -> cushy::Result {
|
||||||
let mut tab_contents = HashMap::new();
|
let mut tab_contents = HashMap::new();
|
||||||
tab_contents.insert(Tab::First, "This is the first tab!".make_widget());
|
tab_contents.insert(Tab::First, "This is the first tab!".make_widget());
|
||||||
tab_contents.insert(Tab::Second, "This is the second tab!".make_widget());
|
tab_contents.insert(Tab::Second, "This is the second tab!".make_widget());
|
||||||
|
|
|
||||||
|
|
@ -1,16 +1,16 @@
|
||||||
use gooey::kludgine::include_texture;
|
use cushy::kludgine::include_texture;
|
||||||
use gooey::value::{Dynamic, MapEach};
|
use cushy::value::{Dynamic, MapEach};
|
||||||
use gooey::widget::MakeWidget;
|
use cushy::widget::MakeWidget;
|
||||||
use gooey::widgets::Image;
|
use cushy::widgets::Image;
|
||||||
use gooey::window::PendingWindow;
|
use cushy::window::PendingWindow;
|
||||||
use gooey::{Application, Open, PendingApp, Run};
|
use cushy::{Application, Open, PendingApp, Run};
|
||||||
use kludgine::LazyTexture;
|
use kludgine::LazyTexture;
|
||||||
|
|
||||||
fn main() -> gooey::Result {
|
fn main() -> cushy::Result {
|
||||||
// To open multiple applications, we need a handle to the application. This
|
// To open multiple applications, we need a handle to the application. This
|
||||||
// starts with the `PendingApp` type.
|
// starts with the `PendingApp` type.
|
||||||
let app = PendingApp::default();
|
let app = PendingApp::default();
|
||||||
// Gooey ensures it's easy to share resources between windows.
|
// Cushy ensures it's easy to share resources between windows.
|
||||||
let texture = include_texture!("assets/ferris-happy.png").expect("valid image");
|
let texture = include_texture!("assets/ferris-happy.png").expect("valid image");
|
||||||
|
|
||||||
let open_windows = Dynamic::new(0_usize);
|
let open_windows = Dynamic::new(0_usize);
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,11 @@
|
||||||
use gooey::styles::components::FontFamily;
|
use cushy::styles::components::FontFamily;
|
||||||
use gooey::styles::FontFamilyList;
|
use cushy::styles::FontFamilyList;
|
||||||
use gooey::widget::MakeWidget;
|
use cushy::widget::MakeWidget;
|
||||||
use gooey::Run;
|
use cushy::Run;
|
||||||
use kludgine::cosmic_text::FamilyOwned;
|
use kludgine::cosmic_text::FamilyOwned;
|
||||||
use kludgine::figures::units::Lp;
|
use kludgine::figures::units::Lp;
|
||||||
|
|
||||||
fn main() -> gooey::Result {
|
fn main() -> cushy::Result {
|
||||||
include_str!("./nested-scroll.rs")
|
include_str!("./nested-scroll.rs")
|
||||||
.vertical_scroll()
|
.vertical_scroll()
|
||||||
.with(&FontFamily, FontFamilyList::from(FamilyOwned::Monospace))
|
.with(&FontFamily, FontFamilyList::from(FamilyOwned::Monospace))
|
||||||
|
|
|
||||||
|
|
@ -1,13 +1,13 @@
|
||||||
use gooey::widget::{MakeWidget, MakeWidgetWithTag, WidgetTag};
|
use cushy::widget::{MakeWidget, MakeWidgetWithTag, WidgetTag};
|
||||||
use gooey::widgets::container::ContainerShadow;
|
use cushy::widgets::container::ContainerShadow;
|
||||||
use gooey::widgets::layers::{OverlayBuilder, OverlayLayer};
|
use cushy::widgets::layers::{OverlayBuilder, OverlayLayer};
|
||||||
use gooey::Run;
|
use cushy::Run;
|
||||||
use kludgine::figures::units::Lp;
|
use kludgine::figures::units::Lp;
|
||||||
use kludgine::figures::Point;
|
use kludgine::figures::Point;
|
||||||
use kludgine::Color;
|
use kludgine::Color;
|
||||||
use rand::{thread_rng, Rng};
|
use rand::{thread_rng, Rng};
|
||||||
|
|
||||||
fn main() -> gooey::Result {
|
fn main() -> cushy::Result {
|
||||||
let overlay = OverlayLayer::default();
|
let overlay = OverlayLayer::default();
|
||||||
|
|
||||||
test_widget(&overlay, true)
|
test_widget(&overlay, true)
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,12 @@
|
||||||
use gooey::value::{Dynamic, MapEach};
|
use cushy::value::{Dynamic, MapEach};
|
||||||
use gooey::widget::MakeWidget;
|
use cushy::widget::MakeWidget;
|
||||||
use gooey::widgets::progress::Progressable;
|
use cushy::widgets::progress::Progressable;
|
||||||
use gooey::widgets::slider::Slidable;
|
use cushy::widgets::slider::Slidable;
|
||||||
use gooey::Run;
|
use cushy::Run;
|
||||||
use kludgine::figures::units::Lp;
|
use kludgine::figures::units::Lp;
|
||||||
use kludgine::figures::Size;
|
use kludgine::figures::Size;
|
||||||
|
|
||||||
fn main() -> gooey::Result {
|
fn main() -> cushy::Result {
|
||||||
let indeterminant = Dynamic::new(false);
|
let indeterminant = Dynamic::new(false);
|
||||||
let value = Dynamic::new(0_u8);
|
let value = Dynamic::new(0_u8);
|
||||||
let progress = (&indeterminant, &value)
|
let progress = (&indeterminant, &value)
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
use gooey::value::Dynamic;
|
use cushy::value::Dynamic;
|
||||||
use gooey::widget::MakeWidget;
|
use cushy::widget::MakeWidget;
|
||||||
use gooey::Run;
|
use cushy::Run;
|
||||||
|
|
||||||
#[derive(Default, Eq, PartialEq, Debug, Clone, Copy)]
|
#[derive(Default, Eq, PartialEq, Debug, Clone, Copy)]
|
||||||
pub enum Choice {
|
pub enum Choice {
|
||||||
|
|
@ -10,7 +10,7 @@ pub enum Choice {
|
||||||
C,
|
C,
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() -> gooey::Result {
|
fn main() -> cushy::Result {
|
||||||
let option = Dynamic::default();
|
let option = Dynamic::default();
|
||||||
|
|
||||||
option
|
option
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
use gooey::widget::MakeWidget;
|
use cushy::widget::MakeWidget;
|
||||||
use gooey::Run;
|
use cushy::Run;
|
||||||
|
|
||||||
fn main() -> gooey::Result {
|
fn main() -> cushy::Result {
|
||||||
include_str!("../src/widgets/scroll.rs")
|
include_str!("../src/widgets/scroll.rs")
|
||||||
.scroll()
|
.scroll()
|
||||||
.expand()
|
.expand()
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
use gooey::value::Dynamic;
|
use cushy::value::Dynamic;
|
||||||
use gooey::widget::MakeWidget;
|
use cushy::widget::MakeWidget;
|
||||||
use gooey::Run;
|
use cushy::Run;
|
||||||
|
|
||||||
#[derive(Default, Eq, PartialEq, Debug, Clone, Copy)]
|
#[derive(Default, Eq, PartialEq, Debug, Clone, Copy)]
|
||||||
pub enum Choice {
|
pub enum Choice {
|
||||||
|
|
@ -10,7 +10,7 @@ pub enum Choice {
|
||||||
C,
|
C,
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() -> gooey::Result {
|
fn main() -> cushy::Result {
|
||||||
let option = Dynamic::default();
|
let option = Dynamic::default();
|
||||||
|
|
||||||
option
|
option
|
||||||
|
|
|
||||||
|
|
@ -1,14 +1,14 @@
|
||||||
use gooey::animation::{LinearInterpolate, PercentBetween};
|
use cushy::animation::{LinearInterpolate, PercentBetween};
|
||||||
use gooey::value::{Dynamic, ForEach};
|
use cushy::value::{Dynamic, ForEach};
|
||||||
use gooey::widget::MakeWidget;
|
use cushy::widget::MakeWidget;
|
||||||
use gooey::widgets::checkbox::Checkable;
|
use cushy::widgets::checkbox::Checkable;
|
||||||
use gooey::widgets::input::InputValue;
|
use cushy::widgets::input::InputValue;
|
||||||
use gooey::widgets::slider::Slidable;
|
use cushy::widgets::slider::Slidable;
|
||||||
use gooey::Run;
|
use cushy::Run;
|
||||||
use kludgine::figures::units::Lp;
|
use kludgine::figures::units::Lp;
|
||||||
use kludgine::figures::Ranged;
|
use kludgine::figures::Ranged;
|
||||||
|
|
||||||
fn main() -> gooey::Result {
|
fn main() -> cushy::Result {
|
||||||
let enabled = Dynamic::new(true);
|
let enabled = Dynamic::new(true);
|
||||||
u8_slider()
|
u8_slider()
|
||||||
.and(u8_range_slider())
|
.and(u8_range_slider())
|
||||||
|
|
@ -86,7 +86,7 @@ enum SlidableEnum {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl PercentBetween for SlidableEnum {
|
impl PercentBetween for SlidableEnum {
|
||||||
fn percent_between(&self, min: &Self, max: &Self) -> gooey::animation::ZeroToOne {
|
fn percent_between(&self, min: &Self, max: &Self) -> cushy::animation::ZeroToOne {
|
||||||
let min = *min as u8;
|
let min = *min as u8;
|
||||||
let max = *max as u8;
|
let max = *max as u8;
|
||||||
let value = *self as u8;
|
let value = *self as u8;
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
use gooey::widget::MakeWidget;
|
use cushy::widget::MakeWidget;
|
||||||
use gooey::Run;
|
use cushy::Run;
|
||||||
|
|
||||||
/// This example shows a tricky layout problem. The hierarchy of widgets is
|
/// This example shows a tricky layout problem. The hierarchy of widgets is
|
||||||
/// this:
|
/// this:
|
||||||
|
|
@ -40,7 +40,7 @@ use gooey::Run;
|
||||||
/// a Stack is asked to layout with the Stack's non-primary being a size-to-fit
|
/// a Stack is asked to layout with the Stack's non-primary being a size-to-fit
|
||||||
/// measurement, a second layout call for all children is required with Known
|
/// measurement, a second layout call for all children is required with Known
|
||||||
/// measurements to allow layouts like this example to work correctly.
|
/// measurements to allow layouts like this example to work correctly.
|
||||||
fn main() -> gooey::Result {
|
fn main() -> cushy::Result {
|
||||||
// TODO once we have offscreen rendering, turn this into a test case
|
// TODO once we have offscreen rendering, turn this into a test case
|
||||||
"Really Long Label"
|
"Really Long Label"
|
||||||
.and("Short".into_button().centered())
|
.and("Short".into_button().centered())
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,12 @@
|
||||||
use gooey::styles::components::{TextColor, TextSize};
|
use cushy::styles::components::{TextColor, TextSize};
|
||||||
use gooey::widget::MakeWidget;
|
use cushy::widget::MakeWidget;
|
||||||
use gooey::widgets::stack::Stack;
|
use cushy::widgets::stack::Stack;
|
||||||
use gooey::widgets::Style;
|
use cushy::widgets::Style;
|
||||||
use gooey::Run;
|
use cushy::Run;
|
||||||
use kludgine::figures::units::Lp;
|
use kludgine::figures::units::Lp;
|
||||||
use kludgine::Color;
|
use kludgine::Color;
|
||||||
|
|
||||||
fn main() -> gooey::Result {
|
fn main() -> cushy::Result {
|
||||||
Stack::rows("Green".and(red_text("Red")))
|
Stack::rows("Green".and(red_text("Red")))
|
||||||
.with(&TextColor, Color::GREEN)
|
.with(&TextColor, Color::GREEN)
|
||||||
// Local styles are not inherited. In this situation, the text size is
|
// Local styles are not inherited. In this situation, the text size is
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
use gooey::value::{Dynamic, Switchable};
|
use cushy::value::{Dynamic, Switchable};
|
||||||
use gooey::widget::{MakeWidget, WidgetInstance};
|
use cushy::widget::{MakeWidget, WidgetInstance};
|
||||||
use gooey::Run;
|
use cushy::Run;
|
||||||
|
|
||||||
#[derive(Debug, Eq, PartialEq)]
|
#[derive(Debug, Eq, PartialEq)]
|
||||||
enum ActiveContent {
|
enum ActiveContent {
|
||||||
|
|
@ -8,7 +8,7 @@ enum ActiveContent {
|
||||||
Success,
|
Success,
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() -> gooey::Result {
|
fn main() -> cushy::Result {
|
||||||
let active = Dynamic::new(ActiveContent::Intro);
|
let active = Dynamic::new(ActiveContent::Intro);
|
||||||
|
|
||||||
active
|
active
|
||||||
|
|
|
||||||
|
|
@ -1,24 +1,24 @@
|
||||||
use std::fmt::Write;
|
use std::fmt::Write;
|
||||||
|
|
||||||
use gooey::styles::components::{TextColor, WidgetBackground};
|
use cushy::styles::components::{TextColor, WidgetBackground};
|
||||||
use gooey::styles::{
|
use cushy::styles::{
|
||||||
ColorScheme, ColorSchemeBuilder, ColorSource, ColorTheme, FixedTheme, SurfaceTheme, Theme,
|
ColorScheme, ColorSchemeBuilder, ColorSource, ColorTheme, FixedTheme, SurfaceTheme, Theme,
|
||||||
ThemePair,
|
ThemePair,
|
||||||
};
|
};
|
||||||
use gooey::value::{Dynamic, MapEachCloned};
|
use cushy::value::{Dynamic, MapEachCloned};
|
||||||
use gooey::widget::MakeWidget;
|
use cushy::widget::MakeWidget;
|
||||||
use gooey::widgets::checkbox::Checkable;
|
use cushy::widgets::checkbox::Checkable;
|
||||||
use gooey::widgets::color::ColorSourcePicker;
|
use cushy::widgets::color::ColorSourcePicker;
|
||||||
use gooey::widgets::input::InputValue;
|
use cushy::widgets::input::InputValue;
|
||||||
use gooey::widgets::slider::Slidable;
|
use cushy::widgets::slider::Slidable;
|
||||||
use gooey::widgets::Space;
|
use cushy::widgets::Space;
|
||||||
use gooey::window::ThemeMode;
|
use cushy::window::ThemeMode;
|
||||||
use gooey::{Open, PendingApp};
|
use cushy::{Open, PendingApp};
|
||||||
use kludgine::figures::units::Lp;
|
use kludgine::figures::units::Lp;
|
||||||
use kludgine::Color;
|
use kludgine::Color;
|
||||||
use palette::OklabHue;
|
use palette::OklabHue;
|
||||||
|
|
||||||
fn main() -> gooey::Result {
|
fn main() -> cushy::Result {
|
||||||
let app = PendingApp::default();
|
let app = PendingApp::default();
|
||||||
|
|
||||||
let (theme_mode, theme_switcher) = dark_mode_picker();
|
let (theme_mode, theme_switcher) = dark_mode_picker();
|
||||||
|
|
@ -79,9 +79,9 @@ fn main() -> gooey::Result {
|
||||||
.and(editors.neutral.1)
|
.and(editors.neutral.1)
|
||||||
.and(editors.neutral_variant.1)
|
.and(editors.neutral_variant.1)
|
||||||
.and("Copy to Clipboard".into_button().on_click({
|
.and("Copy to Clipboard".into_button().on_click({
|
||||||
let gooey = app.gooey().clone();
|
let cushy = app.cushy().clone();
|
||||||
move |()| {
|
move |()| {
|
||||||
if let Some(mut clipboard) = gooey.clipboard_guard() {
|
if let Some(mut clipboard) = cushy.clipboard_guard() {
|
||||||
let builder = color_scheme_builder.get();
|
let builder = color_scheme_builder.get();
|
||||||
let mut source = String::default();
|
let mut source = String::default();
|
||||||
builder.format_rust_into(&mut source);
|
builder.format_rust_into(&mut source);
|
||||||
|
|
|
||||||
|
|
@ -3,13 +3,13 @@ use std::iter;
|
||||||
use std::ops::Not;
|
use std::ops::Not;
|
||||||
use std::time::SystemTime;
|
use std::time::SystemTime;
|
||||||
|
|
||||||
use gooey::value::Dynamic;
|
use cushy::value::Dynamic;
|
||||||
use gooey::widget::MakeWidget;
|
use cushy::widget::MakeWidget;
|
||||||
use gooey::widgets::button::ButtonKind;
|
use cushy::widgets::button::ButtonKind;
|
||||||
use gooey::{Run, WithClone};
|
use cushy::{Run, WithClone};
|
||||||
use kludgine::figures::units::Lp;
|
use kludgine::figures::units::Lp;
|
||||||
|
|
||||||
fn main() -> gooey::Result {
|
fn main() -> cushy::Result {
|
||||||
let app = Dynamic::default();
|
let app = Dynamic::default();
|
||||||
app.map_each(app.with_clone(|app| {
|
app.map_each(app.with_clone(|app| {
|
||||||
move |state: &AppState| match state {
|
move |state: &AppState| match state {
|
||||||
|
|
|
||||||
|
|
@ -2,18 +2,18 @@ use std::array;
|
||||||
use std::cmp::Ordering;
|
use std::cmp::Ordering;
|
||||||
use std::time::Duration;
|
use std::time::Duration;
|
||||||
|
|
||||||
use gooey::kludgine::app::winit::keyboard::Key;
|
use cushy::kludgine::app::winit::keyboard::Key;
|
||||||
use gooey::kludgine::figures::units::Px;
|
use cushy::kludgine::figures::units::Px;
|
||||||
use gooey::kludgine::figures::{Point, Rect, Size};
|
use cushy::kludgine::figures::{Point, Rect, Size};
|
||||||
use gooey::kludgine::render::Renderer;
|
use cushy::kludgine::render::Renderer;
|
||||||
use gooey::kludgine::shapes::Shape;
|
use cushy::kludgine::shapes::Shape;
|
||||||
use gooey::kludgine::tilemap::{
|
use cushy::kludgine::tilemap::{
|
||||||
DebugGrid, Object, ObjectLayer, TileArray, TileKind, TileMapFocus, TILE_SIZE,
|
DebugGrid, Object, ObjectLayer, TileArray, TileKind, TileMapFocus, TILE_SIZE,
|
||||||
};
|
};
|
||||||
use gooey::kludgine::Color;
|
use cushy::kludgine::Color;
|
||||||
use gooey::value::Dynamic;
|
use cushy::value::Dynamic;
|
||||||
use gooey::widgets::TileMap;
|
use cushy::widgets::TileMap;
|
||||||
use gooey::{Run, Tick};
|
use cushy::{Run, Tick};
|
||||||
use kludgine::app::winit::keyboard::NamedKey;
|
use kludgine::app::winit::keyboard::NamedKey;
|
||||||
use kludgine::figures::FloatConversion;
|
use kludgine::figures::FloatConversion;
|
||||||
use kludgine::sprite::{Sprite, SpriteSource};
|
use kludgine::sprite::{Sprite, SpriteSource};
|
||||||
|
|
@ -21,7 +21,7 @@ use kludgine::{include_aseprite_sprite, DrawableExt};
|
||||||
|
|
||||||
const PLAYER_SIZE: Px = Px::new(16);
|
const PLAYER_SIZE: Px = Px::new(16);
|
||||||
|
|
||||||
fn main() -> gooey::Result {
|
fn main() -> cushy::Result {
|
||||||
let mut characters = ObjectLayer::new();
|
let mut characters = ObjectLayer::new();
|
||||||
|
|
||||||
let mut sprite = include_aseprite_sprite!("assets/stickguy").unwrap();
|
let mut sprite = include_aseprite_sprite!("assets/stickguy").unwrap();
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
use gooey::widget::MakeWidget;
|
use cushy::widget::MakeWidget;
|
||||||
use gooey::Run;
|
use cushy::Run;
|
||||||
|
|
||||||
fn main() -> gooey::Result {
|
fn main() -> cushy::Result {
|
||||||
"Heading 1"
|
"Heading 1"
|
||||||
.h1()
|
.h1()
|
||||||
.and("Heading 2".h2())
|
.and("Heading 2".h2())
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,10 @@
|
||||||
use gooey::value::{Dynamic, Validations};
|
use cushy::value::{Dynamic, Validations};
|
||||||
use gooey::widget::MakeWidget;
|
use cushy::widget::MakeWidget;
|
||||||
use gooey::widgets::input::InputValue;
|
use cushy::widgets::input::InputValue;
|
||||||
use gooey::Run;
|
use cushy::Run;
|
||||||
use kludgine::figures::units::Lp;
|
use kludgine::figures::units::Lp;
|
||||||
|
|
||||||
fn main() -> gooey::Result {
|
fn main() -> cushy::Result {
|
||||||
let text = Dynamic::default();
|
let text = Dynamic::default();
|
||||||
let validations = Validations::default();
|
let validations = Validations::default();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,9 @@
|
||||||
use gooey::value::Dynamic;
|
use cushy::value::Dynamic;
|
||||||
use gooey::widget::{MakeWidget, WidgetInstance};
|
use cushy::widget::{MakeWidget, WidgetInstance};
|
||||||
use gooey::Run;
|
use cushy::Run;
|
||||||
use kludgine::figures::Size;
|
use kludgine::figures::Size;
|
||||||
|
|
||||||
fn main() -> gooey::Result {
|
fn main() -> cushy::Result {
|
||||||
let focused = Dynamic::new(false);
|
let focused = Dynamic::new(false);
|
||||||
let occluded = Dynamic::new(false);
|
let occluded = Dynamic::new(false);
|
||||||
let inner_size = Dynamic::new(Size::default());
|
let inner_size = Dynamic::new(Size::default());
|
||||||
|
|
@ -15,7 +15,7 @@ fn main() -> gooey::Result {
|
||||||
.into_rows()
|
.into_rows()
|
||||||
.centered();
|
.centered();
|
||||||
|
|
||||||
gooey::window::Window::<WidgetInstance>::for_widget(widgets)
|
cushy::window::Window::<WidgetInstance>::for_widget(widgets)
|
||||||
.focused(focused)
|
.focused(focused)
|
||||||
.occluded(occluded)
|
.occluded(occluded)
|
||||||
.inner_size(inner_size)
|
.inner_size(inner_size)
|
||||||
|
|
|
||||||
|
|
@ -1,14 +1,14 @@
|
||||||
use gooey::styles::components::{LineHeight, TextSize};
|
use cushy::styles::components::{LineHeight, TextSize};
|
||||||
use gooey::value::Dynamic;
|
use cushy::value::Dynamic;
|
||||||
use gooey::widget::{Children, MakeWidget};
|
use cushy::widget::{Children, MakeWidget};
|
||||||
use gooey::widgets::wrap::{VerticalAlign, WrapAlign};
|
use cushy::widgets::wrap::{VerticalAlign, WrapAlign};
|
||||||
use gooey::Run;
|
use cushy::Run;
|
||||||
use kludgine::figures::units::Lp;
|
use kludgine::figures::units::Lp;
|
||||||
use rand::{thread_rng, Rng};
|
use rand::{thread_rng, Rng};
|
||||||
|
|
||||||
const EXPLANATION: &str = "This example demonstrates the Wrap widget. Each word shown here is an individual Label widget that is being positioned by the Wrap widget.";
|
const EXPLANATION: &str = "This example demonstrates the Wrap widget. Each word shown here is an individual Label widget that is being positioned by the Wrap widget.";
|
||||||
|
|
||||||
fn main() -> gooey::Result {
|
fn main() -> cushy::Result {
|
||||||
let mut rng = thread_rng();
|
let mut rng = thread_rng();
|
||||||
let words = EXPLANATION
|
let words = EXPLANATION
|
||||||
.split_ascii_whitespace()
|
.split_ascii_whitespace()
|
||||||
|
|
|
||||||
|
|
@ -1,5 +0,0 @@
|
||||||
# gooey-macros
|
|
||||||
|
|
||||||
This crate contains procedural macros that [Gooey][gooey] exposes.
|
|
||||||
|
|
||||||
[gooey]: https://github.com/khonsulabs/gooey
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
//! Types for creating animations.
|
//! Types for creating animations.
|
||||||
//!
|
//!
|
||||||
//! Animations in Gooey are performed by transitioning a [`Dynamic`]'s contained
|
//! Animations in Cushy are performed by transitioning a [`Dynamic`]'s contained
|
||||||
//! value over time. This starts with [`Dynamic::transition_to()`], which
|
//! value over time. This starts with [`Dynamic::transition_to()`], which
|
||||||
//! returns a [`DynamicTransition`].
|
//! returns a [`DynamicTransition`].
|
||||||
//!
|
//!
|
||||||
|
|
@ -17,9 +17,9 @@
|
||||||
//! ```rust
|
//! ```rust
|
||||||
//! use std::time::Duration;
|
//! use std::time::Duration;
|
||||||
//!
|
//!
|
||||||
//! use gooey::animation::easings::EaseInOutElastic;
|
//! use cushy::animation::easings::EaseInOutElastic;
|
||||||
//! use gooey::animation::{AnimationTarget, Spawn};
|
//! use cushy::animation::{AnimationTarget, Spawn};
|
||||||
//! use gooey::value::Dynamic;
|
//! use cushy::value::Dynamic;
|
||||||
//!
|
//!
|
||||||
//! let value = Dynamic::new(0);
|
//! let value = Dynamic::new(0);
|
||||||
//! let mut reader = value.create_reader();
|
//! let mut reader = value.create_reader();
|
||||||
|
|
@ -775,8 +775,8 @@ impl Animate for Duration {
|
||||||
/// the wrappers [`BinaryLerp`] and [`ImmediateLerp`] can be used.
|
/// the wrappers [`BinaryLerp`] and [`ImmediateLerp`] can be used.
|
||||||
///
|
///
|
||||||
/// ```
|
/// ```
|
||||||
/// use gooey::animation::{BinaryLerp, ImmediateLerp, LinearInterpolate};
|
/// use cushy::animation::{BinaryLerp, ImmediateLerp, LinearInterpolate};
|
||||||
/// use gooey::kludgine::Color;
|
/// use cushy::kludgine::Color;
|
||||||
///
|
///
|
||||||
/// #[derive(LinearInterpolate, PartialEq, Debug)]
|
/// #[derive(LinearInterpolate, PartialEq, Debug)]
|
||||||
/// struct Struct(Color, BinaryLerp<&'static str>, ImmediateLerp<&'static str>);
|
/// struct Struct(Color, BinaryLerp<&'static str>, ImmediateLerp<&'static str>);
|
||||||
|
|
@ -811,7 +811,7 @@ pub trait LinearInterpolate: PartialEq {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Derives [`LinerarInterpolate`](trait@LinearInterpolate) for structs and fieldless enums.
|
/// Derives [`LinerarInterpolate`](trait@LinearInterpolate) for structs and fieldless enums.
|
||||||
pub use gooey_macros::LinearInterpolate;
|
pub use cushy_macros::LinearInterpolate;
|
||||||
|
|
||||||
macro_rules! impl_lerp_for_int {
|
macro_rules! impl_lerp_for_int {
|
||||||
($type:ident, $unsigned:ident, $float:ident) => {
|
($type:ident, $unsigned:ident, $float:ident) => {
|
||||||
|
|
|
||||||
32
src/app.rs
32
src/app.rs
|
|
@ -7,16 +7,16 @@ use crate::utils::IgnorePoison;
|
||||||
use crate::window::sealed::WindowCommand;
|
use crate::window::sealed::WindowCommand;
|
||||||
use crate::window::WindowHandle;
|
use crate::window::WindowHandle;
|
||||||
|
|
||||||
/// A Gooey application that has not started running yet.
|
/// A Cushy application that has not started running yet.
|
||||||
pub struct PendingApp {
|
pub struct PendingApp {
|
||||||
app: kludgine::app::PendingApp<WindowCommand>,
|
app: kludgine::app::PendingApp<WindowCommand>,
|
||||||
gooey: Gooey,
|
cushy: Cushy,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl PendingApp {
|
impl PendingApp {
|
||||||
/// The shared resources this application utilizes.
|
/// The shared resources this application utilizes.
|
||||||
pub const fn gooey(&self) -> &Gooey {
|
pub const fn cushy(&self) -> &Cushy {
|
||||||
&self.gooey
|
&self.cushy
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -30,7 +30,7 @@ impl Default for PendingApp {
|
||||||
fn default() -> Self {
|
fn default() -> Self {
|
||||||
Self {
|
Self {
|
||||||
app: kludgine::app::PendingApp::default(),
|
app: kludgine::app::PendingApp::default(),
|
||||||
gooey: Gooey {
|
cushy: Cushy {
|
||||||
clipboard: Clipboard::new()
|
clipboard: Clipboard::new()
|
||||||
.ok()
|
.ok()
|
||||||
.map(|clipboard| Arc::new(Mutex::new(clipboard))),
|
.map(|clipboard| Arc::new(Mutex::new(clipboard))),
|
||||||
|
|
@ -47,11 +47,11 @@ impl AsApplication<AppEvent<WindowCommand>> for PendingApp {
|
||||||
|
|
||||||
/// Shared resources for a GUI application.
|
/// Shared resources for a GUI application.
|
||||||
#[derive(Clone)]
|
#[derive(Clone)]
|
||||||
pub struct Gooey {
|
pub struct Cushy {
|
||||||
pub(crate) clipboard: Option<Arc<Mutex<Clipboard>>>,
|
pub(crate) clipboard: Option<Arc<Mutex<Clipboard>>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Gooey {
|
impl Cushy {
|
||||||
/// Returns a locked mutex guard to the OS's clipboard, if one was able to be
|
/// Returns a locked mutex guard to the OS's clipboard, if one was able to be
|
||||||
/// initialized when the window opened.
|
/// initialized when the window opened.
|
||||||
#[must_use]
|
#[must_use]
|
||||||
|
|
@ -62,37 +62,37 @@ impl Gooey {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A type that is a Gooey application.
|
/// A type that is a Cushy application.
|
||||||
pub trait Application: AsApplication<AppEvent<WindowCommand>> {
|
pub trait Application: AsApplication<AppEvent<WindowCommand>> {
|
||||||
/// Returns the shared resources for the application.
|
/// Returns the shared resources for the application.
|
||||||
fn gooey(&self) -> &Gooey;
|
fn cushy(&self) -> &Cushy;
|
||||||
/// Returns this type as an [`App`] handle.
|
/// Returns this type as an [`App`] handle.
|
||||||
fn as_app(&self) -> App;
|
fn as_app(&self) -> App;
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Application for PendingApp {
|
impl Application for PendingApp {
|
||||||
fn gooey(&self) -> &Gooey {
|
fn cushy(&self) -> &Cushy {
|
||||||
&self.gooey
|
&self.cushy
|
||||||
}
|
}
|
||||||
|
|
||||||
fn as_app(&self) -> App {
|
fn as_app(&self) -> App {
|
||||||
App {
|
App {
|
||||||
app: self.app.as_app(),
|
app: self.app.as_app(),
|
||||||
gooey: self.gooey.clone(),
|
cushy: self.cushy.clone(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A handle to a Gooey application.
|
/// A handle to a Cushy application.
|
||||||
#[derive(Clone)]
|
#[derive(Clone)]
|
||||||
pub struct App {
|
pub struct App {
|
||||||
app: kludgine::app::App<WindowCommand>,
|
app: kludgine::app::App<WindowCommand>,
|
||||||
gooey: Gooey,
|
cushy: Cushy,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Application for App {
|
impl Application for App {
|
||||||
fn gooey(&self) -> &Gooey {
|
fn cushy(&self) -> &Cushy {
|
||||||
&self.gooey
|
&self.cushy
|
||||||
}
|
}
|
||||||
|
|
||||||
fn as_app(&self) -> App {
|
fn as_app(&self) -> App {
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
//! Types that provide access to the Gooey runtime.
|
//! Types that provide access to the Cushy runtime.
|
||||||
use std::borrow::Cow;
|
use std::borrow::Cow;
|
||||||
use std::ops::{Deref, DerefMut};
|
use std::ops::{Deref, DerefMut};
|
||||||
use std::sync::atomic::{AtomicBool, Ordering};
|
use std::sync::atomic::{AtomicBool, Ordering};
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
#![allow(clippy::module_name_repetitions, clippy::missing_errors_doc)]
|
#![allow(clippy::module_name_repetitions, clippy::missing_errors_doc)]
|
||||||
|
|
||||||
// for proc-macros
|
// for proc-macros
|
||||||
extern crate self as gooey;
|
extern crate self as cushy;
|
||||||
|
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
mod utils;
|
mod utils;
|
||||||
|
|
@ -23,7 +23,7 @@ pub mod widgets;
|
||||||
pub mod window;
|
pub mod window;
|
||||||
use std::ops::Sub;
|
use std::ops::Sub;
|
||||||
|
|
||||||
pub use app::{App, Application, Gooey, Open, PendingApp, Run};
|
pub use app::{App, Application, Cushy, Open, PendingApp, Run};
|
||||||
pub use kludgine;
|
pub use kludgine;
|
||||||
use kludgine::app::winit::error::EventLoopError;
|
use kludgine::app::winit::error::EventLoopError;
|
||||||
use kludgine::figures::units::UPx;
|
use kludgine::figures::units::UPx;
|
||||||
|
|
@ -119,7 +119,7 @@ pub type Result<T = (), E = EventLoopError> = std::result::Result<T, E>;
|
||||||
|
|
||||||
/// Counts the number of expressions passed to it.
|
/// Counts the number of expressions passed to it.
|
||||||
///
|
///
|
||||||
/// This is used inside of Gooey macros to preallocate collections.
|
/// This is used inside of Cushy macros to preallocate collections.
|
||||||
#[macro_export]
|
#[macro_export]
|
||||||
#[doc(hidden)]
|
#[doc(hidden)]
|
||||||
macro_rules! count {
|
macro_rules! count {
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@ use interner::global::{GlobalString, StringPool};
|
||||||
static NAMES: StringPool<ahash::RandomState> =
|
static NAMES: StringPool<ahash::RandomState> =
|
||||||
StringPool::with_hasher(ahash::RandomState::with_seeds(0, 0, 0, 0));
|
StringPool::with_hasher(ahash::RandomState::with_seeds(0, 0, 0, 0));
|
||||||
|
|
||||||
/// A smart-string type that is used as a "name" in Gooey.
|
/// A smart-string type that is used as a "name" in Cushy.
|
||||||
///
|
///
|
||||||
/// This type ensures that globably only one instance of any unique wrapped
|
/// This type ensures that globably only one instance of any unique wrapped
|
||||||
/// string exists. By ensuring all instances of each unique string are the same
|
/// string exists. By ensuring all instances of each unique string are the same
|
||||||
|
|
|
||||||
|
|
@ -1103,7 +1103,7 @@ pub trait ComponentDefinition: NamedComponent {
|
||||||
|
|
||||||
/// Describes whether a type should invalidate a widget.
|
/// Describes whether a type should invalidate a widget.
|
||||||
pub trait RequireInvalidation {
|
pub trait RequireInvalidation {
|
||||||
/// Gooey tracks two different states:
|
/// Cushy tracks two different states:
|
||||||
///
|
///
|
||||||
/// - Whether to repaint the window
|
/// - Whether to repaint the window
|
||||||
/// - Whether to relayout a widget
|
/// - Whether to relayout a widget
|
||||||
|
|
@ -1535,7 +1535,7 @@ impl Default for ThemePair {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A Gooey Color theme.
|
/// A Cushy Color theme.
|
||||||
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
|
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
|
||||||
pub struct Theme {
|
pub struct Theme {
|
||||||
/// The primary color theme.
|
/// The primary color theme.
|
||||||
|
|
@ -2408,7 +2408,7 @@ where
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A color scheme for a Gooey application.
|
/// A color scheme for a Cushy application.
|
||||||
#[derive(Debug, Clone, Copy, PartialEq)]
|
#[derive(Debug, Clone, Copy, PartialEq)]
|
||||||
pub struct ColorScheme {
|
pub struct ColorScheme {
|
||||||
/// The primary accent color.
|
/// The primary accent color.
|
||||||
|
|
|
||||||
|
|
@ -9,18 +9,18 @@ use crate::animation::easings::{EaseInOutQuadradic, EaseInQuadradic, EaseOutQuad
|
||||||
use crate::animation::{EasingFunction, ZeroToOne};
|
use crate::animation::{EasingFunction, ZeroToOne};
|
||||||
use crate::styles::{Dimension, FocusableWidgets, FontFamilyList, VisualOrder};
|
use crate::styles::{Dimension, FocusableWidgets, FontFamilyList, VisualOrder};
|
||||||
|
|
||||||
/// Defines a set of style components for Gooey.
|
/// Defines a set of style components for Cushy.
|
||||||
///
|
///
|
||||||
/// These macros implement [`NamedComponent`](crate::styles::NamedComponent) and
|
/// These macros implement [`NamedComponent`](crate::styles::NamedComponent) and
|
||||||
/// [`ComponentDefinition`](crate::styles::ComponentDefinition) for each entry
|
/// [`ComponentDefinition`](crate::styles::ComponentDefinition) for each entry
|
||||||
/// defined. The syntax is:
|
/// defined. The syntax is:
|
||||||
///
|
///
|
||||||
/// ```rust
|
/// ```rust
|
||||||
/// use gooey::define_components;
|
/// use cushy::define_components;
|
||||||
/// use gooey::styles::Dimension;
|
/// use cushy::styles::Dimension;
|
||||||
/// use gooey::styles::components::{SurfaceColor, TextColor};
|
/// use cushy::styles::components::{SurfaceColor, TextColor};
|
||||||
/// use gooey::kludgine::Color;
|
/// use cushy::kludgine::Color;
|
||||||
/// use gooey::kludgine::figures::Zero;
|
/// use cushy::kludgine::figures::Zero;
|
||||||
///
|
///
|
||||||
/// define_components! {
|
/// define_components! {
|
||||||
/// GroupName {
|
/// GroupName {
|
||||||
|
|
|
||||||
|
|
@ -325,7 +325,7 @@ impl<T> Dynamic<T> {
|
||||||
/// code may produce slightly more readable code.
|
/// code may produce slightly more readable code.
|
||||||
///
|
///
|
||||||
/// ```rust
|
/// ```rust
|
||||||
/// let value = gooey::value::Dynamic::new(1);
|
/// let value = cushy::value::Dynamic::new(1);
|
||||||
///
|
///
|
||||||
/// // Using with_clone
|
/// // Using with_clone
|
||||||
/// value.with_clone(|value| {
|
/// value.with_clone(|value| {
|
||||||
|
|
@ -950,7 +950,7 @@ pub enum ReplaceError<T> {
|
||||||
|
|
||||||
/// A deadlock occurred accessing a [`Dynamic`].
|
/// A deadlock occurred accessing a [`Dynamic`].
|
||||||
///
|
///
|
||||||
/// Currently Gooey is only able to detect deadlocks where a single thread tries
|
/// Currently Cushy is only able to detect deadlocks where a single thread tries
|
||||||
/// to lock the same [`Dynamic`] multiple times.
|
/// to lock the same [`Dynamic`] multiple times.
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
struct DeadlockError;
|
struct DeadlockError;
|
||||||
|
|
@ -2709,7 +2709,7 @@ fn map_cycle_is_finite() {
|
||||||
let a = Dynamic::new(0_usize);
|
let a = Dynamic::new(0_usize);
|
||||||
|
|
||||||
// This callback updates a each time a is updated with a + 1, causing an
|
// This callback updates a each time a is updated with a + 1, causing an
|
||||||
// infinite cycle if not broken by Gooey.
|
// infinite cycle if not broken by Cushy.
|
||||||
a.for_each_cloned({
|
a.for_each_cloned({
|
||||||
let a = a.clone();
|
let a = a.clone();
|
||||||
move |current| {
|
move |current| {
|
||||||
|
|
@ -2718,7 +2718,7 @@ fn map_cycle_is_finite() {
|
||||||
})
|
})
|
||||||
.persist();
|
.persist();
|
||||||
|
|
||||||
// Gooey will invoke the callback for the first set call, but the set call
|
// Cushy will invoke the callback for the first set call, but the set call
|
||||||
// within the callback will not cause the callback to be invoked again.
|
// within the callback will not cause the callback to be invoked again.
|
||||||
// Thus, we expect setting the value to 1 to result in `a` containing 2.
|
// Thus, we expect setting the value to 1 to result in `a` containing 2.
|
||||||
a.set(1);
|
a.set(1);
|
||||||
|
|
|
||||||
|
|
@ -52,13 +52,13 @@ use crate::ConstraintLimit;
|
||||||
///
|
///
|
||||||
/// # Widgets are hierarchical
|
/// # Widgets are hierarchical
|
||||||
///
|
///
|
||||||
/// Gooey's widgets are organized in a hierarchical structure: widgets can
|
/// Cushy's widgets are organized in a hierarchical structure: widgets can
|
||||||
/// contain other widgets. A window in Gooey contains a single root widget,
|
/// contain other widgets. A window in Cushy contains a single root widget,
|
||||||
/// which may contain one or more additional widgets.
|
/// which may contain one or more additional widgets.
|
||||||
///
|
///
|
||||||
/// # How Widgets are created
|
/// # How Widgets are created
|
||||||
///
|
///
|
||||||
/// Gooey offers several approaches to creating widgets. The primary trait that
|
/// Cushy offers several approaches to creating widgets. The primary trait that
|
||||||
/// is used to instantiate a widget is [`MakeWidget`]. This trait is
|
/// is used to instantiate a widget is [`MakeWidget`]. This trait is
|
||||||
/// automatically implemented for all types that implement [`Widget`].
|
/// automatically implemented for all types that implement [`Widget`].
|
||||||
///
|
///
|
||||||
|
|
@ -119,8 +119,8 @@ use crate::ConstraintLimit;
|
||||||
///
|
///
|
||||||
/// Next, the window sets the root's layout. When a widget contains another
|
/// Next, the window sets the root's layout. When a widget contains another
|
||||||
/// widget, it must call [`LayoutContext::set_child_layout`] for the child to be
|
/// widget, it must call [`LayoutContext::set_child_layout`] for the child to be
|
||||||
/// able to be rendered. This tells Gooey the location to draw the widget. While
|
/// able to be rendered. This tells Cushy the location to draw the widget. While
|
||||||
/// it is possible to provide any rectangle, Gooey clips all widgets and their
|
/// it is possible to provide any rectangle, Cushy clips all widgets and their
|
||||||
/// children so that they cannot draw outside of their assigned bounds.
|
/// children so that they cannot draw outside of their assigned bounds.
|
||||||
///
|
///
|
||||||
/// Once the layout has been determined, the window will invoke the root
|
/// Once the layout has been determined, the window will invoke the root
|
||||||
|
|
@ -136,13 +136,13 @@ use crate::ConstraintLimit;
|
||||||
///
|
///
|
||||||
/// # Controlling Invalidation and Redrawing
|
/// # Controlling Invalidation and Redrawing
|
||||||
///
|
///
|
||||||
/// Gooey only redraws window contents when requested by the operating system or
|
/// Cushy only redraws window contents when requested by the operating system or
|
||||||
/// a tracked [`Dynamic`] is updated. Similarly, Gooey caches the known layout
|
/// a tracked [`Dynamic`] is updated. Similarly, Cushy caches the known layout
|
||||||
/// sizes and locations for widgets unless they are *invalidated*. Invalidation
|
/// sizes and locations for widgets unless they are *invalidated*. Invalidation
|
||||||
/// is done automatically when the window size changes or a tracked [`Dynamic`]
|
/// is done automatically when the window size changes or a tracked [`Dynamic`]
|
||||||
/// is updated.
|
/// is updated.
|
||||||
///
|
///
|
||||||
/// These systems require Gooey to track which [`Dynamic`] values a widget
|
/// These systems require Cushy to track which [`Dynamic`] values a widget
|
||||||
/// depends on for redrawing and invalidation. During a widget's redraw and
|
/// depends on for redrawing and invalidation. During a widget's redraw and
|
||||||
/// layout functions, it needs to ensure that all depended upon [`Dynamic`]s are
|
/// layout functions, it needs to ensure that all depended upon [`Dynamic`]s are
|
||||||
/// tracked using one of the various
|
/// tracked using one of the various
|
||||||
|
|
@ -231,33 +231,33 @@ use crate::ConstraintLimit;
|
||||||
///
|
///
|
||||||
/// # Styling
|
/// # Styling
|
||||||
///
|
///
|
||||||
/// Gooey allows widgets to receive styling information through the widget
|
/// Cushy allows widgets to receive styling information through the widget
|
||||||
/// hierarchy using [`Styles`]. Gooey calculates the effectives styles for each
|
/// hierarchy using [`Styles`]. Cushy calculates the effectives styles for each
|
||||||
/// widget by inheriting all inheritable styles from its parent.
|
/// widget by inheriting all inheritable styles from its parent.
|
||||||
///
|
///
|
||||||
/// The [`Style`] widget allows assigining [`Styles`] to all of its children
|
/// The [`Style`] widget allows assigining [`Styles`] to all of its children
|
||||||
/// widget. It works by calling [`WidgetContext::attach_styles`], and Gooey
|
/// widget. It works by calling [`WidgetContext::attach_styles`], and Cushy
|
||||||
/// takes care of the rest.
|
/// takes care of the rest.
|
||||||
///
|
///
|
||||||
/// Styling in Gooey aims to be simple, easy-to-understand, and extensible.
|
/// Styling in Cushy aims to be simple, easy-to-understand, and extensible.
|
||||||
///
|
///
|
||||||
/// # Color Themes
|
/// # Color Themes
|
||||||
///
|
///
|
||||||
/// Gooey aims to make it easy for developers to customize the appearance of its
|
/// Cushy aims to make it easy for developers to customize the appearance of its
|
||||||
/// applications. The way color themes work in Gooey begins with the
|
/// applications. The way color themes work in Cushy begins with the
|
||||||
/// [`ColorScheme`](crate::styles::ColorScheme). A color scheme is a set of
|
/// [`ColorScheme`](crate::styles::ColorScheme). A color scheme is a set of
|
||||||
/// [`ColorSource`](crate::styles::ColorSource) that are used to generate a
|
/// [`ColorSource`](crate::styles::ColorSource) that are used to generate a
|
||||||
/// variety of shades of colors for various roles color plays in a user
|
/// variety of shades of colors for various roles color plays in a user
|
||||||
/// interface. In a way, coloring Gooey apps is a bit like paint-by-number,
|
/// interface. In a way, coloring Cushy apps is a bit like paint-by-number,
|
||||||
/// where the number is the name of the color role.
|
/// where the number is the name of the color role.
|
||||||
///
|
///
|
||||||
/// A `ColorScheme` can be used to create a [`ThemePair`], which is theme
|
/// A `ColorScheme` can be used to create a [`ThemePair`], which is theme
|
||||||
/// definition that a theme for light and dark mode.
|
/// definition that a theme for light and dark mode.
|
||||||
///
|
///
|
||||||
/// In [the repository][repo], the `theme` example is a good way to explore how
|
/// In [the repository][repo], the `theme` example is a good way to explore how
|
||||||
/// the color system works in Gooey.
|
/// the color system works in Cushy.
|
||||||
///
|
///
|
||||||
/// [repo]: https://github.com/khonsulabs/gooey
|
/// [repo]: https://github.com/khonsulabs/cushy
|
||||||
pub trait Widget: Send + Debug + 'static {
|
pub trait Widget: Send + Debug + 'static {
|
||||||
/// Redraw the contents of this widget.
|
/// Redraw the contents of this widget.
|
||||||
fn redraw(&mut self, context: &mut GraphicsContext<'_, '_, '_, '_, '_>);
|
fn redraw(&mut self, context: &mut GraphicsContext<'_, '_, '_, '_, '_>);
|
||||||
|
|
@ -327,7 +327,7 @@ pub trait Widget: Send + Debug + 'static {
|
||||||
fn unhover(&mut self, context: &mut EventContext<'_, '_>) {}
|
fn unhover(&mut self, context: &mut EventContext<'_, '_>) {}
|
||||||
|
|
||||||
/// This widget has been targeted to be focused. If this function returns
|
/// This widget has been targeted to be focused. If this function returns
|
||||||
/// true, the widget will be focused. If false, Gooey will continue
|
/// true, the widget will be focused. If false, Cushy will continue
|
||||||
/// searching for another focus target.
|
/// searching for another focus target.
|
||||||
#[allow(unused_variables)]
|
#[allow(unused_variables)]
|
||||||
fn accept_focus(&mut self, context: &mut EventContext<'_, '_>) -> bool {
|
fn accept_focus(&mut self, context: &mut EventContext<'_, '_>) -> bool {
|
||||||
|
|
@ -487,7 +487,7 @@ pub enum RootBehavior {
|
||||||
PassThrough,
|
PassThrough,
|
||||||
/// This widget will try to expand to fill the window.
|
/// This widget will try to expand to fill the window.
|
||||||
Expand,
|
Expand,
|
||||||
/// This widget will measure its contents to fit its child, but Gooey should
|
/// This widget will measure its contents to fit its child, but Cushy should
|
||||||
/// still stretch this widget to fill the window.
|
/// still stretch this widget to fill the window.
|
||||||
Align,
|
Align,
|
||||||
/// This widget adjusts its child layout with padding.
|
/// This widget adjusts its child layout with padding.
|
||||||
|
|
@ -643,7 +643,7 @@ pub trait WrapperWidget: Debug + Send + 'static {
|
||||||
fn unhover(&mut self, context: &mut EventContext<'_, '_>) {}
|
fn unhover(&mut self, context: &mut EventContext<'_, '_>) {}
|
||||||
|
|
||||||
/// This widget has been targeted to be focused. If this function returns
|
/// This widget has been targeted to be focused. If this function returns
|
||||||
/// true, the widget will be focused. If false, Gooey will continue
|
/// true, the widget will be focused. If false, Cushy will continue
|
||||||
/// searching for another focus target.
|
/// searching for another focus target.
|
||||||
#[allow(unused_variables)]
|
#[allow(unused_variables)]
|
||||||
fn accept_focus(&mut self, context: &mut EventContext<'_, '_>) -> bool {
|
fn accept_focus(&mut self, context: &mut EventContext<'_, '_>) -> bool {
|
||||||
|
|
@ -1061,7 +1061,7 @@ pub trait MakeWidget: Sized {
|
||||||
|
|
||||||
/// Sets the widget that should be focused next.
|
/// Sets the widget that should be focused next.
|
||||||
///
|
///
|
||||||
/// Gooey automatically determines reverse tab order by using this same
|
/// Cushy automatically determines reverse tab order by using this same
|
||||||
/// relationship.
|
/// relationship.
|
||||||
fn with_next_focus(self, next_focus: impl IntoValue<Option<WidgetId>>) -> WidgetInstance {
|
fn with_next_focus(self, next_focus: impl IntoValue<Option<WidgetId>>) -> WidgetInstance {
|
||||||
self.make_widget().with_next_focus(next_focus)
|
self.make_widget().with_next_focus(next_focus)
|
||||||
|
|
@ -1441,7 +1441,7 @@ impl WidgetInstance {
|
||||||
|
|
||||||
/// Sets the widget that should be focused next.
|
/// Sets the widget that should be focused next.
|
||||||
///
|
///
|
||||||
/// Gooey automatically determines reverse tab order by using this same
|
/// Cushy automatically determines reverse tab order by using this same
|
||||||
/// relationship.
|
/// relationship.
|
||||||
///
|
///
|
||||||
/// # Panics
|
/// # Panics
|
||||||
|
|
|
||||||
|
|
@ -372,7 +372,7 @@ impl Widget for Button {
|
||||||
// colors. most_contrasting from a 0-alpha color is not a
|
// colors. most_contrasting from a 0-alpha color is not a
|
||||||
// meaningful measurement, so we only start measuring contrast
|
// meaningful measurement, so we only start measuring contrast
|
||||||
// once we reach 50% opacity. If we ever add solid background
|
// once we reach 50% opacity. If we ever add solid background
|
||||||
// tracking (<https://github.com/khonsulabs/gooey/issues/73>),
|
// tracking (<https://github.com/khonsulabs/cushy/issues/73>),
|
||||||
// we should use that color for most_contrasting always.
|
// we should use that color for most_contrasting always.
|
||||||
let color = if style.background.alpha() > 128 {
|
let color = if style.background.alpha() > 128 {
|
||||||
style
|
style
|
||||||
|
|
|
||||||
|
|
@ -266,7 +266,7 @@ impl Custom {
|
||||||
|
|
||||||
/// Invokes `advance_focus` when this widget has focus and focus is
|
/// Invokes `advance_focus` when this widget has focus and focus is
|
||||||
/// requested to advance to another widget. Returning
|
/// requested to advance to another widget. Returning
|
||||||
/// [`HANDLED`](crate::widget::HANDLED) will signal to Gooey that the focus
|
/// [`HANDLED`](crate::widget::HANDLED) will signal to Cushy that the focus
|
||||||
/// has moved and the request should not be processed any further.
|
/// has moved and the request should not be processed any further.
|
||||||
///
|
///
|
||||||
/// This callback corresponds to [`WrapperWidget::advance_focus`].
|
/// This callback corresponds to [`WrapperWidget::advance_focus`].
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@ use std::sync::{Arc, Mutex};
|
||||||
use std::time::Duration;
|
use std::time::Duration;
|
||||||
|
|
||||||
use alot::{LotId, OrderedLots};
|
use alot::{LotId, OrderedLots};
|
||||||
use gooey::widget::{RootBehavior, WidgetInstance};
|
use cushy::widget::{RootBehavior, WidgetInstance};
|
||||||
use intentional::Assert;
|
use intentional::Assert;
|
||||||
use kludgine::figures::units::{Lp, Px, UPx};
|
use kludgine::figures::units::{Lp, Px, UPx};
|
||||||
use kludgine::figures::{IntoSigned, IntoUnsigned, Point, Rect, Size, Zero};
|
use kludgine::figures::{IntoSigned, IntoUnsigned, Point, Rect, Size, Zero};
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,7 @@ use kludgine::Kludgine;
|
||||||
use tracing::Level;
|
use tracing::Level;
|
||||||
|
|
||||||
use crate::animation::{LinearInterpolate, PercentBetween, ZeroToOne};
|
use crate::animation::{LinearInterpolate, PercentBetween, ZeroToOne};
|
||||||
use crate::app::{Application, Gooey, Open, PendingApp, Run};
|
use crate::app::{Application, Cushy, Open, PendingApp, Run};
|
||||||
use crate::context::{
|
use crate::context::{
|
||||||
AsEventContext, EventContext, Exclusive, GraphicsContext, InvalidationStatus, LayoutContext,
|
AsEventContext, EventContext, Exclusive, GraphicsContext, InvalidationStatus, LayoutContext,
|
||||||
WidgetContext,
|
WidgetContext,
|
||||||
|
|
@ -44,11 +44,11 @@ use crate::widget::{
|
||||||
use crate::window::sealed::WindowCommand;
|
use crate::window::sealed::WindowCommand;
|
||||||
use crate::{initialize_tracing, ConstraintLimit};
|
use crate::{initialize_tracing, ConstraintLimit};
|
||||||
|
|
||||||
/// A currently running Gooey window.
|
/// A currently running Cushy window.
|
||||||
pub struct RunningWindow<'window> {
|
pub struct RunningWindow<'window> {
|
||||||
window: kludgine::app::Window<'window, WindowCommand>,
|
window: kludgine::app::Window<'window, WindowCommand>,
|
||||||
invalidation_status: InvalidationStatus,
|
invalidation_status: InvalidationStatus,
|
||||||
gooey: Gooey,
|
cushy: Cushy,
|
||||||
focused: Dynamic<bool>,
|
focused: Dynamic<bool>,
|
||||||
occluded: Dynamic<bool>,
|
occluded: Dynamic<bool>,
|
||||||
inner_size: Dynamic<Size<UPx>>,
|
inner_size: Dynamic<Size<UPx>>,
|
||||||
|
|
@ -58,7 +58,7 @@ impl<'window> RunningWindow<'window> {
|
||||||
pub(crate) fn new(
|
pub(crate) fn new(
|
||||||
window: kludgine::app::Window<'window, WindowCommand>,
|
window: kludgine::app::Window<'window, WindowCommand>,
|
||||||
invalidation_status: &InvalidationStatus,
|
invalidation_status: &InvalidationStatus,
|
||||||
gooey: &Gooey,
|
cushy: &Cushy,
|
||||||
focused: &Dynamic<bool>,
|
focused: &Dynamic<bool>,
|
||||||
occluded: &Dynamic<bool>,
|
occluded: &Dynamic<bool>,
|
||||||
inner_size: &Dynamic<Size<UPx>>,
|
inner_size: &Dynamic<Size<UPx>>,
|
||||||
|
|
@ -66,7 +66,7 @@ impl<'window> RunningWindow<'window> {
|
||||||
Self {
|
Self {
|
||||||
window,
|
window,
|
||||||
invalidation_status: invalidation_status.clone(),
|
invalidation_status: invalidation_status.clone(),
|
||||||
gooey: gooey.clone(),
|
cushy: cushy.clone(),
|
||||||
focused: focused.clone(),
|
focused: focused.clone(),
|
||||||
occluded: occluded.clone(),
|
occluded: occluded.clone(),
|
||||||
inner_size: inner_size.clone(),
|
inner_size: inner_size.clone(),
|
||||||
|
|
@ -116,7 +116,7 @@ impl<'window> RunningWindow<'window> {
|
||||||
/// initialized when the window opened.
|
/// initialized when the window opened.
|
||||||
#[must_use]
|
#[must_use]
|
||||||
pub fn clipboard_guard(&self) -> Option<MutexGuard<'_, Clipboard>> {
|
pub fn clipboard_guard(&self) -> Option<MutexGuard<'_, Clipboard>> {
|
||||||
self.gooey.clipboard_guard()
|
self.cushy.clipboard_guard()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -134,10 +134,10 @@ impl<'window> DerefMut for RunningWindow<'window> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// The attributes of a Gooey window.
|
/// The attributes of a Cushy window.
|
||||||
pub type WindowAttributes = kludgine::app::WindowAttributes;
|
pub type WindowAttributes = kludgine::app::WindowAttributes;
|
||||||
|
|
||||||
/// A Gooey window that is not yet running.
|
/// A Cushy window that is not yet running.
|
||||||
#[must_use]
|
#[must_use]
|
||||||
pub struct Window<Behavior>
|
pub struct Window<Behavior>
|
||||||
where
|
where
|
||||||
|
|
@ -305,7 +305,7 @@ where
|
||||||
.and_then(OsStr::to_str)
|
.and_then(OsStr::to_str)
|
||||||
.map(ToString::to_string)
|
.map(ToString::to_string)
|
||||||
})
|
})
|
||||||
.unwrap_or_else(|| String::from("Gooey App"))
|
.unwrap_or_else(|| String::from("Cushy App"))
|
||||||
})
|
})
|
||||||
.clone();
|
.clone();
|
||||||
Self {
|
Self {
|
||||||
|
|
@ -355,14 +355,14 @@ where
|
||||||
where
|
where
|
||||||
App: Application,
|
App: Application,
|
||||||
{
|
{
|
||||||
let gooey = app.gooey().clone();
|
let cushy = app.cushy().clone();
|
||||||
|
|
||||||
let handle = GooeyWindow::<Behavior>::open_with(
|
let handle = CushyWindow::<Behavior>::open_with(
|
||||||
app,
|
app,
|
||||||
sealed::Context {
|
sealed::Context {
|
||||||
user: self.context,
|
user: self.context,
|
||||||
settings: RefCell::new(sealed::WindowSettings {
|
settings: RefCell::new(sealed::WindowSettings {
|
||||||
gooey,
|
cushy,
|
||||||
redraw_status: self.pending.0.redraw_status.clone(),
|
redraw_status: self.pending.0.redraw_status.clone(),
|
||||||
on_closed: self.on_closed,
|
on_closed: self.on_closed,
|
||||||
transparent: self.attributes.transparent,
|
transparent: self.attributes.transparent,
|
||||||
|
|
@ -391,7 +391,7 @@ where
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// The behavior of a Gooey window.
|
/// The behavior of a Cushy window.
|
||||||
pub trait WindowBehavior: Sized + 'static {
|
pub trait WindowBehavior: Sized + 'static {
|
||||||
/// The type that is provided when initializing this window.
|
/// The type that is provided when initializing this window.
|
||||||
type Context: Send + 'static;
|
type Context: Send + 'static;
|
||||||
|
|
@ -424,7 +424,7 @@ pub trait WindowBehavior: Sized + 'static {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
struct GooeyWindow<T> {
|
struct CushyWindow<T> {
|
||||||
behavior: T,
|
behavior: T,
|
||||||
tree: Tree,
|
tree: Tree,
|
||||||
root: MountedWidget,
|
root: MountedWidget,
|
||||||
|
|
@ -446,11 +446,11 @@ struct GooeyWindow<T> {
|
||||||
theme_mode: Value<ThemeMode>,
|
theme_mode: Value<ThemeMode>,
|
||||||
transparent: bool,
|
transparent: bool,
|
||||||
fonts: FontState,
|
fonts: FontState,
|
||||||
gooey: Gooey,
|
cushy: Cushy,
|
||||||
on_closed: Option<OnceCallback>,
|
on_closed: Option<OnceCallback>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<T> GooeyWindow<T>
|
impl<T> CushyWindow<T>
|
||||||
where
|
where
|
||||||
T: WindowBehavior,
|
T: WindowBehavior,
|
||||||
{
|
{
|
||||||
|
|
@ -675,7 +675,7 @@ enum RootMode {
|
||||||
Align,
|
Align,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<T> kludgine::app::WindowBehavior<WindowCommand> for GooeyWindow<T>
|
impl<T> kludgine::app::WindowBehavior<WindowCommand> for CushyWindow<T>
|
||||||
where
|
where
|
||||||
T: WindowBehavior,
|
T: WindowBehavior,
|
||||||
{
|
{
|
||||||
|
|
@ -687,7 +687,7 @@ where
|
||||||
context: Self::Context,
|
context: Self::Context,
|
||||||
) -> Self {
|
) -> Self {
|
||||||
let mut settings = context.settings.borrow_mut();
|
let mut settings = context.settings.borrow_mut();
|
||||||
let gooey = settings.gooey.clone();
|
let cushy = settings.cushy.clone();
|
||||||
let occluded = settings.occluded.take().unwrap_or_default();
|
let occluded = settings.occluded.take().unwrap_or_default();
|
||||||
let focused = settings.focused.take().unwrap_or_default();
|
let focused = settings.focused.take().unwrap_or_default();
|
||||||
let theme = settings.theme.take().expect("theme always present");
|
let theme = settings.theme.take().expect("theme always present");
|
||||||
|
|
@ -712,7 +712,7 @@ where
|
||||||
&mut RunningWindow::new(
|
&mut RunningWindow::new(
|
||||||
window,
|
window,
|
||||||
&redraw_status,
|
&redraw_status,
|
||||||
&gooey,
|
&cushy,
|
||||||
&focused,
|
&focused,
|
||||||
&occluded,
|
&occluded,
|
||||||
&inner_size,
|
&inner_size,
|
||||||
|
|
@ -752,7 +752,7 @@ where
|
||||||
theme_mode,
|
theme_mode,
|
||||||
transparent,
|
transparent,
|
||||||
fonts,
|
fonts,
|
||||||
gooey,
|
cushy,
|
||||||
on_closed,
|
on_closed,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -778,7 +778,7 @@ where
|
||||||
let mut window = RunningWindow::new(
|
let mut window = RunningWindow::new(
|
||||||
window,
|
window,
|
||||||
&self.redraw_status,
|
&self.redraw_status,
|
||||||
&self.gooey,
|
&self.cushy,
|
||||||
&self.focused,
|
&self.focused,
|
||||||
&self.occluded,
|
&self.occluded,
|
||||||
&self.inner_size,
|
&self.inner_size,
|
||||||
|
|
@ -914,7 +914,7 @@ where
|
||||||
&mut RunningWindow::new(
|
&mut RunningWindow::new(
|
||||||
window,
|
window,
|
||||||
&self.redraw_status,
|
&self.redraw_status,
|
||||||
&self.gooey,
|
&self.cushy,
|
||||||
&self.focused,
|
&self.focused,
|
||||||
&self.occluded,
|
&self.occluded,
|
||||||
&self.inner_size,
|
&self.inner_size,
|
||||||
|
|
@ -988,7 +988,7 @@ where
|
||||||
let mut window = RunningWindow::new(
|
let mut window = RunningWindow::new(
|
||||||
window,
|
window,
|
||||||
&self.redraw_status,
|
&self.redraw_status,
|
||||||
&self.gooey,
|
&self.cushy,
|
||||||
&self.focused,
|
&self.focused,
|
||||||
&self.occluded,
|
&self.occluded,
|
||||||
&self.inner_size,
|
&self.inner_size,
|
||||||
|
|
@ -1093,7 +1093,7 @@ where
|
||||||
let mut window = RunningWindow::new(
|
let mut window = RunningWindow::new(
|
||||||
window,
|
window,
|
||||||
&self.redraw_status,
|
&self.redraw_status,
|
||||||
&self.gooey,
|
&self.cushy,
|
||||||
&self.focused,
|
&self.focused,
|
||||||
&self.occluded,
|
&self.occluded,
|
||||||
&self.inner_size,
|
&self.inner_size,
|
||||||
|
|
@ -1129,7 +1129,7 @@ where
|
||||||
let mut window = RunningWindow::new(
|
let mut window = RunningWindow::new(
|
||||||
window,
|
window,
|
||||||
&self.redraw_status,
|
&self.redraw_status,
|
||||||
&self.gooey,
|
&self.cushy,
|
||||||
&self.focused,
|
&self.focused,
|
||||||
&self.occluded,
|
&self.occluded,
|
||||||
&self.inner_size,
|
&self.inner_size,
|
||||||
|
|
@ -1162,7 +1162,7 @@ where
|
||||||
let mut window = RunningWindow::new(
|
let mut window = RunningWindow::new(
|
||||||
window,
|
window,
|
||||||
&self.redraw_status,
|
&self.redraw_status,
|
||||||
&self.gooey,
|
&self.cushy,
|
||||||
&self.focused,
|
&self.focused,
|
||||||
&self.occluded,
|
&self.occluded,
|
||||||
&self.inner_size,
|
&self.inner_size,
|
||||||
|
|
@ -1214,7 +1214,7 @@ where
|
||||||
let mut window = RunningWindow::new(
|
let mut window = RunningWindow::new(
|
||||||
window,
|
window,
|
||||||
&self.redraw_status,
|
&self.redraw_status,
|
||||||
&self.gooey,
|
&self.cushy,
|
||||||
&self.focused,
|
&self.focused,
|
||||||
&self.occluded,
|
&self.occluded,
|
||||||
&self.inner_size,
|
&self.inner_size,
|
||||||
|
|
@ -1244,7 +1244,7 @@ where
|
||||||
let mut window = RunningWindow::new(
|
let mut window = RunningWindow::new(
|
||||||
window,
|
window,
|
||||||
&self.redraw_status,
|
&self.redraw_status,
|
||||||
&self.gooey,
|
&self.cushy,
|
||||||
&self.focused,
|
&self.focused,
|
||||||
&self.occluded,
|
&self.occluded,
|
||||||
&self.inner_size,
|
&self.inner_size,
|
||||||
|
|
@ -1356,7 +1356,7 @@ where
|
||||||
let mut window = RunningWindow::new(
|
let mut window = RunningWindow::new(
|
||||||
window,
|
window,
|
||||||
&self.redraw_status,
|
&self.redraw_status,
|
||||||
&self.gooey,
|
&self.cushy,
|
||||||
&self.focused,
|
&self.focused,
|
||||||
&self.occluded,
|
&self.occluded,
|
||||||
&self.inner_size,
|
&self.inner_size,
|
||||||
|
|
@ -1369,7 +1369,7 @@ where
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<Behavior> Drop for GooeyWindow<Behavior> {
|
impl<Behavior> Drop for CushyWindow<Behavior> {
|
||||||
fn drop(&mut self) {
|
fn drop(&mut self) {
|
||||||
if let Some(on_closed) = self.on_closed.take() {
|
if let Some(on_closed) = self.on_closed.take() {
|
||||||
on_closed.invoke(());
|
on_closed.invoke(());
|
||||||
|
|
@ -1401,7 +1401,7 @@ pub(crate) mod sealed {
|
||||||
use kludgine::figures::units::UPx;
|
use kludgine::figures::units::UPx;
|
||||||
use kludgine::figures::Size;
|
use kludgine::figures::Size;
|
||||||
|
|
||||||
use crate::app::Gooey;
|
use crate::app::Cushy;
|
||||||
use crate::context::InvalidationStatus;
|
use crate::context::InvalidationStatus;
|
||||||
use crate::styles::{FontFamilyList, ThemePair};
|
use crate::styles::{FontFamilyList, ThemePair};
|
||||||
use crate::value::{Dynamic, Value};
|
use crate::value::{Dynamic, Value};
|
||||||
|
|
@ -1414,7 +1414,7 @@ pub(crate) mod sealed {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub struct WindowSettings {
|
pub struct WindowSettings {
|
||||||
pub gooey: Gooey,
|
pub cushy: Cushy,
|
||||||
pub redraw_status: InvalidationStatus,
|
pub redraw_status: InvalidationStatus,
|
||||||
pub attributes: Option<WindowAttributes>,
|
pub attributes: Option<WindowAttributes>,
|
||||||
pub occluded: Option<Dynamic<bool>>,
|
pub occluded: Option<Dynamic<bool>>,
|
||||||
|
|
@ -1537,7 +1537,7 @@ fn default_family(query: Family<'_>) -> Option<FamilyOwned> {
|
||||||
.map(FamilyOwned::Name)
|
.map(FamilyOwned::Name)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A handle to an open Gooey window.
|
/// A handle to an open Cushy window.
|
||||||
#[derive(Clone)]
|
#[derive(Clone)]
|
||||||
pub struct WindowHandle {
|
pub struct WindowHandle {
|
||||||
inner: InnerWindowHandle,
|
inner: InnerWindowHandle,
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue