NSBrowser: ask the delegate about the selection a click proposes - #848
Open
DTW-Thalion wants to merge 3 commits into
Open
NSBrowser: ask the delegate about the selection a click proposes#848DTW-Thalion wants to merge 3 commits into
DTW-Thalion wants to merge 3 commits into
Conversation
…eLastColumn The delegate protocol was missing eleven of the methods AppKit declares, along with NSBrowserDropOperation, which the drop methods take. browser:didChangeLastColumn:toColumn: was declared but never sent. It is sent now whenever the last loaded column moves, from loading a column and from setLastColumn:, and not when the value stays where it was.
browser:selectionIndexesForProposedSelection:inColumn: was declared but never sent. -doClick: now offers the delegate the rows the click has selected and selects the set it returns instead, leaving the selection alone when the delegate returns the proposal it was given or nothing at all.
START_SET creates an autorelease pool and END_SET releases it, so the pool these tests create around the set is redundant.
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.
Closes #279 in part. Stacked on #846, which declares the method, so the change to review here is the second commit. Independent of #847.
browser:selectionIndexesForProposedSelection:inColumn: was declared and never sent. -doClick:, which is where a click in a column arrives, now collects the rows the click has selected, offers them to the delegate, and selects the set it gets back. The selection is left as it is when the delegate returns the same set or nil, and an empty set clears the column.
AppKit does not ask the delegate for selections made in code: -selectRow:inColumn:, -selectRowIndexes:inColumn: and -selectAll: all go straight through, with the delegate implemented and never called. So this is wired to the click path only, and a test covers the code path staying quiet.
Tests/gui/NSBrowser/selectionIndexes.m covers it. 5 of its 8 assertions fail without this change; the other 3 are the ones that hold either way. NSBrowser, NSMatrix and NSTableView give 202 passing with it.