Use setHighlighted: on table header cells instead of setting their background

color directly


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@15773 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
nico 2003-01-30 04:27:26 +00:00
parent 1986c09996
commit c11218da2c

View file

@ -187,20 +187,11 @@
if ((column == highlightedTableColumn) if ((column == highlightedTableColumn)
|| [_tableView isColumnSelected: i]) || [_tableView isColumnSelected: i])
{ {
/* FIXME/TODO - cell can be any subclass of NSCell
(specially a custom subclass), which might not implement
setBackgroundColor: (or might not want us to mess up its
custom drawing by hardcoding a background color here) -
so we should not call it. Instead, NSTableHeaderCell
should override setHighlighted: to change the background
color. */
[cell setHighlighted: YES]; [cell setHighlighted: YES];
[cell setBackgroundColor: [NSColor controlColor]];
} }
else else
{ {
[cell setHighlighted: NO]; [cell setHighlighted: NO];
[cell setBackgroundColor: [NSColor controlShadowColor]];
} }
[cell drawWithFrame: drawingRect [cell drawWithFrame: drawingRect
inView: self]; inView: self];
@ -216,12 +207,10 @@
|| [_tableView isColumnSelected: lastColumnToDraw]) || [_tableView isColumnSelected: lastColumnToDraw])
{ {
[cell setHighlighted: YES]; [cell setHighlighted: YES];
[cell setBackgroundColor: [NSColor controlColor]];
} }
else else
{ {
[cell setHighlighted: NO]; [cell setHighlighted: NO];
[cell setBackgroundColor: [NSColor controlShadowColor]];
} }
[cell drawWithFrame: drawingRect [cell drawWithFrame: drawingRect
inView: self]; inView: self];
@ -237,12 +226,10 @@
|| [_tableView isColumnSelected: lastColumnToDraw]) || [_tableView isColumnSelected: lastColumnToDraw])
{ {
[cell setHighlighted: YES]; [cell setHighlighted: YES];
[cell setBackgroundColor: [NSColor controlColor]];
} }
else else
{ {
[cell setHighlighted: NO]; [cell setHighlighted: NO];
[cell setBackgroundColor: [NSColor controlShadowColor]];
} }
[cell drawWithFrame: drawingRect [cell drawWithFrame: drawingRect
inView: self]; inView: self];
@ -530,8 +517,7 @@
objectAtIndex: columnIndex]]; objectAtIndex: columnIndex]];
rect.origin.y++; rect.origin.y++;
rect.size.height--; rect.size.height--;
[[currentColumn headerCell] [[currentColumn headerCell] setHighlighted: YES];
setBackgroundColor: [NSColor controlColor]];
[[currentColumn headerCell] [[currentColumn headerCell]
highlight: YES highlight: YES
@ -767,7 +753,7 @@
rect.origin.y++; rect.origin.y++;
rect.size.height--; rect.size.height--;
[[currentColumn headerCell] [[currentColumn headerCell]
setBackgroundColor: [NSColor controlShadowColor]]; setHighlighted: NO];
[[currentColumn headerCell] [[currentColumn headerCell]
highlight: NO highlight: NO
@ -822,7 +808,7 @@
rect.origin.y++; rect.origin.y++;
rect.size.height--; rect.size.height--;
[[currentColumn headerCell] [[currentColumn headerCell]
setBackgroundColor: [NSColor controlShadowColor]]; setHighlighted: NO];
[[currentColumn headerCell] [[currentColumn headerCell]
highlight: NO highlight: NO
@ -852,8 +838,7 @@
rect.origin.y++; rect.origin.y++;
rect.size.height--; rect.size.height--;
NSLog(@"highlight"); NSLog(@"highlight");
[[currentColumn headerCell] [[currentColumn headerCell] setHighlighted: NO];
setBackgroundColor: [NSColor controlShadowColor]];
[[currentColumn headerCell] [[currentColumn headerCell]
highlight: NO highlight: NO