Removed drawing of background so that it is easier for subclasses

to implement a custom background drawing while referring to super
for text/image drawing [canonical example: NSTextFieldCell].


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@5220 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Nicola Pero 1999-11-16 23:59:20 +00:00
parent ad45f6350b
commit aa04d96075

View file

@ -55,11 +55,8 @@ static Class cellClass;
static Class fontClass;
static Class imageClass;
static NSColor *bgCol;
static NSColor *hbgCol;
static NSColor *txtCol;
static NSColor *dtxtCol;
static NSColor *clearCol;
static NSColor *shadowCol;
@interface NSCell (PrivateColor)
@ -69,11 +66,8 @@ static NSColor *shadowCol;
@implementation NSCell (PrivateColor)
+ (void) _systemColorsChanged: (NSNotification*)n
{
ASSIGN(bgCol, [colorClass controlBackgroundColor]);
ASSIGN(hbgCol, [colorClass selectedControlColor]);
ASSIGN(txtCol, [colorClass controlTextColor]);
ASSIGN(dtxtCol, [colorClass disabledControlTextColor]);
ASSIGN(clearCol, [colorClass clearColor]);
ASSIGN(shadowCol, [colorClass controlDarkShadowColor]);
}
@end
@ -499,11 +493,6 @@ static NSColor *shadowCol;
else
[textObject setTextColor: dtxtCol];
if (cell_highlighted)
[textObject setBackgroundColor: hbgCol];
else
[textObject setBackgroundColor: bgCol];
[textObject setFont: [self font]];
[textObject setAlignment: [self alignment]];
[textObject setEditable: [self isEditable]];
@ -551,9 +540,9 @@ static NSColor *shadowCol;
[textObject setFrame: [self drawingRectForBounds: aRect]];
[textObject setText: [self stringValue]];
[textObject setSelectedRange: NSMakeRange (selStart, selLength)];
[textObject setDelegate: anObject];
[controlView addSubview: textObject];
[textObject setSelectedRange: NSMakeRange (selStart, selLength)];
[[controlView window] makeFirstResponder: textObject];
[textObject display];
}
@ -709,27 +698,15 @@ static NSColor *shadowCol;
[title drawInRect: cellFrame withAttributes: dict];
}
//
// This drawing is minimal and with no background,
// to make it easier for subclass to customize drawing.
//
- (void) drawInteriorWithFrame: (NSRect)cellFrame inView: (NSView*)controlView
{
cellFrame = [self drawingRectForBounds: cellFrame];
[controlView lockFocus];
// Clear the cell frame
if ([self isOpaque])
{
NSColor *bg;
if (cell_highlighted)
bg = hbgCol;
else
bg = bgCol;
[bg set];
[cell_image setBackgroundColor: bg];
NSRectFill(cellFrame);
}
else
[cell_image setBackgroundColor: clearCol];
switch ([self type])
{
case NSTextCellType: