Repository navigation
GraphiteControls: the Control Manager - #29
Merged
Merged
Conversation
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.
Summary
The Control Manager, the next of the Toolbox's managers after the Menu Manager: the controls a window holds, their values and parts, and the 'CNTL' resources that define them — everything but the drawing and the tracking, which are the host's, as Perry's controls.c made them AppKit's.
ControlPart(ControlPartCode): inButton 10, inCheckBox 11, the scroll arrows 20 and 21, the pages 22 and 23, the thumb 129, and the appearance's disabled 254 and inactive 255 — as the classic's part codes were.ControlKind, the five standard kinds by their control definition IDs (pushButProc 0, checkBoxProc 1, radioButProc 2, scrollBarProc 16, popupMenuProc 1008), with auseWFontvariation (the ID plus 8) read as the kind beneath it; a definition ID of the host's own reads as none, for the definition the host brings.ControlDefinition, the CDEFs: what kind of value a control keeps (a button's none, a checkbox's or radio button's on-or-off, a scroll bar's and a pop-up menu's range), which part a point is on with the control's real value placing its thumb, the thumb's rectangle, and where any part is.StandardControlDefinitionis the classic's look: arrows 16 pixels square at a scroll bar's ends, a fixed-size thumb — the arrow's length — placed by the value in the travel between the arrows, the pages the bar on either side of the thumb, and a bar taller than wide vertical.Control: the rectangle, the value with SetControlValue's pinning, the range, the title, the reference value, visibility (ShowControl, HideControl), enabling (EnableControl, DisableControl), activity (ActivateControl, DeactivateControl) and HiliteControl's pressed part; the command ID, the signature-and-ID pair GetControlByID finds, and the action procedure the classic's TrackControl called. A pop-up menu keeps its menu's resource ID in its minimum and its title's width in its maximum, as the classic's resources did — so a maximum below a minimum is allowed, the fields being the program's to read. A scroll bar's drag names a value by the thumb's center under the point.ControlList: a window's controls, last added first, as NewControl added them and FindControl searched them; GetControlByID, and the command ID a control answers to; CreateRootControl, with errRootAlreadyExists for a second.Control.make(GetNewControl): a 'CNTL' resource — the rectangle, the setting, the visibility, the fill byte, the maximum and minimum, the control definition ID, the reference value, and the title — with bytes past the title ignored, and paramErr for a definition ID no standard kind answers and no host definition given.MacErrorwith the rest.Notes for review
Testing
isLiveanswering visible-and-enabled-and-active, hilited parts, reference values, command IDs, identifiers, action procedures through a lock, moving and sizing, titles in MacRoman; hit testing on buttons, checkboxes, radio buttons and pop-up menus (a disabled one hit as 254), scroll bars' arrows, thumbs at both ends, pages below a top thumb and by the thumb's place, horizontal bars' parts at their ends; bars too short for their arrows, a bar exactly as long as them, a range of one's thumb at both ends of its travel; and 'CNTL' resources — the button, the checkbox on with a useWFont variation, the radio button, the horizontal scroll bar with its range and place, the invisible pop-up menu holding its menu's resource ID in its minimum, bytes past the title ignored, four damaged resources each paramErr.FreeTypetrait. Linux and the 32-bit targets are left to CI.