* Headers/AppKit/NSColor.h,

* Source/NSColor.m: Add OSX 10 named colours.
        * Source/NSColorList.m: Add keyed coding/decoding.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@38449 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Fred Kiefer 2015-04-02 22:54:42 +00:00
parent a47ee28eae
commit 1a8e5a320b
4 changed files with 73 additions and 19 deletions

View file

@ -1,3 +1,9 @@
2015-04-03 Fred Kiefer <FredKiefer@gmx.de>
* Headers/AppKit/NSColor.h,
* Source/NSColor.m: Add OSX 10 named colours.
* Source/NSColorList.m: Add keyed coding/decoding.
2015-03-27 Fred Kiefer <FredKiefer@gmx.de>
* Source/NSSavePanel.m: Fix problem with the title shown in

View file

@ -256,6 +256,12 @@ typedef NSUInteger NSControlSize;
+ (NSColor*) windowBackgroundColor;
+ (NSColor*) windowFrameColor;
+ (NSColor*) windowFrameTextColor;
#if OS_API_VERSION(MAC_OS_X_VERSION_10_10, GS_API_LATEST)
+ (NSColor*) labelColor;
+ (NSColor*) secondaryLabelColor;
+ (NSColor*) tertiaryLabelColor;
+ (NSColor*) quaternaryLabelColor;
#endif
#if OS_API_VERSION(MAC_OS_X_VERSION_10_3, GS_API_LATEST)
+ (NSArray*) controlAlternatingRowBackgroundColors;

View file

@ -203,12 +203,14 @@ void initSystemColors(void)
colorStrings = [[NSMutableDictionary alloc]
initWithObjectsAndKeys:
black, @"alternateSelectedControlColor",
white, @"alternateSelectedControlTextColor",
lightGray, @"controlBackgroundColor",
lightGray, @"controlColor",
black, @"controlDarkShadowColor",
lightGray, @"controlHighlightColor",
white, @"controlLightHighlightColor",
darkGray, @"controlShadowColor",
black, @"controlDarkShadowColor",
black, @"controlTextColor",
darkGray, @"disabledControlTextColor",
gray, @"gridColor",
@ -217,7 +219,11 @@ void initSystemColors(void)
white, @"highlightColor",
black, @"keyboardFocusIndicatorColor",
lightGray, @"knobColor",
black, @"labelColor",
black, @"quaternaryLabelColor",
gray, @"scrollBarColor",
black, @"secondaryLabelColor",
lightGray, @"secondarySelectedControlColor",
white, @"selectedControlColor",
black, @"selectedControlTextColor",
lightGray, @"selectedKnobColor",
@ -226,18 +232,15 @@ void initSystemColors(void)
lightGray, @"selectedTextBackgroundColor",
black, @"selectedTextColor",
black, @"shadowColor",
black, @"tertiaryLabelColor",
white, @"textBackgroundColor",
black, @"textColor",
lightGray, @"windowBackgroundColor",
black, @"windowFrameColor",
white, @"windowFrameTextColor",
black, @"alternateSelectedControlColor",
white, @"alternateSelectedControlTextColor",
white, @"rowBackgroundColor",
lightGray, @"alternateRowBackgroundColor",
lightGray, @"secondarySelectedControlColor",
//gray, @"windowFrameColor",
//black, @"windowFrameTextColor",
nil];
systemColors = RETAIN([NSColorList colorListNamed: @"System"]);
@ -487,8 +490,8 @@ systemColorWithName(NSString *name)
+ (NSColor*) colorForControlTint: (NSControlTint)controlTint
{
switch (controlTint)
{
switch (controlTint)
{
default:
case NSDefaultControlTint:
return [self colorForControlTint: [self currentControlTint]];
@ -498,13 +501,13 @@ systemColorWithName(NSString *name)
// FIXME
case NSBlueControlTint:
return [NSColor blueColor];
}
}
}
+ (NSControlTint) currentControlTint
{
// FIXME: should be made a system setting
return NSBlueControlTint;
// FIXME: should be made a system setting
return NSBlueControlTint;
}
+ (NSColor*) colorWithPatternImage: (NSImage*)image
@ -740,6 +743,11 @@ systemColorWithName(NSString *name)
return systemColorWithName(@"controlColor");
}
+ (NSColor*) controlDarkShadowColor
{
return systemColorWithName(@"controlDarkShadowColor");
}
+ (NSColor*) controlHighlightColor
{
return systemColorWithName(@"controlHighlightColor");
@ -755,11 +763,6 @@ systemColorWithName(NSString *name)
return systemColorWithName(@"controlShadowColor");
}
+ (NSColor*) controlDarkShadowColor
{
return systemColorWithName(@"controlDarkShadowColor");
}
+ (NSColor*) controlTextColor
{
return systemColorWithName(@"controlTextColor");
@ -800,11 +803,26 @@ systemColorWithName(NSString *name)
return systemColorWithName(@"knobColor");
}
+ (NSColor*) labelColor
{
return systemColorWithName(@"labelColor");
}
+ (NSColor*) quaternaryLabelColor
{
return systemColorWithName(@"quaternaryLabelColor");
}
+ (NSColor*) scrollBarColor
{
return systemColorWithName(@"scrollBarColor");
}
+ (NSColor*) secondaryLabelColor
{
return systemColorWithName(@"secondaryLabelColor");
}
+ (NSColor*) secondarySelectedControlColor
{
return systemColorWithName(@"secondarySelectedControlColor");
@ -850,6 +868,11 @@ systemColorWithName(NSString *name)
return systemColorWithName(@"shadowColor");
}
+ (NSColor*) tertiaryLabelColor
{
return systemColorWithName(@"tertiaryLabelColor");
}
+ (NSColor*) textBackgroundColor
{
return systemColorWithName(@"textBackgroundColor");

View file

@ -535,8 +535,20 @@ static NSColorList *themeColorList = nil;
{
if ([aCoder allowsKeyedCoding])
{
// FIXME
}
NSMutableArray *colors = [[NSMutableArray alloc] init];
NSInteger i;
for (i = 0; i < [_orderedColorKeys count]; i++)
{
NSString *name = [_orderedColorKeys objectAtIndex: i];
[colors insertObject: [_colorDictionary objectForKey: name]
atIndex: i];
}
[aCoder encodeObject: _name forKey: @"NSName"];
[aCoder encodeObject: _orderedColorKeys forKey: @"NSKeys"];
[aCoder encodeObject: colors forKey: @"NSColors"];
RELEASE(colors);
}
else
{
[aCoder encodeObject: _name];
@ -549,7 +561,14 @@ static NSColorList *themeColorList = nil;
{
if ([aDecoder allowsKeyedCoding])
{
// FIXME
NSArray *colors;
ASSIGN(_name, [aDecoder decodeObjectForKey: @"NSName"]);
ASSIGN(_orderedColorKeys, [aDecoder decodeObjectForKey: @"NSKeys"]);
colors = [aDecoder decodeObjectForKey: @"NSColors"];
_colorDictionary = [[NSMutableDictionary alloc]
initWithObjects: colors
forKeys: _orderedColorKeys];
}
else
{