mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-04-23 07:00:46 +00:00
* Source/GSThemeDrawing.m (-drawTableViewBackgroundInClipRect:...):
Add support for drawing striped table backgrounds, using the colors returned by [NSColor controlAlternatingRowBackgroundColors]. Currently not used because -[NSTableView usesAlternatingRowBackgroundColors] is hardcoded to return NO. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@37226 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
9dfd31dc6e
commit
856b71dd2f
2 changed files with 49 additions and 2 deletions
|
@ -1,3 +1,12 @@
|
|||
2013-10-14 Eric Wasylishen <ewasylishen@gmail.com>
|
||||
|
||||
* Source/GSThemeDrawing.m (-drawTableViewBackgroundInClipRect:...):
|
||||
Add support for drawing striped table backgrounds, using the colors
|
||||
returned by [NSColor controlAlternatingRowBackgroundColors].
|
||||
Currently not used because
|
||||
-[NSTableView usesAlternatingRowBackgroundColors] is hardcoded to
|
||||
return NO.
|
||||
|
||||
2013-10-13 Eric Wasylishen <ewasylishen@gmail.com>
|
||||
|
||||
* Source/NSSliderCell.m (-drawKnob:): Don't fill the knob
|
||||
|
|
|
@ -2805,13 +2805,51 @@ typedef enum {
|
|||
// Default implementation of this method does nothing.
|
||||
}
|
||||
|
||||
- (void) drawTableViewBackgroundInClipRect: (NSRect)clipRect
|
||||
- (void) drawTableViewBackgroundInClipRect: (NSRect)aRect
|
||||
inView: (NSView *)view
|
||||
withBackgroundColor: (NSColor *)backgroundColor
|
||||
{
|
||||
NSTableView *tableView = (NSTableView *)view;
|
||||
|
||||
[backgroundColor set];
|
||||
NSRectFill (clipRect);
|
||||
NSRectFill (aRect);
|
||||
|
||||
if ([tableView usesAlternatingRowBackgroundColors])
|
||||
{
|
||||
const CGFloat rowHeight = [tableView rowHeight];
|
||||
NSInteger startingRow = [tableView rowAtPoint: NSMakePoint(0, NSMinY(aRect))];
|
||||
NSInteger endingRow;
|
||||
NSInteger i;
|
||||
|
||||
NSArray *rowColors = [NSColor controlAlternatingRowBackgroundColors];
|
||||
const NSUInteger rowColorCount = [rowColors count];
|
||||
|
||||
NSRect rowRect;
|
||||
|
||||
if (rowHeight <= 0
|
||||
|| rowColorCount == 0
|
||||
|| aRect.size.height <= 0)
|
||||
return;
|
||||
|
||||
if (startingRow <= 0)
|
||||
startingRow = 0;
|
||||
|
||||
rowRect = [tableView rectOfRow: startingRow];
|
||||
rowRect.origin.x = aRect.origin.x;
|
||||
rowRect.size.width = aRect.size.width;
|
||||
|
||||
endingRow = startingRow + ceil(aRect.size.height / rowHeight);
|
||||
|
||||
for (i = startingRow; i <= endingRow; i++)
|
||||
{
|
||||
NSColor *color = [rowColors objectAtIndex: (i % rowColorCount)];
|
||||
|
||||
[color set];
|
||||
NSRectFill(rowRect);
|
||||
|
||||
rowRect.origin.y += rowHeight;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
- (void) drawTableViewGridInClipRect: (NSRect)aRect
|
||||
|
|
Loading…
Reference in a new issue