-
Notifications
You must be signed in to change notification settings - Fork 0
/
demo.rs
34 lines (26 loc) · 855 Bytes
/
demo.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
use gtk::{prelude::*, Application, ApplicationWindow};
use gtk_egui_area::EguiArea;
use std::cell::RefCell;
fn main() {
let app = Application::builder().build();
app.connect_activate(build_ui);
app.run();
}
fn build_ui(app: &Application) {
let window = ApplicationWindow::new(app);
window.set_default_width(1200);
window.set_default_height(900);
let demo_windows = RefCell::new(egui_demo_lib::DemoWindows::default());
let egui_area = EguiArea::new(move |ctx| {
demo_windows.borrow_mut().ui(ctx);
});
let frame = gtk::Frame::new(Some("EGUI"));
frame.set_label_align(0.5);
frame.set_margin_top(10);
frame.set_margin_bottom(10);
frame.set_margin_start(10);
frame.set_margin_end(10);
frame.set_child(Some(&egui_area));
window.set_child(Some(&frame));
window.present();
}