Struct druid::WindowDesc

source ·
pub struct WindowDesc<T> {
    pub id: WindowId,
    /* private fields */
}
Expand description

A description of a window to be instantiated.

This struct has builder methods to specify some window properties. Each of these methods usually corresponds to a platform API call when constructing the function. Except for title(), they have no default values and the APIS won’t be called if the method is not used.

Fields§

§id: WindowId

The WindowId that will be assigned to this window.

This can be used to track a window from when it is launched and when it actually connects.

Implementations§

Create a new WindowDesc, taking the root [Widget] for this window.

Set the title for this window. This is a LabelText; it can be either a String, a LocalizedString, or a closure that computes a string; it will be kept up to date as the application’s state changes.

If this method isn’t called, the default title will be LocalizedString::new("app-name").

Set the menu for this window.

menu is a callback for creating the menu. Its first argument is the id of the window that will have the menu, or None if it’s creating the root application menu for an app with no menus (which can happen, for example, on macOS).

Set the window size policy

Set the window’s initial drawing area size in display points.

You can pass in a tuple (width, height) or a Size, e.g. to create a window with a drawing area 1000dp wide and 500dp high:

window.window_size((1000.0, 500.0));

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 increase the size a tiny bit due to DPI.

Set the window’s minimum drawing area size in display points.

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

This should be considered a request to the platform to set the minimum size of the window. The platform might increase the size a tiny bit due to DPI.

To set the window’s initial drawing area size use window_size.

Builder-style method to set whether this window can be resized.

Builder-style method to set whether this window’s titlebar is visible.

Builder-style method to set whether this window’s background should be transparent.

Sets the initial window position in display points, relative to the origin of the virtual screen.

Sets the WindowLevel of the window

Set initial state for the window.

Set the WindowConfig of window.

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.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Calls U::from(self).

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

Performs the conversion.
Performs the conversion.
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.
Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more