fix delegate methods not sent in transient mode when closing

This commit is contained in:
Antoine Mercadal committed 2011-11-02 11:59:20 +01:00
1 parent 7e6ed01dd2
commit 4841f209b3
2 files changed
+20 -3

No files matched your search

+15
View File
@@ -221,6 +221,7 @@ var CPPopoverDelegate_popover_willShow_ = 1 << 0,
[_attachedWindow setAppearance:_appearance];
[_attachedWindow setAnimates:_animates];
[_attachedWindow setDelegate:self];
[_attachedWindow setMovableByWindowBackground:NO];
[_attachedWindow setFrame:[_attachedWindow frameRectForContentRect:[[_contentViewController view] frame]]];
[_attachedWindow setContentView:[_contentViewController view]];
@@ -268,6 +269,20 @@ var CPPopoverDelegate_popover_willShow_ = 1 << 0,
[self close];
}
#pragma mark -
#pragma mark Delegates
/*! @ignore */
- (BOOL)didAttachedWindowShouldClose:(_CPAttachedWindow)anAttachedWindow
{
[self close];
// we return NO, because we want the CPPopover to compute
// if the attached can be close in order to send delegate messages
return NO;
}
@end
+5 -3
View File
@@ -410,10 +410,12 @@ CPPopoverAppearanceHUD = 1;
{
// set a close flag to avoid infinite loop
_isClosed = YES;
[self close];
if (_delegate && [_delegate respondsToSelector:@selector(didAttachedWindowClose:)])
[_delegate didAttachedWindowClose:self];
if (_delegate && [_delegate respondsToSelector:@selector(didAttachedWindowShouldClose:)])
if ([_delegate didAttachedWindowShouldClose:self])
[self close];
else
[self close];
}
}