Move corner view drawing into GSTheme.

Add new 10.3 methods for NSTableHeaderCell.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@28985 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
fredkiefer 2009-11-09 14:53:59 +00:00
parent 6f96e84bc6
commit 48bf51f21c
7 changed files with 90 additions and 27 deletions

View file

@ -728,6 +728,28 @@
}
}
// Table drawing methods
- (void) drawTableCornerView: (NSView*)cornerView
withClip: (NSRect)aRect
{
NSRect divide;
NSRect rect;
if ([cornerView isFlipped])
{
NSDivideRect(aRect, &divide, &rect, 1.0, NSMaxYEdge);
}
else
{
NSDivideRect(aRect, &divide, &rect, 1.0, NSMinYEdge);
}
[[NSColor blackColor] set];
NSRectFill(divide);
rect = [self drawDarkButton: rect withClip: aRect];
[[NSColor controlShadowColor] set];
NSRectFill(rect);
}
// Window decoration drawing methods
/* These include the black border. */

View file

@ -24,19 +24,20 @@
Boston, MA 02110-1301, USA.
*/
#include "AppKit/NSTableHeaderCell.h"
#include "AppKit/NSColor.h"
#include "AppKit/NSFont.h"
#import "AppKit/NSColor.h"
#import "AppKit/NSFont.h"
#import "AppKit/NSImage.h"
#import "AppKit/NSTableHeaderCell.h"
#include "GNUstepGUI/GSTheme.h"
@implementation NSTableHeaderCell
{
}
// Default appearance of NSTableHeaderCell
- (id) initTextCell: (NSString *)aString
{
[super initTextCell: aString];
self = [super initTextCell: aString];
if (!self)
return nil;
[self setAlignment: NSCenterTextAlignment];
[self setTextColor: [NSColor windowFrameTextColor]];
@ -75,6 +76,36 @@
[self _drawBackgroundWithFrame: cellFrame inView: controlView];
}
- (void) drawSortIndicatorWithFrame: (NSRect)cellFrame
inView: (NSView *)controlView
ascending: (BOOL)ascending
priority: (int)priority
{
NSImage *img;
cellFrame = [self sortIndicatorRectForBounds: cellFrame];
if (ascending)
img = [NSImage imageNamed: @"NSAscendingSortIndicator"];
else
img = [NSImage imageNamed: @"NSDescendingSortIndicator"];
[img drawAtPoint: cellFrame.origin
fromRect: NSZeroRect
operation: NSCompositeSourceOver
fraction: 1.0];
}
- (NSRect) sortIndicatorRectForBounds: (NSRect)theRect
{
NSImage *img = [NSImage imageNamed: @"NSAscendingSortIndicator"];
NSSize size = [img size];
theRect.origin.x = NSMaxX(theRect) - size.width;
theRect.size = size;
return theRect;
}
- (void) setHighlighted: (BOOL)flag
{
_cell.is_highlighted = flag;

View file

@ -1934,23 +1934,7 @@ static void computeNewSelection
- (void) drawRect: (NSRect)aRect
{
NSRect divide;
NSRect rect;
if ([self isFlipped])
{
NSDivideRect(aRect, &divide, &rect, 1.0, NSMaxYEdge);
}
else
{
NSDivideRect(aRect, &divide, &rect, 1.0, NSMinYEdge);
}
[[NSColor blackColor] set];
NSRectFill(divide);
rect = [[GSTheme theme] drawDarkButton: rect withClip: aRect];
[[NSColor controlShadowColor] set];
NSRectFill(rect);
[[GSTheme theme] drawTableCornerView: self withClip: aRect];
}
@end

View file

@ -202,13 +202,13 @@
inView: (NSView*)controlView
{
if (_textfieldcell_draws_background)
{
{
if ([self isEnabled])
{
{
[_background_color set];
}
else
{
{
[[NSColor controlBackgroundColor] set];
}
NSRectFill([self drawingRectForBounds: cellFrame]);