cappuccino/cappuccino — pull request #1818 by t00f (2013-03-01 11:22:54+00:00)
Title: Adding tableView:shouldReorderColumn:toColumn: to CPTableView delegate methods

Hi guys,

This delegate method is presented in the API doc page but was not implemented yet. I would like to suggest a solution which fits NSTableView behaviour (https://developer.apple.com/library/mac/#documentation/Cocoa/Reference/NSTableViewDelegate_Protocol/Reference/Reference.html#//apple_ref/occ/intfm/NSTableViewDelegate/tableView:shouldReorderColumn:toColumn:)

The solution can be explained in 4 points :
- CPTableView registers delegate methods when setting the delegate.
- CPTableView implements a private method called _shouldReorderColumn:toColumn to check if it allows column reordering and if the delegate allows a given column to be reordered.
- Before actually moving the column in _moveColumn:toColumn: method, we now ask the delegate opinion though the new CPTableView method
- CPTableHeaderView _shouldDragTableColumn method checked only if tableView allows column reodering. It now calls the new CPTableView method to verify if it allows column reordering and ask its delegate opinion with newColumnIndex equal to -1.

Hope it could help !
Regards,