1
1
mirror of https://github.com/wez/wezterm.git synced 2024-12-25 06:12:16 +03:00
wezterm/window/examples/basic.rs
2019-09-15 19:09:08 -07:00

34 lines
619 B
Rust

use failure::Fallible;
use window::os::windows::window::*;
struct MyWindow {
allow_close: bool,
}
impl WindowCallbacks for MyWindow {
fn can_close(&mut self) -> bool {
eprintln!("can I close?");
if self.allow_close {
terminate_message_loop();
true
} else {
self.allow_close = true;
false
}
}
}
fn main() -> Fallible<()> {
let win = Window::new_window(
"myclass",
"the title",
800,
600,
Box::new(MyWindow { allow_close: false }),
)?;
win.show();
run_message_loop()
}