Trait cat_engine_basement::windows::WindowProcedure[][src]

pub trait WindowProcedure {
    type CreateParameters;
    type Data: Copy;
    fn create(
        window: &Window,
        parameters: &mut Self::CreateParameters
    ) -> Result<Self::Data, WinError>;
fn close_request(window: &Window, data: Self::Data);
fn destroy(window: &Window, data: Self::Data);
fn paint(window: &Window, data: Self::Data);
fn set_cursor(window: &Window, data: Self::Data);
fn resized(
        client_size: [u16; 2],
        resize_type: WindowResizeType,
        window: &Window,
        data: Self::Data
    );
fn moved(client_position: [i16; 2], window: &Window, data: Self::Data);
fn handle(event: WindowEvent, window: &Window, data: Self::Data);
fn catch_panic(
        window: &Window,
        data: Self::Data,
        error: Box<dyn Any + Send>
    ); }
This is supported on Windows only.
Expand description

Defines window’s behavior.

Associated Types

Required methods

Called when an application requests that a window be created.

Called as a signal that a window or an application should terminate.

Called when a window is being destroyed, after the window is removed from the screen.

Called when the system or another application makes a request to paint a portion of an application’s window.

This is supported on crate feature set_cursor_event only.

Called if the mouse causes the cursor to move within a window and mouse input is not captured.

Note that you have to set up cursor manually each time the function is called.

Called after window’s size has changed.

client_size specifies the new width of the client area.

Called after a window has been moved.

client_position contains coordinates of the upper-left corner of the client area of the window.

Called in other cases.

This is supported on crate feature wnd_proc_catch_panic only.

Called when one of the functions above panics and catch_unwind catches the panic in WndProc.

You have to handle this panic manually. The engine just continue processing events with the default function (DefWindowProcW).

This capturing is needed because all of the WindowProcedure functions are called by the system beyond the Rust rules.

You can remove panic capturing with disabling the wnd_proc_catch_panic feature. In that case any panic will cause aborting the process.

Note that this function may not catch all panics in Rust. A panic in Rust is not always implemented via unwinding, but can be implemented by aborting the process as well. This function only catches unwinding panics, not those that abort the process.

Implementors