mirror of
https://github.com/cappuccino/cappuccino.git
synced 2026-09-08 19:57:14 +00:00
-sheet attached to modal window runs in modal context
-events in modal run loop get passed to sheet's parent window, so it can move and resize
This commit is contained in:
@@ -1181,7 +1181,9 @@ _CPRunModalLoop = function(anEvent)
|
||||
var theWindow = [anEvent window],
|
||||
modalSession = CPApp._currentSession;
|
||||
|
||||
if (theWindow == modalSession._window || [theWindow worksWhenModal])
|
||||
if (theWindow == modalSession._window ||
|
||||
[theWindow worksWhenModal] ||
|
||||
[theWindow attachedSheet] == modalSession._window)
|
||||
[theWindow sendEvent:anEvent];
|
||||
}
|
||||
|
||||
|
||||
@@ -2369,8 +2369,14 @@ CPTexturedBackgroundWindowMask
|
||||
|
||||
[[CPNotificationCenter defaultCenter] postNotificationName:CPWindowWillBeginSheetNotification object:self];
|
||||
|
||||
// old behavior; in Cocoa, sheets are not modal by default
|
||||
//[CPApp runModalForWindow:aSheet];
|
||||
// if sheet is attached to a modal window, the sheet runs
|
||||
// as if itself and the parent window are modal
|
||||
aSheet._isModal = NO;
|
||||
if ([CPApp modalWindow]===self)
|
||||
{
|
||||
[CPApp runModalForWindow:aSheet];
|
||||
aSheet._isModal = YES;
|
||||
}
|
||||
|
||||
[aSheet orderFront:self];
|
||||
[aSheet setFrame:startFrame display:YES animate:NO];
|
||||
@@ -2454,6 +2460,9 @@ CPTexturedBackgroundWindowMask
|
||||
_sheetContext = nil;
|
||||
sheet._parentView = nil;
|
||||
|
||||
if (sheet._isModal)
|
||||
[CPApp stopModal];
|
||||
|
||||
if (delegate != nil && endSelector != nil)
|
||||
objj_msgSend(delegate, endSelector, sheet, returnCode, contextInfo);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user