Repository navigation
Build the tray's menu as a model in the core - #986
Merged
Merged
Conversation
TrayMenu builds PlatformHeads' TrayMenuItems from what the tracker holds, with an action for each by id and tips kept beside the items. Ids name the entry acted on by its key. It comes in two halves, Fixed and Tracked, and what only a head can do is handed in as TrayActions. The Windows head's MenuBuilder makes the model ToolStrip items with PlatformHeads' TrayMenuItems, keeping the fixed items and building the tracked ones on every open. MenuButton goes. TrayMenuTests in the core's tests snapshot the menu as text and run on every platform; MenuBuilderTest keeps four images and the head's own tests.
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.
Phase 2c of the cross-platform tray plan: the tray's menu becomes a model in the core, snapshot tested as text, and the Windows head only draws it.
TrayMenu(core) builds PlatformHeads'TrayMenuItems from what the tracker holds, with an action for each item:FixedandTracked, because the Windows head keeps the fixed items and builds the tracked ones each time the menu opens.TrayActions: its windows, exit, and starting a move's diff tool.TrayMenuItem, since a Linux tray's menu has nowhere to show one.MenuBuilder(Windows head) makes the model ToolStrip items with PlatformHeads'TrayMenuItems, which BuildMonitor's tray uses too, and sets the tips and the submenus' direction through the options'Style.MenuButtonis gone.Two visible changes:
The Windows head keeps its own
NotifyIconandContextMenuStriprather than moving to PlatformHeads'NotifyIconTray. The tray is event driven, its hot keys register on the icon's window, and a left click opens the menu, whereNotifyIconTrayis built for a polling loop. That's a question for phase 3.docs/tray.mdsaid clicking a file accepts it, which the drop-down buttons didn't do either. Those lines now describe the submenus.Tests:
TrayMenuTests(core) snapshots the menu as text, and checks that ids are unique, that each half answers only for its own items, and that "Open diff tool" is handed the move as it is when chosen.MenuBuilderTest(head) keeps the Empty, Full, FullGrouped and drop-down images, and tests the tips, a click through both halves, menus kept off the desktop, and disposal. The other six images are covered by the text snapshots.dotnet/sdk:10.0container: the core's 272 tests pass, 43 of them skipped as Windows only.