mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-05-31 19:40:48 +00:00
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:
parent
2dc0ccead9
commit
46bf28532b
2 changed files with 25 additions and 16 deletions
|
@ -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>
|
Wed Aug 25 09:42:05 1999 Martin Man <Martin.Man@seznam.cz>
|
||||||
|
|
||||||
* Source/NSWindow.m ([NSWindow -setFrameTopLeftPoint:]): Corrected
|
* 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>
|
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.
|
controlDarkShadowColor rather than blackColor.
|
||||||
* Source/NSBox.m: draw line borders in correct color.
|
* Source/NSBox.m: draw line borders in correct color.
|
||||||
* Source/NSCell.m ditto
|
* Source/NSCell.m ditto
|
||||||
|
|
|
@ -37,7 +37,7 @@
|
||||||
#include <AppKit/NSTextFieldCell.h>
|
#include <AppKit/NSTextFieldCell.h>
|
||||||
|
|
||||||
@interface NSBox (Private)
|
@interface NSBox (Private)
|
||||||
- (NSRect) calcSizes;
|
- (NSRect) calcSizesAllowingNegative: (BOOL)aFlag;
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@implementation NSBox
|
@implementation NSBox
|
||||||
|
@ -106,7 +106,7 @@
|
||||||
if (border_type != aType)
|
if (border_type != aType)
|
||||||
{
|
{
|
||||||
border_type = aType;
|
border_type = aType;
|
||||||
[content_view setFrame: [self calcSizes]];
|
[content_view setFrame: [self calcSizesAllowingNegative: NO]];
|
||||||
[self setNeedsDisplay: YES];
|
[self setNeedsDisplay: YES];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -114,14 +114,14 @@
|
||||||
- (void) setTitle: (NSString *)aString
|
- (void) setTitle: (NSString *)aString
|
||||||
{
|
{
|
||||||
[cell setStringValue: aString];
|
[cell setStringValue: aString];
|
||||||
[content_view setFrame: [self calcSizes]];
|
[content_view setFrame: [self calcSizesAllowingNegative: NO]];
|
||||||
[self setNeedsDisplay: YES];
|
[self setNeedsDisplay: YES];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) setTitleFont: (NSFont *)fontObj
|
- (void) setTitleFont: (NSFont *)fontObj
|
||||||
{
|
{
|
||||||
[cell setFont: fontObj];
|
[cell setFont: fontObj];
|
||||||
[content_view setFrame: [self calcSizes]];
|
[content_view setFrame: [self calcSizesAllowingNegative: NO]];
|
||||||
[self setNeedsDisplay: YES];
|
[self setNeedsDisplay: YES];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -130,7 +130,7 @@
|
||||||
if (title_position != aPosition)
|
if (title_position != aPosition)
|
||||||
{
|
{
|
||||||
title_position = aPosition;
|
title_position = aPosition;
|
||||||
[content_view setFrame: [self calcSizes]];
|
[content_view setFrame: [self calcSizesAllowingNegative: NO]];
|
||||||
[self setNeedsDisplay: YES];
|
[self setNeedsDisplay: YES];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -179,7 +179,7 @@
|
||||||
{
|
{
|
||||||
[super replaceSubview: content_view with: aView];
|
[super replaceSubview: content_view with: aView];
|
||||||
content_view = aView;
|
content_view = aView;
|
||||||
[content_view setFrame: [self calcSizes]];
|
[content_view setFrame: [self calcSizesAllowingNegative: NO]];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -189,7 +189,7 @@
|
||||||
@"illegal margins supplied");
|
@"illegal margins supplied");
|
||||||
|
|
||||||
offsets = offsetSize;
|
offsets = offsetSize;
|
||||||
[content_view setFrame: [self calcSizes]];
|
[content_view setFrame: [self calcSizesAllowingNegative: NO]];
|
||||||
[self setNeedsDisplay: YES];
|
[self setNeedsDisplay: YES];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -199,7 +199,7 @@
|
||||||
- (void) setFrameFromContentFrame: (NSRect)contentFrame
|
- (void) setFrameFromContentFrame: (NSRect)contentFrame
|
||||||
{
|
{
|
||||||
// First calc the sizes to see how much we are off by
|
// 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];
|
NSRect f = [self frame];
|
||||||
|
|
||||||
NSAssert(contentFrame.size.width >= 0 && contentFrame.size.height >= 0,
|
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);
|
f.size.height = f.size.height + (contentFrame.size.height - r.size.height);
|
||||||
|
|
||||||
[self setFrame: f];
|
[self setFrame: f];
|
||||||
|
[content_view setFrame: [self calcSizesAllowingNegative: NO]];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) sizeToFit
|
- (void) sizeToFit
|
||||||
|
@ -237,7 +238,7 @@
|
||||||
- (void) resizeWithOldSuperviewSize: (NSSize)oldSize
|
- (void) resizeWithOldSuperviewSize: (NSSize)oldSize
|
||||||
{
|
{
|
||||||
[super resizeWithOldSuperviewSize: oldSize];
|
[super resizeWithOldSuperviewSize: oldSize];
|
||||||
[content_view setFrame: [self calcSizes]];
|
[content_view setFrame: [self calcSizesAllowingNegative: NO]];
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -341,7 +342,7 @@
|
||||||
|
|
||||||
@implementation NSBox (Private)
|
@implementation NSBox (Private)
|
||||||
|
|
||||||
- (NSRect)calcSizes
|
- (NSRect) calcSizesAllowingNegative: (BOOL)aFlag
|
||||||
{
|
{
|
||||||
NSRect r = NSZeroRect;
|
NSRect r = NSZeroRect;
|
||||||
|
|
||||||
|
@ -569,11 +570,14 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (r.size.width < 0)
|
if (!aFlag)
|
||||||
r.size.width = 0;
|
{
|
||||||
if (r.size.height < 0)
|
if (r.size.width < 0)
|
||||||
r.size.height = 0;
|
r.size.width = 0;
|
||||||
|
if (r.size.height < 0)
|
||||||
|
r.size.height = 0;
|
||||||
|
}
|
||||||
|
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue