From 2e93e4abf73fc35b0776fc8c9c36e53ea9de081b Mon Sep 17 00:00:00 2001 From: Alexandre Wilhelm Date: Mon, 29 Apr 2013 16:16:29 -0700 Subject: [PATCH] Fixed: Sheet window under the toolbar Previously when using a sheet window in a fullPlatform window, the sheet window started the animation under (the layout) the toolbar. Now, the sheet animation starts below the toolbar as in cocoa. It also fixed that only a CPBordelessWindow/CPTitleWindow/HUD can have a toolbar. --- AppKit/CPWindow/CPWindow.j | 9 +++++++++ AppKit/CPWindow/_CPWindowView.j | 4 +++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/AppKit/CPWindow/CPWindow.j b/AppKit/CPWindow/CPWindow.j index ccac5bf02..f43c34ba7 100644 --- a/AppKit/CPWindow/CPWindow.j +++ b/AppKit/CPWindow/CPWindow.j @@ -2763,6 +2763,15 @@ CPTexturedBackgroundWindowMask endY = [_windowView bodyOffset] - [[self contentView] frame].origin.y, endFrame = CGRectMake(originX, endY, sheetFrame.size.width, sheetFrame.size.height); + if (_toolbar && [_windowView showsToolbar] && [self isFullPlatformWindow]) + { + originX += [[_toolbar _toolbarView] frameSize].height; + endY += [[_toolbar _toolbarView] frameSize].height; + + startFrame = CGRectMake(originX, -sheetShadowFrame.size.height, sheetFrame.size.width, sheetFrame.size.height); + endFrame = CGRectMake(originX, endY, sheetFrame.size.width, sheetFrame.size.height); + } + // Move the sheet offscreen before ordering front so it doesn't appear briefly [sheet setFrameOrigin:CGPointMake(0, -13000)]; diff --git a/AppKit/CPWindow/_CPWindowView.j b/AppKit/CPWindow/_CPWindowView.j index 8cd74b0e3..11660eaf3 100644 --- a/AppKit/CPWindow/_CPWindowView.j +++ b/AppKit/CPWindow/_CPWindowView.j @@ -742,7 +742,9 @@ _CPWindowViewResizeSlop = 3; - (BOOL)showsToolbar { - return YES; + var styleMaskWindow = [[self window] styleMask]; + + return styleMaskWindow & CPBorderlessWindowMask || styleMaskWindow & CPTitledWindowMask || styleMaskWindow & CPHUDBackgroundWindowMask; } - (CGSize)toolbarOffset