pub trait WindowAttributesExtWindows {
Show 15 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;
fn with_cloaked(self, cloaked: bool) -> Self;
}
Expand description
Additional methods on WindowAttributes
that are specific to Windows.
Required Methods§
Sourcefn with_owner_window(self, parent: HWND) -> Self
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
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
Sourcefn with_taskbar_icon(self, taskbar_icon: Option<Icon>) -> Self
fn with_taskbar_icon(self, taskbar_icon: Option<Icon>) -> Self
This sets ICON_BIG
. A good ceiling here is 256x256.
Sourcefn with_no_redirection_bitmap(self, flag: bool) -> Self
fn with_no_redirection_bitmap(self, flag: bool) -> Self
This sets WS_EX_NOREDIRECTIONBITMAP
.
Sourcefn with_drag_and_drop(self, flag: bool) -> Self
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.
Sourcefn with_skip_taskbar(self, skip: bool) -> Self
fn with_skip_taskbar(self, skip: bool) -> Self
Whether show or hide the window icon in the taskbar.
Sourcefn with_class_name<S: Into<String>>(self, class_name: S) -> Self
fn with_class_name<S: Into<String>>(self, class_name: S) -> Self
Customize the window class name.
Sourcefn with_undecorated_shadow(self, shadow: bool) -> Self
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.
Sourcefn with_system_backdrop(self, backdrop_type: BackdropType) -> Self
fn with_system_backdrop(self, backdrop_type: BackdropType) -> Self
Sets system-drawn backdrop type.
Requires Windows 11 build 22523+.
Sourcefn with_clip_children(self, flag: bool) -> Self
fn with_clip_children(self, flag: bool) -> Self
This sets or removes WS_CLIPCHILDREN
style.
Sourcefn with_border_color(self, color: Option<Color>) -> Self
fn with_border_color(self, color: Option<Color>) -> Self
Sets the color of the window border.
Supported starting with Windows 11 Build 22000.
Sourcefn with_title_background_color(self, color: Option<Color>) -> Self
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.
Sourcefn with_title_text_color(self, color: Color) -> Self
fn with_title_text_color(self, color: Color) -> Self
Sets the color of the window title.
Supported starting with Windows 11 Build 22000.
Sourcefn with_corner_preference(self, corners: CornerPreference) -> Self
fn with_corner_preference(self, corners: CornerPreference) -> Self
Sets the preferred style of the window corners.
Supported starting with Windows 11 Build 22000.
Sourcefn with_cloaked(self, cloaked: bool) -> Self
fn with_cloaked(self, cloaked: bool) -> Self
Cloaks the window such that it is not visible to the user. The window is still composed by DWM.
Not supported on Windows 7 and earlier.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.