mirror of
https://github.com/cappuccino/cappuccino.git
synced 2026-08-25 21:17:03 +00:00
Improved nib2cib support for windows (min/max size, correct autoresize mask, flipped Y coordinate)
This commit is contained in:
@@ -35,8 +35,10 @@ var _CPCibWindowTemplateMinSizeKey = @"_CPCibWindowTemplateMinSizeKey",
|
||||
|
||||
if (self)
|
||||
{
|
||||
_minSize = [aCoder decodeSizeForKey:_CPCibWindowTemplateMinSizeKey];
|
||||
_maxSize = [aCoder decodeSizeForKey:_CPCibWindowTemplateMaxSizeKey];
|
||||
if ([aCoder containsValueForKey:_CPCibWindowTemplateMinSizeKey])
|
||||
_minSize = [aCoder decodeSizeForKey:_CPCibWindowTemplateMinSizeKey];
|
||||
if ([aCoder containsValueForKey:_CPCibWindowTemplateMaxSizeKey])
|
||||
_maxSize = [aCoder decodeSizeForKey:_CPCibWindowTemplateMaxSizeKey];
|
||||
|
||||
_viewClass = [aCoder decodeObjectForKey:_CPCibWindowTemplateViewClassKey];
|
||||
|
||||
@@ -53,8 +55,10 @@ var _CPCibWindowTemplateMinSizeKey = @"_CPCibWindowTemplateMinSizeKey",
|
||||
|
||||
- (void)encodeWithCoder:(CPCoder)aCoder
|
||||
{
|
||||
[aCoder encodeSize:_minSize forKey:_CPCibWindowTemplateMinSizeKey];
|
||||
[aCoder encodeSize:_maxSize forKey:_CPCibWindowTemplateMaxSizeKey];
|
||||
if (_minSize)
|
||||
[aCoder encodeSize:_minSize forKey:_CPCibWindowTemplateMinSizeKey];
|
||||
if (_maxSize)
|
||||
[aCoder encodeSize:_maxSize forKey:_CPCibWindowTemplateMaxSizeKey];
|
||||
|
||||
[aCoder encodeObject:_viewClass forKey:_CPCibWindowTemplateViewClassKey];
|
||||
|
||||
@@ -74,12 +78,13 @@ var _CPCibWindowTemplateMinSizeKey = @"_CPCibWindowTemplateMinSizeKey",
|
||||
[NSException raise:NSInvalidArgumentException format:@"Unable to locate NSWindow class %@, using NSWindow",_windowClass];
|
||||
class=[NSWindow class];*/
|
||||
|
||||
var theWindow = [[windowClass alloc] initWithContentRect:_windowRect styleMask:CPHUDBackgroundWindowMask | CPClosableWindowMask];//styleMask:_windowStyleMask];
|
||||
// alert(CPStringFromRect(_windowRect));
|
||||
// alert(CPStringFromSize(_minSize));
|
||||
// alert(CPStringFromSize(_maxSize));
|
||||
//[theWindow setMinSize:_minSize];
|
||||
//[theWindow setMaxSize:_maxSize];
|
||||
_windowStyleMask = (CPHUDBackgroundWindowMask | CPClosableWindowMask | CPResizableWindowMask);
|
||||
var theWindow = [[windowClass alloc] initWithContentRect:_windowRect styleMask:_windowStyleMask];
|
||||
|
||||
if (_minSize)
|
||||
[theWindow setMinSize:_minSize];
|
||||
if (_maxSize)
|
||||
[theWindow setMaxSize:_maxSize];
|
||||
[theWindow setLevel:CPFloatingWindowLevel];
|
||||
|
||||
//[result setHidesOnDeactivate:(_wtFlags&0x80000000)?YES:NO];
|
||||
|
||||
@@ -30,9 +30,12 @@
|
||||
self = [super init];
|
||||
|
||||
if (self)
|
||||
{
|
||||
_minSize = [aCoder decodeSizeForKey:@"NSMinSize"];
|
||||
_maxSize = [aCoder decodeSizeForKey:@"NSMaxSize"];
|
||||
{
|
||||
if ([aCoder containsValueForKey:@"NSMinSize"])
|
||||
_minSize = [aCoder decodeSizeForKey:@"NSMinSize"];
|
||||
if ([aCoder containsValueForKey:@"NSMaxSize"])
|
||||
_maxSize = [aCoder decodeSizeForKey:@"NSMaxSize"];
|
||||
|
||||
_screenRect = [aCoder decodeRectForKey:@"NSScreenRect"]; // screen created on
|
||||
_viewClass = [aCoder decodeObjectForKey:@"NSViewClass"];
|
||||
_wtFlags = [aCoder decodeIntForKey:@"NSWTFlags"];
|
||||
@@ -46,9 +49,10 @@
|
||||
_windowTitle = [aCoder decodeObjectForKey:@"NSWindowTitle"];
|
||||
_windowView = [aCoder decodeObjectForKey:@"NSWindowView"];
|
||||
|
||||
/*
|
||||
_windowRect.origin.y -= _screenRect.size.height - [[NSScreen mainScreen] frame].size.height;
|
||||
if (![_windowClass isEqualToString:@"NSPanel"])
|
||||
// Flip Y coordinate
|
||||
_windowRect.origin.y = _screenRect.size.height - _windowRect.origin.y - _windowRect.size.height;
|
||||
|
||||
/*if (![_windowClass isEqualToString:@"NSPanel"])
|
||||
_windowRect.origin.y -= [NSMainMenuView menuHeight]; // compensation for the additional menu bar
|
||||
*/
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user