| | 75 | |
|---|
| | 76 | //Handle mouseDown events to toggle expandable items when they are clicked |
|---|
| | 77 | - (void)mouseDown:(NSEvent *)theEvent |
|---|
| | 78 | { |
|---|
| | 79 | NSPoint viewPoint = [self convertPoint:[theEvent locationInWindow] fromView:nil]; |
|---|
| | 80 | int row = [self rowAtPoint:viewPoint]; |
|---|
| | 81 | id item = [self itemAtRow:row]; |
|---|
| | 82 | |
|---|
| | 83 | //Expand/Collapse groups on mouse DOWN instead of mouse up (Makes it feel a ton faster) |
|---|
| | 84 | if ((item) && |
|---|
| | 85 | ([self isExpandable:item]) && |
|---|
| | 86 | (viewPoint.x < [self frameOfCellAtColumn:0 row:row].size.height)) { |
|---|
| | 87 | //XXX - This is kind of a hack. We need to check < WidthOfDisclosureTriangle, and are using the fact that |
|---|
| | 88 | // the disclosure width is about the same as the height of the row to fudge it. -ai |
|---|
| | 89 | |
|---|
| | 90 | if ([self isItemExpanded:item]) { |
|---|
| | 91 | [self collapseItem:item]; |
|---|
| | 92 | } else { |
|---|
| | 93 | [self expandItem:item]; |
|---|
| | 94 | } |
|---|
| | 95 | } else { |
|---|
| | 96 | [super mouseDown:theEvent]; |
|---|
| | 97 | } |
|---|
| | 98 | } |
|---|