* Source/NSWindow.m: Change to correct issue with NSWindow placement

when toolbar is present.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@26476 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Gregory John Casamento 2008-04-27 22:44:12 +00:00
parent 980e82dfb8
commit ddc130cae7
2 changed files with 48 additions and 4 deletions

View file

@ -1,3 +1,8 @@
2008-04-27 18:42-EDT Gregory John Casamento <greg_casamento@yahoo.com>
* Source/NSWindow.m: Change to correct issue with NSWindow placement
when toolbar is present.
2008-04-25 18:16-EDT Gregory John Casamento <greg_casamento@yahoo.com>
* Source/GSNibTemplates.m: Correct [GSNibTemplates deferredWindows] to

View file

@ -106,6 +106,24 @@ BOOL GSViewAcceptsDrag(NSView *v, id<NSDraggingInfo> dragInfo);
- (void) _viewWillMoveToWindow: (NSWindow*)newWindow;
@end
@interface NSScreen (PrivateMethods)
- (id) _initWithScreenNumber: (int)screen;
@end
/*
* FIXME: Not sure if I should be exposing this here, but it seems to be the only way
* to fix the window frame save issue when a toolbar is present.
*/
@interface NSWindow (ToolbarPrivate)
- (id) toolbar;
- (NSView *)contentViewWithoutToolbar;
@end
@interface NSToolbar (GNUstepPrivate)
- (GSToolbarView *) _toolbarView;
@end
// FIXME: END (GJC)
/*
* Category for internal methods (for use only within the NSWindow class itself
* or with other AppKit classes.
@ -1001,8 +1019,9 @@ many times.
// Get the properties for the underlying window
winNum = [srv nativeWindow: windowRef : &contentRect : &bufferingType
: &aStyle : &screen];
// FIXME: Get the screen for the right screen number.
aScreen = nil;
// Get the screen for the right screen number.
aScreen = [[NSScreen alloc] _initWithScreenNumber: screen];
// Set up a NSWindow with the same properties
self = [self initWithContentRect: contentRect
@ -1041,13 +1060,11 @@ many times.
- (NSRect) contentRectForFrameRect: (NSRect)frameRect
{
// FIXME
return [isa contentRectForFrameRect: frameRect styleMask: _styleMask];
}
- (NSRect) frameRectForContentRect: (NSRect)contentRect
{
// FIXME
return [isa frameRectForContentRect: contentRect styleMask: _styleMask];
}
@ -4478,6 +4495,28 @@ current key view.<br />
fRect = _frame;
/*
* FIXME: This may not be such an elegant solution, but it works.
* I need to find a better way to handle this, maybe in the window
* decoration view could handle these calculations.
*/
if([self toolbar] != nil)
{
NSView *tbview = [[self toolbar] _toolbarView];
NSRect tbframe = [tbview frame];
if([tbview superview] != nil)
{
NSRect r = [[self contentViewWithoutToolbar] frame];
r = [NSWindow frameRectForContentRect: r
styleMask: _styleMask];
// copy w/h
fRect.size.width = r.size.width;
fRect.size.height = r.size.height;
fRect.origin.y += tbframe.size.height;
}
}
/*
* The screen rectangle should gives the area of the screen in which
* the window could be placed (ie a rectangle excluding the dock).