mirror of
https://github.com/cappuccino/cappuccino.git
synced 2026-09-15 07:01:28 +00:00
CPOutlineView item Expande/Collapse delegate method notifications
Conflicts: AppKit/CPOutlineView.j
This commit is contained in:
+71
-1
@@ -224,8 +224,14 @@ CPOutlineViewDropOnItemIndex = -1;
|
||||
|
||||
if (!itemInfo)
|
||||
return;
|
||||
|
||||
|
||||
if (itemInfo.isExpanded)
|
||||
return;
|
||||
|
||||
[self _noteItemWillExpand];
|
||||
itemInfo.isExpanded = YES;
|
||||
[self _noteItemDidExpand];
|
||||
|
||||
[self reloadItem:anItem reloadChildren:YES];
|
||||
|
||||
if (shouldExpandChildren)
|
||||
@@ -251,7 +257,9 @@ CPOutlineViewDropOnItemIndex = -1;
|
||||
if (!itemInfo.isExpanded)
|
||||
return;
|
||||
|
||||
[self _noteItemWillCollapse];
|
||||
itemInfo.isExpanded = NO;
|
||||
[self _noteItemDidCollapse];
|
||||
|
||||
[self reloadItem:anItem reloadChildren:YES];
|
||||
}
|
||||
@@ -474,6 +482,36 @@ CPOutlineViewDropOnItemIndex = -1;
|
||||
selector:@selector(outlineViewSelectionIsChanging:)
|
||||
name:CPOutlineViewSelectionIsChangingNotification
|
||||
object:self];
|
||||
|
||||
|
||||
if ([_outlineViewDelegate respondsToSelector:@selector(outlineViewItemWillExpand:)])
|
||||
[defaultCenter
|
||||
addObserver:_outlineViewDelegate
|
||||
selector:@selector(outlineViewItemWillExpand:)
|
||||
name:CPOutlineViewItemWillExpandNotification
|
||||
object:self];
|
||||
|
||||
if ([_outlineViewDelegate respondsToSelector:@selector(outlineViewItemDidExpand:)])
|
||||
[defaultCenter
|
||||
addObserver:_outlineViewDelegate
|
||||
selector:@selector(outlineViewItemDidExpand:)
|
||||
name:CPOutlineViewItemDidExpandNotification
|
||||
object:self];
|
||||
|
||||
if ([_outlineViewDelegate respondsToSelector:@selector(outlineViewItemWillCollapse:)])
|
||||
[defaultCenter
|
||||
addObserver:_outlineViewDelegate
|
||||
selector:@selector(outlineViewItemWillCollapse:)
|
||||
name:CPOutlineViewItemWillCollapseNotification
|
||||
object:self];
|
||||
|
||||
if ([_outlineViewDelegate respondsToSelector:@selector(outlineViewItemDidCollapse:)])
|
||||
[defaultCenter
|
||||
addObserver:_outlineViewDelegate
|
||||
selector:@selector(outlineViewItemDidCollapse:)
|
||||
name:CPOutlineViewItemDidCollapseNotification
|
||||
object:self];
|
||||
|
||||
}
|
||||
|
||||
- (id)delegate
|
||||
@@ -722,6 +760,38 @@ CPOutlineViewDropOnItemIndex = -1;
|
||||
userInfo:nil];
|
||||
}
|
||||
|
||||
- (void)_noteItemWillExpand
|
||||
{
|
||||
[[CPNotificationCenter defaultCenter]
|
||||
postNotificationName:CPOutlineViewItemWillExpandNotification
|
||||
object:self
|
||||
userInfo:nil];
|
||||
}
|
||||
|
||||
- (void)_noteItemDidExpand
|
||||
{
|
||||
[[CPNotificationCenter defaultCenter]
|
||||
postNotificationName:CPOutlineViewItemDidExpandNotification
|
||||
object:self
|
||||
userInfo:nil];
|
||||
}
|
||||
|
||||
- (void)_noteItemWillCollapse
|
||||
{
|
||||
[[CPNotificationCenter defaultCenter]
|
||||
postNotificationName:CPOutlineViewItemWillCollapseNotification
|
||||
object:self
|
||||
userInfo:nil];
|
||||
}
|
||||
|
||||
- (void)_noteItemDidCollapse
|
||||
{
|
||||
[[CPNotificationCenter defaultCenter]
|
||||
postNotificationName:CPOutlineViewItemDidCollapseNotification
|
||||
object:self
|
||||
userInfo:nil];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
// FIX ME: We're using with() here because Safari fails if we use anOutlineView._itemInfosForItems or whatever...
|
||||
|
||||
Reference in New Issue
Block a user