Chrome: title bar, dialogs, info and status bars#
Source: lib/ui/chrome.rs
chrome -- window chrome and overlays: content dialog, info bar, status bar, title bar,
caption buttons, the chrome of secondary windows, edge grips [src/ui/ui_chrome.s]
dialog_begin(id, title, open) -> true while open (emit the content, then
dialog_buttons and dialog_end; always call dialog_end)
WinUI ContentDialog on L_DIALOG: smoke over the window, centred 320..548 DIP
wide, title, content; everything below is inert while it is open
dialog_buttons(primary, secondary, close) -> DLG_NONE / DLG_PRIMARY / DLG_SECONDARY /
DLG_CLOSE -- footer buttons (labels, None = none; primary is the accent button);
Enter = primary, Esc = close. Any result clears the open flag.
dialog_end()
infobar(id, severity, title, msg) -> EV (EV_ACT: the close button was clicked)
IB_INFO / IB_SUCCESS / IB_WARNING / IB_ERROR; the close button has the id id + 1;
placed too narrow, the message and then the title are cut with "…"
statusbar_begin() / statusbar_end()
32 DIP bar (layer fill, top divider) laying out its children left to right,
vertically centred, 16 DIP apart (captions: text(TS_CAPTION, ...))
edge_grips() resize handles for frameless windows on Linux (the runtime calls it;
also for resizable secondary windows with the library frame); the caption buttons
win over them where they are
titlebar_begin(title, icon) / titlebar_end() / titlebar_open()
custom title bar row (style: SM_TB_H, SM_TB_H_LARGE with next_flags(ST_LARGE)):
icon + title, then the caller's widgets; empty parts are an HB_DRAG region, the end
adds the caption buttons (HB_MIN / HB_MAX / HB_CLOSE; with SM_CAP_LEFT the begin puts
them first, close / min / max). The system's layout (SysSettings::titlebar: GNOME's
button-layout) wins over the style's: its left buttons come first, its right ones
last, missing ones are not shown; right-to-left mirrors the whole bar (as GTK does).
A double click, a middle and a right click on the empty part do what the system says
(default: maximize / restore, nothing, the window menu; a left press moves the
window). Headless runs only record what they would ask the window manager for
(scripts: expect wm ...)
Windows (win.rs):
win_chrome_begin(i) / win_chrome_end(i) -> natural content height (DIP)
border, title bar (28 DIP tool / 32 DIP dialog: title, close button) and the
content box of a secondary window; inside a WF_DIALOG window dialog_buttons puts
its footer below the content box (pinned to the bottom)
Ids: dialog parts (id << 3 | k) | 0x80000000; title bar 0xFFFF7400.. (min +1, max +2,
close +3); status bar 0xFFFF7410 .. 0xFFFF7412; edge grips 0xFFFF7430..
impl Ui
fn dialog_begin(&mut self, id: u32, title: &str, open: &Shared<i32>) -> boolui_dialog_begin(id, title, open) -> true if the dialog is openfn dialog_end(&mut self)ui_dialog_endfn infobar(&mut self, id: u32, severity: u32, title: &str, msg: &str) -> u32ui_infobar(id, severity, title, msg) -> EV (EV_ACT when the close button was clicked)fn statusbar_begin(&mut self)ui_statusbar_begin: a 32 DIP bar; call it last in a vertical layout (after a fill)fn statusbar_end(&mut self)ui_statusbar_endfn titlebar_begin(&mut self, title: &str, icon: u32)ui_titlebar_begin(title, icon): a title bar row (icon 0 = none)fn titlebar_begin_opt(&mut self, title: Option<&str>, icon: u32)ui_titlebar_begin with title 0: no title text (the record has no label) // pn-corefn titlebar_begin_overlay(&mut self, title: Option<&str>, icon: u32)Overlay native window controls and a drag region without painting a titlebar surface. Usenext_rect_pxto place it over the empty top edge of a file/start screen. The agent indicator remains visible beside the caption buttons when control is enabled.fn titlebar_end(&mut self)ui_titlebar_end: caption buttons at the right end (unless the style puts them at the left: SM_CAP_LEFT)fn titlebar_open(&self) -> Option<([i32; 4], bool)>The title bar being built, betweentitlebar_beginandtitlebar_end(None elsewhere and on an overlay, which paints no bar): its rectangle (px) and whether the window is active. For a style whose bar has the same colours in every theme (classic): a widget drawn right on it cannot use the theme's T_TEXT.