Repository navigation
Draw the notebook, the group box, and the default button as AppKit - #1093
Open
beetlebugorg wants to merge 1 commit into
Open
beetlebugorg wants to merge 1 commit into
beetlebugorg wants to merge 1 commit into
Conversation
beetlebugorg
force-pushed
the
aqua-controls
branch
4 times, most recently
from
December 4, 2026 17:20
7b7158a to
4d3a8bd
Compare
The macOS look draws ttk::notebook as the tab view of AppKit: the tabs are a segmented control, centered on the top edge of a rounded pane. The part ::tabs of the notebook centers the row with justify-content, paints its background as the track, and a negative margin-bottom moves the client area up under the row. ttk::labelframe and labelframe are the group box of AppKit, and labels, check boxes, radio buttons, and the pages of a notebook draw no background, so the fill shows. A button with -default active, of Tk or of ttk, gets the new pseudo-class :default, and each look draws it as Button.primary. native-ref also renders and measures the tab view, the box, the combo box, the pull-down button, the legacy scroller, and the spinner, with the content rectangle of the tab view and the box. The values of the sheet come from those measures, and from an on-screen capture of an AppKit window on macOS 27 for what cacheDisplayInRect does not draw: the tabs of the tab view (a near-white selected segment inset in the track, with no accent), the stroke of the text field, and the dark window color. The Login dialog of tkchat in the macOS look, light and dark, is a golden picture.
beetlebugorg
force-pushed
the
aqua-controls
branch
from
December 4, 2026 18:48
4d3a8bd to
e68b92a
Compare
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part of #1071 (part 1 of 2) and #154. Stacked on #1090 (the space of the theme).
The Login dialog of tkchat. The ztk pictures come from
src/tests/aqua_look.zig(headless, Core Text, scale 2). The AppKit pictures are a real window on the screen (screencapture -l): a small AppKit program with the same dialog (an NSTabView, text fields, a check box, Cancel, and a default Login button) and the same made-up text.For part 2, a segmented control (NSSegmentedControl,
fillEqually) in a separate window:(The pictures are on the branch
shots/aqua-controls; delete it after the merge.)The target, measured on this Mac: macOS 27.0 (build 26A428), for both
native-refand the capture. The sheet header says so.What the capture shows, and what this PR follows:
An NSTabView on macOS 27 draws its tabs as a segmented track (the bezel fill, corner 6) with a near-white selected segment (light) or a light fill (dark), stroke 1 point, corner 5, inset 1.5 points in the track, and the label in labelColor. It has no accent.
ttk::notebookfollows it, as Tk's aqua theme maps the notebook to NSTabView.An NSSegmentedControl (the separate window) draws the selected segment with the accent and white text, at full width with
fillEqually. That is the form of the Battery page of System Settings. It is the form for a segmented control (ttk::radiobuttonwith the classsegmented, in part 2). The notebook keeps the form of NSTabView.cacheDisplayInRectdoes not draw the tabs of an NSTabView or the glass of the window, so those values come from the capture: the selected tab, the stroke of the pane (0.075), the stroke and corner of the text field (1 point, 6), and the dark window color (#232323).Left to differ: the AppKit buttons in the capture are 28 points high because the program gives them that frame (a regular push button is 24); the placement of the widgets follows each program's own layout;
-show *shows asterisks where AppKit shows bullets.ttk::notebook: the tab view of AppKit (NSTabView, regular). The tabs are a segmented control of 24 points, centered on the top edge of the pane. The pane is 7 points in from the sides and 10 from the bottom, with a stroke of 1 point and a corner of 5. The page is 3 points in from the sides and the bottom of the pane, and 17 below its top. The selected tab is a near-white segment inset in the track (capture), with no accent.src/ttk/notebook.zig: the part::tabscenters the row withjustify-content: center, paints its background as the track behind the row, and a negativemargin-bottommoves the client area up under the row.ttk::labelframeandlabelframe: the group box (NSBox): the title in 11 points, the fill with a corner of 12 and no stroke, the content 5 points in.Labels, check boxes, radio buttons, and the pages of a notebook draw no background in the macOS look, as in AppKit.
The default button: a button with
-default active, of Tk or of ttk, gets the new pseudo-class:default(a state bit set inlabel.configured). The modern, macOS, and Windows sheets draw it asButton.primary.tools/native-ref: also the tab view, the box, the combo box, the pull-down button, the legacy scroller, and the spinner, with the content rectangle of the tab view and the box inmeasures.json. AppKit does not draw the labels of the tabs of a tab view incacheDisplayInRect, so the segments come from the render ofNSSegmentedControl.Test: the golden pictures
tests/golden/aqua-login-light.pngand-dark.png(macOS only, with a small tolerance for the glyphs of Core Text).zig build testpasses.Part 2 (next PR): the combo box, the pop-up and pull-down buttons, the progress bar and spinner, the legacy scroller, the table and outline view, the separator, the stepper, the size grip, and the menu.
Lines: estimate 300 for this part, actual +309 −32.