Small changes for NSAlert.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@21250 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Fred Kiefer 2005-05-22 23:53:35 +00:00
parent 931fa977c7
commit cbb49af830
2 changed files with 54 additions and 4 deletions

View file

@ -1,3 +1,9 @@
2005-05-23 Fred Kiefer <FredKiefer@gmx.de>
* Source/NSAlert.m (-_setupPanel): New method.
(-runModal, -beginSheetModalForWindow:...contextInfo:) Use this
new method.
2005-05-22 Fred Kiefer <FredKiefer@gmx.de>
* 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.

View file

@ -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