diff --git a/src/editor/main.rs b/src/editor/main.rs index 128528b2e658844be8af210211541c7977b8df74..967d6ff897c88963da5dbebb173a828828dae78e 100644 --- a/src/editor/main.rs +++ b/src/editor/main.rs @@ -3,8 +3,9 @@ extern crate orbclient; extern crate orbtk; +use orbclient::WindowFlag; use orbtk::{Action, Button, Menu, Point, Rect, Separator, TextBox, Window}; -use orbtk::traits::{Click, Place, Text}; +use orbtk::traits::{Click, Place, Resize, Text}; use std::{cmp, env}; use std::fs::File; @@ -22,7 +23,7 @@ fn main(){ let (display_width, display_height) = orbclient::get_display_size().expect("viewer: failed to get display size"); let (width, height) = (cmp::min(1024, display_width * 4/5), cmp::min(768, display_height * 4/5)); - let mut window = Window::new(Rect::new(-1, -1, width, height), &title); + let mut window = Window::new_flags(Rect::new(-1, -1, width, height), &title, &[WindowFlag::Resizable]); let text_box = TextBox::new(); text_box.position(0, 16) @@ -180,5 +181,9 @@ fn main(){ window.add(&menu); + window.on_resize(move |_, width, height| { + text_box.size(width, height - 16); + }); + window.exec(); }