mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-05-30 14:20:37 +00:00
Fix NSFormCell drawing and sizing
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@4906 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
4d92dd99d1
commit
3ed0bfd3d6
2 changed files with 27 additions and 1 deletions
|
@ -43,7 +43,6 @@
|
|||
- initTextCell: (NSString *)aString
|
||||
{
|
||||
self = [super initTextCell:@""];
|
||||
[self setBordered:YES];
|
||||
[self setBezeled:YES];
|
||||
[self setAlignment:NSLeftTextAlignment];
|
||||
titleWidth = -1;
|
||||
|
@ -114,6 +113,25 @@
|
|||
return 0;
|
||||
}
|
||||
|
||||
- (NSSize)cellSize
|
||||
{
|
||||
NSSize returnedSize;
|
||||
NSSize titleSize = [titleCell cellSize];
|
||||
NSSize textSize = [super cellSize];
|
||||
|
||||
textSize.width = [cell_font widthOfString: @"minimum"];
|
||||
textSize.height = [cell_font pointSize] + (2 * yDist)
|
||||
+ 2 * ([NSCell sizeForBorderType: NSBezelBorder].height);
|
||||
|
||||
returnedSize.width = titleSize.width + 4 + textSize.width;
|
||||
if (titleSize.height > textSize.height)
|
||||
returnedSize.height = titleSize.height;
|
||||
else
|
||||
returnedSize.height = textSize.height;
|
||||
|
||||
return returnedSize;
|
||||
}
|
||||
|
||||
- (void) drawWithFrame: (NSRect)cellFrame inView: (NSView*)controlView
|
||||
{
|
||||
NSRect titleFrame;
|
||||
|
@ -121,6 +139,7 @@
|
|||
|
||||
NSDivideRect(cellFrame, &titleFrame, &textFrame,
|
||||
[self titleWidth] + 4, NSMinXEdge);
|
||||
titleFrame.size.width -= 4;
|
||||
|
||||
[titleCell drawWithFrame: titleFrame inView: controlView];
|
||||
[super drawWithFrame: textFrame inView: controlView];
|
||||
|
@ -139,3 +158,4 @@
|
|||
}
|
||||
|
||||
@end
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue