From 29a168d55468e5ab93b39168574e1e8fb21c7ed9 Mon Sep 17 00:00:00 2001 From: Marcian Lytwyn Date: Thu, 26 Mar 2015 22:06:52 +0000 Subject: [PATCH] Position NSAlert panel git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/branches/gnustep_testplant_branch@38438 72102866-910b-0410-8b05-ffd578937521 --- Source/NSAlert.m | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/Source/NSAlert.m b/Source/NSAlert.m index d418bd96d..6a388e1c0 100644 --- a/Source/NSAlert.m +++ b/Source/NSAlert.m @@ -2028,9 +2028,26 @@ void NSBeginInformationalAlertSheet(NSString *title, didEndSelector: (SEL)didEndSelector contextInfo: (void *)contextInfo { + NSRect frame = [window frame]; + NSPoint point = frame.origin; + NSSize size; + CGFloat width; + + // Ssetup... [self _setupPanel]; + + // Position window... + size = [_window frame].size; + point = NSMakePoint(NSMinX(frame), NSMaxY(frame)-size.height); + width = frame.size.width - size.width; + point.x += width / 2; + point.y -= size.height; + [_window setFrameOrigin:point]; + + // Save parameters... _modalDelegate = delegate; _didEndSelector = didEndSelector; + [NSApp beginSheet: _window modalForWindow: window modalDelegate: self