Change to GSThemeDrawing to implement drawTableHeaderRect:inView:

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@31673 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Gregory John Casamento 2010-11-27 18:17:49 +00:00
parent a34d9f2b4a
commit be0954d2ac
4 changed files with 110 additions and 86 deletions

View file

@ -44,6 +44,7 @@
#include "AppKit/NSScrollView.h"
#include "AppKit/NSGraphics.h"
#include "GSGuiPrivate.h"
#include "GNUstepGUI/GSTheme.h"
/*
* Number of pixels in either direction that will be counted as a hit
@ -165,91 +166,8 @@
*/
- (void)drawRect: (NSRect)aRect
{
NSArray *columns;
int firstColumnToDraw;
int lastColumnToDraw;
NSRect drawingRect;
NSTableColumn *column;
NSTableColumn *highlightedTableColumn;
float width;
int i;
NSCell *cell;
if (_tableView == nil)
return;
firstColumnToDraw = [self columnAtPoint: NSMakePoint (aRect.origin.x,
aRect.origin.y)];
if (firstColumnToDraw == -1)
firstColumnToDraw = 0;
lastColumnToDraw = [self columnAtPoint: NSMakePoint (NSMaxX (aRect),
aRect.origin.y)];
if (lastColumnToDraw == -1)
lastColumnToDraw = [_tableView numberOfColumns] - 1;
drawingRect = [self headerRectOfColumn: firstColumnToDraw];
columns = [_tableView tableColumns];
highlightedTableColumn = [_tableView highlightedTableColumn];
for (i = firstColumnToDraw; i < lastColumnToDraw; i++)
{
column = [columns objectAtIndex: i];
width = [column width];
drawingRect.size.width = width;
cell = [column headerCell];
if ((column == highlightedTableColumn)
|| [_tableView isColumnSelected: i])
{
[cell setHighlighted: YES];
}
else
{
[cell setHighlighted: NO];
}
[cell drawWithFrame: drawingRect
inView: self];
drawingRect.origin.x += width;
}
if (lastColumnToDraw == [_tableView numberOfColumns] - 1)
{
column = [columns objectAtIndex: lastColumnToDraw];
width = [column width] - 1;
drawingRect.size.width = width;
cell = [column headerCell];
if ((column == highlightedTableColumn)
|| [_tableView isColumnSelected: lastColumnToDraw])
{
[cell setHighlighted: YES];
}
else
{
[cell setHighlighted: NO];
}
[cell drawWithFrame: drawingRect
inView: self];
drawingRect.origin.x += width;
}
else
{
column = [columns objectAtIndex: lastColumnToDraw];
width = [column width];
drawingRect.size.width = width;
cell = [column headerCell];
if ((column == highlightedTableColumn)
|| [_tableView isColumnSelected: lastColumnToDraw])
{
[cell setHighlighted: YES];
}
else
{
[cell setHighlighted: NO];
}
[cell drawWithFrame: drawingRect
inView: self];
drawingRect.origin.x += width;
}
[[GSTheme theme] drawTableHeaderRect: aRect
inView: self];
}
/**