mirror of
https://github.com/danbulant/cushy
synced 2026-06-20 23:11:12 +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://gooey.rs/main/docs/gooey/)
|
||||

|
||||
[](https://crates.io/crates/cushy)
|
||||
[](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
|
||||
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].
|
||||
|
||||
Gooey is powered by:
|
||||
Cushy is powered by:
|
||||
|
||||
- [`Kludgine`][kludgine], a 2d graphics library powered by:
|
||||
- [`winit`][winit] for windowing/input
|
||||
|
|
@ -18,19 +18,19 @@ Gooey is powered by:
|
|||
- [`arboard`][arboard] for clipboard support
|
||||
- [`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
|
||||
[documentation][widget] has an overview of how Gooey works. A list of built-in
|
||||
widgets can be found in the [`gooey::widgets`][widgets] module.
|
||||
[documentation][widget] has an overview of how Cushy works. A list of built-in
|
||||
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
|
||||
increments its own label:
|
||||
|
||||
```rust,ignore
|
||||
fn main() -> gooey::Result {
|
||||
fn main() -> cushy::Result {
|
||||
// Create a dynamic usize.
|
||||
let count = Dynamic::new(0_isize);
|
||||
// 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
|
||||
directory][examples]. Nearly every feature in Gooey was initially tested by
|
||||
A great way to learn more about Cushy is to explore the [examples
|
||||
directory][examples]. Nearly every feature in Cushy was initially tested by
|
||||
creating an example.
|
||||
|
||||
## 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
|
||||
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
|
||||
Gooey.
|
||||
Cushy.
|
||||
|
||||
[widget]: crate::widget::Widget
|
||||
[widgets]: mod@crate::widgets
|
||||
[button-example]: https://github.com/khonsulabs/gooey/tree/main/examples/basic-button.rs
|
||||
[examples]: https://github.com/khonsulabs/gooey/tree/main/examples/
|
||||
[button-example]: https://github.com/khonsulabs/cushy/tree/main/examples/basic-button.rs
|
||||
[examples]: https://github.com/khonsulabs/cushy/tree/main/examples/
|
||||
[kludgine]: https://github.com/khonsulabs/kludgine
|
||||
[figures]: https://github.com/khonsulabs/figures
|
||||
[wgpu]: https://github.com/gfx-rs/wgpu
|
||||
|
|
@ -75,7 +75,7 @@ Gooey.
|
|||
[palette]: https://github.com/Ogeon/palette
|
||||
[arboard]: https://github.com/1Password/arboard
|
||||
[ecton]: https://github.com/khonsulabs/ecton
|
||||
[issues]: https://github.com/khonsulabs/gooey/issues
|
||||
[issues]: https://github.com/khonsulabs/cushy/issues
|
||||
|
||||
## Open-source Licenses
|
||||
|
||||
|
|
|
|||
2
.github/workflows/docs.yml
vendored
2
.github/workflows/docs.yml
vendored
|
|
@ -30,6 +30,6 @@ jobs:
|
|||
url: ${{ secrets.DOSSIER_URL }}
|
||||
api-key-id: ${{ secrets.DOSSIER_API_KEY_ID }}
|
||||
api-key: ${{ secrets.DOSSIER_API_KEY }}
|
||||
project: gooey
|
||||
project: cushy
|
||||
from: target/doc/
|
||||
to: /${{ github.ref_name }}/docs
|
||||
|
|
@ -37,17 +37,17 @@ Configuration(
|
|||
release: "v0.1.3",
|
||||
),
|
||||
"docs": (
|
||||
default: "https://gooey.rs/main/docs/gooey/",
|
||||
release: "https://docs.rs/gooey",
|
||||
default: "https://khonsu.dev/cushy/main/docs/cushy/",
|
||||
release: "https://docs.rs/cushy",
|
||||
),
|
||||
"widget": (
|
||||
default: "https://gooey.rs/main/docs/gooey/widget/trait.Widget.html",
|
||||
release: "https://docs.rs/gooey/*/gooey/widget/trait.Widget.html",
|
||||
default: "https://khonsu.dev/cushy/main/docs/cushy/widget/trait.Widget.html",
|
||||
release: "https://docs.rs/cushy/*/cushy/widget/trait.Widget.html",
|
||||
for_docs: "crate::widget::Widget",
|
||||
),
|
||||
"widgets": (
|
||||
default: "https://gooey.rs/main/docs/gooey/widgets/index.html",
|
||||
release: "https://docs.rs/gooey/*/gooey/widgets/index.html",
|
||||
default: "https://khonsu.dev/cushy/main/docs/cushy/widgets/index.html",
|
||||
release: "https://docs.rs/cushy/*/cushy/widgets/index.html",
|
||||
for_docs: "mod@crate::widgets",
|
||||
),
|
||||
},
|
||||
|
|
|
|||
|
|
@ -1,14 +1,14 @@
|
|||

|
||||
[](https://crates.io/crates/gooey)
|
||||

|
||||
[](https://crates.io/crates/cushy)
|
||||
[]($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
|
||||
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].
|
||||
|
||||
Gooey is powered by:
|
||||
Cushy is powered by:
|
||||
|
||||
- [`Kludgine`][kludgine], a 2d graphics library powered by:
|
||||
- [`winit`][winit] for windowing/input
|
||||
|
|
@ -18,14 +18,14 @@ Gooey is powered by:
|
|||
- [`arboard`][arboard] for clipboard support
|
||||
- [`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
|
||||
[documentation][widget] has an overview of how Gooey works. A list of built-in
|
||||
widgets can be found in the [`gooey::widgets`][widgets] module.
|
||||
[documentation][widget] has an overview of how Cushy works. A list of built-in
|
||||
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
|
||||
increments its own label:
|
||||
|
||||
|
|
@ -33,8 +33,8 @@ increments its own label:
|
|||
$../examples/basic-button.rs:readme$
|
||||
```
|
||||
|
||||
A great way to learn more about Gooey is to explore the [examples
|
||||
directory][examples]. Nearly every feature in Gooey was initially tested by
|
||||
A great way to learn more about Cushy is to explore the [examples
|
||||
directory][examples]. Nearly every feature in Cushy was initially tested by
|
||||
creating an example.
|
||||
|
||||
## 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
|
||||
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
|
||||
Gooey.
|
||||
Cushy.
|
||||
|
||||
[widget]: $widget$
|
||||
[widgets]: $widgets$
|
||||
[button-example]: https://github.com/khonsulabs/gooey/tree/$ref-name$/examples/basic-button.rs
|
||||
[examples]: https://github.com/khonsulabs/gooey/tree/$ref-name$/examples/
|
||||
[button-example]: https://github.com/khonsulabs/cushy/tree/$ref-name$/examples/basic-button.rs
|
||||
[examples]: https://github.com/khonsulabs/cushy/tree/$ref-name$/examples/
|
||||
[kludgine]: https://github.com/khonsulabs/kludgine
|
||||
[figures]: https://github.com/khonsulabs/figures
|
||||
[wgpu]: https://github.com/gfx-rs/wgpu
|
||||
|
|
@ -62,4 +62,4 @@ Gooey.
|
|||
[palette]: https://github.com/Ogeon/palette
|
||||
[arboard]: https://github.com/1Password/arboard
|
||||
[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
|
||||
|
||||
- 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
|
||||
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`.
|
||||
- `Window::new` no longer accepts a `Gooey` parameter. The window now adopts the
|
||||
`Gooey` from the application it is opened within.
|
||||
- `Window::new` no longer accepts a `Cushy` parameter. The window now adopts the
|
||||
`Cushy` from the application it is opened within.
|
||||
- `MakeWidget::into_window()` no longer takes any parameters.
|
||||
|
||||
### Changed
|
||||
|
|
@ -61,10 +64,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||
application.
|
||||
|
||||
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.
|
||||
- `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
|
||||
the 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
|
||||
alive.
|
||||
|
||||
[91]: https://github.com/khonsulabs/gooey/issues/91
|
||||
[92]: https://github.com/khonsulabs/gooey/issues/92
|
||||
[112]: https://github.com/khonsulabs/gooey/issues/112
|
||||
[113]: https://github.com/khonsulabs/gooey/issues/113
|
||||
[91]: https://github.com/khonsulabs/cushy/issues/91
|
||||
[92]: https://github.com/khonsulabs/cushy/issues/92
|
||||
[112]: https://github.com/khonsulabs/cushy/issues/112
|
||||
[113]: https://github.com/khonsulabs/cushy/issues/113
|
||||
|
||||
## 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.
|
||||
- Padding is now rounded to the nearest whole pixel when applied across widgets.
|
||||
|
||||
[94]: https://github.com/khonsulabs/gooey/pull/94
|
||||
[97]: https://github.com/khonsulabs/gooey/issues/97
|
||||
[94]: https://github.com/khonsulabs/cushy/pull/94
|
||||
[97]: https://github.com/khonsulabs/cushy/issues/97
|
||||
|
||||
## v0.1.2 (2023-12-18)
|
||||
|
||||
### 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
|
||||
`appit`.
|
||||
|
||||
|
|
@ -137,4 +140,4 @@ This release only contains fixed links in the README. No code was changed.
|
|||
|
||||
## 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"
|
||||
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]]
|
||||
name = "d3d12"
|
||||
version = "0.7.0"
|
||||
|
|
@ -897,42 +933,6 @@ dependencies = [
|
|||
"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]]
|
||||
name = "gpu-alloc"
|
||||
version = "0.6.0"
|
||||
|
|
|
|||
|
|
@ -1,11 +1,11 @@
|
|||
[workspace]
|
||||
|
||||
[package]
|
||||
name = "gooey"
|
||||
name = "cushy"
|
||||
version = "0.1.3"
|
||||
edition = "2021"
|
||||
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"
|
||||
keywords = ["gui", "ui", "widgets", "reactive"]
|
||||
categories = ["gui"]
|
||||
|
|
@ -33,7 +33,7 @@ tracing-subscriber = { version = "0.3", optional = true, features = [
|
|||
] }
|
||||
palette = "0.7.3"
|
||||
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"
|
||||
zeroize = "1.6.1"
|
||||
unicode-segmentation = "1.10.1"
|
||||
|
|
|
|||
42
README.md
42
README.md
|
|
@ -1,16 +1,16 @@
|
|||
# Gooey
|
||||
# Cushy
|
||||
|
||||

|
||||
[](https://crates.io/crates/gooey)
|
||||
[](https://gooey.rs/main/docs/gooey/)
|
||||

|
||||
[](https://crates.io/crates/cushy)
|
||||
[](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
|
||||
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].
|
||||
|
||||
Gooey is powered by:
|
||||
Cushy is powered by:
|
||||
|
||||
- [`Kludgine`][kludgine], a 2d graphics library powered by:
|
||||
- [`winit`][winit] for windowing/input
|
||||
|
|
@ -20,19 +20,19 @@ Gooey is powered by:
|
|||
- [`arboard`][arboard] for clipboard support
|
||||
- [`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
|
||||
[documentation][widget] has an overview of how Gooey works. A list of built-in
|
||||
widgets can be found in the [`gooey::widgets`][widgets] module.
|
||||
[documentation][widget] has an overview of how Cushy works. A list of built-in
|
||||
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
|
||||
increments its own label:
|
||||
|
||||
```rust,ignore
|
||||
fn main() -> gooey::Result {
|
||||
fn main() -> cushy::Result {
|
||||
// Create a dynamic usize.
|
||||
let count = Dynamic::new(0_isize);
|
||||
// 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
|
||||
directory][examples]. Nearly every feature in Gooey was initially tested by
|
||||
A great way to learn more about Cushy is to explore the [examples
|
||||
directory][examples]. Nearly every feature in Cushy was initially tested by
|
||||
creating an example.
|
||||
|
||||
## 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
|
||||
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
|
||||
Gooey.
|
||||
Cushy.
|
||||
|
||||
[widget]: https://gooey.rs/main/docs/gooey/widget/trait.Widget.html
|
||||
[widgets]: https://gooey.rs/main/docs/gooey/widgets/index.html
|
||||
[button-example]: https://github.com/khonsulabs/gooey/tree/main/examples/basic-button.rs
|
||||
[examples]: https://github.com/khonsulabs/gooey/tree/main/examples/
|
||||
[widget]: https://cushy.rs/main/docs/cushy/widget/trait.Widget.html
|
||||
[widgets]: https://cushy.rs/main/docs/cushy/widgets/index.html
|
||||
[button-example]: https://github.com/khonsulabs/cushy/tree/main/examples/basic-button.rs
|
||||
[examples]: https://github.com/khonsulabs/cushy/tree/main/examples/
|
||||
[kludgine]: https://github.com/khonsulabs/kludgine
|
||||
[figures]: https://github.com/khonsulabs/figures
|
||||
[wgpu]: https://github.com/gfx-rs/wgpu
|
||||
|
|
@ -77,7 +77,7 @@ Gooey.
|
|||
[palette]: https://github.com/Ogeon/palette
|
||||
[arboard]: https://github.com/1Password/arboard
|
||||
[ecton]: https://github.com/khonsulabs/ecton
|
||||
[issues]: https://github.com/khonsulabs/gooey/issues
|
||||
[issues]: https://github.com/khonsulabs/cushy/issues
|
||||
|
||||
## Open-source Licenses
|
||||
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
[package]
|
||||
name = "gooey-macros"
|
||||
name = "cushy-macros"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
description = "Macros for the Gooey GUI framework"
|
||||
repository = "https://github.com/khonsulabs/gooey"
|
||||
description = "Macros for the Cushy GUI framework"
|
||||
repository = "https://github.com/khonsulabs/cushy"
|
||||
license = "MIT OR Apache-2.0"
|
||||
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
|
||||
.map(ToTokens::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).";
|
||||
|
|
@ -62,7 +62,7 @@ pub fn linear_interpolate(
|
|||
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).";
|
||||
quote! {
|
||||
# use ::gooey::animation::LinearInterpolate;
|
||||
# use ::cushy::animation::LinearInterpolate;
|
||||
fn variant_to_index(__v: &#item_ident) -> usize {
|
||||
match __v {
|
||||
#(#variants => #idx,)*
|
||||
|
|
@ -80,7 +80,7 @@ pub fn linear_interpolate(
|
|||
};
|
||||
|
||||
Ok(quote! {
|
||||
impl ::gooey::animation::LinearInterpolate for #item_ident {
|
||||
impl ::cushy::animation::LinearInterpolate for #item_ident {
|
||||
#[doc = #doc]
|
||||
fn lerp(&self, __target: &Self, __percent: f32) -> Self {
|
||||
#body
|
||||
|
|
@ -1,8 +1,8 @@
|
|||
---
|
||||
source: gooey-macros/src/animation.rs
|
||||
source: cushy-macros/src/animation.rs
|
||||
expression: unparse(ok)
|
||||
---
|
||||
impl ::gooey::animation::LinearInterpolate for Enum {
|
||||
impl ::cushy::animation::LinearInterpolate for Enum {
|
||||
/**# Panics
|
||||
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 {
|
||||
|
|
@ -11,7 +11,7 @@ impl ::gooey::animation::LinearInterpolate for Enum {
|
|||
}
|
||||
let __self = variant_to_index(&self);
|
||||
let __target = variant_to_index(&self);
|
||||
match ::gooey::animation::LinearInterpolate::lerp(
|
||||
match ::cushy::animation::LinearInterpolate::lerp(
|
||||
&__self,
|
||||
&__target,
|
||||
__percent,
|
||||
|
|
@ -1,8 +1,8 @@
|
|||
---
|
||||
source: gooey-macros/src/animation.rs
|
||||
source: cushy-macros/src/animation.rs
|
||||
expression: unparse(ok)
|
||||
---
|
||||
impl ::gooey::animation::LinearInterpolate for Enum {
|
||||
impl ::cushy::animation::LinearInterpolate for Enum {
|
||||
/**# Panics
|
||||
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 {
|
||||
|
|
@ -14,7 +14,7 @@ impl ::gooey::animation::LinearInterpolate for Enum {
|
|||
}
|
||||
let __self = variant_to_index(&self);
|
||||
let __target = variant_to_index(&self);
|
||||
match ::gooey::animation::LinearInterpolate::lerp(
|
||||
match ::cushy::animation::LinearInterpolate::lerp(
|
||||
&__self,
|
||||
&__target,
|
||||
__percent,
|
||||
|
|
@ -1,18 +1,18 @@
|
|||
---
|
||||
source: gooey-macros/src/animation.rs
|
||||
source: cushy-macros/src/animation.rs
|
||||
expression: unparse(ok)
|
||||
---
|
||||
impl ::gooey::animation::LinearInterpolate for HelloWorld {
|
||||
impl ::cushy::animation::LinearInterpolate for HelloWorld {
|
||||
/**# Panics
|
||||
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 {
|
||||
HelloWorld {
|
||||
fielda: ::gooey::animation::LinearInterpolate::lerp(
|
||||
fielda: ::cushy::animation::LinearInterpolate::lerp(
|
||||
&self.fielda,
|
||||
&__target.fielda,
|
||||
__percent,
|
||||
),
|
||||
fieldb: ::gooey::animation::LinearInterpolate::lerp(
|
||||
fieldb: ::cushy::animation::LinearInterpolate::lerp(
|
||||
&self.fieldb,
|
||||
&__target.fieldb,
|
||||
__percent,
|
||||
|
|
@ -1,18 +1,18 @@
|
|||
---
|
||||
source: gooey-macros/src/animation.rs
|
||||
source: cushy-macros/src/animation.rs
|
||||
expression: unparse(ok)
|
||||
---
|
||||
impl ::gooey::animation::LinearInterpolate for HelloWorld {
|
||||
impl ::cushy::animation::LinearInterpolate for HelloWorld {
|
||||
/**# Panics
|
||||
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 {
|
||||
HelloWorld {
|
||||
0: ::gooey::animation::LinearInterpolate::lerp(
|
||||
0: ::cushy::animation::LinearInterpolate::lerp(
|
||||
&self.0,
|
||||
&__target.0,
|
||||
__percent,
|
||||
),
|
||||
1: ::gooey::animation::LinearInterpolate::lerp(
|
||||
1: ::cushy::animation::LinearInterpolate::lerp(
|
||||
&self.1,
|
||||
&__target.1,
|
||||
__percent,
|
||||
|
|
@ -1,21 +1,21 @@
|
|||
use std::time::Duration;
|
||||
|
||||
use gooey::animation::{AnimationHandle, AnimationTarget, IntoAnimate, Spawn};
|
||||
use gooey::value::Dynamic;
|
||||
use gooey::widget::MakeWidget;
|
||||
use gooey::widgets::progress::Progressable;
|
||||
use gooey::{Run, WithClone};
|
||||
use cushy::animation::{AnimationHandle, AnimationTarget, IntoAnimate, Spawn};
|
||||
use cushy::value::Dynamic;
|
||||
use cushy::widget::MakeWidget;
|
||||
use cushy::widgets::progress::Progressable;
|
||||
use cushy::{Run, WithClone};
|
||||
use kludgine::figures::units::Lp;
|
||||
|
||||
fn main() -> gooey::Result {
|
||||
fn main() -> cushy::Result {
|
||||
let animation = Dynamic::new(AnimationHandle::new());
|
||||
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
|
||||
// after a specified amount of time:
|
||||
Duration::from_secs(1)
|
||||
.on_complete(|| println!("Gooey animations are neat!"))
|
||||
.on_complete(|| println!("Cushy animations are neat!"))
|
||||
.launch();
|
||||
|
||||
"To 0"
|
||||
|
|
|
|||
|
|
@ -3,18 +3,18 @@
|
|||
|
||||
use std::time::Duration;
|
||||
|
||||
use gooey::animation::ZeroToOne;
|
||||
use gooey::value::{Dynamic, Switchable};
|
||||
use gooey::widget::MakeWidget;
|
||||
use gooey::widgets::progress::{Progress, Progressable};
|
||||
use gooey::Run;
|
||||
use cushy::animation::ZeroToOne;
|
||||
use cushy::value::{Dynamic, Switchable};
|
||||
use cushy::widget::MakeWidget;
|
||||
use cushy::widgets::progress::{Progress, Progressable};
|
||||
use cushy::Run;
|
||||
|
||||
#[derive(Debug, Default, Eq, PartialEq)]
|
||||
struct Task {
|
||||
progress: Dynamic<Progress>,
|
||||
}
|
||||
|
||||
fn main() -> gooey::Result {
|
||||
fn main() -> cushy::Result {
|
||||
let task = Dynamic::new(None::<Task>);
|
||||
|
||||
task.switcher(|task, dynamic| {
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
use gooey::value::Dynamic;
|
||||
use gooey::widget::MakeWidget;
|
||||
use gooey::Run;
|
||||
use cushy::value::Dynamic;
|
||||
use cushy::widget::MakeWidget;
|
||||
use cushy::Run;
|
||||
|
||||
// begin rustme snippet: readme
|
||||
fn main() -> gooey::Result {
|
||||
fn main() -> cushy::Result {
|
||||
// Create a dynamic usize.
|
||||
let count = Dynamic::new(0_isize);
|
||||
// Create a dynamic that contains `count.to_string()`
|
||||
|
|
|
|||
|
|
@ -16,13 +16,13 @@
|
|||
//! ┃ ┃ ┣ clicked_button Label
|
||||
//! ```
|
||||
|
||||
use gooey::value::Dynamic;
|
||||
use gooey::widget::MakeWidget;
|
||||
use gooey::widgets::button::{ButtonHoverBackground, ButtonHoverForeground};
|
||||
use gooey::Run;
|
||||
use cushy::value::Dynamic;
|
||||
use cushy::widget::MakeWidget;
|
||||
use cushy::widgets::button::{ButtonHoverBackground, ButtonHoverForeground};
|
||||
use cushy::Run;
|
||||
use kludgine::Color;
|
||||
|
||||
fn main() -> gooey::Result {
|
||||
fn main() -> cushy::Result {
|
||||
let clicked_button = Dynamic::<&'static str>::default();
|
||||
|
||||
let inner_button = "So I put buttons in your buttons"
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
use gooey::value::Dynamic;
|
||||
use gooey::widget::MakeWidget;
|
||||
use gooey::widgets::button::ButtonKind;
|
||||
use gooey::Run;
|
||||
use cushy::value::Dynamic;
|
||||
use cushy::widget::MakeWidget;
|
||||
use cushy::widgets::button::ButtonKind;
|
||||
use cushy::Run;
|
||||
|
||||
fn main() -> gooey::Result {
|
||||
fn main() -> cushy::Result {
|
||||
let clicked_label = Dynamic::new(String::from("Click a Button"));
|
||||
let default_is_outline = Dynamic::new(false);
|
||||
let default_button_style = default_is_outline.map_each(|is_outline| {
|
||||
|
|
|
|||
|
|
@ -1,11 +1,11 @@
|
|||
use gooey::widgets::Canvas;
|
||||
use gooey::{Run, Tick};
|
||||
use cushy::widgets::Canvas;
|
||||
use cushy::{Run, Tick};
|
||||
use kludgine::figures::{Angle, IntoSigned, Point, Px2D, Rect, Size};
|
||||
use kludgine::shapes::Shape;
|
||||
use kludgine::text::{Text, TextOrigin};
|
||||
use kludgine::{Color, DrawableExt};
|
||||
|
||||
fn main() -> gooey::Result<()> {
|
||||
fn main() -> cushy::Result<()> {
|
||||
let mut angle = Angle::degrees(0);
|
||||
Canvas::new(move |context| {
|
||||
angle += Angle::degrees(1);
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
use gooey::value::Dynamic;
|
||||
use gooey::widget::MakeWidget;
|
||||
use gooey::widgets::checkbox::{Checkable, CheckboxState};
|
||||
use gooey::Run;
|
||||
use cushy::value::Dynamic;
|
||||
use cushy::widget::MakeWidget;
|
||||
use cushy::widgets::checkbox::{Checkable, CheckboxState};
|
||||
use cushy::Run;
|
||||
|
||||
fn main() -> gooey::Result {
|
||||
fn main() -> cushy::Result {
|
||||
let checkbox_state = Dynamic::new(CheckboxState::Checked);
|
||||
let label = checkbox_state.map_each(|state| format!("Check Me! Current: {state:?}"));
|
||||
|
||||
|
|
|
|||
|
|
@ -1,12 +1,12 @@
|
|||
use gooey::value::Dynamic;
|
||||
use gooey::widget::MakeWidget;
|
||||
use gooey::widgets::checkbox::Checkable;
|
||||
use gooey::Run;
|
||||
use cushy::value::Dynamic;
|
||||
use cushy::widget::MakeWidget;
|
||||
use cushy::widgets::checkbox::Checkable;
|
||||
use cushy::Run;
|
||||
|
||||
const EXPLANATION: &str =
|
||||
"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);
|
||||
|
||||
collapse
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
use std::collections::HashMap;
|
||||
|
||||
use gooey::value::{Dynamic, MapEach};
|
||||
use gooey::widget::{Children, MakeWidget};
|
||||
use gooey::widgets::input::InputValue;
|
||||
use gooey::Run;
|
||||
use cushy::value::{Dynamic, MapEach};
|
||||
use cushy::widget::{Children, MakeWidget};
|
||||
use cushy::widgets::input::InputValue;
|
||||
use cushy::Run;
|
||||
|
||||
#[derive(Debug, Clone, Eq, PartialEq)]
|
||||
pub struct Contact {
|
||||
|
|
@ -13,7 +13,7 @@ pub struct Contact {
|
|||
pub title: String,
|
||||
}
|
||||
|
||||
fn main() -> gooey::Result {
|
||||
fn main() -> cushy::Result {
|
||||
let initial_contacts = vec![
|
||||
Contact {
|
||||
id: 0,
|
||||
|
|
|
|||
|
|
@ -1,15 +1,15 @@
|
|||
use gooey::styles::components::CornerRadius;
|
||||
use gooey::styles::Dimension;
|
||||
use gooey::value::{Dynamic, MapEachCloned};
|
||||
use gooey::widget::MakeWidget;
|
||||
use gooey::widgets::container::ContainerShadow;
|
||||
use gooey::widgets::slider::Slidable;
|
||||
use gooey::Run;
|
||||
use cushy::styles::components::CornerRadius;
|
||||
use cushy::styles::Dimension;
|
||||
use cushy::value::{Dynamic, MapEachCloned};
|
||||
use cushy::widget::MakeWidget;
|
||||
use cushy::widgets::container::ContainerShadow;
|
||||
use cushy::widgets::slider::Slidable;
|
||||
use cushy::Run;
|
||||
use kludgine::figures::units::Lp;
|
||||
use kludgine::figures::{Point, Size};
|
||||
use kludgine::shapes::CornerRadii;
|
||||
|
||||
fn main() -> gooey::Result {
|
||||
fn main() -> cushy::Result {
|
||||
let top_left = Dynamic::new(Lp::mm(1));
|
||||
let top_right = Dynamic::new(Lp::mm(1));
|
||||
let bottom_right = Dynamic::new(Lp::mm(1));
|
||||
|
|
|
|||
|
|
@ -1,12 +1,12 @@
|
|||
use gooey::value::Dynamic;
|
||||
use gooey::widget::{MakeWidget, WidgetInstance};
|
||||
use gooey::widgets::container::ContainerShadow;
|
||||
use gooey::window::ThemeMode;
|
||||
use gooey::Run;
|
||||
use cushy::value::Dynamic;
|
||||
use cushy::widget::{MakeWidget, WidgetInstance};
|
||||
use cushy::widgets::container::ContainerShadow;
|
||||
use cushy::window::ThemeMode;
|
||||
use cushy::Run;
|
||||
use kludgine::figures::units::Lp;
|
||||
use kludgine::figures::Point;
|
||||
|
||||
fn main() -> gooey::Result {
|
||||
fn main() -> cushy::Result {
|
||||
let theme_mode = Dynamic::default();
|
||||
set_of_containers(3, theme_mode.clone())
|
||||
.centered()
|
||||
|
|
|
|||
|
|
@ -1,11 +1,11 @@
|
|||
use std::string::ToString;
|
||||
|
||||
use gooey::value::Dynamic;
|
||||
use gooey::widget::MakeWidget;
|
||||
use gooey::Run;
|
||||
use cushy::value::Dynamic;
|
||||
use cushy::widget::MakeWidget;
|
||||
use cushy::Run;
|
||||
use kludgine::figures::units::Lp;
|
||||
|
||||
fn main() -> gooey::Result {
|
||||
fn main() -> cushy::Result {
|
||||
let counter = Dynamic::new(0i32);
|
||||
let label = counter.map_each(ToString::to_string);
|
||||
|
||||
|
|
|
|||
|
|
@ -1,11 +1,11 @@
|
|||
use gooey::value::Dynamic;
|
||||
use gooey::widget::MakeWidget;
|
||||
use gooey::widgets::input::InputValue;
|
||||
use gooey::widgets::Custom;
|
||||
use gooey::Run;
|
||||
use cushy::value::Dynamic;
|
||||
use cushy::widget::MakeWidget;
|
||||
use cushy::widgets::input::InputValue;
|
||||
use cushy::widgets::Custom;
|
||||
use cushy::Run;
|
||||
use kludgine::app::winit::window::CursorIcon;
|
||||
|
||||
fn main() -> gooey::Result {
|
||||
fn main() -> cushy::Result {
|
||||
Custom::new(
|
||||
"Try hovering the mouse cursor around this window"
|
||||
.and(
|
||||
|
|
|
|||
|
|
@ -1,15 +1,15 @@
|
|||
//! This example shows two approaches to writing custom widgets: implementing
|
||||
//! traits or using the [`Custom`] widget with callbacks.
|
||||
|
||||
use gooey::value::Dynamic;
|
||||
use gooey::widget::{MakeWidget, MakeWidgetWithTag, Widget, WidgetInstance, WidgetTag, HANDLED};
|
||||
use gooey::widgets::Custom;
|
||||
use gooey::Run;
|
||||
use cushy::value::Dynamic;
|
||||
use cushy::widget::{MakeWidget, MakeWidgetWithTag, Widget, WidgetInstance, WidgetTag, HANDLED};
|
||||
use cushy::widgets::Custom;
|
||||
use cushy::Run;
|
||||
use kludgine::figures::units::{Lp, UPx};
|
||||
use kludgine::figures::{ScreenScale, Size};
|
||||
use kludgine::Color;
|
||||
|
||||
fn main() -> gooey::Result {
|
||||
fn main() -> cushy::Result {
|
||||
"Inline Widgets"
|
||||
.and(callback_widget())
|
||||
.into_rows()
|
||||
|
|
@ -90,14 +90,14 @@ impl Default 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));
|
||||
}
|
||||
|
||||
fn layout(
|
||||
&mut self,
|
||||
available_space: Size<gooey::ConstraintLimit>,
|
||||
context: &mut gooey::context::LayoutContext<'_, '_, '_, '_, '_>,
|
||||
available_space: Size<cushy::ConstraintLimit>,
|
||||
context: &mut cushy::context::LayoutContext<'_, '_, '_, '_, '_>,
|
||||
) -> Size<UPx> {
|
||||
Size::new(
|
||||
available_space.width.min(),
|
||||
|
|
@ -108,7 +108,7 @@ impl Widget for Toggle {
|
|||
fn hit_test(
|
||||
&mut self,
|
||||
_location: kludgine::figures::Point<kludgine::figures::units::Px>,
|
||||
_context: &mut gooey::context::EventContext<'_, '_>,
|
||||
_context: &mut cushy::context::EventContext<'_, '_>,
|
||||
) -> bool {
|
||||
true
|
||||
}
|
||||
|
|
@ -118,8 +118,8 @@ impl Widget for Toggle {
|
|||
_location: kludgine::figures::Point<kludgine::figures::units::Px>,
|
||||
_device_id: kludgine::app::winit::event::DeviceId,
|
||||
_button: kludgine::app::winit::event::MouseButton,
|
||||
_context: &mut gooey::context::EventContext<'_, '_>,
|
||||
) -> gooey::widget::EventHandling {
|
||||
_context: &mut cushy::context::EventContext<'_, '_>,
|
||||
) -> cushy::widget::EventHandling {
|
||||
self.value.toggle();
|
||||
|
||||
HANDLED
|
||||
|
|
|
|||
|
|
@ -1,17 +1,17 @@
|
|||
use std::process::exit;
|
||||
|
||||
use gooey::value::{Dynamic, MapEach};
|
||||
use gooey::widget::{MakeWidget, MakeWidgetWithTag, WidgetTag};
|
||||
use gooey::widgets::grid::{Grid, GridDimension, GridWidgets};
|
||||
use gooey::widgets::input::{InputValue, MaskedString};
|
||||
use gooey::widgets::Expand;
|
||||
use gooey::Run;
|
||||
use cushy::value::{Dynamic, MapEach};
|
||||
use cushy::widget::{MakeWidget, MakeWidgetWithTag, WidgetTag};
|
||||
use cushy::widgets::grid::{Grid, GridDimension, GridWidgets};
|
||||
use cushy::widgets::input::{InputValue, MaskedString};
|
||||
use cushy::widgets::Expand;
|
||||
use cushy::Run;
|
||||
use kludgine::figures::units::Lp;
|
||||
|
||||
/// 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
|
||||
/// username, password, log in, cancel.
|
||||
fn main() -> gooey::Result {
|
||||
fn main() -> cushy::Result {
|
||||
let username = Dynamic::default();
|
||||
let password = Dynamic::default();
|
||||
|
||||
|
|
|
|||
|
|
@ -1,12 +1,12 @@
|
|||
use gooey::value::Dynamic;
|
||||
use gooey::widget::MakeWidget;
|
||||
use gooey::widgets::input::InputValue;
|
||||
use gooey::widgets::slider::Slidable;
|
||||
use gooey::widgets::Custom;
|
||||
use gooey::Run;
|
||||
use cushy::value::Dynamic;
|
||||
use cushy::widget::MakeWidget;
|
||||
use cushy::widgets::input::InputValue;
|
||||
use cushy::widgets::slider::Slidable;
|
||||
use cushy::widgets::Custom;
|
||||
use cushy::Run;
|
||||
use kludgine::figures::units::Lp;
|
||||
|
||||
fn main() -> gooey::Result {
|
||||
fn main() -> cushy::Result {
|
||||
let allow_blur = Dynamic::new(true);
|
||||
"Input Field"
|
||||
.and(Dynamic::<String>::default().into_input())
|
||||
|
|
|
|||
|
|
@ -1,12 +1,12 @@
|
|||
use gooey::value::Dynamic;
|
||||
use gooey::widget::{MakeWidget, HANDLED, IGNORED};
|
||||
use gooey::widgets::input::InputValue;
|
||||
use gooey::Run;
|
||||
use cushy::value::Dynamic;
|
||||
use cushy::widget::{MakeWidget, HANDLED, IGNORED};
|
||||
use cushy::widgets::input::InputValue;
|
||||
use cushy::Run;
|
||||
use kludgine::app::winit::event::ElementState;
|
||||
use kludgine::app::winit::keyboard::{Key, NamedKey};
|
||||
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_message = Dynamic::new(String::new());
|
||||
|
||||
|
|
|
|||
|
|
@ -1,14 +1,14 @@
|
|||
use gooey::animation::ZeroToOne;
|
||||
use gooey::value::{Dynamic, MapEachCloned};
|
||||
use gooey::widget::MakeWidget;
|
||||
use gooey::widgets::image::{Aspect, ImageScaling};
|
||||
use gooey::widgets::slider::Slidable;
|
||||
use gooey::widgets::Image;
|
||||
use gooey::Run;
|
||||
use cushy::animation::ZeroToOne;
|
||||
use cushy::value::{Dynamic, MapEachCloned};
|
||||
use cushy::widget::MakeWidget;
|
||||
use cushy::widgets::image::{Aspect, ImageScaling};
|
||||
use cushy::widgets::slider::Slidable;
|
||||
use cushy::widgets::Image;
|
||||
use cushy::Run;
|
||||
use kludgine::figures::Size;
|
||||
use kludgine::include_texture;
|
||||
|
||||
fn main() -> gooey::Result {
|
||||
fn main() -> cushy::Result {
|
||||
let mode = Dynamic::<ScalingMode>::default();
|
||||
let scale = Dynamic::new(1f32);
|
||||
let orientation_width = Dynamic::<ZeroToOne>::default();
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
use gooey::value::Dynamic;
|
||||
use gooey::widget::MakeWidget;
|
||||
use gooey::widgets::input::{InputValue, MaskedString};
|
||||
use gooey::Run;
|
||||
use cushy::value::Dynamic;
|
||||
use cushy::widget::MakeWidget;
|
||||
use cushy::widgets::input::{InputValue, MaskedString};
|
||||
use cushy::Run;
|
||||
use kludgine::figures::units::Px;
|
||||
|
||||
fn main() -> gooey::Result {
|
||||
fn main() -> cushy::Result {
|
||||
let contents = Dynamic::from("Hello World");
|
||||
let password = Dynamic::new(MaskedString::default());
|
||||
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
use gooey::widget::MakeWidget;
|
||||
use gooey::widgets::Space;
|
||||
use gooey::Run;
|
||||
use cushy::widget::MakeWidget;
|
||||
use cushy::widgets::Space;
|
||||
use cushy::Run;
|
||||
use kludgine::Color;
|
||||
|
||||
fn main() -> gooey::Result {
|
||||
fn main() -> cushy::Result {
|
||||
Space::colored(Color::RED)
|
||||
.and("Layers stack widgets on top of each other")
|
||||
.into_layers()
|
||||
|
|
|
|||
|
|
@ -1,14 +1,14 @@
|
|||
use std::process::exit;
|
||||
|
||||
use gooey::value::{Dynamic, Validations};
|
||||
use gooey::widget::MakeWidget;
|
||||
use gooey::widgets::input::{InputValue, MaskedString};
|
||||
use gooey::widgets::layers::OverlayLayer;
|
||||
use gooey::widgets::Expand;
|
||||
use gooey::Run;
|
||||
use cushy::value::{Dynamic, Validations};
|
||||
use cushy::widget::MakeWidget;
|
||||
use cushy::widgets::input::{InputValue, MaskedString};
|
||||
use cushy::widgets::layers::OverlayLayer;
|
||||
use cushy::widgets::Expand;
|
||||
use cushy::Run;
|
||||
use kludgine::figures::units::Lp;
|
||||
|
||||
fn main() -> gooey::Result {
|
||||
fn main() -> cushy::Result {
|
||||
let tooltips = OverlayLayer::default();
|
||||
let username = Dynamic::default();
|
||||
let password = Dynamic::default();
|
||||
|
|
|
|||
|
|
@ -3,9 +3,9 @@
|
|||
|
||||
use std::collections::HashMap;
|
||||
|
||||
use gooey::value::{Dynamic, Switchable};
|
||||
use gooey::widget::MakeWidget;
|
||||
use gooey::Run;
|
||||
use cushy::value::{Dynamic, Switchable};
|
||||
use cushy::widget::MakeWidget;
|
||||
use cushy::Run;
|
||||
|
||||
#[derive(Debug, Eq, PartialEq, Clone, Hash)]
|
||||
enum Tab {
|
||||
|
|
@ -14,7 +14,7 @@ enum Tab {
|
|||
Missing,
|
||||
}
|
||||
|
||||
fn main() -> gooey::Result {
|
||||
fn main() -> cushy::Result {
|
||||
let mut tab_contents = HashMap::new();
|
||||
tab_contents.insert(Tab::First, "This is the first 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 gooey::value::{Dynamic, MapEach};
|
||||
use gooey::widget::MakeWidget;
|
||||
use gooey::widgets::Image;
|
||||
use gooey::window::PendingWindow;
|
||||
use gooey::{Application, Open, PendingApp, Run};
|
||||
use cushy::kludgine::include_texture;
|
||||
use cushy::value::{Dynamic, MapEach};
|
||||
use cushy::widget::MakeWidget;
|
||||
use cushy::widgets::Image;
|
||||
use cushy::window::PendingWindow;
|
||||
use cushy::{Application, Open, PendingApp, Run};
|
||||
use kludgine::LazyTexture;
|
||||
|
||||
fn main() -> gooey::Result {
|
||||
fn main() -> cushy::Result {
|
||||
// To open multiple applications, we need a handle to the application. This
|
||||
// starts with the `PendingApp` type.
|
||||
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 open_windows = Dynamic::new(0_usize);
|
||||
|
|
|
|||
|
|
@ -1,11 +1,11 @@
|
|||
use gooey::styles::components::FontFamily;
|
||||
use gooey::styles::FontFamilyList;
|
||||
use gooey::widget::MakeWidget;
|
||||
use gooey::Run;
|
||||
use cushy::styles::components::FontFamily;
|
||||
use cushy::styles::FontFamilyList;
|
||||
use cushy::widget::MakeWidget;
|
||||
use cushy::Run;
|
||||
use kludgine::cosmic_text::FamilyOwned;
|
||||
use kludgine::figures::units::Lp;
|
||||
|
||||
fn main() -> gooey::Result {
|
||||
fn main() -> cushy::Result {
|
||||
include_str!("./nested-scroll.rs")
|
||||
.vertical_scroll()
|
||||
.with(&FontFamily, FontFamilyList::from(FamilyOwned::Monospace))
|
||||
|
|
|
|||
|
|
@ -1,13 +1,13 @@
|
|||
use gooey::widget::{MakeWidget, MakeWidgetWithTag, WidgetTag};
|
||||
use gooey::widgets::container::ContainerShadow;
|
||||
use gooey::widgets::layers::{OverlayBuilder, OverlayLayer};
|
||||
use gooey::Run;
|
||||
use cushy::widget::{MakeWidget, MakeWidgetWithTag, WidgetTag};
|
||||
use cushy::widgets::container::ContainerShadow;
|
||||
use cushy::widgets::layers::{OverlayBuilder, OverlayLayer};
|
||||
use cushy::Run;
|
||||
use kludgine::figures::units::Lp;
|
||||
use kludgine::figures::Point;
|
||||
use kludgine::Color;
|
||||
use rand::{thread_rng, Rng};
|
||||
|
||||
fn main() -> gooey::Result {
|
||||
fn main() -> cushy::Result {
|
||||
let overlay = OverlayLayer::default();
|
||||
|
||||
test_widget(&overlay, true)
|
||||
|
|
|
|||
|
|
@ -1,12 +1,12 @@
|
|||
use gooey::value::{Dynamic, MapEach};
|
||||
use gooey::widget::MakeWidget;
|
||||
use gooey::widgets::progress::Progressable;
|
||||
use gooey::widgets::slider::Slidable;
|
||||
use gooey::Run;
|
||||
use cushy::value::{Dynamic, MapEach};
|
||||
use cushy::widget::MakeWidget;
|
||||
use cushy::widgets::progress::Progressable;
|
||||
use cushy::widgets::slider::Slidable;
|
||||
use cushy::Run;
|
||||
use kludgine::figures::units::Lp;
|
||||
use kludgine::figures::Size;
|
||||
|
||||
fn main() -> gooey::Result {
|
||||
fn main() -> cushy::Result {
|
||||
let indeterminant = Dynamic::new(false);
|
||||
let value = Dynamic::new(0_u8);
|
||||
let progress = (&indeterminant, &value)
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
use gooey::value::Dynamic;
|
||||
use gooey::widget::MakeWidget;
|
||||
use gooey::Run;
|
||||
use cushy::value::Dynamic;
|
||||
use cushy::widget::MakeWidget;
|
||||
use cushy::Run;
|
||||
|
||||
#[derive(Default, Eq, PartialEq, Debug, Clone, Copy)]
|
||||
pub enum Choice {
|
||||
|
|
@ -10,7 +10,7 @@ pub enum Choice {
|
|||
C,
|
||||
}
|
||||
|
||||
fn main() -> gooey::Result {
|
||||
fn main() -> cushy::Result {
|
||||
let option = Dynamic::default();
|
||||
|
||||
option
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
use gooey::widget::MakeWidget;
|
||||
use gooey::Run;
|
||||
use cushy::widget::MakeWidget;
|
||||
use cushy::Run;
|
||||
|
||||
fn main() -> gooey::Result {
|
||||
fn main() -> cushy::Result {
|
||||
include_str!("../src/widgets/scroll.rs")
|
||||
.scroll()
|
||||
.expand()
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
use gooey::value::Dynamic;
|
||||
use gooey::widget::MakeWidget;
|
||||
use gooey::Run;
|
||||
use cushy::value::Dynamic;
|
||||
use cushy::widget::MakeWidget;
|
||||
use cushy::Run;
|
||||
|
||||
#[derive(Default, Eq, PartialEq, Debug, Clone, Copy)]
|
||||
pub enum Choice {
|
||||
|
|
@ -10,7 +10,7 @@ pub enum Choice {
|
|||
C,
|
||||
}
|
||||
|
||||
fn main() -> gooey::Result {
|
||||
fn main() -> cushy::Result {
|
||||
let option = Dynamic::default();
|
||||
|
||||
option
|
||||
|
|
|
|||
|
|
@ -1,14 +1,14 @@
|
|||
use gooey::animation::{LinearInterpolate, PercentBetween};
|
||||
use gooey::value::{Dynamic, ForEach};
|
||||
use gooey::widget::MakeWidget;
|
||||
use gooey::widgets::checkbox::Checkable;
|
||||
use gooey::widgets::input::InputValue;
|
||||
use gooey::widgets::slider::Slidable;
|
||||
use gooey::Run;
|
||||
use cushy::animation::{LinearInterpolate, PercentBetween};
|
||||
use cushy::value::{Dynamic, ForEach};
|
||||
use cushy::widget::MakeWidget;
|
||||
use cushy::widgets::checkbox::Checkable;
|
||||
use cushy::widgets::input::InputValue;
|
||||
use cushy::widgets::slider::Slidable;
|
||||
use cushy::Run;
|
||||
use kludgine::figures::units::Lp;
|
||||
use kludgine::figures::Ranged;
|
||||
|
||||
fn main() -> gooey::Result {
|
||||
fn main() -> cushy::Result {
|
||||
let enabled = Dynamic::new(true);
|
||||
u8_slider()
|
||||
.and(u8_range_slider())
|
||||
|
|
@ -86,7 +86,7 @@ enum 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 max = *max as u8;
|
||||
let value = *self as u8;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
use gooey::widget::MakeWidget;
|
||||
use gooey::Run;
|
||||
use cushy::widget::MakeWidget;
|
||||
use cushy::Run;
|
||||
|
||||
/// This example shows a tricky layout problem. The hierarchy of widgets is
|
||||
/// 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
|
||||
/// measurement, a second layout call for all children is required with Known
|
||||
/// 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
|
||||
"Really Long Label"
|
||||
.and("Short".into_button().centered())
|
||||
|
|
|
|||
|
|
@ -1,12 +1,12 @@
|
|||
use gooey::styles::components::{TextColor, TextSize};
|
||||
use gooey::widget::MakeWidget;
|
||||
use gooey::widgets::stack::Stack;
|
||||
use gooey::widgets::Style;
|
||||
use gooey::Run;
|
||||
use cushy::styles::components::{TextColor, TextSize};
|
||||
use cushy::widget::MakeWidget;
|
||||
use cushy::widgets::stack::Stack;
|
||||
use cushy::widgets::Style;
|
||||
use cushy::Run;
|
||||
use kludgine::figures::units::Lp;
|
||||
use kludgine::Color;
|
||||
|
||||
fn main() -> gooey::Result {
|
||||
fn main() -> cushy::Result {
|
||||
Stack::rows("Green".and(red_text("Red")))
|
||||
.with(&TextColor, Color::GREEN)
|
||||
// Local styles are not inherited. In this situation, the text size is
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
use gooey::value::{Dynamic, Switchable};
|
||||
use gooey::widget::{MakeWidget, WidgetInstance};
|
||||
use gooey::Run;
|
||||
use cushy::value::{Dynamic, Switchable};
|
||||
use cushy::widget::{MakeWidget, WidgetInstance};
|
||||
use cushy::Run;
|
||||
|
||||
#[derive(Debug, Eq, PartialEq)]
|
||||
enum ActiveContent {
|
||||
|
|
@ -8,7 +8,7 @@ enum ActiveContent {
|
|||
Success,
|
||||
}
|
||||
|
||||
fn main() -> gooey::Result {
|
||||
fn main() -> cushy::Result {
|
||||
let active = Dynamic::new(ActiveContent::Intro);
|
||||
|
||||
active
|
||||
|
|
|
|||
|
|
@ -1,24 +1,24 @@
|
|||
use std::fmt::Write;
|
||||
|
||||
use gooey::styles::components::{TextColor, WidgetBackground};
|
||||
use gooey::styles::{
|
||||
use cushy::styles::components::{TextColor, WidgetBackground};
|
||||
use cushy::styles::{
|
||||
ColorScheme, ColorSchemeBuilder, ColorSource, ColorTheme, FixedTheme, SurfaceTheme, Theme,
|
||||
ThemePair,
|
||||
};
|
||||
use gooey::value::{Dynamic, MapEachCloned};
|
||||
use gooey::widget::MakeWidget;
|
||||
use gooey::widgets::checkbox::Checkable;
|
||||
use gooey::widgets::color::ColorSourcePicker;
|
||||
use gooey::widgets::input::InputValue;
|
||||
use gooey::widgets::slider::Slidable;
|
||||
use gooey::widgets::Space;
|
||||
use gooey::window::ThemeMode;
|
||||
use gooey::{Open, PendingApp};
|
||||
use cushy::value::{Dynamic, MapEachCloned};
|
||||
use cushy::widget::MakeWidget;
|
||||
use cushy::widgets::checkbox::Checkable;
|
||||
use cushy::widgets::color::ColorSourcePicker;
|
||||
use cushy::widgets::input::InputValue;
|
||||
use cushy::widgets::slider::Slidable;
|
||||
use cushy::widgets::Space;
|
||||
use cushy::window::ThemeMode;
|
||||
use cushy::{Open, PendingApp};
|
||||
use kludgine::figures::units::Lp;
|
||||
use kludgine::Color;
|
||||
use palette::OklabHue;
|
||||
|
||||
fn main() -> gooey::Result {
|
||||
fn main() -> cushy::Result {
|
||||
let app = PendingApp::default();
|
||||
|
||||
let (theme_mode, theme_switcher) = dark_mode_picker();
|
||||
|
|
@ -79,9 +79,9 @@ fn main() -> gooey::Result {
|
|||
.and(editors.neutral.1)
|
||||
.and(editors.neutral_variant.1)
|
||||
.and("Copy to Clipboard".into_button().on_click({
|
||||
let gooey = app.gooey().clone();
|
||||
let cushy = app.cushy().clone();
|
||||
move |()| {
|
||||
if let Some(mut clipboard) = gooey.clipboard_guard() {
|
||||
if let Some(mut clipboard) = cushy.clipboard_guard() {
|
||||
let builder = color_scheme_builder.get();
|
||||
let mut source = String::default();
|
||||
builder.format_rust_into(&mut source);
|
||||
|
|
|
|||
|
|
@ -3,13 +3,13 @@ use std::iter;
|
|||
use std::ops::Not;
|
||||
use std::time::SystemTime;
|
||||
|
||||
use gooey::value::Dynamic;
|
||||
use gooey::widget::MakeWidget;
|
||||
use gooey::widgets::button::ButtonKind;
|
||||
use gooey::{Run, WithClone};
|
||||
use cushy::value::Dynamic;
|
||||
use cushy::widget::MakeWidget;
|
||||
use cushy::widgets::button::ButtonKind;
|
||||
use cushy::{Run, WithClone};
|
||||
use kludgine::figures::units::Lp;
|
||||
|
||||
fn main() -> gooey::Result {
|
||||
fn main() -> cushy::Result {
|
||||
let app = Dynamic::default();
|
||||
app.map_each(app.with_clone(|app| {
|
||||
move |state: &AppState| match state {
|
||||
|
|
|
|||
|
|
@ -2,18 +2,18 @@ use std::array;
|
|||
use std::cmp::Ordering;
|
||||
use std::time::Duration;
|
||||
|
||||
use gooey::kludgine::app::winit::keyboard::Key;
|
||||
use gooey::kludgine::figures::units::Px;
|
||||
use gooey::kludgine::figures::{Point, Rect, Size};
|
||||
use gooey::kludgine::render::Renderer;
|
||||
use gooey::kludgine::shapes::Shape;
|
||||
use gooey::kludgine::tilemap::{
|
||||
use cushy::kludgine::app::winit::keyboard::Key;
|
||||
use cushy::kludgine::figures::units::Px;
|
||||
use cushy::kludgine::figures::{Point, Rect, Size};
|
||||
use cushy::kludgine::render::Renderer;
|
||||
use cushy::kludgine::shapes::Shape;
|
||||
use cushy::kludgine::tilemap::{
|
||||
DebugGrid, Object, ObjectLayer, TileArray, TileKind, TileMapFocus, TILE_SIZE,
|
||||
};
|
||||
use gooey::kludgine::Color;
|
||||
use gooey::value::Dynamic;
|
||||
use gooey::widgets::TileMap;
|
||||
use gooey::{Run, Tick};
|
||||
use cushy::kludgine::Color;
|
||||
use cushy::value::Dynamic;
|
||||
use cushy::widgets::TileMap;
|
||||
use cushy::{Run, Tick};
|
||||
use kludgine::app::winit::keyboard::NamedKey;
|
||||
use kludgine::figures::FloatConversion;
|
||||
use kludgine::sprite::{Sprite, SpriteSource};
|
||||
|
|
@ -21,7 +21,7 @@ use kludgine::{include_aseprite_sprite, DrawableExt};
|
|||
|
||||
const PLAYER_SIZE: Px = Px::new(16);
|
||||
|
||||
fn main() -> gooey::Result {
|
||||
fn main() -> cushy::Result {
|
||||
let mut characters = ObjectLayer::new();
|
||||
|
||||
let mut sprite = include_aseprite_sprite!("assets/stickguy").unwrap();
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
use gooey::widget::MakeWidget;
|
||||
use gooey::Run;
|
||||
use cushy::widget::MakeWidget;
|
||||
use cushy::Run;
|
||||
|
||||
fn main() -> gooey::Result {
|
||||
fn main() -> cushy::Result {
|
||||
"Heading 1"
|
||||
.h1()
|
||||
.and("Heading 2".h2())
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
use gooey::value::{Dynamic, Validations};
|
||||
use gooey::widget::MakeWidget;
|
||||
use gooey::widgets::input::InputValue;
|
||||
use gooey::Run;
|
||||
use cushy::value::{Dynamic, Validations};
|
||||
use cushy::widget::MakeWidget;
|
||||
use cushy::widgets::input::InputValue;
|
||||
use cushy::Run;
|
||||
use kludgine::figures::units::Lp;
|
||||
|
||||
fn main() -> gooey::Result {
|
||||
fn main() -> cushy::Result {
|
||||
let text = Dynamic::default();
|
||||
let validations = Validations::default();
|
||||
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
use gooey::value::Dynamic;
|
||||
use gooey::widget::{MakeWidget, WidgetInstance};
|
||||
use gooey::Run;
|
||||
use cushy::value::Dynamic;
|
||||
use cushy::widget::{MakeWidget, WidgetInstance};
|
||||
use cushy::Run;
|
||||
use kludgine::figures::Size;
|
||||
|
||||
fn main() -> gooey::Result {
|
||||
fn main() -> cushy::Result {
|
||||
let focused = Dynamic::new(false);
|
||||
let occluded = Dynamic::new(false);
|
||||
let inner_size = Dynamic::new(Size::default());
|
||||
|
|
@ -15,7 +15,7 @@ fn main() -> gooey::Result {
|
|||
.into_rows()
|
||||
.centered();
|
||||
|
||||
gooey::window::Window::<WidgetInstance>::for_widget(widgets)
|
||||
cushy::window::Window::<WidgetInstance>::for_widget(widgets)
|
||||
.focused(focused)
|
||||
.occluded(occluded)
|
||||
.inner_size(inner_size)
|
||||
|
|
|
|||
|
|
@ -1,14 +1,14 @@
|
|||
use gooey::styles::components::{LineHeight, TextSize};
|
||||
use gooey::value::Dynamic;
|
||||
use gooey::widget::{Children, MakeWidget};
|
||||
use gooey::widgets::wrap::{VerticalAlign, WrapAlign};
|
||||
use gooey::Run;
|
||||
use cushy::styles::components::{LineHeight, TextSize};
|
||||
use cushy::value::Dynamic;
|
||||
use cushy::widget::{Children, MakeWidget};
|
||||
use cushy::widgets::wrap::{VerticalAlign, WrapAlign};
|
||||
use cushy::Run;
|
||||
use kludgine::figures::units::Lp;
|
||||
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.";
|
||||
|
||||
fn main() -> gooey::Result {
|
||||
fn main() -> cushy::Result {
|
||||
let mut rng = thread_rng();
|
||||
let words = EXPLANATION
|
||||
.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.
|
||||
//!
|
||||
//! 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
|
||||
//! returns a [`DynamicTransition`].
|
||||
//!
|
||||
|
|
@ -17,9 +17,9 @@
|
|||
//! ```rust
|
||||
//! use std::time::Duration;
|
||||
//!
|
||||
//! use gooey::animation::easings::EaseInOutElastic;
|
||||
//! use gooey::animation::{AnimationTarget, Spawn};
|
||||
//! use gooey::value::Dynamic;
|
||||
//! use cushy::animation::easings::EaseInOutElastic;
|
||||
//! use cushy::animation::{AnimationTarget, Spawn};
|
||||
//! use cushy::value::Dynamic;
|
||||
//!
|
||||
//! let value = Dynamic::new(0);
|
||||
//! let mut reader = value.create_reader();
|
||||
|
|
@ -775,8 +775,8 @@ impl Animate for Duration {
|
|||
/// the wrappers [`BinaryLerp`] and [`ImmediateLerp`] can be used.
|
||||
///
|
||||
/// ```
|
||||
/// use gooey::animation::{BinaryLerp, ImmediateLerp, LinearInterpolate};
|
||||
/// use gooey::kludgine::Color;
|
||||
/// use cushy::animation::{BinaryLerp, ImmediateLerp, LinearInterpolate};
|
||||
/// use cushy::kludgine::Color;
|
||||
///
|
||||
/// #[derive(LinearInterpolate, PartialEq, Debug)]
|
||||
/// 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.
|
||||
pub use gooey_macros::LinearInterpolate;
|
||||
pub use cushy_macros::LinearInterpolate;
|
||||
|
||||
macro_rules! impl_lerp_for_int {
|
||||
($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::WindowHandle;
|
||||
|
||||
/// A Gooey application that has not started running yet.
|
||||
/// A Cushy application that has not started running yet.
|
||||
pub struct PendingApp {
|
||||
app: kludgine::app::PendingApp<WindowCommand>,
|
||||
gooey: Gooey,
|
||||
cushy: Cushy,
|
||||
}
|
||||
|
||||
impl PendingApp {
|
||||
/// The shared resources this application utilizes.
|
||||
pub const fn gooey(&self) -> &Gooey {
|
||||
&self.gooey
|
||||
pub const fn cushy(&self) -> &Cushy {
|
||||
&self.cushy
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -30,7 +30,7 @@ impl Default for PendingApp {
|
|||
fn default() -> Self {
|
||||
Self {
|
||||
app: kludgine::app::PendingApp::default(),
|
||||
gooey: Gooey {
|
||||
cushy: Cushy {
|
||||
clipboard: Clipboard::new()
|
||||
.ok()
|
||||
.map(|clipboard| Arc::new(Mutex::new(clipboard))),
|
||||
|
|
@ -47,11 +47,11 @@ impl AsApplication<AppEvent<WindowCommand>> for PendingApp {
|
|||
|
||||
/// Shared resources for a GUI application.
|
||||
#[derive(Clone)]
|
||||
pub struct Gooey {
|
||||
pub struct Cushy {
|
||||
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
|
||||
/// initialized when the window opened.
|
||||
#[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>> {
|
||||
/// Returns the shared resources for the application.
|
||||
fn gooey(&self) -> &Gooey;
|
||||
fn cushy(&self) -> &Cushy;
|
||||
/// Returns this type as an [`App`] handle.
|
||||
fn as_app(&self) -> App;
|
||||
}
|
||||
|
||||
impl Application for PendingApp {
|
||||
fn gooey(&self) -> &Gooey {
|
||||
&self.gooey
|
||||
fn cushy(&self) -> &Cushy {
|
||||
&self.cushy
|
||||
}
|
||||
|
||||
fn as_app(&self) -> App {
|
||||
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)]
|
||||
pub struct App {
|
||||
app: kludgine::app::App<WindowCommand>,
|
||||
gooey: Gooey,
|
||||
cushy: Cushy,
|
||||
}
|
||||
|
||||
impl Application for App {
|
||||
fn gooey(&self) -> &Gooey {
|
||||
&self.gooey
|
||||
fn cushy(&self) -> &Cushy {
|
||||
&self.cushy
|
||||
}
|
||||
|
||||
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::ops::{Deref, DerefMut};
|
||||
use std::sync::atomic::{AtomicBool, Ordering};
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
#![allow(clippy::module_name_repetitions, clippy::missing_errors_doc)]
|
||||
|
||||
// for proc-macros
|
||||
extern crate self as gooey;
|
||||
extern crate self as cushy;
|
||||
|
||||
#[macro_use]
|
||||
mod utils;
|
||||
|
|
@ -23,7 +23,7 @@ pub mod widgets;
|
|||
pub mod window;
|
||||
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;
|
||||
use kludgine::app::winit::error::EventLoopError;
|
||||
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.
|
||||
///
|
||||
/// This is used inside of Gooey macros to preallocate collections.
|
||||
/// This is used inside of Cushy macros to preallocate collections.
|
||||
#[macro_export]
|
||||
#[doc(hidden)]
|
||||
macro_rules! count {
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ use interner::global::{GlobalString, StringPool};
|
|||
static NAMES: StringPool<ahash::RandomState> =
|
||||
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
|
||||
/// 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.
|
||||
pub trait RequireInvalidation {
|
||||
/// Gooey tracks two different states:
|
||||
/// Cushy tracks two different states:
|
||||
///
|
||||
/// - Whether to repaint the window
|
||||
/// - 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)]
|
||||
pub struct 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)]
|
||||
pub struct ColorScheme {
|
||||
/// The primary accent color.
|
||||
|
|
|
|||
|
|
@ -9,18 +9,18 @@ use crate::animation::easings::{EaseInOutQuadradic, EaseInQuadradic, EaseOutQuad
|
|||
use crate::animation::{EasingFunction, ZeroToOne};
|
||||
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
|
||||
/// [`ComponentDefinition`](crate::styles::ComponentDefinition) for each entry
|
||||
/// defined. The syntax is:
|
||||
///
|
||||
/// ```rust
|
||||
/// use gooey::define_components;
|
||||
/// use gooey::styles::Dimension;
|
||||
/// use gooey::styles::components::{SurfaceColor, TextColor};
|
||||
/// use gooey::kludgine::Color;
|
||||
/// use gooey::kludgine::figures::Zero;
|
||||
/// use cushy::define_components;
|
||||
/// use cushy::styles::Dimension;
|
||||
/// use cushy::styles::components::{SurfaceColor, TextColor};
|
||||
/// use cushy::kludgine::Color;
|
||||
/// use cushy::kludgine::figures::Zero;
|
||||
///
|
||||
/// define_components! {
|
||||
/// GroupName {
|
||||
|
|
|
|||
|
|
@ -325,7 +325,7 @@ impl<T> Dynamic<T> {
|
|||
/// code may produce slightly more readable code.
|
||||
///
|
||||
/// ```rust
|
||||
/// let value = gooey::value::Dynamic::new(1);
|
||||
/// let value = cushy::value::Dynamic::new(1);
|
||||
///
|
||||
/// // Using with_clone
|
||||
/// value.with_clone(|value| {
|
||||
|
|
@ -950,7 +950,7 @@ pub enum ReplaceError<T> {
|
|||
|
||||
/// 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.
|
||||
#[derive(Debug)]
|
||||
struct DeadlockError;
|
||||
|
|
@ -2709,7 +2709,7 @@ fn map_cycle_is_finite() {
|
|||
let a = Dynamic::new(0_usize);
|
||||
|
||||
// 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({
|
||||
let a = a.clone();
|
||||
move |current| {
|
||||
|
|
@ -2718,7 +2718,7 @@ fn map_cycle_is_finite() {
|
|||
})
|
||||
.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.
|
||||
// Thus, we expect setting the value to 1 to result in `a` containing 2.
|
||||
a.set(1);
|
||||
|
|
|
|||
|
|
@ -52,13 +52,13 @@ use crate::ConstraintLimit;
|
|||
///
|
||||
/// # Widgets are hierarchical
|
||||
///
|
||||
/// Gooey's widgets are organized in a hierarchical structure: widgets can
|
||||
/// contain other widgets. A window in Gooey contains a single root widget,
|
||||
/// Cushy's widgets are organized in a hierarchical structure: widgets can
|
||||
/// contain other widgets. A window in Cushy contains a single root widget,
|
||||
/// which may contain one or more additional widgets.
|
||||
///
|
||||
/// # 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
|
||||
/// 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
|
||||
/// 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
|
||||
/// it is possible to provide any rectangle, Gooey clips all widgets and their
|
||||
/// able to be rendered. This tells Cushy the location to draw the widget. While
|
||||
/// it is possible to provide any rectangle, Cushy clips all widgets and their
|
||||
/// children so that they cannot draw outside of their assigned bounds.
|
||||
///
|
||||
/// Once the layout has been determined, the window will invoke the root
|
||||
|
|
@ -136,13 +136,13 @@ use crate::ConstraintLimit;
|
|||
///
|
||||
/// # Controlling Invalidation and Redrawing
|
||||
///
|
||||
/// Gooey only redraws window contents when requested by the operating system or
|
||||
/// a tracked [`Dynamic`] is updated. Similarly, Gooey caches the known layout
|
||||
/// Cushy only redraws window contents when requested by the operating system or
|
||||
/// a tracked [`Dynamic`] is updated. Similarly, Cushy caches the known layout
|
||||
/// sizes and locations for widgets unless they are *invalidated*. Invalidation
|
||||
/// is done automatically when the window size changes or a tracked [`Dynamic`]
|
||||
/// 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
|
||||
/// layout functions, it needs to ensure that all depended upon [`Dynamic`]s are
|
||||
/// tracked using one of the various
|
||||
|
|
@ -231,33 +231,33 @@ use crate::ConstraintLimit;
|
|||
///
|
||||
/// # Styling
|
||||
///
|
||||
/// Gooey allows widgets to receive styling information through the widget
|
||||
/// hierarchy using [`Styles`]. Gooey calculates the effectives styles for each
|
||||
/// Cushy allows widgets to receive styling information through the widget
|
||||
/// hierarchy using [`Styles`]. Cushy calculates the effectives styles for each
|
||||
/// widget by inheriting all inheritable styles from its parent.
|
||||
///
|
||||
/// 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.
|
||||
///
|
||||
/// 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
|
||||
///
|
||||
/// Gooey aims to make it easy for developers to customize the appearance of its
|
||||
/// applications. The way color themes work in Gooey begins with the
|
||||
/// Cushy aims to make it easy for developers to customize the appearance of its
|
||||
/// applications. The way color themes work in Cushy begins with the
|
||||
/// [`ColorScheme`](crate::styles::ColorScheme). A color scheme is a set of
|
||||
/// [`ColorSource`](crate::styles::ColorSource) that are used to generate a
|
||||
/// 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.
|
||||
///
|
||||
/// A `ColorScheme` can be used to create a [`ThemePair`], which is theme
|
||||
/// definition that a theme for light and dark mode.
|
||||
///
|
||||
/// 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 {
|
||||
/// Redraw the contents of this widget.
|
||||
fn redraw(&mut self, context: &mut GraphicsContext<'_, '_, '_, '_, '_>);
|
||||
|
|
@ -327,7 +327,7 @@ pub trait Widget: Send + Debug + 'static {
|
|||
fn unhover(&mut self, context: &mut EventContext<'_, '_>) {}
|
||||
|
||||
/// 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.
|
||||
#[allow(unused_variables)]
|
||||
fn accept_focus(&mut self, context: &mut EventContext<'_, '_>) -> bool {
|
||||
|
|
@ -487,7 +487,7 @@ pub enum RootBehavior {
|
|||
PassThrough,
|
||||
/// This widget will try to expand to fill the window.
|
||||
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.
|
||||
Align,
|
||||
/// 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<'_, '_>) {}
|
||||
|
||||
/// 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.
|
||||
#[allow(unused_variables)]
|
||||
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.
|
||||
///
|
||||
/// Gooey automatically determines reverse tab order by using this same
|
||||
/// Cushy automatically determines reverse tab order by using this same
|
||||
/// relationship.
|
||||
fn with_next_focus(self, next_focus: impl IntoValue<Option<WidgetId>>) -> WidgetInstance {
|
||||
self.make_widget().with_next_focus(next_focus)
|
||||
|
|
@ -1441,7 +1441,7 @@ impl WidgetInstance {
|
|||
|
||||
/// 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.
|
||||
///
|
||||
/// # Panics
|
||||
|
|
|
|||
|
|
@ -372,7 +372,7 @@ impl Widget for Button {
|
|||
// colors. most_contrasting from a 0-alpha color is not a
|
||||
// meaningful measurement, so we only start measuring contrast
|
||||
// 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.
|
||||
let color = if style.background.alpha() > 128 {
|
||||
style
|
||||
|
|
|
|||
|
|
@ -266,7 +266,7 @@ impl Custom {
|
|||
|
||||
/// Invokes `advance_focus` when this widget has focus and focus is
|
||||
/// 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.
|
||||
///
|
||||
/// This callback corresponds to [`WrapperWidget::advance_focus`].
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ use std::sync::{Arc, Mutex};
|
|||
use std::time::Duration;
|
||||
|
||||
use alot::{LotId, OrderedLots};
|
||||
use gooey::widget::{RootBehavior, WidgetInstance};
|
||||
use cushy::widget::{RootBehavior, WidgetInstance};
|
||||
use intentional::Assert;
|
||||
use kludgine::figures::units::{Lp, Px, UPx};
|
||||
use kludgine::figures::{IntoSigned, IntoUnsigned, Point, Rect, Size, Zero};
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ use kludgine::Kludgine;
|
|||
use tracing::Level;
|
||||
|
||||
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::{
|
||||
AsEventContext, EventContext, Exclusive, GraphicsContext, InvalidationStatus, LayoutContext,
|
||||
WidgetContext,
|
||||
|
|
@ -44,11 +44,11 @@ use crate::widget::{
|
|||
use crate::window::sealed::WindowCommand;
|
||||
use crate::{initialize_tracing, ConstraintLimit};
|
||||
|
||||
/// A currently running Gooey window.
|
||||
/// A currently running Cushy window.
|
||||
pub struct RunningWindow<'window> {
|
||||
window: kludgine::app::Window<'window, WindowCommand>,
|
||||
invalidation_status: InvalidationStatus,
|
||||
gooey: Gooey,
|
||||
cushy: Cushy,
|
||||
focused: Dynamic<bool>,
|
||||
occluded: Dynamic<bool>,
|
||||
inner_size: Dynamic<Size<UPx>>,
|
||||
|
|
@ -58,7 +58,7 @@ impl<'window> RunningWindow<'window> {
|
|||
pub(crate) fn new(
|
||||
window: kludgine::app::Window<'window, WindowCommand>,
|
||||
invalidation_status: &InvalidationStatus,
|
||||
gooey: &Gooey,
|
||||
cushy: &Cushy,
|
||||
focused: &Dynamic<bool>,
|
||||
occluded: &Dynamic<bool>,
|
||||
inner_size: &Dynamic<Size<UPx>>,
|
||||
|
|
@ -66,7 +66,7 @@ impl<'window> RunningWindow<'window> {
|
|||
Self {
|
||||
window,
|
||||
invalidation_status: invalidation_status.clone(),
|
||||
gooey: gooey.clone(),
|
||||
cushy: cushy.clone(),
|
||||
focused: focused.clone(),
|
||||
occluded: occluded.clone(),
|
||||
inner_size: inner_size.clone(),
|
||||
|
|
@ -116,7 +116,7 @@ impl<'window> RunningWindow<'window> {
|
|||
/// initialized when the window opened.
|
||||
#[must_use]
|
||||
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;
|
||||
|
||||
/// A Gooey window that is not yet running.
|
||||
/// A Cushy window that is not yet running.
|
||||
#[must_use]
|
||||
pub struct Window<Behavior>
|
||||
where
|
||||
|
|
@ -305,7 +305,7 @@ where
|
|||
.and_then(OsStr::to_str)
|
||||
.map(ToString::to_string)
|
||||
})
|
||||
.unwrap_or_else(|| String::from("Gooey App"))
|
||||
.unwrap_or_else(|| String::from("Cushy App"))
|
||||
})
|
||||
.clone();
|
||||
Self {
|
||||
|
|
@ -355,14 +355,14 @@ where
|
|||
where
|
||||
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,
|
||||
sealed::Context {
|
||||
user: self.context,
|
||||
settings: RefCell::new(sealed::WindowSettings {
|
||||
gooey,
|
||||
cushy,
|
||||
redraw_status: self.pending.0.redraw_status.clone(),
|
||||
on_closed: self.on_closed,
|
||||
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 {
|
||||
/// The type that is provided when initializing this window.
|
||||
type Context: Send + 'static;
|
||||
|
|
@ -424,7 +424,7 @@ pub trait WindowBehavior: Sized + 'static {
|
|||
}
|
||||
}
|
||||
|
||||
struct GooeyWindow<T> {
|
||||
struct CushyWindow<T> {
|
||||
behavior: T,
|
||||
tree: Tree,
|
||||
root: MountedWidget,
|
||||
|
|
@ -446,11 +446,11 @@ struct GooeyWindow<T> {
|
|||
theme_mode: Value<ThemeMode>,
|
||||
transparent: bool,
|
||||
fonts: FontState,
|
||||
gooey: Gooey,
|
||||
cushy: Cushy,
|
||||
on_closed: Option<OnceCallback>,
|
||||
}
|
||||
|
||||
impl<T> GooeyWindow<T>
|
||||
impl<T> CushyWindow<T>
|
||||
where
|
||||
T: WindowBehavior,
|
||||
{
|
||||
|
|
@ -675,7 +675,7 @@ enum RootMode {
|
|||
Align,
|
||||
}
|
||||
|
||||
impl<T> kludgine::app::WindowBehavior<WindowCommand> for GooeyWindow<T>
|
||||
impl<T> kludgine::app::WindowBehavior<WindowCommand> for CushyWindow<T>
|
||||
where
|
||||
T: WindowBehavior,
|
||||
{
|
||||
|
|
@ -687,7 +687,7 @@ where
|
|||
context: Self::Context,
|
||||
) -> Self {
|
||||
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 focused = settings.focused.take().unwrap_or_default();
|
||||
let theme = settings.theme.take().expect("theme always present");
|
||||
|
|
@ -712,7 +712,7 @@ where
|
|||
&mut RunningWindow::new(
|
||||
window,
|
||||
&redraw_status,
|
||||
&gooey,
|
||||
&cushy,
|
||||
&focused,
|
||||
&occluded,
|
||||
&inner_size,
|
||||
|
|
@ -752,7 +752,7 @@ where
|
|||
theme_mode,
|
||||
transparent,
|
||||
fonts,
|
||||
gooey,
|
||||
cushy,
|
||||
on_closed,
|
||||
}
|
||||
}
|
||||
|
|
@ -778,7 +778,7 @@ where
|
|||
let mut window = RunningWindow::new(
|
||||
window,
|
||||
&self.redraw_status,
|
||||
&self.gooey,
|
||||
&self.cushy,
|
||||
&self.focused,
|
||||
&self.occluded,
|
||||
&self.inner_size,
|
||||
|
|
@ -914,7 +914,7 @@ where
|
|||
&mut RunningWindow::new(
|
||||
window,
|
||||
&self.redraw_status,
|
||||
&self.gooey,
|
||||
&self.cushy,
|
||||
&self.focused,
|
||||
&self.occluded,
|
||||
&self.inner_size,
|
||||
|
|
@ -988,7 +988,7 @@ where
|
|||
let mut window = RunningWindow::new(
|
||||
window,
|
||||
&self.redraw_status,
|
||||
&self.gooey,
|
||||
&self.cushy,
|
||||
&self.focused,
|
||||
&self.occluded,
|
||||
&self.inner_size,
|
||||
|
|
@ -1093,7 +1093,7 @@ where
|
|||
let mut window = RunningWindow::new(
|
||||
window,
|
||||
&self.redraw_status,
|
||||
&self.gooey,
|
||||
&self.cushy,
|
||||
&self.focused,
|
||||
&self.occluded,
|
||||
&self.inner_size,
|
||||
|
|
@ -1129,7 +1129,7 @@ where
|
|||
let mut window = RunningWindow::new(
|
||||
window,
|
||||
&self.redraw_status,
|
||||
&self.gooey,
|
||||
&self.cushy,
|
||||
&self.focused,
|
||||
&self.occluded,
|
||||
&self.inner_size,
|
||||
|
|
@ -1162,7 +1162,7 @@ where
|
|||
let mut window = RunningWindow::new(
|
||||
window,
|
||||
&self.redraw_status,
|
||||
&self.gooey,
|
||||
&self.cushy,
|
||||
&self.focused,
|
||||
&self.occluded,
|
||||
&self.inner_size,
|
||||
|
|
@ -1214,7 +1214,7 @@ where
|
|||
let mut window = RunningWindow::new(
|
||||
window,
|
||||
&self.redraw_status,
|
||||
&self.gooey,
|
||||
&self.cushy,
|
||||
&self.focused,
|
||||
&self.occluded,
|
||||
&self.inner_size,
|
||||
|
|
@ -1244,7 +1244,7 @@ where
|
|||
let mut window = RunningWindow::new(
|
||||
window,
|
||||
&self.redraw_status,
|
||||
&self.gooey,
|
||||
&self.cushy,
|
||||
&self.focused,
|
||||
&self.occluded,
|
||||
&self.inner_size,
|
||||
|
|
@ -1356,7 +1356,7 @@ where
|
|||
let mut window = RunningWindow::new(
|
||||
window,
|
||||
&self.redraw_status,
|
||||
&self.gooey,
|
||||
&self.cushy,
|
||||
&self.focused,
|
||||
&self.occluded,
|
||||
&self.inner_size,
|
||||
|
|
@ -1369,7 +1369,7 @@ where
|
|||
}
|
||||
}
|
||||
|
||||
impl<Behavior> Drop for GooeyWindow<Behavior> {
|
||||
impl<Behavior> Drop for CushyWindow<Behavior> {
|
||||
fn drop(&mut self) {
|
||||
if let Some(on_closed) = self.on_closed.take() {
|
||||
on_closed.invoke(());
|
||||
|
|
@ -1401,7 +1401,7 @@ pub(crate) mod sealed {
|
|||
use kludgine::figures::units::UPx;
|
||||
use kludgine::figures::Size;
|
||||
|
||||
use crate::app::Gooey;
|
||||
use crate::app::Cushy;
|
||||
use crate::context::InvalidationStatus;
|
||||
use crate::styles::{FontFamilyList, ThemePair};
|
||||
use crate::value::{Dynamic, Value};
|
||||
|
|
@ -1414,7 +1414,7 @@ pub(crate) mod sealed {
|
|||
}
|
||||
|
||||
pub struct WindowSettings {
|
||||
pub gooey: Gooey,
|
||||
pub cushy: Cushy,
|
||||
pub redraw_status: InvalidationStatus,
|
||||
pub attributes: Option<WindowAttributes>,
|
||||
pub occluded: Option<Dynamic<bool>>,
|
||||
|
|
@ -1537,7 +1537,7 @@ fn default_family(query: Family<'_>) -> Option<FamilyOwned> {
|
|||
.map(FamilyOwned::Name)
|
||||
}
|
||||
|
||||
/// A handle to an open Gooey window.
|
||||
/// A handle to an open Cushy window.
|
||||
#[derive(Clone)]
|
||||
pub struct WindowHandle {
|
||||
inner: InnerWindowHandle,
|
||||
|
|
|
|||
Loading…
Reference in a new issue