ui::WindowStyle¶
Header: winui/ui/WindowStyle.hpp.
The frame a window is drawn with: caption buttons, sizing border, frame kind, z-order and title-bar extension.
Seed it through ui::WindowOptions::style. To change it live, edit a copy of Window::style() and hand it to Window::set_style(), which applies it to the running window. The defaults give a plain resizable window with a caption. Fill it with designated initializers.
Example:
// A fixed-size tool palette that stays on top and has no maximize button.
ui::Window palette{{.title = "Tools",
.style = {.resizable = false, .maximize_button = false, .always_on_top = true}}};
// Content under the caption of the main window, with a TitleBar in the 48 DIP row it leaves.
ui::WindowStyle style = window.style();
style.extend_content_into_title_bar = true;
style.title_bar_height = 48;
window.set_style(style);
| Field | Type | Default | |
|---|---|---|---|
resizable |
bool |
true |
A sizing border, and with it drag-to-snap. On Frame::None it has no effect: a popup has no border to size by. |
minimize_button |
bool |
true |
The caption's minimize button (and Win+Down's fallback target). |
maximize_button |
bool |
true |
The caption's maximize button, maximizing by double-clicking the caption, and Win+Up. Independent of resizable. It only limits the user. Window::request_state() still maximizes a window that has no maximize button. |
always_on_top |
bool |
false |
Stays above every non-topmost window. Off by default. |
frame |
Frame |
Frame::Standard |
How much of the frame the OS draws; see Frame. |
tool_window |
bool |
false |
A short caption, no taskbar button and no entry in Alt+Tab, for a palette or a tool strip that belongs to another window. |
closable |
bool |
true |
Whether the close button and Alt+F4 are enabled. Off also grays out the system menu's Close item. An app that must stay open also has to refuse to quit when it is asked another way. |
animations |
bool |
true |
The OS's open/close/minimize/maximize animations. Off suits a kiosk or a remote session. |
caption_title |
bool |
true |
Whether the caption draws the window title. Only meaningful on Frame::Standard; the caption buttons stay either way. |
caption_icon |
bool |
true |
Whether the caption draws the window icon. Only meaningful on Frame::Standard. Without the icon, clicking where it was no longer opens the system menu (Alt+Space and a caption right-click still do). |
extend_content_into_title_bar |
bool |
false |
Let the client area extend over the caption. The OS keeps drawing the caption buttons and the caption background, and the app lays out its own title row, usually a TitleBar, underneath them. Window::caption_insets() reports the space the buttons take. Only meaningful on Frame::Standard. Ignored while fullscreen. |
title_bar_height |
float |
0.0f |
How tall the extended caption row is at least, in DIPs, when extend_content_into_title_bar is on. The row is never shorter than the OS's own caption, so 0 leaves it at that height. A taller row (TitleBar's 48 DIP expanded height) extends the caption background further; the buttons stay at the top. |
caption_buttons |
bool |
true |
The caption's minimize, maximize and close buttons. Off takes all three away, and the system menu with them. Meaningful on Frame::Standard, and on Frame::Borderless under a system backdrop, where the system would otherwise draw the buttons over the content (a tray flyout turns it off for that). Frame::None has no caption at all. Window::close() still closes. With content extended into the title bar, off means no buttons and no caption band beyond title_bar_height, so 0 leaves no band at all. |
round_popup_corners |
bool |
false |
On Frame::None, gives the popup rounded corners and a 1px rim like a top-level window has, where a bare popup is square. The system's own flyouts (Start, Quick Settings, the calendar) look this way, with no shadow. Applies only while the theme's ChromeHints::corner_preference is Default, so an era that asks for square corners keeps them. No effect on any other frame, which the system already rounds. |