Corrected the handling of the cellClass so that every subclass of

NSControl, that uses a cell, has its own implementaion of
[cellClass] and [setCellClass].


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@9544 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
FredKiefer 2001-04-09 21:28:49 +00:00
parent 8186809048
commit 68edce8d37
2 changed files with 50 additions and 16 deletions

View file

@ -29,13 +29,41 @@
#include <AppKit/NSImageCell.h>
#include <AppKit/NSImageView.h>
/*
* Class variables
*/
static Class usedCellClass;
static Class imageCellClass;
@implementation NSImageView
//
// Class methods
//
+ (void) initialize
{
if (self == [NSImageView class])
{
[self setVersion: 1];
imageCellClass = [NSImageCell class];
usedCellClass = imageCellClass;
}
}
/*
* Setting the Cell class
*/
+ (Class) cellClass
{
return [NSImageCell class];
return usedCellClass;
}
+ (void) setCellClass: (Class)factoryId
{
usedCellClass = factoryId ? factoryId : imageCellClass;
}
- (id) init
{
return [self initWithFrame: NSZeroRect];
@ -45,9 +73,6 @@
{
[super initWithFrame: aFrame];
// allocate the image cell
[self setCell: [[NSImageCell alloc] init]];
// set the default values
[self setImageAlignment: NSImageAlignCenter];
[self setImageFrameStyle: NSImageFrameNone];