diff --git a/ChangeLog b/ChangeLog index d3efc81ba..285517bc9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2005-05-23 Fred Kiefer + + * Source/NSAlert.m (-_setupPanel): New method. + (-runModal, -beginSheetModalForWindow:...contextInfo:) Use this + new method. + 2005-05-22 Fred Kiefer * Source/NSView.m (-display) @@ -5,7 +11,7 @@ * Source/NSBrowserCell.m (-drawWithFrame:inView:) * Source/NSImageCell.m (-drawWithFrame:inView:) * Source/NSMenuItemCell.m (-drawWithFrame:inView:) - * Source/NSTableHeaderCell.m (-drawWithFrame:inView:) + * Source/NSTableHeaderCell.m (-drawWithFrame:inView:): Removed check for window existence. This should already have been checked by a surrounding canDraw call. Fixes bug #13140. diff --git a/Source/NSAlert.m b/Source/NSAlert.m index fc31e8cde..97a20516a 100644 --- a/Source/NSAlert.m +++ b/Source/NSAlert.m @@ -1405,10 +1405,48 @@ void NSBeginInformationalAlertSheet(NSString *title, return _delegate; } +- (void)_setupPanel +{ + GSAlertPanel *panel; + NSString *title; + + panel = [[GSAlertPanel alloc] init]; + _window = panel; + + switch (_style) + { + case NSCriticalAlertStyle: + title = @"Critical"; + break; + case NSInformationalAlertStyle: + title = @"Information"; + break; + case NSWarningAlertStyle: + default: + title = @"Alert"; + break; + } + [panel setTitle: title]; + // FIXME: Should also set the icon + [panel setTitle: _informative_text + message: _message_text + def: [[_buttons objectAtIndex: 0] title] + alt: [[_buttons objectAtIndex: 1] title] + other: [[_buttons objectAtIndex: 2] title]]; + [panel sizePanelToFit]; +} + - (int)runModal { - // FIXME - return NSAlertFirstButtonReturn; + int result; + + [self _setupPanel]; + [NSApp runModalForWindow: _window]; + [_window orderOut: self]; + result = [(GSAlertPanel*)_window result]; + DESTROY(_window); + + return result; } - (void)beginSheetModalForWindow:(NSWindow *)window @@ -1416,7 +1454,13 @@ void NSBeginInformationalAlertSheet(NSString *title, didEndSelector:(SEL)didEndSelector contextInfo:(void *)contextInfo { -// FIXME + [self _setupPanel]; + [NSApp beginSheet: _window + modalForWindow: window + modalDelegate: delegate + didEndSelector: didEndSelector + contextInfo: contextInfo]; + DESTROY(_window); } - (id)window