Skip to content

NSBrowser: ask the delegate about the selection a click proposes - #848

Open
DTW-Thalion wants to merge 3 commits into
gnustep:masterfrom
DTW-Thalion:fix/browser-selection-indexes
Open

NSBrowser: ask the delegate about the selection a click proposes#848
DTW-Thalion wants to merge 3 commits into
gnustep:masterfrom
DTW-Thalion:fix/browser-selection-indexes

Conversation

@DTW-Thalion

Copy link
Copy Markdown
Contributor

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.

…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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

NSBrowser missing 10.6+ delegate methods

1 participant