mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-05-31 07:20:47 +00:00
Fix issues raised by fred's comments
This commit is contained in:
parent
4d477f4e34
commit
5a71c1c944
1 changed files with 37 additions and 38 deletions
|
@ -99,6 +99,36 @@ static NSNotificationCenter *nc = nil;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (void) _configureContainer: (NSRect)contentRect
|
||||||
|
{
|
||||||
|
NSRect rect = contentRect;
|
||||||
|
NSSize containerContentSize;
|
||||||
|
|
||||||
|
rect.origin.x += 2.0;
|
||||||
|
rect.origin.y -= 5.0;
|
||||||
|
|
||||||
|
if (_container == nil)
|
||||||
|
{
|
||||||
|
_container = [[NSBox alloc] initWithFrame: rect];
|
||||||
|
[[super contentView] addSubview: _container];
|
||||||
|
|
||||||
|
[_container setTitle: @""];
|
||||||
|
[_container setTitlePosition: NSNoTitle];
|
||||||
|
[_container setBorderType: NSBezelBorder];
|
||||||
|
[_container setAutoresizingMask: NSViewWidthSizable | NSViewHeightSizable];
|
||||||
|
[_container setContentViewMargins: NSMakeSize(2,2)];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
[_container setFrame: rect];
|
||||||
|
}
|
||||||
|
|
||||||
|
// determine the difference between the container's content size and the window content size
|
||||||
|
containerContentSize = [[_container contentView] frame].size;
|
||||||
|
_borderSize = NSMakeSize(contentRect.size.width - containerContentSize.width,
|
||||||
|
contentRect.size.height - containerContentSize.height);
|
||||||
|
}
|
||||||
|
|
||||||
- (id) initWithContentRect: (NSRect)contentRect
|
- (id) initWithContentRect: (NSRect)contentRect
|
||||||
styleMask: (NSUInteger)aStyle
|
styleMask: (NSUInteger)aStyle
|
||||||
backing: (NSBackingStoreType)bufferingType
|
backing: (NSBackingStoreType)bufferingType
|
||||||
|
@ -113,43 +143,12 @@ static NSNotificationCenter *nc = nil;
|
||||||
styleMask: aStyle
|
styleMask: aStyle
|
||||||
backing: bufferingType
|
backing: bufferingType
|
||||||
defer: flag];
|
defer: flag];
|
||||||
|
|
||||||
if (self != nil)
|
if (self != nil)
|
||||||
{
|
{
|
||||||
NSRect rect = contentRect;
|
[self _configureContainer: contentRect];
|
||||||
NSRect border = contentRect;
|
|
||||||
NSSize containerContentSize;
|
|
||||||
|
|
||||||
rect.origin.x += 6;
|
|
||||||
rect.origin.y += 6;
|
|
||||||
rect.size.width -= 16;
|
|
||||||
rect.size.height -= 16;
|
|
||||||
|
|
||||||
border.origin.x += 1;
|
|
||||||
border.origin.y += 1;
|
|
||||||
border.size.width -= 2;
|
|
||||||
border.size.height -= 2;
|
|
||||||
|
|
||||||
_borderBox = [[NSBox alloc] initWithFrame: border];
|
|
||||||
[_borderBox setTitle: @""];
|
|
||||||
[_borderBox setTitlePosition: NSNoTitle];
|
|
||||||
[_borderBox setBorderType: NSLineBorder];
|
|
||||||
[_borderBox setAutoresizingMask: NSViewWidthSizable | NSViewHeightSizable];
|
|
||||||
[_borderBox setContentViewMargins: NSMakeSize(0,0)];
|
|
||||||
[[super contentView] addSubview: _borderBox];
|
|
||||||
|
|
||||||
_container = [[NSBox alloc] initWithFrame: rect];
|
|
||||||
[_container setTitle: @""];
|
|
||||||
[_container setTitlePosition: NSNoTitle];
|
|
||||||
[_container setBorderType: NSBezelBorder];
|
|
||||||
[_container setAutoresizingMask: NSViewWidthSizable | NSViewHeightSizable];
|
|
||||||
[_container setContentViewMargins: NSMakeSize(2,2)];
|
|
||||||
[_borderBox addSubview: _container];
|
|
||||||
|
|
||||||
// determine the difference between the container's content size and the window content size
|
|
||||||
containerContentSize = [[_container contentView] frame].size;
|
|
||||||
_borderSize = NSMakeSize(contentRect.size.width - containerContentSize.width,
|
|
||||||
contentRect.size.height - containerContentSize.height);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -162,13 +161,13 @@ static NSNotificationCenter *nc = nil;
|
||||||
{
|
{
|
||||||
NSRect newFrame = [_parentWindow frame];
|
NSRect newFrame = [_parentWindow frame];
|
||||||
CGFloat totalOffset = [_drawer leadingOffset] + [_drawer trailingOffset];
|
CGFloat totalOffset = [_drawer leadingOffset] + [_drawer trailingOffset];
|
||||||
// NSRectEdge edge = _currentEdge;
|
|
||||||
BOOL opened = (state == NSDrawerOpenState || state == NSDrawerOpeningState);
|
BOOL opened = (state == NSDrawerOpenState || state == NSDrawerOpeningState);
|
||||||
NSSize size = [_parentWindow frame].size;
|
NSSize size = [_parentWindow frame].size;
|
||||||
NSRect windowContentRect = [[_parentWindow contentView] frame];
|
NSRect windowContentRect = [[_parentWindow contentView] frame];
|
||||||
CGFloat windowHeightWithoutTitleBar = windowContentRect.origin.y + windowContentRect.size.height;
|
CGFloat windowHeightWithoutTitleBar = windowContentRect.origin.y + windowContentRect.size.height;
|
||||||
|
|
||||||
// FIXME: This should probably add the toolbar height too, if the window has a toolbar
|
// FIXME: This should probably add the toolbar height too, if the window has a toolbar
|
||||||
|
[self _configureContainer: windowContentRect];
|
||||||
if (_currentEdge == NSMinXEdge) // left
|
if (_currentEdge == NSMinXEdge) // left
|
||||||
{
|
{
|
||||||
if (opened)
|
if (opened)
|
||||||
|
@ -621,14 +620,14 @@ static NSNotificationCenter *nc = nil;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case NSMaxXEdge:
|
case NSMaxXEdge:
|
||||||
if (windowFrame.origin.x + windowFrame.size.height > screenRect.size.height)
|
if (windowFrame.origin.x + windowFrame.size.width > screenRect.size.width)
|
||||||
{
|
{
|
||||||
result = NSMinXEdge;
|
result = NSMinXEdge;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case NSMaxYEdge:
|
case NSMaxYEdge:
|
||||||
if (windowFrame.origin.y + windowFrame.size.width > screenRect.size.width)
|
if (windowFrame.origin.y + windowFrame.size.height > screenRect.size.height)
|
||||||
{
|
{
|
||||||
result = NSMinYEdge;
|
result = NSMinYEdge;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue