mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-06-01 20:31:56 +00:00
Monor tidyups
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@5116 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
a62d5596c9
commit
4b2933e3ce
3 changed files with 695 additions and 665 deletions
|
@ -1,3 +1,8 @@
|
||||||
|
Tue Nov 2 1999 Richard Frith-Macdonald <richard@brainstorm.co.uk>
|
||||||
|
|
||||||
|
* Source/NSCell.m: Updated to notice changes in system colors,
|
||||||
|
also optimised a little by caching some classes.
|
||||||
|
|
||||||
Sat Oct 30 1999 Nicola Pero <n.pero@mi.flashnet.it>
|
Sat Oct 30 1999 Nicola Pero <n.pero@mi.flashnet.it>
|
||||||
|
|
||||||
Still work in progress, but this is a first preview
|
Still work in progress, but this is a first preview
|
||||||
|
|
|
@ -49,19 +49,36 @@
|
||||||
#include <AppKit/NSColor.h>
|
#include <AppKit/NSColor.h>
|
||||||
#include <AppKit/PSOperators.h>
|
#include <AppKit/PSOperators.h>
|
||||||
|
|
||||||
|
static Class colorClass;
|
||||||
|
static Class cellClass;
|
||||||
|
static Class fontClass;
|
||||||
|
static Class imageClass;
|
||||||
|
|
||||||
static NSColor *bgCol;
|
static NSColor *bgCol;
|
||||||
static NSColor *hbgCol;
|
static NSColor *hbgCol;
|
||||||
static NSColor *txtCol;
|
static NSColor *txtCol;
|
||||||
static NSColor *dtxtCol;
|
static NSColor *dtxtCol;
|
||||||
static NSColor *clearCol = nil;
|
static NSColor *clearCol;
|
||||||
|
static NSColor *shadowCol;
|
||||||
|
|
||||||
|
@interface NSCell (PrivateColor)
|
||||||
|
+ (void) _systemColorsChanged: (NSNotification*)n;
|
||||||
|
@end
|
||||||
|
|
||||||
|
@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
|
||||||
|
|
||||||
@implementation NSCell
|
@implementation NSCell
|
||||||
|
|
||||||
static Class imageClass;
|
|
||||||
static Class cellClass;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Class methods
|
* Class methods
|
||||||
*/
|
*/
|
||||||
|
@ -70,8 +87,20 @@ static Class cellClass;
|
||||||
if (self == [NSCell class])
|
if (self == [NSCell class])
|
||||||
{
|
{
|
||||||
[self setVersion: 1];
|
[self setVersion: 1];
|
||||||
imageClass = [NSImage class];
|
colorClass = [NSColor class];
|
||||||
cellClass = [NSCell class];
|
cellClass = [NSCell class];
|
||||||
|
fontClass = [NSFont class];
|
||||||
|
imageClass = [NSImage class];
|
||||||
|
/*
|
||||||
|
* Watch for changes to system colors, and simulate an initial change
|
||||||
|
* in order to set up our defaults.
|
||||||
|
*/
|
||||||
|
[[NSNotificationCenter defaultCenter]
|
||||||
|
addObserver: self
|
||||||
|
selector: @selector(_systemColorsChanged:)
|
||||||
|
name: NSSystemColorsDidChangeNotification
|
||||||
|
object: nil];
|
||||||
|
[self _systemColorsChanged: nil];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -102,20 +131,10 @@ static Class cellClass;
|
||||||
cell_float_left = 0;
|
cell_float_left = 0;
|
||||||
cell_float_right = 0;
|
cell_float_right = 0;
|
||||||
action_mask = NSLeftMouseUpMask;
|
action_mask = NSLeftMouseUpMask;
|
||||||
|
|
||||||
if (clearCol == nil)
|
|
||||||
{
|
|
||||||
bgCol = RETAIN([NSColor controlBackgroundColor]);
|
|
||||||
hbgCol = RETAIN([NSColor selectedControlColor]);
|
|
||||||
txtCol = RETAIN([NSColor controlTextColor]);
|
|
||||||
dtxtCol = RETAIN([NSColor disabledControlTextColor]);
|
|
||||||
clearCol = RETAIN([NSColor clearColor]);
|
|
||||||
}
|
|
||||||
|
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
- init
|
- (id) init
|
||||||
{
|
{
|
||||||
return [self initTextCell: @""];
|
return [self initTextCell: @""];
|
||||||
}
|
}
|
||||||
|
@ -132,7 +151,7 @@ static Class cellClass;
|
||||||
cell_type = NSImageCellType;
|
cell_type = NSImageCellType;
|
||||||
cell_image = RETAIN(anImage);
|
cell_image = RETAIN(anImage);
|
||||||
image_position = NSImageOnly;
|
image_position = NSImageOnly;
|
||||||
cell_font = RETAIN([NSFont userFontOfSize: 0]);
|
cell_font = RETAIN([fontClass userFontOfSize: 0]);
|
||||||
|
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
@ -143,7 +162,7 @@ static Class cellClass;
|
||||||
|
|
||||||
[self _init];
|
[self _init];
|
||||||
|
|
||||||
cell_font = RETAIN([NSFont userFontOfSize: 0]);
|
cell_font = RETAIN([fontClass userFontOfSize: 0]);
|
||||||
contents = RETAIN(aString);
|
contents = RETAIN(aString);
|
||||||
cell_type = NSTextCellType;
|
cell_type = NSTextCellType;
|
||||||
text_align = NSCenterTextAlignment;
|
text_align = NSCenterTextAlignment;
|
||||||
|
@ -354,7 +373,7 @@ static Class cellClass;
|
||||||
|
|
||||||
- (void) setStringValue: (NSString *)aString
|
- (void) setStringValue: (NSString *)aString
|
||||||
{
|
{
|
||||||
NSString* _string;
|
NSString *_string;
|
||||||
|
|
||||||
if (cell_type != NSTextCellType)
|
if (cell_type != NSTextCellType)
|
||||||
[self setType: NSTextCellType];
|
[self setType: NSTextCellType];
|
||||||
|
@ -437,8 +456,8 @@ static Class cellClass;
|
||||||
|
|
||||||
- (void) setFont: (NSFont *)fontObject
|
- (void) setFont: (NSFont *)fontObject
|
||||||
{
|
{
|
||||||
NSAssert(fontObject == nil || [fontObject isKindOfClass: [NSFont class]],
|
NSAssert(fontObject == nil || [fontObject isKindOfClass: fontClass],
|
||||||
NSInvalidArgumentException);
|
NSInvalidArgumentException);
|
||||||
|
|
||||||
ASSIGN(cell_font, fontObject);
|
ASSIGN(cell_font, fontObject);
|
||||||
}
|
}
|
||||||
|
@ -635,10 +654,10 @@ static Class cellClass;
|
||||||
|
|
||||||
- (void) _drawText: (NSString *) title inFrame: (NSRect) cellFrame
|
- (void) _drawText: (NSString *) title inFrame: (NSRect) cellFrame
|
||||||
{
|
{
|
||||||
NSColor *textColor;
|
NSColor *textColor;
|
||||||
NSFont *font;
|
NSFont *font;
|
||||||
float titleWidth;
|
float titleWidth;
|
||||||
float titleHeight;
|
float titleHeight;
|
||||||
NSDictionary *dict;
|
NSDictionary *dict;
|
||||||
|
|
||||||
if (!title)
|
if (!title)
|
||||||
|
@ -757,7 +776,7 @@ static Class cellClass;
|
||||||
// draw the border if needed
|
// draw the border if needed
|
||||||
if ([self isBordered])
|
if ([self isBordered])
|
||||||
{
|
{
|
||||||
[[NSColor controlDarkShadowColor] set];
|
[shadowCol set];
|
||||||
NSFrameRect(cellFrame);
|
NSFrameRect(cellFrame);
|
||||||
}
|
}
|
||||||
else if ([self isBezeled])
|
else if ([self isBezeled])
|
||||||
|
@ -1097,7 +1116,7 @@ static Class cellClass;
|
||||||
*/
|
*/
|
||||||
- (NSComparisonResult) compare: (id)otherCell
|
- (NSComparisonResult) compare: (id)otherCell
|
||||||
{
|
{
|
||||||
if ([otherCell isKindOfClass: [NSCell class]] == NO)
|
if ([otherCell isKindOfClass: cellClass] == NO)
|
||||||
[NSException raise: NSBadComparisonException
|
[NSException raise: NSBadComparisonException
|
||||||
format: @"NSCell comparison with non-NSCell"];
|
format: @"NSCell comparison with non-NSCell"];
|
||||||
if (cell_type != NSTextCellType
|
if (cell_type != NSTextCellType
|
||||||
|
|
1274
Source/NSText.m
1274
Source/NSText.m
File diff suppressed because it is too large
Load diff
Loading…
Add table
Add a link
Reference in a new issue