Changeset 24544
- Timestamp:
- 07/31/2008 11:51:51 PM (4 months ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/Frameworks/AIUtilities Framework/Source/AIMultiCellOutlineView.m
r24088 r24544 82 82 * Called from mouseDown; separated out to let subclasses have finer granularity of control 83 83 * 84 * @param theEvent The triggerring event 85 * @param needsExpandCollapseSuppression Pointer to a BOOL which, on return, will be YES if we need to prevent NSOutlineView from trying to expand/collapse a group. 86 * 84 87 * @result YES if the event was handled; NO if it should be processed normally 85 88 */ 86 - (BOOL)handleExpandedStateToggleForEvent:(NSEvent *)theEvent 89 - (BOOL)handleExpandedStateToggleForEvent:(NSEvent *)theEvent needsExpandCollapseSuppression:(BOOL *)needsExpandCollapseSuppression 87 90 { 88 91 NSPoint viewPoint = [self convertPoint:[theEvent locationInWindow] fromView:nil]; … … 92 95 93 96 //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] &&97 if (item && [self isExpandable:item] && 95 98 (viewPoint.x < NSHeight([self frameOfCellAtColumn:0 row:row]))) { 96 99 /* XXX - This is kind of a hack. We need to check < WidthOfDisclosureTriangle, and are using the fact that 97 100 * the disclosure width is about the same as the height of the row to fudge it. -ai 98 101 */ 99 if ([self isItemExpanded:item]) { 100 [self collapseItem:item]; 101 } else { 102 [self expandItem:item]; 102 if ([[self delegate] outlineView:self isGroup:item]) { 103 /* For a group, perform the expand/collapse */ 104 if ([self isItemExpanded:item]) { 105 [self collapseItem:item]; 106 } else { 107 [self expandItem:item]; 108 } 109 handled = YES; 110 } else { 111 /* If it's not a group, we'll need to suppress NSOutlineView from trying to do an expand/contract */ 112 if (needsExpandCollapseSuppression) *needsExpandCollapseSuppression = YES; 113 handled = NO; 103 114 } 104 handled = YES;105 115 106 116 } else { 117 if (needsExpandCollapseSuppression) *needsExpandCollapseSuppression = NO; 107 118 handled = NO; 108 119 } trunk/Frameworks/AIUtilities Framework/Source/AIVariableHeightOutlineView.h
r24493 r24544 20 20 BOOL drawHighlightOnlyWhenMain; 21 21 BOOL drawsSelectedRowHighlight; 22 23 BOOL suppressExpandCollapseRequests; 22 24 } 23 25 trunk/Frameworks/AIUtilities Framework/Source/AIVariableHeightOutlineView.m
r24493 r24544 80 80 * Called from mouseDown; separated out to let subclasses have finer granularity of control 81 81 * 82 * @param theEvent The triggerring event 83 * @param needsExpandCollapseSuppression Pointer to a BOOL which, on return, will be YES if we need to prevent NSOutlineView from trying to expand/collapse a group. 84 * 82 85 * @result YES if the event was handled; NO if it should be processed normally 83 86 */ 84 - (BOOL)handleExpandedStateToggleForEvent:(NSEvent *)theEvent 87 - (BOOL)handleExpandedStateToggleForEvent:(NSEvent *)theEvent needsExpandCollapseSuppression:(BOOL *)needsExpandCollapseSuppression 85 88 { 86 89 NSPoint viewPoint = [self convertPoint:[theEvent locationInWindow] fromView:nil]; … … 106 109 } 107 110 111 if (needsExpandCollapseSuppression) *needsExpandCollapseSuppression = NO; 112 108 113 return handled; 114 } 115 116 - (void)collapseItem:(id)item collapseChildren:(BOOL)collapseChildren 117 { 118 if (!suppressExpandCollapseRequests) 119 [super collapseItem:item collapseChildren:collapseChildren]; 120 } 121 122 - (void)expandItem:(id)item expandChildren:(BOOL)expandChildren; 123 { 124 if (!suppressExpandCollapseRequests) 125 [super expandItem:item expandChildren:expandChildren]; 109 126 } 110 127 … … 112 129 - (void)mouseDown:(NSEvent *)theEvent 113 130 { 114 if (![self handleExpandedStateToggleForEvent:theEvent]) 131 BOOL needsExpandCollapseSuppression; 132 if (![self handleExpandedStateToggleForEvent:theEvent needsExpandCollapseSuppression:&needsExpandCollapseSuppression]) { 133 suppressExpandCollapseRequests = needsExpandCollapseSuppression; 115 134 [super mouseDown:theEvent]; 135 suppressExpandCollapseRequests = NO; 136 } 116 137 } 117 138