Struct winmsg_executor::util::Window
source · 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>(
message_only: bool,
shared_state: S,
wndproc: F,
) -> Result<Self, WindowCreationError>
pub fn new<F>( message_only: bool, shared_state: S, wndproc: F, ) -> Result<Self, WindowCreationError>
Creates a new window with a wndproc closure.
The shared_state parameter will be allocated alongside closure with
a 'static lifetime. Allows for convenient access to variables from
both inside and outside of the closure without an extra Rc<State>.
Use the Window::shared_state() method to access the state from the
outside.
Message-Only Windows are useful for windows that do not need to be visible nor need access to broadcast messages from the desktop.
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 procudere. If you required more
control for those scenarios use Window::new_reentrant().
sourcepub fn new_reentrant<F>(
message_only: bool,
shared_state: S,
wndproc: F,
) -> Result<Self, WindowCreationError>
pub fn new_reentrant<F>( message_only: bool, shared_state: S, wndproc: F, ) -> Result<Self, WindowCreationError>
Same as Window::new() but allows the closure to be re-entered.
Returns a reference to the state shared with the wndproc closure.