pub struct Window<S> { /* private fields */ }Expand description
Owned window handle.
Dropping the handle destroys the window.
Implementations§
Source§impl<S> Window<S>
impl<S> Window<S>
Sourcepub fn new<F>(
window_type: WindowType,
state: S,
wndproc: F,
) -> Result<Self, WindowCreationError>
pub fn new<F>( window_type: WindowType, state: S, wndproc: F, ) -> Result<Self, WindowCreationError>
Creates a new window with a wndproc closure.
The state parameter will be allocated alongside the closure. It is
meant as a convenient alternative to Rc<State> to access variables
from both inside and outside the closure. A pinned reference to the
state is passed as the first parameter to the closure.
Use Window::state() to access the state from the outside.
Sourcepub fn new_ex<F>(
window_type: WindowType,
ex_style: WINDOW_EX_STYLE,
state: S,
wndproc: F,
) -> Result<Self, WindowCreationError>
pub fn new_ex<F>( window_type: WindowType, ex_style: WINDOW_EX_STYLE, state: S, wndproc: F, ) -> Result<Self, WindowCreationError>
Same as Window::new() but allows specifying extended window styles
(the dwExStyle parameter of CreateWindowExA), such as
WS_EX_NOREDIRECTIONBITMAP.
Sourcepub fn new_checked<F>(
window_type: WindowType,
state: S,
wndproc: F,
) -> Result<Self, WindowCreationError>
pub fn new_checked<F>( window_type: WindowType, state: S, wndproc: F, ) -> Result<Self, WindowCreationError>
Same as Window::new() but allows the closure to be FnMut.
Internally uses a RefCell for the closure to prevent it from being
re-entered by nested message loops (e.g., from modal dialogs). Forwards
nested messages to the default wndproc procedure.
Sourcepub fn new_checked_ex<F>(
window_type: WindowType,
ex_style: WINDOW_EX_STYLE,
state: S,
wndproc: F,
) -> Result<Self, WindowCreationError>
pub fn new_checked_ex<F>( window_type: WindowType, ex_style: WINDOW_EX_STYLE, state: S, wndproc: F, ) -> Result<Self, WindowCreationError>
Same as Window::new_checked() but allows specifying extended window
styles (the dwExStyle parameter), such as WS_EX_NOREDIRECTIONBITMAP.
See Window::new_ex().