Trait winit::platform::windows::WindowAttributesExtWindows

source ·
pub trait WindowAttributesExtWindows {
Show 14 methods // Required methods fn with_owner_window(self, parent: HWND) -> Self; fn with_menu(self, menu: HMENU) -> Self; fn with_taskbar_icon(self, taskbar_icon: Option<Icon>) -> Self; fn with_no_redirection_bitmap(self, flag: bool) -> Self; fn with_drag_and_drop(self, flag: bool) -> Self; fn with_skip_taskbar(self, skip: bool) -> Self; fn with_class_name<S: Into<String>>(self, class_name: S) -> Self; fn with_undecorated_shadow(self, shadow: bool) -> Self; fn with_system_backdrop(self, backdrop_type: BackdropType) -> Self; fn with_clip_children(self, flag: bool) -> Self; fn with_border_color(self, color: Option<Color>) -> Self; fn with_title_background_color(self, color: Option<Color>) -> Self; fn with_title_text_color(self, color: Color) -> Self; fn with_corner_preference(self, corners: CornerPreference) -> Self;
}
Available on windows_platform only.
Expand description

Additional methods on WindowAttributes that are specific to Windows.

Required Methods§

source

fn with_owner_window(self, parent: HWND) -> Self

Set an owner to the window to be created. Can be used to create a dialog box, for example. This only works when WindowAttributes::with_parent_window isn’t called or set to None. Can be used in combination with WindowExtWindows::set_enable(false) on the owner window to create a modal dialog box.

From MSDN:

  • An owned window is always above its owner in the z-order.
  • The system automatically destroys an owned window when its owner is destroyed.
  • An owned window is hidden when its owner is minimized.

For more information, see https://docs.microsoft.com/en-us/windows/win32/winmsg/window-features#owned-windows

source

fn with_menu(self, menu: HMENU) -> Self

Sets a menu on the window to be created.

Parent and menu are mutually exclusive; a child window cannot have a menu!

The menu must have been manually created beforehand with [CreateMenu] or similar.

Note: Dark mode cannot be supported for win32 menus, it’s simply not possible to change how the menus look. If you use this, it is recommended that you combine it with with_theme(Some(Theme::Light)) to avoid a jarring effect. [CreateMenu]: #only-available-on-windows

source

fn with_taskbar_icon(self, taskbar_icon: Option<Icon>) -> Self

This sets ICON_BIG. A good ceiling here is 256x256.

source

fn with_no_redirection_bitmap(self, flag: bool) -> Self

This sets WS_EX_NOREDIRECTIONBITMAP.

source

fn with_drag_and_drop(self, flag: bool) -> Self

Enables or disables drag and drop support (enabled by default). Will interfere with other crates that use multi-threaded COM API (CoInitializeEx with COINIT_MULTITHREADED instead of COINIT_APARTMENTTHREADED) on the same thread. Note that winit may still attempt to initialize COM API regardless of this option. Currently only fullscreen mode does that, but there may be more in the future. If you need COM API with COINIT_MULTITHREADED you must initialize it before calling any winit functions. See https://docs.microsoft.com/en-us/windows/win32/api/objbase/nf-objbase-coinitialize#remarks for more information.

source

fn with_skip_taskbar(self, skip: bool) -> Self

Whether show or hide the window icon in the taskbar.

source

fn with_class_name<S: Into<String>>(self, class_name: S) -> Self

Customize the window class name.

source

fn with_undecorated_shadow(self, shadow: bool) -> Self

Shows or hides the background drop shadow for undecorated windows.

The shadow is hidden by default. Enabling the shadow causes a thin 1px line to appear on the top of the window.

source

fn with_system_backdrop(self, backdrop_type: BackdropType) -> Self

Sets system-drawn backdrop type.

Requires Windows 11 build 22523+.

source

fn with_clip_children(self, flag: bool) -> Self

This sets or removes WS_CLIPCHILDREN style.

source

fn with_border_color(self, color: Option<Color>) -> Self

Sets the color of the window border.

Supported starting with Windows 11 Build 22000.

source

fn with_title_background_color(self, color: Option<Color>) -> Self

Sets the background color of the title bar.

Supported starting with Windows 11 Build 22000.

source

fn with_title_text_color(self, color: Color) -> Self

Sets the color of the window title.

Supported starting with Windows 11 Build 22000.

source

fn with_corner_preference(self, corners: CornerPreference) -> Self

Sets the preferred style of the window corners.

Supported starting with Windows 11 Build 22000.

Object Safety§

This trait is not object safe.

Implementors§