2015-04-24 17:51:23 +10:00
|
|
|
#![cfg(target_os = "windows")]
|
|
|
|
|
2015-07-27 17:52:51 +10:00
|
|
|
pub use api::win32;
|
2015-09-24 17:11:59 +10:00
|
|
|
pub use api::win32::{MonitorId, get_available_monitors, get_primary_monitor};
|
2015-07-27 17:52:51 +10:00
|
|
|
pub use api::win32::{WindowProxy, PollEventsIterator, WaitEventsIterator};
|
2015-04-29 18:19:59 +10:00
|
|
|
|
|
|
|
use CreationError;
|
2015-09-21 21:15:43 +10:00
|
|
|
use WindowAttributes;
|
2015-04-29 18:19:59 +10:00
|
|
|
|
2015-07-27 17:52:51 +10:00
|
|
|
use std::ops::{Deref, DerefMut};
|
|
|
|
|
2016-05-23 16:17:31 +10:00
|
|
|
#[derive(Clone, Default)]
|
2016-01-08 02:01:18 +11:00
|
|
|
pub struct PlatformSpecificWindowBuilderAttributes;
|
2016-05-23 16:17:31 +10:00
|
|
|
#[derive(Clone, Default)]
|
2016-01-08 02:01:18 +11:00
|
|
|
pub struct PlatformSpecificHeadlessBuilderAttributes;
|
2015-07-27 17:52:51 +10:00
|
|
|
|
|
|
|
/// The Win32 implementation of the main `Window` object.
|
|
|
|
pub struct Window(win32::Window);
|
|
|
|
|
|
|
|
impl Window {
|
|
|
|
/// See the docs in the crate root file.
|
2015-09-21 22:42:05 +10:00
|
|
|
#[inline]
|
2016-02-23 22:56:23 +11:00
|
|
|
pub fn new(window: &WindowAttributes, _: &PlatformSpecificWindowBuilderAttributes)
|
2016-01-08 02:01:18 +11:00
|
|
|
-> Result<Window, CreationError>
|
2015-09-21 21:15:43 +10:00
|
|
|
{
|
2016-02-23 22:56:23 +11:00
|
|
|
win32::Window::new(window).map(Window)
|
2015-07-27 17:52:51 +10:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
impl Deref for Window {
|
|
|
|
type Target = win32::Window;
|
|
|
|
|
2015-09-21 22:42:05 +10:00
|
|
|
#[inline]
|
2015-07-27 17:52:51 +10:00
|
|
|
fn deref(&self) -> &win32::Window {
|
|
|
|
&self.0
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
impl DerefMut for Window {
|
2015-09-21 22:42:05 +10:00
|
|
|
#[inline]
|
2015-07-27 17:52:51 +10:00
|
|
|
fn deref_mut(&mut self) -> &mut win32::Window {
|
|
|
|
&mut self.0
|
|
|
|
}
|
|
|
|
}
|