Implement get_*_size() for win32
This commit is contained in:
parent
d4e334aecb
commit
14a697b272
2 changed files with 28 additions and 2 deletions
|
|
@ -222,11 +222,31 @@ impl Window {
|
|||
}
|
||||
|
||||
pub fn get_inner_size(&self) -> (uint, uint) {
|
||||
unimplemented!()
|
||||
use std::{mem, os};
|
||||
let mut rect: ffi::RECT = unsafe { mem::uninitialized() };
|
||||
|
||||
if unsafe { ffi::GetClientRect(self.window, &mut rect) } == 0 {
|
||||
fail!("GetClientRect failed: {}", os::error_string(os::errno() as uint));
|
||||
}
|
||||
|
||||
(
|
||||
(rect.right - rect.left) as uint,
|
||||
(rect.bottom - rect.top) as uint
|
||||
)
|
||||
}
|
||||
|
||||
pub fn get_outer_size(&self) -> (uint, uint) {
|
||||
unimplemented!()
|
||||
use std::{mem, os};
|
||||
let mut rect: ffi::RECT = unsafe { mem::uninitialized() };
|
||||
|
||||
if unsafe { ffi::GetWindowRect(self.window, &mut rect) } == 0 {
|
||||
fail!("GetWindowRect failed: {}", os::error_string(os::errno() as uint));
|
||||
}
|
||||
|
||||
(
|
||||
(rect.right - rect.left) as uint,
|
||||
(rect.bottom - rect.top) as uint
|
||||
)
|
||||
}
|
||||
|
||||
pub fn set_inner_size(&self, x: uint, y: uint) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue