Use theme tiles (if available) to draw table headers. New tile names are

GSTableHeader and GSTableCorner.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@29444 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Eric Wasylishen 2010-01-29 22:21:34 +00:00
parent cd3d1785e3
commit ffc734898c
6 changed files with 55 additions and 26 deletions

View file

@ -1,3 +1,13 @@
2010-01-29 Eric Wasylishen <ewasylishen@gmail.com>
* Source/NSTableHeaderCell.m:
* Source/GSTheme.m:
* Source/NSTableHeaderView.m:
* Source/GSThemeDrawing.m:
* Headers/Additions/GNUstepGUI/GSTheme.h: Use theme tiles (if available)
to draw table headers. New tile names are GSTableHeader and
GSTableCorner.
2010-01-29 Eric Wasylishen <ewasylishen@gmail.com> 2010-01-29 Eric Wasylishen <ewasylishen@gmail.com>
* Source/GSThemeDrawing.m (-cellForScrollerKnobSlot:): If there are * Source/GSThemeDrawing.m (-cellForScrollerKnobSlot:): If there are

View file

@ -259,6 +259,11 @@ APPKIT_EXPORT NSString *GSScrollerUpArrow;
APPKIT_EXPORT NSString *GSScrollerVerticalKnob; APPKIT_EXPORT NSString *GSScrollerVerticalKnob;
APPKIT_EXPORT NSString *GSScrollerVerticalSlot; APPKIT_EXPORT NSString *GSScrollerVerticalSlot;
/* Names for table view parts */
APPKIT_EXPORT NSString *GSTableHeader;
APPKIT_EXPORT NSString *GSTableCorner;
/** /**
* This defines how the values in a tile array should be used when * This defines how the values in a tile array should be used when
* drawing a rectangle. Mostly this just effects the center, middle * drawing a rectangle. Mostly this just effects the center, middle

View file

@ -72,6 +72,12 @@ NSString *GSScrollerUpArrow = @"GSScrollerUpArrow";
NSString *GSScrollerVerticalKnob = @"GSScrollerVerticalKnob"; NSString *GSScrollerVerticalKnob = @"GSScrollerVerticalKnob";
NSString *GSScrollerVerticalSlot = @"GSScrollerVerticalSlot"; NSString *GSScrollerVerticalSlot = @"GSScrollerVerticalSlot";
// Table view part names
NSString *GSTableHeader = @"GSTableHeader";
NSString *GSTableCorner = @"GSTableCorner";
NSString *GSThemeDidActivateNotification NSString *GSThemeDidActivateNotification
= @"GSThemeDidActivateNotification"; = @"GSThemeDidActivateNotification";
NSString *GSThemeDidDeactivateNotification NSString *GSThemeDidDeactivateNotification

View file

@ -959,6 +959,7 @@ static NSImage *spinningImages[MaxCount];
{ {
NSRect divide; NSRect divide;
NSRect rect; NSRect rect;
GSDrawTiles *tiles = [self tilesNamed: GSTableCorner state: GSThemeNormalState];
if ([cornerView isFlipped]) if ([cornerView isFlipped])
{ {
@ -969,11 +970,20 @@ static NSImage *spinningImages[MaxCount];
NSDivideRect(aRect, &divide, &rect, 1.0, NSMinYEdge); NSDivideRect(aRect, &divide, &rect, 1.0, NSMinYEdge);
} }
[[NSColor blackColor] set]; if (tiles == nil)
NSRectFill(divide); {
rect = [self drawDarkButton: rect withClip: aRect]; [[NSColor blackColor] set];
[[NSColor controlShadowColor] set]; NSRectFill(divide);
NSRectFill(rect); rect = [self drawDarkButton: rect withClip: aRect];
[[NSColor controlShadowColor] set];
NSRectFill(rect);
}
else
{
[self fillRect: aRect
withTiles: tiles
background: [NSColor clearColor]];
}
} }
- (void) drawTableHeaderCell: (NSTableHeaderCell *)cell - (void) drawTableHeaderCell: (NSTableHeaderCell *)cell
@ -981,13 +991,29 @@ static NSImage *spinningImages[MaxCount];
inView: (NSView *)controlView inView: (NSView *)controlView
state: (GSThemeControlState)state state: (GSThemeControlState)state
{ {
if (state == GSThemeHighlightedState) GSDrawTiles *tiles = [self tilesNamed: GSTableHeader state: state];
if (tiles == nil)
{ {
[self drawButton: cellFrame withClip: cellFrame]; NSRect rect;
if (state == GSThemeHighlightedState)
{
rect = [self drawButton: cellFrame withClip: cellFrame];
[[NSColor controlColor] set];
NSRectFill(rect);
}
else
{
rect = [self drawDarkButton: cellFrame withClip: cellFrame];
[[NSColor controlShadowColor] set];
NSRectFill(rect);
}
} }
else else
{ {
[self drawDarkButton: cellFrame withClip: cellFrame]; [self fillRect: cellFrame
withTiles: tiles
background: [NSColor clearColor]];
} }
} }

View file

@ -78,9 +78,6 @@
withFrame: cellFrame withFrame: cellFrame
inView: controlView inView: controlView
state: state]; state: state];
// Draw the label
[self _drawBackgroundWithFrame: cellFrame inView: controlView];
} }
- (void) drawSortIndicatorWithFrame: (NSRect)cellFrame - (void) drawSortIndicatorWithFrame: (NSRect)cellFrame

View file

@ -254,21 +254,6 @@
inView: self]; inView: self];
drawingRect.origin.x += width; drawingRect.origin.x += width;
} }
{
NSRectEdge up_sides[] = {NSMinYEdge, NSMaxXEdge};
NSRectEdge dn_sides[] = {NSMaxYEdge, NSMaxXEdge};
float grays[] = {NSBlack, NSBlack};
if (![self isFlipped])
{
NSDrawTiledRects(_bounds, aRect, up_sides, grays, 2);
}
else
{
NSDrawTiledRects(_bounds, aRect, dn_sides, grays, 2);
}
}
} }
/** /**