brendand / mbtablegrid

An NSControl subclass which provides a spreadsheet-style table grid
9 stars 3 forks source link

Editing checkboxes occurs immediately on (first, or any) mouse down #18

Closed interstateone closed 9 years ago

interstateone commented 9 years ago

Add a protocol that cells can implement to provide whether they should edit immediately on first mouse down. MBButtonCell is the first cell to implement this and also overrides - hitTestForEvent:inRect:ofView: to provide whether the mouse event was in the cell or also in the checkbox frame (thus toggling the state). I'm imagining this protocol and method also being used with popup button cells to enable showing the popup menu (edit state) when the arrows are clicked even if the cell isn't already selected.

Some of the logic in mouseDown: and editSelectedCell was rearranged to support this, and I think there's probably some further refactoring that could happen in those methods.

Fixes #5.