mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-05-31 17:10:58 +00:00
Merge Headers/AppKit/NSBrowser.h Source/NSBrowser.m Source/NSBrowserCell.m
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/branches/gnustep_testplant_branch@38664 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
ca87d7eb34
commit
a06204c706
3 changed files with 442 additions and 59 deletions
|
@ -276,6 +276,55 @@ static NSFont *_leafFont;
|
|||
*/
|
||||
}
|
||||
|
||||
- (NSRect) titleRectForBounds: (NSRect)theRect
|
||||
{
|
||||
NSRect titleRect = [super titleRectForBounds: theRect];
|
||||
NSImage *branch_image = nil;
|
||||
NSImage *cell_image = [self image];
|
||||
|
||||
if (_cell.is_highlighted || _cell.state)
|
||||
{
|
||||
if (!_browsercell_is_leaf)
|
||||
{
|
||||
branch_image = [object_getClass(self) highlightedBranchImage];
|
||||
}
|
||||
if (nil != [self alternateImage])
|
||||
{
|
||||
cell_image = [self alternateImage];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!_browsercell_is_leaf)
|
||||
{
|
||||
branch_image = [object_getClass(self) branchImage];
|
||||
}
|
||||
}
|
||||
|
||||
if (branch_image)
|
||||
{
|
||||
NSRect imgRect;
|
||||
|
||||
imgRect.size = [branch_image size];
|
||||
titleRect.size.width -= imgRect.size.width + 8;
|
||||
}
|
||||
|
||||
if (cell_image)
|
||||
{
|
||||
NSRect imgRect;
|
||||
|
||||
imgRect.size = [cell_image size];
|
||||
titleRect.origin.x += imgRect.size.width + 4;
|
||||
titleRect.size.width -= imgRect.size.width + 4;
|
||||
}
|
||||
|
||||
// Skip 2 points from the left border
|
||||
titleRect.origin.x += 2;
|
||||
titleRect.size.width -= 2;
|
||||
|
||||
return titleRect;
|
||||
}
|
||||
|
||||
/*
|
||||
* Displaying
|
||||
*/
|
||||
|
@ -342,9 +391,9 @@ static NSFont *_leafFont;
|
|||
imgRect.origin.y = MAX(NSMidY(title_rect) - (imgRect.size.height/2.),0.);
|
||||
|
||||
if (controlView != nil)
|
||||
{
|
||||
imgRect = [controlView centerScanRect: imgRect];
|
||||
}
|
||||
{
|
||||
imgRect = [controlView centerScanRect: imgRect];
|
||||
}
|
||||
|
||||
[cell_image drawInRect: imgRect
|
||||
fromRect: NSZeroRect
|
||||
|
@ -358,8 +407,15 @@ static NSFont *_leafFont;
|
|||
}
|
||||
|
||||
// Draw the body of the cell
|
||||
[self _drawAttributedText: [self attributedStringValue]
|
||||
inFrame: title_rect];
|
||||
if (_cell.in_editing)
|
||||
{
|
||||
[self _drawEditorWithFrame: cellFrame inView: controlView];
|
||||
}
|
||||
else
|
||||
{
|
||||
[self _drawAttributedText: [self attributedStringValue]
|
||||
inFrame: title_rect];
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue