diff options
| author | 2019-11-09 19:29:23 +0100 | |
|---|---|---|
| committer | 2019-11-09 19:29:23 +0100 | |
| commit | 839e039dbf2fb89dcb8c141503740777d2af2eb3 (patch) | |
| tree | 9c775128e047e4a141f2aefb691e7e31a801ba93 /winit | |
| parent | e66d38403d09b265f111d9e1b59af6143464d912 (diff) | |
| parent | e953b1828d5b8dbdd145829f47c4817137e37f0d (diff) | |
| download | iced-839e039dbf2fb89dcb8c141503740777d2af2eb3.tar.gz iced-839e039dbf2fb89dcb8c141503740777d2af2eb3.tar.bz2 iced-839e039dbf2fb89dcb8c141503740777d2af2eb3.zip | |
Merge pull request #49 from hecrj/feature/control-window-title
Allow applications to control the window title
Diffstat (limited to '')
| -rw-r--r-- | winit/src/application.rs | 13 | 
1 files changed, 13 insertions, 0 deletions
| diff --git a/winit/src/application.rs b/winit/src/application.rs index 3b908189..4deffecc 100644 --- a/winit/src/application.rs +++ b/winit/src/application.rs @@ -10,6 +10,8 @@ pub trait Application {      type Message: std::fmt::Debug; +    fn title(&self) -> String; +      fn update(&mut self, message: Self::Message);      fn view(&mut self) -> Element<Self::Message, Self::Renderer>; @@ -25,12 +27,14 @@ pub trait Application {          };          let mut debug = Debug::new(); +        let mut title = self.title();          debug.startup_started();          let event_loop = EventLoop::new();          // TODO: Ask for window settings and configure this properly          let window = WindowBuilder::new() +            .with_title(&title)              .with_inner_size(winit::dpi::LogicalSize {                  width: 1280.0,                  height: 1024.0, @@ -112,6 +116,15 @@ pub trait Application {                          debug.update_finished();                      } +                    // Update window title +                    let new_title = self.title(); + +                    if title != new_title { +                        window.set_title(&new_title); + +                        title = new_title; +                    } +                      debug.layout_started();                      let user_interface = UserInterface::build(                          document(&mut self, size, &mut debug), | 
