Add an API for setting a window's title
This controls how the window appears in the Window menu.
This commit is contained in:
parent
f4d13ef596
commit
04bd57b2c7
5 changed files with 44 additions and 3 deletions
|
@ -386,8 +386,15 @@ impl platform::Window for Window {
|
|||
}
|
||||
|
||||
fn activate(&self) {
|
||||
unsafe { msg_send![self.0.borrow().native_window, makeKeyAndOrderFront: nil] }
|
||||
}
|
||||
|
||||
fn set_title(&mut self, title: &str) {
|
||||
unsafe {
|
||||
let _: () = msg_send![self.0.borrow().native_window, makeKeyAndOrderFront: nil];
|
||||
let app = NSApplication::sharedApplication(nil);
|
||||
let window = self.0.borrow().native_window;
|
||||
let title = ns_string(title);
|
||||
msg_send![app, changeWindowsItem:window title:title filename:false]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue