Trait winit::platform::windows::WindowBuilderExtWindows
source · pub trait WindowBuilderExtWindows {
// Required methods
fn with_owner_window(self, parent: HWND) -> WindowBuilder;
fn with_menu(self, menu: HMENU) -> WindowBuilder;
fn with_taskbar_icon(self, taskbar_icon: Option<Icon>) -> WindowBuilder;
fn with_no_redirection_bitmap(self, flag: bool) -> WindowBuilder;
fn with_drag_and_drop(self, flag: bool) -> WindowBuilder;
fn with_skip_taskbar(self, skip: bool) -> WindowBuilder;
fn with_undecorated_shadow(self, shadow: bool) -> WindowBuilder;
}
windows_platform
only.Expand description
Additional methods on WindowBuilder
that are specific to Windows.
Required Methods§
sourcefn with_owner_window(self, parent: HWND) -> WindowBuilder
fn with_owner_window(self, parent: HWND) -> WindowBuilder
Set an owner to the window to be created. Can be used to create a dialog box, for example.
This only works when WindowBuilder::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
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.
sourcefn with_taskbar_icon(self, taskbar_icon: Option<Icon>) -> WindowBuilder
fn with_taskbar_icon(self, taskbar_icon: Option<Icon>) -> WindowBuilder
This sets ICON_BIG
. A good ceiling here is 256x256.
sourcefn with_no_redirection_bitmap(self, flag: bool) -> WindowBuilder
fn with_no_redirection_bitmap(self, flag: bool) -> WindowBuilder
This sets WS_EX_NOREDIRECTIONBITMAP
.
sourcefn with_drag_and_drop(self, flag: bool) -> WindowBuilder
fn with_drag_and_drop(self, flag: bool) -> WindowBuilder
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.
sourcefn with_skip_taskbar(self, skip: bool) -> WindowBuilder
fn with_skip_taskbar(self, skip: bool) -> WindowBuilder
Whether show or hide the window icon in the taskbar.
sourcefn with_undecorated_shadow(self, shadow: bool) -> WindowBuilder
fn with_undecorated_shadow(self, shadow: bool) -> WindowBuilder
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.