pub struct WindowHandle(_);
Expand description

A handle to a platform window object.

Implementations

Make this window visible.

This is part of the initialization process; it should only be called once, when a window is first created.

Close the window.

Set whether the window should be resizable

Sets the state of the window.

Gets the state of the window.

Informs the system that the current location of the mouse should be treated as part of the window’s titlebar. This can be used to implement a custom titlebar widget. Note that because this refers to the current location of the mouse, you should probably call this function in response to every relevant WinHandler::mouse_move.

This is currently only implemented on Windows.

Set whether the window should show titlebar.

Sets the position of the window in pixels, relative to the origin of the virtual screen.

Returns the position of the window in pixels, relative to the origin of the virtual screen.

Set the window’s size in display points.

The actual window size in pixels will depend on the platform DPI settings.

This should be considered a request to the platform to set the size of the window. The platform might choose a different size depending on its DPI or other platform-dependent configuration. To know the actual size of the window you should handle the WinHandler::size method.

Gets the window size, in pixels.

Sets the WindowLevel, the z-order in the Window system / compositor

We do not currently have a getter method, mostly because the system’s levels aren’t a perfect one-to-one map to druid_shell’s levels. A getter method may be added in the future.

Bring this window to the front of the window stack and give it focus.

Request that prepare_paint and paint be called next time there’s the opportunity to render another frame. This differs from invalidate and invalidate_rect in that it doesn’t invalidate any part of the window.

Request invalidation of the entire window contents.

Request invalidation of a region of the window.

Set the title for this menu.

Set the top-level menu for this window.

Get access to a type that can perform text layout.

Schedule a timer.

This causes a WinHandler::timer call at the deadline. The return value is a token that can be used to associate the request with the handler call.

Note that this is not a precise timer. On Windows, the typical resolution is around 10ms. Therefore, it’s best used for things like blinking a cursor or triggering tooltips, not for anything requiring precision.

Set the cursor icon.

Prompt the user to choose a file to open.

This won’t block immediately; the file dialog will be shown whenever control returns to druid-shell, and the WinHandler::open_file method will be called when the dialog is closed.

Prompt the user to choose a path for saving.

This won’t block immediately; the file dialog will be shown whenever control returns to druid-shell, and the WinHandler::save_as method will be called when the dialog is closed.

Display a pop-up menu at the given position.

pos is in the coordinate space of the window.

Get a handle that can be used to schedule an idle task.

Get the DPI scale of the window.

The returned Scale is a copy and thus its information will be stale after the platform DPI changes. This means you should not stash it and rely on it later; it is only guaranteed to be valid for the current pass of the runloop.

Trait Implementations

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Returns the “default value” for a type. Read more
Converts to this type from the input type.

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
This associated type is used to avoid recursive comparisons of the whole widget subtree (if one of the fields is itself a widget). 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.

The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
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.