[demo] Refactor and minor cleanup

This commit is contained in:
Emil Ernerfeldt
2021-02-07 17:04:03 +01:00
parent e82fb81f07
commit 6377a4231f
11 changed files with 147 additions and 116 deletions
+15 -2
View File
@@ -26,8 +26,21 @@ impl Default for DemoWindow {
}
}
impl DemoWindow {
pub fn ui(&mut self, ui: &mut Ui) {
impl Demo for DemoWindow {
fn name(&self) -> &str {
"✨ Misc Demos"
}
fn show(&mut self, ctx: &CtxRef, open: &mut bool) {
Window::new(self.name())
.open(open)
.scroll(true)
.show(ctx, |ui| self.ui(ui));
}
}
impl View for DemoWindow {
fn ui(&mut self, ui: &mut Ui) {
CollapsingHeader::new("Widgets")
.default_open(true)
.show(ui, |ui| {