1
0
mirror of https://github.com/emilk/egui.git synced 2026-06-27 15:13:12 -04:00

More cleanup

This commit is contained in:
Konkitoman
2023-08-04 10:45:52 +03:00
parent 172be33b40
commit fbcb26827c
14 changed files with 268 additions and 295 deletions

View File

@@ -1,4 +1,5 @@
// ----------------------------------------------------------------------------
#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))]
#[cfg_attr(feature = "serde", serde(default))]
pub struct CodeEditor {
@@ -36,7 +37,7 @@ impl super::Demo for CodeEditor {
impl super::View for CodeEditor {
fn ui(&mut self, ui: &mut egui::Ui) {
let CodeEditor { language, code } = self;
let Self { language, code } = self;
ui.horizontal(|ui| {
ui.set_height(0.0);

View File

@@ -16,7 +16,7 @@ impl super::Demo for DancingStrings {
.open(open)
.default_size(vec2(512.0, 256.0))
.vscroll(false)
.show(ctx, |ui| Self::default().ui(ui));
.show(ctx, |ui| self.ui(ui));
}
}

View File

@@ -1,7 +1,5 @@
use egui::{Context, Modifiers, ScrollArea, Ui};
use std::collections::BTreeSet;
use std::sync::Arc;
use std::sync::RwLock;
use super::About;
use super::Demo;
@@ -14,7 +12,7 @@ use crate::is_mobile;
#[cfg_attr(feature = "serde", serde(default))]
struct Demos {
#[cfg_attr(feature = "serde", serde(skip))]
demos: Vec<Box<dyn Demo + Sync + Send>>,
demos: Vec<Box<dyn Demo>>,
open: BTreeSet<String>,
}
@@ -47,7 +45,7 @@ impl Default for Demos {
}
impl Demos {
pub fn from_demos(demos: Vec<Box<dyn Demo + Sync + Send>>) -> Self {
pub fn from_demos(demos: Vec<Box<dyn Demo>>) -> Self {
let mut open = BTreeSet::new();
open.insert(
super::widget_gallery::WidgetGallery::default()
@@ -151,20 +149,14 @@ fn set_open(open: &mut BTreeSet<String>, key: &'static str, is_open: bool) {
#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))]
#[cfg_attr(feature = "serde", serde(default))]
pub struct DemoWindowsData {
pub struct DemoWindows {
about_is_open: bool,
about: About,
demos: Demos,
tests: Tests,
}
#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))]
#[cfg_attr(feature = "serde", serde(default))]
#[derive(Clone, Default)]
pub struct DemoWindows {
data: Arc<RwLock<DemoWindowsData>>,
}
impl Default for DemoWindowsData {
impl Default for DemoWindows {
fn default() -> Self {
Self {
about_is_open: true,
@@ -186,36 +178,32 @@ impl DemoWindows {
}
fn mobile_ui(&mut self, ctx: &Context) {
let mut about_is_open = self.data.read().unwrap().about_is_open;
if about_is_open {
if self.about_is_open {
let screen_size = ctx.input(|i| i.screen_rect.size());
let default_width = (screen_size.x - 20.0).min(400.0);
let close = Arc::new(RwLock::new(false));
let close_ = close.clone();
let clone = self.clone();
egui::Window::new(self.data.read().unwrap().about.name())
let mut close = false;
egui::Window::new(self.about.name())
.anchor(egui::Align2::CENTER_CENTER, [0.0, 0.0])
.default_width(default_width)
.default_height(ctx.available_rect().height() - 46.0)
.vscroll(true)
.open(&mut about_is_open)
.open(&mut self.about_is_open)
.resizable(false)
.collapsible(false)
.show(ctx, |ui| {
let close = close.clone();
clone.data.write().unwrap().about.ui(ui);
self.about.ui(ui);
ui.add_space(12.0);
ui.vertical_centered_justified(|ui| {
if ui
.button(egui::RichText::new("Continue to the demo!").size(20.0))
.clicked()
{
*close.write().unwrap() = true;
close = true;
}
});
});
self.data.write().unwrap().about_is_open &= !*close_.read().unwrap();
self.about_is_open &= !close;
} else {
self.mobile_top_bar(ctx);
self.show_windows(ctx);
@@ -288,22 +276,20 @@ impl DemoWindows {
/// Show the open windows.
fn show_windows(&mut self, ctx: &Context) {
let data = &mut *self.data.write().unwrap();
data.about.show(ctx, &mut data.about_is_open);
data.demos.windows(ctx);
data.tests.windows(ctx);
self.about.show(ctx, &mut self.about_is_open);
self.demos.windows(ctx);
self.tests.windows(ctx);
}
fn demo_list_ui(&mut self, ui: &mut egui::Ui) {
ScrollArea::vertical().show(ui, |ui| {
ui.with_layout(egui::Layout::top_down_justified(egui::Align::LEFT), |ui| {
let data = &mut *self.data.write().unwrap();
ui.toggle_value(&mut data.about_is_open, data.about.name());
ui.toggle_value(&mut self.about_is_open, self.about.name());
ui.separator();
data.demos.checkboxes(ui);
self.demos.checkboxes(ui);
ui.separator();
data.tests.checkboxes(ui);
self.tests.checkboxes(ui);
ui.separator();
if ui.button("Organize windows").clicked() {

View File

@@ -120,9 +120,8 @@ impl super::View for DragAndDropDemo {
let id_source = "my_drag_and_drop_demo";
let mut source_col_row = None;
let mut drop_col = None;
let columns = &mut self.columns;
ui.columns(columns.len(), |uis| {
for (col_idx, column) in columns.clone().into_iter().enumerate() {
ui.columns(self.columns.len(), |uis| {
for (col_idx, column) in self.columns.clone().into_iter().enumerate() {
let ui = &mut uis[col_idx];
let can_accept_what_is_being_dragged = true; // We accept anything being dragged (for now) ¯\_(ツ)_/¯
let response = drop_target(ui, can_accept_what_is_being_dragged, |ui| {
@@ -133,7 +132,7 @@ impl super::View for DragAndDropDemo {
let response = ui.add(Label::new(item).sense(Sense::click()));
response.context_menu(|ui| {
if ui.button("Remove").clicked() {
columns[col_idx].remove(row_idx);
self.columns[col_idx].remove(row_idx);
ui.close_menu();
}
});
@@ -148,7 +147,7 @@ impl super::View for DragAndDropDemo {
let response = response.context_menu(|ui| {
if ui.button("New Item").clicked() {
columns[col_idx].push("New Item".to_owned());
self.columns[col_idx].push("New Item".to_owned());
ui.close_menu();
}
});
@@ -164,8 +163,8 @@ impl super::View for DragAndDropDemo {
if let Some(drop_col) = drop_col {
if ui.input(|i| i.pointer.any_released()) {
// do the drop:
let item = columns[source_col].remove(source_row);
columns[drop_col].push(item);
let item = self.columns[source_col].remove(source_row);
self.columns[drop_col].push(item);
}
}
}

View File

@@ -1,4 +1,5 @@
use std::collections::BTreeMap;
pub struct FontBook {
filter: String,
font_id: egui::FontId,

View File

@@ -14,7 +14,7 @@ impl super::Demo for Highlighting {
.open(open)
.show(ctx, |ui| {
use super::View as _;
Self::default().ui(ui);
self.ui(ui);
});
}
}

View File

@@ -30,7 +30,8 @@ impl Default for Panel {
}
// ----------------------------------------------------------------------------
#[derive(Default, PartialEq)]
#[derive(PartialEq, Default)]
pub struct PlotDemo {
line_demo: LineDemo,
marker_demo: MarkerDemo,

View File

@@ -55,141 +55,137 @@ impl super::Demo for Sliders {
impl super::View for Sliders {
fn ui(&mut self, ui: &mut Ui) {
{
let Sliders {
min,
max,
logarithmic,
clamp_to_range,
smart_aim,
step,
use_steps,
integer,
vertical,
value,
trailing_fill,
} = self;
let Self {
min,
max,
logarithmic,
clamp_to_range,
smart_aim,
step,
use_steps,
integer,
vertical,
value,
trailing_fill,
} = self;
ui.label("You can click a slider value to edit it with the keyboard.");
ui.label("You can click a slider value to edit it with the keyboard.");
let (type_min, type_max) = if *integer {
((i32::MIN as f64), (i32::MAX as f64))
} else if *logarithmic {
(-INFINITY, INFINITY)
} else {
(-1e5, 1e5) // linear sliders make little sense with huge numbers
};
let (type_min, type_max) = if *integer {
((i32::MIN as f64), (i32::MAX as f64))
} else if *logarithmic {
(-INFINITY, INFINITY)
} else {
(-1e5, 1e5) // linear sliders make little sense with huge numbers
};
*min = min.clamp(type_min, type_max);
*max = max.clamp(type_min, type_max);
*min = min.clamp(type_min, type_max);
*max = max.clamp(type_min, type_max);
let orientation = if *vertical {
SliderOrientation::Vertical
} else {
SliderOrientation::Horizontal
};
let orientation = if *vertical {
SliderOrientation::Vertical
} else {
SliderOrientation::Horizontal
};
let istep = if *use_steps { *step } else { 0.0 };
if *integer {
let mut value_i32 = *value as i32;
ui.add(
Slider::new(&mut value_i32, (*min as i32)..=(*max as i32))
.logarithmic(*logarithmic)
.clamp_to_range(*clamp_to_range)
.smart_aim(*smart_aim)
.orientation(orientation)
.text("i32 demo slider")
.step_by(istep)
.trailing_fill(*trailing_fill),
);
*value = value_i32 as f64;
} else {
ui.add(
Slider::new(value, (*min)..=(*max))
.logarithmic(*logarithmic)
.clamp_to_range(*clamp_to_range)
.smart_aim(*smart_aim)
.orientation(orientation)
.text("f64 demo slider")
.step_by(istep)
.trailing_fill(*trailing_fill),
);
ui.label(
"Sliders will intelligently pick how many decimals to show. \
You can always see the full precision value by hovering the value.",
);
if ui.button("Assign PI").clicked() {
self.value = std::f64::consts::PI;
}
}
ui.separator();
ui.label("Slider range:");
let istep = if *use_steps { *step } else { 0.0 };
if *integer {
let mut value_i32 = *value as i32;
ui.add(
Slider::new(min, type_min..=type_max)
.logarithmic(true)
Slider::new(&mut value_i32, (*min as i32)..=(*max as i32))
.logarithmic(*logarithmic)
.clamp_to_range(*clamp_to_range)
.smart_aim(*smart_aim)
.text("left")
.orientation(orientation)
.text("i32 demo slider")
.step_by(istep)
.trailing_fill(*trailing_fill),
);
*value = value_i32 as f64;
} else {
ui.add(
Slider::new(max, type_min..=type_max)
.logarithmic(true)
Slider::new(value, (*min)..=(*max))
.logarithmic(*logarithmic)
.clamp_to_range(*clamp_to_range)
.smart_aim(*smart_aim)
.text("right")
.orientation(orientation)
.text("f64 demo slider")
.step_by(istep)
.trailing_fill(*trailing_fill),
);
ui.separator();
ui.checkbox(trailing_fill, "Toggle trailing color");
ui.label("When enabled, trailing color will be painted up until the circle.");
ui.separator();
ui.checkbox(use_steps, "Use steps");
ui.label("When enabled, the minimal value change would be restricted to a given step.");
if *use_steps {
ui.add(egui::DragValue::new(step).speed(1.0));
}
ui.separator();
ui.horizontal(|ui| {
ui.label("Slider type:");
ui.radio_value(integer, true, "i32");
ui.radio_value(integer, false, "f64");
})
.response
.on_hover_text("All numeric types (f32, usize, …) are supported.");
ui.horizontal(|ui| {
ui.label("Slider orientation:");
ui.radio_value(vertical, false, "Horizontal");
ui.radio_value(vertical, true, "Vertical");
});
ui.add_space(8.0);
ui.checkbox(logarithmic, "Logarithmic");
ui.label("Logarithmic sliders are great for when you want to span a huge range, i.e. from zero to a million.");
ui.label("Logarithmic sliders can include infinity and zero.");
ui.add_space(8.0);
ui.checkbox(clamp_to_range, "Clamp to range");
ui.label(
"If true, the slider will clamp incoming and outgoing values to the given range.",
"Sliders will intelligently pick how many decimals to show. \
You can always see the full precision value by hovering the value.",
);
ui.label("If false, the slider can shows values outside its range, and you can manually enter values outside the range.");
ui.add_space(8.0);
ui.checkbox(smart_aim, "Smart Aim");
ui.label("Smart Aim will guide you towards round values when you drag the slider so you you are more likely to hit 250 than 247.23");
ui.add_space(8.0);
if ui.button("Assign PI").clicked() {
self.value = std::f64::consts::PI;
}
}
ui.separator();
ui.label("Slider range:");
ui.add(
Slider::new(min, type_min..=type_max)
.logarithmic(true)
.smart_aim(*smart_aim)
.text("left")
.trailing_fill(*trailing_fill),
);
ui.add(
Slider::new(max, type_min..=type_max)
.logarithmic(true)
.smart_aim(*smart_aim)
.text("right")
.trailing_fill(*trailing_fill),
);
ui.separator();
ui.checkbox(trailing_fill, "Toggle trailing color");
ui.label("When enabled, trailing color will be painted up until the circle.");
ui.separator();
ui.checkbox(use_steps, "Use steps");
ui.label("When enabled, the minimal value change would be restricted to a given step.");
if *use_steps {
ui.add(egui::DragValue::new(step).speed(1.0));
}
ui.separator();
ui.horizontal(|ui| {
ui.label("Slider type:");
ui.radio_value(integer, true, "i32");
ui.radio_value(integer, false, "f64");
})
.response
.on_hover_text("All numeric types (f32, usize, …) are supported.");
ui.horizontal(|ui| {
ui.label("Slider orientation:");
ui.radio_value(vertical, false, "Horizontal");
ui.radio_value(vertical, true, "Vertical");
});
ui.add_space(8.0);
ui.checkbox(logarithmic, "Logarithmic");
ui.label("Logarithmic sliders are great for when you want to span a huge range, i.e. from zero to a million.");
ui.label("Logarithmic sliders can include infinity and zero.");
ui.add_space(8.0);
ui.checkbox(clamp_to_range, "Clamp to range");
ui.label("If true, the slider will clamp incoming and outgoing values to the given range.");
ui.label("If false, the slider can shows values outside its range, and you can manually enter values outside the range.");
ui.add_space(8.0);
ui.checkbox(smart_aim, "Smart Aim");
ui.label("Smart Aim will guide you towards round values when you drag the slider so you you are more likely to hit 250 than 247.23");
ui.add_space(8.0);
ui.vertical_centered(|ui| {
egui::reset_button(ui, self);
ui.add(crate::egui_github_link_file!());

View File

@@ -18,7 +18,7 @@ impl super::Demo for StripDemo {
.default_width(400.0)
.show(ctx, |ui| {
use super::View as _;
Self::default().ui(ui);
self.ui(ui);
});
}
}

View File

@@ -51,54 +51,52 @@ const NUM_MANUAL_ROWS: usize = 20;
impl super::View for TableDemo {
fn ui(&mut self, ui: &mut egui::Ui) {
{
ui.vertical(|ui| {
ui.horizontal(|ui| {
ui.checkbox(&mut self.striped, "Striped");
ui.checkbox(&mut self.resizable, "Resizable columns");
});
ui.label("Table type:");
ui.radio_value(&mut self.demo, DemoType::Manual, "Few, manual rows");
ui.radio_value(
&mut self.demo,
DemoType::ManyHomogeneous,
"Thousands of rows of same height",
);
ui.radio_value(
&mut self.demo,
DemoType::ManyHeterogenous,
"Thousands of rows of differing heights",
);
if self.demo != DemoType::Manual {
ui.add(
egui::Slider::new(&mut self.num_rows, 0..=100_000)
.logarithmic(true)
.text("Num rows"),
);
}
{
let max_rows = if self.demo == DemoType::Manual {
NUM_MANUAL_ROWS
} else {
self.num_rows
};
let slider_response = ui.add(
egui::Slider::new(&mut self.scroll_to_row_slider, 0..=max_rows)
.logarithmic(true)
.text("Row to scroll to"),
);
if slider_response.changed() {
self.scroll_to_row = Some(self.scroll_to_row_slider);
}
}
ui.vertical(|ui| {
ui.horizontal(|ui| {
ui.checkbox(&mut self.striped, "Striped");
ui.checkbox(&mut self.resizable, "Resizable columns");
});
ui.separator();
}
ui.label("Table type:");
ui.radio_value(&mut self.demo, DemoType::Manual, "Few, manual rows");
ui.radio_value(
&mut self.demo,
DemoType::ManyHomogeneous,
"Thousands of rows of same height",
);
ui.radio_value(
&mut self.demo,
DemoType::ManyHeterogenous,
"Thousands of rows of differing heights",
);
if self.demo != DemoType::Manual {
ui.add(
egui::Slider::new(&mut self.num_rows, 0..=100_000)
.logarithmic(true)
.text("Num rows"),
);
}
{
let max_rows = if self.demo == DemoType::Manual {
NUM_MANUAL_ROWS
} else {
self.num_rows
};
let slider_response = ui.add(
egui::Slider::new(&mut self.scroll_to_row_slider, 0..=max_rows)
.logarithmic(true)
.text("Row to scroll to"),
);
if slider_response.changed() {
self.scroll_to_row = Some(self.scroll_to_row_slider);
}
}
});
ui.separator();
// Leave room for the source code link after the table demo:
use egui_extras::{Size, StripBuilder};

View File

@@ -1,5 +1,3 @@
use std::sync::{Arc, RwLock};
#[derive(Default)]
pub struct CursorTest {}
@@ -11,7 +9,7 @@ impl super::Demo for CursorTest {
fn show(&mut self, ctx: &egui::Context, open: &mut bool) {
egui::Window::new(self.name()).open(open).show(ctx, |ui| {
use super::View as _;
Self::default().ui(ui);
self.ui(ui);
});
}
}
@@ -43,7 +41,7 @@ impl super::Demo for IdTest {
fn show(&mut self, ctx: &egui::Context, open: &mut bool) {
egui::Window::new(self.name()).open(open).show(ctx, |ui| {
use super::View as _;
Self::default().ui(ui);
self.ui(ui);
});
}
}
@@ -180,6 +178,7 @@ impl super::View for ManualLayoutTest {
}
// ----------------------------------------------------------------------------
#[derive(PartialEq)]
pub struct TableTest {
num_cols: usize,
@@ -216,91 +215,87 @@ impl super::Demo for TableTest {
impl super::View for TableTest {
fn ui(&mut self, ui: &mut egui::Ui) {
{
ui.add(
egui::Slider::new(&mut self.min_col_width, 0.0..=400.0)
.text("Minimum column width"),
);
ui.add(
egui::Slider::new(&mut self.max_col_width, 0.0..=400.0)
.text("Maximum column width"),
);
ui.add(egui::Slider::new(&mut self.num_cols, 0..=5).text("Columns"));
ui.add(egui::Slider::new(&mut self.num_rows, 0..=20).text("Rows"));
ui.add(
egui::Slider::new(&mut self.min_col_width, 0.0..=400.0).text("Minimum column width"),
);
ui.add(
egui::Slider::new(&mut self.max_col_width, 0.0..=400.0).text("Maximum column width"),
);
ui.add(egui::Slider::new(&mut self.num_cols, 0..=5).text("Columns"));
ui.add(egui::Slider::new(&mut self.num_rows, 0..=20).text("Rows"));
ui.separator();
ui.separator();
let words = [
"random", "words", "in", "a", "random", "order", "that", "just", "keeps", "going",
"with", "some", "more",
];
let words = [
"random", "words", "in", "a", "random", "order", "that", "just", "keeps", "going",
"with", "some", "more",
];
egui::Grid::new("my_grid")
.striped(true)
.min_col_width(self.min_col_width)
.max_col_width(self.max_col_width)
.show(ui, |ui| {
for row in 0..self.num_rows {
for col in 0..self.num_cols {
if col == 0 {
ui.label(format!("row {}", row));
} else {
let word_idx = row * 3 + col * 5;
let word_count = (row * 5 + col * 75) % 13;
let mut string = String::new();
for word in words.iter().cycle().skip(word_idx).take(word_count) {
string += word;
string += " ";
}
ui.label(string);
egui::Grid::new("my_grid")
.striped(true)
.min_col_width(self.min_col_width)
.max_col_width(self.max_col_width)
.show(ui, |ui| {
for row in 0..self.num_rows {
for col in 0..self.num_cols {
if col == 0 {
ui.label(format!("row {}", row));
} else {
let word_idx = row * 3 + col * 5;
let word_count = (row * 5 + col * 75) % 13;
let mut string = String::new();
for word in words.iter().cycle().skip(word_idx).take(word_count) {
string += word;
string += " ";
}
ui.label(string);
}
ui.end_row();
}
});
ui.separator();
ui.add(egui::Slider::new(&mut self.text_length, 1..=40).text("Text length"));
egui::Grid::new("parent grid").striped(true).show(ui, |ui| {
ui.vertical(|ui| {
ui.label("Vertical nest1");
ui.label("Vertical nest2");
});
ui.label("First row, second column");
ui.end_row();
ui.horizontal(|ui| {
ui.label("Horizontal nest1");
ui.label("Horizontal nest2");
});
ui.label("Second row, second column");
ui.end_row();
ui.scope(|ui| {
ui.label("Scope nest 1");
ui.label("Scope nest 2");
});
ui.label("Third row, second column");
ui.end_row();
egui::Grid::new("nested grid").show(ui, |ui| {
ui.label("Grid nest11");
ui.label("Grid nest12");
ui.end_row();
ui.label("Grid nest21");
ui.label("Grid nest22");
ui.end_row();
});
ui.label("Fourth row, second column");
ui.end_row();
}
});
let mut dyn_text = String::from("O");
dyn_text.extend(std::iter::repeat('h').take(self.text_length));
ui.label(dyn_text);
ui.label("Fifth row, second column");
ui.separator();
ui.add(egui::Slider::new(&mut self.text_length, 1..=40).text("Text length"));
egui::Grid::new("parent grid").striped(true).show(ui, |ui| {
ui.vertical(|ui| {
ui.label("Vertical nest1");
ui.label("Vertical nest2");
});
ui.label("First row, second column");
ui.end_row();
ui.horizontal(|ui| {
ui.label("Horizontal nest1");
ui.label("Horizontal nest2");
});
ui.label("Second row, second column");
ui.end_row();
ui.scope(|ui| {
ui.label("Scope nest 1");
ui.label("Scope nest 2");
});
ui.label("Third row, second column");
ui.end_row();
egui::Grid::new("nested grid").show(ui, |ui| {
ui.label("Grid nest11");
ui.label("Grid nest12");
ui.end_row();
ui.label("Grid nest21");
ui.label("Grid nest22");
ui.end_row();
});
}
ui.label("Fourth row, second column");
ui.end_row();
let mut dyn_text = String::from("O");
dyn_text.extend(std::iter::repeat('h').take(self.text_length));
ui.label(dyn_text);
ui.label("Fifth row, second column");
ui.end_row();
});
ui.vertical_centered(|ui| {
egui::reset_button(ui, self);
@@ -383,15 +378,14 @@ impl super::View for InputTest {
// ----------------------------------------------------------------------------
#[derive(Clone)]
pub struct WindowResizeTest {
text: Arc<RwLock<String>>,
text: String,
}
impl Default for WindowResizeTest {
fn default() -> Self {
Self {
text: Arc::new(RwLock::new(crate::LOREM_IPSUM_LONG.to_owned())),
text: crate::LOREM_IPSUM_LONG.to_owned(),
}
}
}
@@ -457,8 +451,6 @@ impl super::Demo for WindowResizeTest {
lorem_ipsum(ui, crate::LOREM_IPSUM);
});
let clone = self.clone();
Window::new("↔ resizable with TextEdit")
.open(open)
.vscroll(false)
@@ -466,8 +458,7 @@ impl super::Demo for WindowResizeTest {
.default_height(300.0)
.show(ctx, |ui| {
ui.label("Shows how you can fill an area with a widget.");
let mut text = clone.text.write().unwrap();
ui.add_sized(ui.available_size(), TextEdit::multiline(&mut *text));
ui.add_sized(ui.available_size(), TextEdit::multiline(&mut self.text));
});
Window::new("↔ freely resized")

View File

@@ -99,7 +99,7 @@ impl super::View for WidgetGallery {
impl WidgetGallery {
fn gallery_grid_contents(&mut self, ui: &mut egui::Ui) {
let WidgetGallery {
let Self {
enabled: _,
visible: _,
boolean,

View File

@@ -37,7 +37,7 @@ impl super::Demo for WindowOptions {
}
fn show(&mut self, ctx: &egui::Context, open: &mut bool) {
let WindowOptions {
let Self {
title,
title_bar,
closable,
@@ -75,7 +75,7 @@ impl super::Demo for WindowOptions {
impl super::View for WindowOptions {
fn ui(&mut self, ui: &mut egui::Ui) {
let WindowOptions {
let Self {
title,
title_bar,
closable,

View File

@@ -14,7 +14,7 @@ impl super::Demo for WindowWithPanels {
.default_height(400.0)
.vscroll(false)
.open(open);
window.show(ctx, |ui| Self {}.ui(ui));
window.show(ctx, |ui| self.ui(ui));
}
}