Repository navigation
GraphiteMenus: the Menu Manager - #28
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 Menu Manager, the next of the Toolbox's managers after the Window Manager: menus and their items, the menu bar they sit in, and the 'MENU' resources that define them — everything but the drawing and the tracking, which are the host's, as they were Perry's.
MenuItem: text in MacRoman, a mark (SetItemMark — the Menu Manager's glyphs, or any character), an icon, a style (SetItemStyle), a keyboard equivalent with its modifiers (SetItemCmd, SetMenuItemKeyEquivalentsMask), a submenu kept by its menu ID as the classic kept it, a command ID (SetMenuItemCommandID), a separator, and the enabled state EnableMenuItem answers.MenuItem(classic:)makes one from an AppendMenu string — the metacharacters as the classic defined them:;between items,(disables,<with B, I, U, O, S sets the styles,!a mark,^an icon,/the keyboard equivalent — and a hyphen alone divides. A submenu is the character whose MacRoman byte is its menu ID, with $1B for the key, exactly as the classic's strings were written.Menu(NewMenu,CreateNewMenu's attributes): AppendMenu and AppendMenuItemText, InsertMenuItem, DeleteMenuItem(s), DeleteAllMenuItems, SetMenuItemText, marks (CheckMenuItem's check mark among them), enabling, key equivalents, and the command-ID finds a menu makes alone.MenuAttributes, the seven the header gives, including kMenuAttrHidden, for menus kept in the bar for their keyboard equivalents alone.MenuBar: InsertMenu's order — before the menu of an ID, after them all for 0, and hierMenu (-1), which keeps a submenu or pop-up menu in the list without a title in the bar — DeleteMenu, ClearMenuBar, GetMenuHandle; GetIndMenuItemWithCommandID, EnableMenuCommand and DisableMenuCommand across every menu in the list; MenuKey, which searches the bar's menus and the hierarchical list alike, as the classic did, with the modifiers held; HiliteMenu; and MenuSelect's answer as a menu ID and an item's number from 1.changeObservertells the host the bar changed, for DrawMenuBar.MenuDefinition, the MDEFs: the sizes a menu takes — the bar's height, an item's, mSizeMsg's width with its columns for the marks, icons and keys and mChooseMsg's geometry — withStandardMenuDefinition, the classic's look: a bar 20 tall, items 16.Menu(bytes:)(GetMenu): a 'MENU' resource — the ID, the size placeholders, the definition's resource ID, the enable flags of the menu and its first 31 items (bit 0 the menu's, item i's bit i, items past 31 enabled), the title, and the items with their five bytes each, a hyphen an item the standard definition draws a divider — with submenus as the classic kept them, the menu ID in the mark field under $1B. menuInvalidErr for bytes a menu can't be read from; bytes past the last item ignored.Notes for review
MacErrorwith the rest.0bbit strings with the low bit first: the Apple menu's0b111…101is bits 1 set and 2 clear — About enabled, the divider disabled — which as a big-endian value is 0x3FFFFFFF, not 0xFFFFFFFD. The tests read the flags as the number they are, and the comment on the Rez listing says what it means.Testing
FreeTypetrait. Linux and the 32-bit targets are left to CI.