Changeset 24088
- Timestamp:
- 06/29/2008 02:32:40 PM (5 months ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/Frameworks/AIUtilities Framework/Source/AIMultiCellOutlineView.m
r23158 r24088 77 77 } 78 78 79 /*! 80 * @brief Handle toggling expanded/collapsed state of an item for an event if needed 81 * 82 * Called from mouseDown; separated out to let subclasses have finer granularity of control 83 * 84 * @result YES if the event was handled; NO if it should be processed normally 85 */ 86 - (BOOL)handleExpandedStateToggleForEvent:(NSEvent *)theEvent 87 { 88 NSPoint viewPoint = [self convertPoint:[theEvent locationInWindow] fromView:nil]; 89 int row = [self rowAtPoint:viewPoint]; 90 id item = [self itemAtRow:row]; 91 BOOL handled; 92 93 //Expand/Collapse groups on mouse DOWN instead of mouse up (Makes it feel a ton faster) 94 if (item && [[self delegate] outlineView:self isGroup:item] && 95 (viewPoint.x < NSHeight([self frameOfCellAtColumn:0 row:row]))) { 96 /* XXX - This is kind of a hack. We need to check < WidthOfDisclosureTriangle, and are using the fact that 97 * the disclosure width is about the same as the height of the row to fudge it. -ai 98 */ 99 if ([self isItemExpanded:item]) { 100 [self collapseItem:item]; 101 } else { 102 [self expandItem:item]; 103 } 104 handled = YES; 105 106 } else { 107 handled = NO; 108 } 109 110 return handled; 111 } 112 79 113 @end trunk/Frameworks/AIUtilities Framework/Source/AIVariableHeightOutlineView.m
r23987 r24088 74 74 } 75 75 76 //Handle mouseDown events to toggle expandable items when they are clicked 77 - (void)mouseDown:(NSEvent *)theEvent 78 { 76 /*! 77 * @brief Handle toggling expanded/collapsed state of an item for an event if needed 78 * 79 * Called from mouseDown; separated out to let subclasses have finer granularity of control 80 * 81 * @result YES if the event was handled; NO if it should be processed normally 82 */ 83 - (BOOL)handleExpandedStateToggleForEvent:(NSEvent *)theEvent 84 { 79 85 NSPoint viewPoint = [self convertPoint:[theEvent locationInWindow] fromView:nil]; 80 int row = [self rowAtPoint:viewPoint]; 81 id item = [self itemAtRow:row]; 82 86 int row = [self rowAtPoint:viewPoint]; 87 id item = [self itemAtRow:row]; 88 BOOL handled; 89 83 90 //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 91 if (item && [self isExpandable:item] && 92 (viewPoint.x < NSHeight([self frameOfCellAtColumn:0 row:row]))) { 93 /* XXX - This is kind of a hack. We need to check < WidthOfDisclosureTriangle, and are using the fact that 94 * the disclosure width is about the same as the height of the row to fudge it. -ai 95 */ 90 96 if ([self isItemExpanded:item]) { 91 97 [self collapseItem:item]; 92 98 } else { 93 99 [self expandItem:item]; 94 } 95 } else { 100 } 101 102 handled = YES; 103 } else { 104 handled = NO; 105 } 106 107 return handled; 108 } 109 110 //Handle mouseDown events to toggle expandable items when they are clicked 111 - (void)mouseDown:(NSEvent *)theEvent 112 { 113 if (![self handleExpandedStateToggleForEvent:theEvent]) 96 114 [super mouseDown:theEvent]; 97 }98 115 } 99 116