Patch from Nicola Pero <n.pero@mi.flashnet.it>

* Source/NSBox.m: Fix setFrameFromContentFrame: for zero rect frame.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@4773 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Richard Frith-MacDonald 1999-08-27 07:04:20 +00:00
parent 001bccf827
commit d62c694535
2 changed files with 25 additions and 16 deletions

View file

@ -1,3 +1,8 @@
Thu Aug 26 5:07:00 1999 Richard Frith-Macdonald <richard@brainstorm.co.uk>
Patch from Nicola Pero <n.pero@mi.flashnet.it>
* Source/NSBox.m: Fix setFrameFromContentFrame: for zero rect frame.
Wed Aug 25 09:42:05 1999 Martin Man <Martin.Man@seznam.cz>
* Source/NSWindow.m ([NSWindow -setFrameTopLeftPoint:]): Corrected
@ -6,7 +11,7 @@ Wed Aug 25 09:42:05 1999 Martin Man <Martin.Man@seznam.cz>
Thu Aug 26 5:07:00 1999 Richard Frith-Macdonald <richard@brainstorm.co.uk>
Patch from Niico Pero <n.pero@mi.flashnet.it> modified to use
Patch from Nicola Pero <n.pero@mi.flashnet.it> modified to use
controlDarkShadowColor rather than blackColor.
* Source/NSBox.m: draw line borders in correct color.
* Source/NSCell.m ditto

View file

@ -37,7 +37,7 @@
#include <AppKit/NSTextFieldCell.h>
@interface NSBox (Private)
- (NSRect) calcSizes;
- (NSRect) calcSizesAllowingNegative: (BOOL)aFlag;
@end
@implementation NSBox
@ -106,7 +106,7 @@
if (border_type != aType)
{
border_type = aType;
[content_view setFrame: [self calcSizes]];
[content_view setFrame: [self calcSizesAllowingNegative: NO]];
[self setNeedsDisplay: YES];
}
}
@ -114,14 +114,14 @@
- (void) setTitle: (NSString *)aString
{
[cell setStringValue: aString];
[content_view setFrame: [self calcSizes]];
[content_view setFrame: [self calcSizesAllowingNegative: NO]];
[self setNeedsDisplay: YES];
}
- (void) setTitleFont: (NSFont *)fontObj
{
[cell setFont: fontObj];
[content_view setFrame: [self calcSizes]];
[content_view setFrame: [self calcSizesAllowingNegative: NO]];
[self setNeedsDisplay: YES];
}
@ -130,7 +130,7 @@
if (title_position != aPosition)
{
title_position = aPosition;
[content_view setFrame: [self calcSizes]];
[content_view setFrame: [self calcSizesAllowingNegative: NO]];
[self setNeedsDisplay: YES];
}
}
@ -179,7 +179,7 @@
{
[super replaceSubview: content_view with: aView];
content_view = aView;
[content_view setFrame: [self calcSizes]];
[content_view setFrame: [self calcSizesAllowingNegative: NO]];
}
}
@ -189,7 +189,7 @@
@"illegal margins supplied");
offsets = offsetSize;
[content_view setFrame: [self calcSizes]];
[content_view setFrame: [self calcSizesAllowingNegative: NO]];
[self setNeedsDisplay: YES];
}
@ -199,7 +199,7 @@
- (void) setFrameFromContentFrame: (NSRect)contentFrame
{
// First calc the sizes to see how much we are off by
NSRect r = [self calcSizes];
NSRect r = [self calcSizesAllowingNegative: YES];
NSRect f = [self frame];
NSAssert(contentFrame.size.width >= 0 && contentFrame.size.height >= 0,
@ -210,6 +210,7 @@
f.size.height = f.size.height + (contentFrame.size.height - r.size.height);
[self setFrame: f];
[content_view setFrame: [self calcSizesAllowingNegative: NO]];
}
- (void) sizeToFit
@ -237,7 +238,7 @@
- (void) resizeWithOldSuperviewSize: (NSSize)oldSize
{
[super resizeWithOldSuperviewSize: oldSize];
[content_view setFrame: [self calcSizes]];
[content_view setFrame: [self calcSizesAllowingNegative: NO]];
}
//
@ -341,7 +342,7 @@
@implementation NSBox (Private)
- (NSRect)calcSizes
- (NSRect) calcSizesAllowingNegative: (BOOL)aFlag
{
NSRect r = NSZeroRect;
@ -569,11 +570,14 @@
}
}
if (r.size.width < 0)
r.size.width = 0;
if (r.size.height < 0)
r.size.height = 0;
if (!aFlag)
{
if (r.size.width < 0)
r.size.width = 0;
if (r.size.height < 0)
r.size.height = 0;
}
return r;
}