1
0
mirror of https://github.com/emilk/egui.git synced 2026-08-31 22:00:03 -04:00

Add a lot more CursorIcon's

This commit is contained in:
Emil Ernerfeldt
2021-03-13 12:38:03 +01:00
parent ee1fcf1ead
commit 958aea922f
8 changed files with 216 additions and 48 deletions

View File

@@ -26,6 +26,7 @@ impl Default for Demos {
Box::new(super::window_options::WindowOptions::default()),
Box::new(super::tests::WindowResizeTest::default()),
// Tests:
Box::new(super::tests::CursorTest::default()),
Box::new(super::tests::IdTest::default()),
Box::new(super::tests::InputTest::default()),
Box::new(super::layout_test::LayoutTest::default()),

View File

@@ -1,3 +1,34 @@
#[derive(Default)]
pub struct CursorTest {}
impl super::Demo for CursorTest {
fn name(&self) -> &'static str {
"Cursor Test"
}
fn show(&mut self, ctx: &egui::CtxRef, open: &mut bool) {
egui::Window::new(self.name()).open(open).show(ctx, |ui| {
use super::View;
self.ui(ui);
});
}
}
impl super::View for CursorTest {
fn ui(&mut self, ui: &mut egui::Ui) {
ui.heading("Hover to switch cursor icon:");
ui.vertical_centered_justified(|ui| {
for &cursor_icon in &egui::CursorIcon::ALL {
let _ = ui
.button(format!("{:?}", cursor_icon))
.on_hover_cursor(cursor_icon);
}
});
}
}
// ----------------------------------------------------------------------------
#[derive(Default)]
pub struct IdTest {}