anvil.window_map: add WindowMap::set_location

This commit is contained in:
Ivan Molodetskikh 2020-02-01 18:30:13 +03:00
parent a51e421c19
commit 0ea4ec9abe
No known key found for this signature in database
GPG Key ID: 02CE38DA47E9D691
1 changed files with 8 additions and 0 deletions

View File

@ -242,4 +242,12 @@ where
.find(|w| w.toplevel.equals(toplevel))
.map(|w| w.location)
}
/// Sets the location of the toplevel, if it exists.
pub fn set_location(&mut self, toplevel: &Kind<R>, location: (i32, i32)) {
if let Some(w) = self.windows.iter_mut().find(|w| w.toplevel.equals(toplevel)) {
w.location = location;
w.self_update(self.ctoken, &self.get_size);
}
}
}