-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fixed cargo.lock issue with rustix, removed duplicate methods from merge
- Loading branch information
Showing
46 changed files
with
5,473 additions
and
1,332 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,29 @@ | ||
use gooey::value::Dynamic; | ||
use gooey::widget::MakeWidget; | ||
use gooey::widgets::button::ButtonOutline; | ||
use gooey::widgets::Button; | ||
use gooey::Run; | ||
use kludgine::Color; | ||
|
||
// begin rustme snippet: readme | ||
fn main() -> gooey::Result { | ||
// begin rustme snippet: readme | ||
// Create a dynamic usize. | ||
let count = Dynamic::new(0_usize); | ||
let count = Dynamic::new(0_isize); | ||
|
||
// Create a new button with a label that is produced by mapping the contents | ||
// of `count`. | ||
Button::new(count.map_each(ToString::to_string)) | ||
// Set the `on_click` callback to a closure that increments the counter. | ||
.on_click(count.with_clone(|count| move |_| count.set(count.get() + 1))) | ||
.and( | ||
// Creates a second, outlined button | ||
Button::new(count.map_each(ToString::to_string)) | ||
// Set the `on_click` callback to a closure that decrements the counter. | ||
.on_click(count.with_clone(|count| move |_| count.set(count.get() - 1))) | ||
.with(&ButtonOutline, Color::DARKRED), | ||
) | ||
.into_columns() | ||
// Run the button as an an application. | ||
.run() | ||
// end rustme snippet | ||
} | ||
// end rustme snippet |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
use gooey::value::Dynamic; | ||
use gooey::widget::{MakeWidget, WidgetInstance}; | ||
use gooey::widgets::{Button, Label}; | ||
use gooey::window::ThemeMode; | ||
use gooey::Run; | ||
|
||
fn main() -> gooey::Result { | ||
let theme_mode = Dynamic::default(); | ||
set_of_containers(1, theme_mode.clone()) | ||
.centered() | ||
.into_window() | ||
.with_theme_mode(theme_mode) | ||
.run() | ||
} | ||
|
||
fn set_of_containers(repeat: usize, theme_mode: Dynamic<ThemeMode>) -> WidgetInstance { | ||
let inner = if let Some(remaining_iters) = repeat.checked_sub(1) { | ||
set_of_containers(remaining_iters, theme_mode) | ||
} else { | ||
Button::new("Toggle Theme Mode") | ||
.on_click(move |_| { | ||
theme_mode.map_mut(|mode| mode.toggle()); | ||
}) | ||
.make_widget() | ||
}; | ||
Label::new("Lowest") | ||
.and( | ||
Label::new("Low") | ||
.and( | ||
Label::new("Mid") | ||
.and( | ||
Label::new("High") | ||
.and(Label::new("Highest").and(inner).into_rows().contain()) | ||
.into_rows() | ||
.contain(), | ||
) | ||
.into_rows() | ||
.contain(), | ||
) | ||
.into_rows() | ||
.contain(), | ||
) | ||
.into_rows() | ||
.contain() | ||
.make_widget() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,17 @@ | ||
use gooey::styles::components::TextColor; | ||
use gooey::styles::Styles; | ||
use gooey::widget::{MakeWidget, Widget}; | ||
use gooey::widget::MakeWidget; | ||
use gooey::widgets::stack::Stack; | ||
use gooey::widgets::{Button, Style}; | ||
use gooey::{styles, Run}; | ||
use gooey::Run; | ||
use kludgine::Color; | ||
|
||
fn main() -> gooey::Result { | ||
Stack::rows(Button::new("Green").and(red_text(Button::new("Red")))) | ||
.with_styles(Styles::new().with(&TextColor, Color::GREEN)) | ||
.with(&TextColor, Color::GREEN) | ||
.run() | ||
} | ||
|
||
/// Creating reusable style helpers that work with any Widget is straightfoward | ||
fn red_text(w: impl Widget) -> Style { | ||
Style::new(styles!(TextColor => Color::RED), w) | ||
fn red_text(w: impl MakeWidget) -> Style { | ||
w.with(&TextColor, Color::RED) | ||
} |
Oops, something went wrong.