public static void InitSystemColors()
{
NSString white;
NSString lightGray;
NSString gray;
NSString darkGray;
NSString black;
// Set up a dictionary containing the names of all the system colors
// as keys and with colors in string format as values.
white = NSString.StringWithFormat(@"%g %g %g", (double)NSWhite, (double)NSWhite, (double)NSWhite);
lightGray = NSString.StringWithFormat(@"%g %g %g", (double)NSLightGray, (double)NSLightGray, (double)NSLightGray);
gray = NSString.StringWithFormat(@"%g %g %g", (double)NSGray, (double)NSGray, (double)NSGray);
darkGray = NSString.StringWithFormat(@"%g %g %g", (double)NSDarkGray, (double)NSDarkGray, (double)NSDarkGray);
black = NSString.StringWithFormat(@"%g %g %g", (double)NSBlack, (double)NSBlack, (double)NSBlack);
ColorStrings = (NSMutableDictionary)NSMutableDictionary.Alloc().InitWithObjectsAndKeys(
lightGray, (NSString)@"controlBackgroundColor",
lightGray, (NSString)@"controlColor",
lightGray, (NSString)@"controlHighlightColor",
white, (NSString)@"controlLightHighlightColor",
darkGray, (NSString)@"controlShadowColor",
black, (NSString)@"controlDarkShadowColor",
black, (NSString)@"controlTextColor",
darkGray, (NSString)@"disabledControlTextColor",
gray, (NSString)@"gridColor",
lightGray, (NSString)@"headerColor",
black, (NSString)@"headerTextColor",
white, (NSString)@"highlightColor",
black, (NSString)@"keyboardFocusIndicatorColor",
lightGray, (NSString)@"knobColor",
gray, (NSString)@"scrollBarColor",
white, (NSString)@"selectedControlColor",
black, (NSString)@"selectedControlTextColor",
lightGray, (NSString)@"selectedKnobColor",
white, (NSString)@"selectedMenuItemColor",
black, (NSString)@"selectedMenuItemTextColor",
lightGray, (NSString)@"selectedTextBackgroundColor",
black, (NSString)@"selectedTextColor",
black, (NSString)@"shadowColor",
white, (NSString)@"textBackgroundColor",
black, (NSString)@"textColor",
lightGray, (NSString)@"windowBackgroundColor",
black, (NSString)@"windowFrameColor",
white, (NSString)@"windowFrameTextColor",
black, (NSString)@"alternateSelectedControlColor",
white, (NSString)@"alternateSelectedControlTextColor",
white, (NSString)@"rowBackgroundColor",
lightGray, (NSString)@"alternateRowBackgroundColor",
lightGray, (NSString)@"secondarySelectedControlColor",
//gray, (NSString)@"windowFrameColor",
//black, (NSString)@"windowFrameTextColor",
null);
SystemColors = NSColorList.ColorListNamed(@"System");
DefaultSystemColors = (NSColorList)NSColorList.Alloc().InitWithName(@"System");
NSColorList._SetDefaultSystemColorList(DefaultSystemColors);
if (SystemColors == null)
{
SystemColors = DefaultSystemColors;
}
{
NSEnumerator enumerator;
NSString key;
// Set up default system colors
enumerator = ColorStrings.KeyEnumerator();
while ((key = (NSString)enumerator.NextObject()) != null)
{
NSColor color;
if ((color = SystemColors.ColorWithKey(key)) == null)
{
NSString aColorString;
aColorString = (NSString)ColorStrings.ObjectForKey(key);
color = NSColor.ColorFromString(aColorString);
//NSCAssert1(color, @"couldn't get default system color %@", key);
SystemColors.SetColor(color, key);
}
if (DefaultSystemColors != SystemColors)
{
DefaultSystemColors.SetColor(color, key);
}
}
}
SystemDict = (NSMutableDictionary)NSMutableDictionary.Alloc().Init();
}