pub struct WindowHandle<'a> { /* private fields */ }
Expand description

Handle to a window.

A WindowHandle can be used to interact with a window from within the global context thread. To interact with a window from another thread, you need a WindowProxy.

Implementations

Create a new window handle from a context handle and a window ID.

Get the window ID.

Get a proxy object for the window to interact with it from a different thread.

You should not use proxy objects from withing the global context thread. The proxy objects often wait for the global context to perform some action. Doing so from within the global context thread would cause a deadlock.

Release the window handle to get a ContextHandle.

This can be used inside a window event handler to gain access to the ContextHandle. If you do not need mutable access to the context, you can also use context_handle().

Get a reference to the context handle.

If you need mutable access to the context, use release() instead.

Destroy the window.

Any subsequent operation on the window through an existing WindowProxy will return InvalidWindowId.

Get the image info.

Returns None if no image is set for the window.

Check if the window will preserve the aspect ratio of images it displays.

Set if the window will preserve the aspect ratio of images it displays.

Get the background color of the window.

Set the background color of the window.

Make the window visible or invisible.

Set the window position in pixels.

This will automatically un-maximize the window.

Some window managers or platforms may ignore this property.

Get the inner size of the window in physical pixels.

This returns the size of the window contents, excluding borders, the title bar and other decorations.

Get the outer size of the window in physical pixels.

This returns the size of the entire window, including borders, the title bar and other decorations.

Set the inner size of the window in pixels.

The size is excluding borders, the title bar and other decorations.

Some window managers may ignore this property.

Set if the window should be resizable for the user.

Some window managers may ignore this property.

Set if the window should be drawn without borders.

Some window managers may ignore this property.

Set the window in fullscreen mode or back.

This will set the window to borderless fullscreen on the current monitor or back. Fullscreen is set if the argument is true, otherwise the window is returned to normal size.

Some window managers may ignore this property.

Check if the window is set to fullscreen mode.

Note that some window managers may ignore the request for fullscreen mode. In that case, this function may return true while the window is not displayed in fullscreen mode.

Set the image to display on the window.

Add an overlay to the window.

If the window already has an overlay with the same name, the overlay is overwritten.

Overlays are drawn on top of the image in the order that they are first added.

If you wish to change the order of existing overlays, you must remove and re-add the overlays.

Remove an overlay from the window.

Returns true if there was an overlay to remove.

Remove all overlays from the window.

Disable a specific overlay.

The overlay is not removed, but it will not be rendered anymore untill you enable the overlay again.

Toggle an overlay between enabled and disabled.

Enable or disable all overlays for this window.

Add an event handler to the window.

Get the image transformation.

The image transformation is applied to the image and all overlays in virtual window space.

Virtual window space goes from (0, 0) in the top left corner of the window to (1, 1) in the bottom right corner.

This transformation does not include scaling introduced by the Self::preserve_aspect_ratio() property. Use Self::effective_transform() if you need that.

Get the full effective transformation from image space to virtual window space.

This transformation maps the image coordinates to virtual window coordinates. Unlike Self::transform(), this function returns a transformation that include the scaling introduced by the Self::preserve_aspect_ratio() property. This is useful to transform between window coordinates and image coordinates.

If no image is set on the window yet, this returns the same transformation as Self::transform().

Virtual window space goes from (0, 0) in the top left corner of the window to (1, 1) in the bottom right corner.

Note that physical pixel locations must be transformed to virtual window coordinates first.

Set the image transformation to a value.

The image transformation is applied to the image and all overlays in virtual window space.

Virtual window space goes from (0, 0) in the top left corner of the window to (1, 1) in the bottom right corner.

This transformation should not include any scaling related to the Self::preserve_aspect_ratio() property.

Pre-apply a transformation to the existing image transformation.

This is equivalent to:

window.set_transform(transform * window.transform())

See Self::set_transform for more information about the image transformation.

Post-apply a transformation to the existing image transformation.

This is equivalent to:

window.set_transform(window.transform() * transform)

See Self::set_transform for more information about the image transformation.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Should always be Self

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.