* Header* Headers/AppKit/NSColor.h,

+	* Source/NSColor.m: Add tool tip named colours.
+	* Source/GSToolTips.m (+initialize, -_timedOut:): Get colours from NSColor.
This commit is contained in:
fredkiefer 2019-07-07 21:39:25 +02:00
parent 9657270757
commit 1e05899a0f
4 changed files with 31 additions and 4 deletions

View file

@ -1,3 +1,9 @@
2019-07-07 Fred Kiefer <FredKiefer@gmx.de>
* Headers/AppKit/NSColor.h,
* Source/NSColor.m: Add tool tip named colours.
* Source/GSToolTips.m (+initialize, -_timedOut:): Get colours from NSColor.
2019-04-17 Sergii Stoian <stoyan255@gmail.com>
* Source/GSDragView.m (_setCursor): Do not hold `cursors` array -

View file

@ -269,6 +269,10 @@ typedef NSUInteger NSControlSize;
// Pattern colour
- (NSImage*) patternImage;
// Tooltip colours
+ (NSColor*) toolTipColor;
+ (NSColor*) toolTipTextColor;
#endif
@end

View file

@ -236,8 +236,7 @@ static BOOL restoreMouseMoved;
backing: NSBackingStoreRetained
defer: YES];
[window setBackgroundColor:
[NSColor colorWithDeviceRed: 1.0 green: 1.0 blue: 0.90 alpha: 1.0]];
[window setBackgroundColor: [NSColor toolTipColor]];
[window setReleasedWhenClosed: NO];
[window setExcludedFromWindowsMenu: YES];
[window setLevel: NSPopUpMenuWindowLevel];
@ -638,6 +637,8 @@ static BOOL restoreMouseMoved;
attributes = [NSMutableDictionary dictionary];
[attributes setObject: [NSFont toolTipsFontOfSize: size]
forKey: NSFontAttributeName];
[attributes setObject: [NSColor toolTipTextColor]
forKey: NSForegroundColorAttributeName];
toolTipText =
[[NSAttributedString alloc] initWithString: toolTipString
attributes: attributes];

View file

@ -187,7 +187,8 @@ void initSystemColors(void)
NSString *gray;
NSString *darkGray;
NSString *black;
NSString *lightYellow;
// 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",
@ -200,7 +201,8 @@ void initSystemColors(void)
(double)NSDarkGray, (double)NSDarkGray, (double)NSDarkGray];
black = [NSString stringWithFormat: @"%g %g %g",
(double)NSBlack, (double)NSBlack, (double)NSBlack];
lightYellow = @"1.0 1.0 0.9";
colorStrings = [[NSMutableDictionary alloc]
initWithObjectsAndKeys:
black, @"alternateSelectedControlColor",
@ -241,6 +243,10 @@ void initSystemColors(void)
white, @"rowBackgroundColor",
lightGray, @"alternateRowBackgroundColor",
lightYellow, @"toolTipColor",
black, @"toolTipTextColor",
nil];
systemColors = RETAIN([NSColorList colorListNamed: @"System"]);
@ -883,6 +889,16 @@ systemColorWithName(NSString *name)
return systemColorWithName(@"textColor");
}
+ (NSColor*) toolTipColor
{
return systemColorWithName(@"toolTipColor");
}
+ (NSColor*) toolTipTextColor
{
return systemColorWithName(@"toolTipTextColor");
}
+ (NSColor *)windowBackgroundColor
{
return systemColorWithName(@"windowBackgroundColor");