Commit Graph
5 Commits
Author SHA1 Message Date
David Richardson bb65f7ca80 CPTableView: Pass nil for the table column when context-clicking outside all columns
Right-clicking outside the column bounds previously attempted to retrieve the CPTableColumn at index -1, raising an exception that prevented the contextual menu from displaying. The menu delegate now receives nil for the column parameter in this case, matching the documented delegate contract.

Includes two unit tests covering context clicks on a populated row and outside the column bounds (with the table hosted inside a CPScrollView so the view extends beyond its column widths).
2026-11-25 15:09:03 -06:00
David Richardson 145138ae8b CPTableView: Ignore clicks on control cells in non-editable columns
Previously, clicking a control cell (such as a checkbox) in a
non-editable column mutated its value and committed the change because
-_hitTest: routed non-text-field control cell mouse-downs to the
control without checking whether the column was editable.

Matching AppKit, control cells in non-editable columns no longer handle
the click, allowing the table view to select the row instead.
2026-11-25 09:47:16 -06:00
David Richardson 333e448f44 AppKit: Prevent premature display during CPTableView view enumeration
-_enumerateViewsInRows:columns:usingBlock: and
-_enumerateViewsInRows:tableColumns:usingBlock: previously executed a run loop
pass before visiting views. Running timers, delayed performs, and the display
server mid-operation caused views to render prematurely before load, selection,
or expansion changes completed.

- CPTableView: Restrict -_enumerateViewsInRows:columns:usingBlock: and
  -_enumerateViewsInRows:tableColumns:usingBlock: to enumerating existing
  views without pumping the run loop.

- CPTableView: Call -layoutIfNeeded to complete reloads in
  -enumerateAvailableViewsUsingBlock: and -removeTableColumn:.

- Tests: Update tests affected by the removal of the implicit run loop pass
  and the interaction test helper fix—dispatch events once through the
  application in the interaction test helper (which command-click and
  shift-click tests depend on), force layout prior to assertions in the reload
  and lazy preparation tests, and target clicks below the rows of a
  scroll-view-hosted table in the click-outside tests.
2026-11-18 09:57:41 -06:00
David Richardson 4f16e876b0 AppKit: Begin double-click editing only when a data source or binding accepts the value
Returning a flag constant instead of evaluating it allowed tables and outlines to initiate double-click edits even when neither the data source nor a binding supported storing the value.

- CPTableView: Evaluate the setObjectValue capability against implemented
  data source methods rather than returning a static flag constant.

- CPTableView: Track click slop on all clicks to ensure bound tables correctly reject edits after pointer movement.

- CPOutlineView: Test whether the outline data source implements -outlineView:setObjectValue:forTableColumn:byItem: rather than inheriting the table view check.

- CPTableViewInteractionTest: Add tests covering read-only data sources, bound tables, and movements within and beyond click slop thresholds.

- CPOutlineViewInteractionTest: Add tests for outline data sources with and without -outlineView:setObjectValue:forTableColumn:byItem:.
2026-11-16 16:39:38 -06:00
David Richardson fca3a9159a AppKit: Fix outline drop retargeting and add interaction regression tests
Protects the selection, editing and drag and drop contracts of tables and
outlines by verifying the events, delegate calls and data source calls that
applications depend on. A drop retargeted between the children of an item is
delivered to that item.

* CPOutlineView: Set the retargeted drop operation in
  setDropItem:dropChildIndex:.

* CPTableViewInteractionTest: Verify selection by mouse and keyboard, editing,
  drag initiation and drop handling, including refusal and retargeting by the
  delegate and data source.

* CPOutlineViewInteractionTest: Verify dragged items, proposed parents and child
  indexes, drop retargeting, and expansion and its cancellation during a hover.
2026-10-31 21:12:08 -06:00