-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
50 additions
and
56 deletions.
There are no files selected for viewing
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 |
---|---|---|
@@ -0,0 +1,28 @@ | ||
use egui::{RichText, Ui, WidgetText}; | ||
|
||
pub fn page<'a>( | ||
ui: &mut Ui, | ||
title: impl Into<RichText>, | ||
text: impl Into<WidgetText>, | ||
icon: impl Into<Option<&'a str>>, | ||
) { | ||
if let Some(icon) = icon.into() { | ||
ui.label(RichText::new(icon).size(120.0)); | ||
} | ||
ui.add_space(10.0); | ||
ui.label(title.into().size(30.0).strong()); | ||
ui.add_space(10.0); | ||
ui.label(text); | ||
} | ||
|
||
pub fn page_with_content<'a, T>( | ||
ui: &mut Ui, | ||
title: impl Into<RichText>, | ||
text: impl Into<WidgetText>, | ||
icon: impl Into<Option<&'a str>>, | ||
add_contents: impl FnOnce(&mut Ui) -> T, | ||
) -> T { | ||
page(ui, title, text, icon); | ||
ui.add_space(20.0); | ||
add_contents(ui) | ||
} |