mirror of
https://github.com/cappuccino/cappuccino.git
synced 2026-09-14 14:41:28 +00:00
-implement CPWindow sheet notifications on delegate
-raise error when window already has a sheet, or attaching sheet to a sheet
This commit is contained in:
@@ -933,6 +933,19 @@ CPRunContinuesResponse = -1002;
|
||||
return;
|
||||
}
|
||||
|
||||
if ([aWindow attachedSheet])
|
||||
{
|
||||
[CPException raise:CPInternalInconsistencyException reason:@"The target window of beginSheet: already has a sheet"];
|
||||
return;
|
||||
}
|
||||
|
||||
if ([aWindow isSheet])
|
||||
{
|
||||
[CPException raise:CPInternalInconsistencyException reason:@"The target window of beginSheet: cannot be a sheet"];
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
[aWindow orderFront:self];
|
||||
[aSheet setPlatformWindow:[aWindow platformWindow]];
|
||||
[aWindow _attachSheet:aSheet modalDelegate:aModalDelegate didEndSelector:aDidEndSelector contextInfo:aContextInfo];
|
||||
|
||||
@@ -1224,6 +1224,8 @@ CPTexturedBackgroundWindowMask
|
||||
[defaultCenter removeObserver:_delegate name:CPWindowDidResignMainNotification object:self];
|
||||
[defaultCenter removeObserver:_delegate name:CPWindowDidMoveNotification object:self];
|
||||
[defaultCenter removeObserver:_delegate name:CPWindowDidResizeNotification object:self];
|
||||
[defaultCenter removeObserver:_delegate name:CPWindowWillBeginSheetNotification object:self];
|
||||
[defaultCenter removeObserver:_delegate name:CPWindowDidEndSheetNotification object:self];
|
||||
|
||||
_delegate = aDelegate;
|
||||
_delegateRespondsToWindowWillReturnUndoManagerSelector = [_delegate respondsToSelector:@selector(windowWillReturnUndoManager:)];
|
||||
@@ -1269,6 +1271,20 @@ CPTexturedBackgroundWindowMask
|
||||
selector:@selector(windowDidResize:)
|
||||
name:CPWindowDidResizeNotification
|
||||
object:self];
|
||||
|
||||
if ([_delegate respondsToSelector:@selector(windowWillBeginSheet:)])
|
||||
[defaultCenter
|
||||
addObserver:_delegate
|
||||
selector:@selector(windowWillBeginSheet:)
|
||||
name:CPWindowWillBeginSheetNotification
|
||||
object:self];
|
||||
|
||||
if ([_delegate respondsToSelector:@selector(windowDidEndSheet:)])
|
||||
[defaultCenter
|
||||
addObserver:_delegate
|
||||
selector:@selector(windowDidEndSheet:)
|
||||
name:CPWindowDidEndSheetNotification
|
||||
object:self];
|
||||
}
|
||||
|
||||
/*!
|
||||
@@ -2367,6 +2383,7 @@ CPTexturedBackgroundWindowMask
|
||||
startFrame = CGRectMake(originx, originy, sheetFrame.size.width, 0),
|
||||
endFrame = CGRectMake(originx, originy, sheetFrame.size.width, sheetFrame.size.height);
|
||||
|
||||
|
||||
[[CPNotificationCenter defaultCenter] postNotificationName:CPWindowWillBeginSheetNotification object:self];
|
||||
|
||||
// if sheet is attached to a modal window, the sheet runs
|
||||
|
||||
Reference in New Issue
Block a user