Theme · Platform: a title bar in three parts, buttons at the window's rem

A title bar lays out a start, a title and an end. In the centered styles
the start and end grow alike from nothing, their padding inside them, so
a short title sits at the bar's center and a long one gives way before
whatever stands at either end; on Windows the title, or a spacer when
there is none, takes the free width before the buttons. Caption buttons
take the bar's height at the window's own rem. Tests keep an untitled
Windows bar's buttons at its end, a long Linux title before the round
buttons, a short title centered, and the buttons inside a bar at rem 8.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
ZacharyZhang-NYandClaude Opus 5.5 committed 2026-09-27 18:20:20 -04:00
1 parent 815aed304d
commit ba865710a7
4 files changed
+115 -30

No files matched your search

+3 -3
View File
@@ -230,9 +230,9 @@ impl Theme {
px_to_rems(46.0)
}
/// A Windows caption button's height: the title bar's, less its bottom hairline.
pub fn caption_button_height(&self) -> Pixels {
self.titlebar_height().to_pixels(self.base_rem()) - px(1.0)
/// A Windows caption button's height at a window's rem: the title bar's, less its hairline.
pub fn caption_button_height(&self, rem: Pixels) -> Pixels {
self.titlebar_height().to_pixels(rem) - px(1.0)
}
/// Resize margin of a client-drawn window.