summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAlan Third <alan@idiocy.org>2017-12-23 11:00:35 +0000
committerAlan Third <alan@idiocy.org>2018-01-06 22:50:35 +0000
commit15cd18991c1d9a9bafeef7bf9b4dad91ecc0332a (patch)
treefca8d2460b73c843ac270c6ce9c0194ec59ca326 /src
parent5fd229735384a5fa479466124a181bf7d4ea8dab (diff)
downloademacs-15cd18991c1d9a9bafeef7bf9b4dad91ecc0332a.tar.gz
Allow setting tooltip colors in NS port
* src/nsfns.m (Fx_show_tip): Get face colors and apply them to the tooltip. * src/nsmenu.m (EmacsTooltip::setBackgroundColor): (EmacsTooltip::setForegroundColor): New functions. * src/nsterm.h (EmacsTooltip::setBackgroundColor): (EmacsTooltip::setForegroundColor): New function prototypes.
Diffstat (limited to 'src')
-rw-r--r--src/nsfns.m10
-rw-r--r--src/nsmenu.m10
-rw-r--r--src/nsterm.h2
3 files changed, 22 insertions, 0 deletions
diff --git a/src/nsfns.m b/src/nsfns.m
index d5049a7a911..3ede63f9854 100644
--- a/src/nsfns.m
+++ b/src/nsfns.m
@@ -2873,6 +2873,8 @@ Text larger than the specified size is clipped. */)
struct frame *f;
char *str;
NSSize size;
+ NSColor *color;
+ Lisp_Object t;
specbind (Qinhibit_redisplay, Qt);
@@ -2900,6 +2902,14 @@ Text larger than the specified size is clipped. */)
else
Fx_hide_tip ();
+ t = x_get_arg (NULL, parms, Qbackground_color, NULL, NULL, RES_TYPE_STRING);
+ if (ns_lisp_to_color (t, &color) == 0)
+ [ns_tooltip setBackgroundColor: color];
+
+ t = x_get_arg (NULL, parms, Qforeground_color, NULL, NULL, RES_TYPE_STRING);
+ if (ns_lisp_to_color (t, &color) == 0)
+ [ns_tooltip setForegroundColor: color];
+
[ns_tooltip setText: str];
size = [ns_tooltip frame].size;
diff --git a/src/nsmenu.m b/src/nsmenu.m
index 20b4e58b479..5748b20ce81 100644
--- a/src/nsmenu.m
+++ b/src/nsmenu.m
@@ -1364,6 +1364,16 @@ update_frame_tool_bar (struct frame *f)
[textField setFrame: r];
}
+- (void) setBackgroundColor: (NSColor *)col
+{
+ [textField setBackgroundColor: col];
+}
+
+- (void) setForegroundColor: (NSColor *)col
+{
+ [textField setTextColor: col];
+}
+
- (void) showAtX: (int)x Y: (int)y for: (int)seconds
{
NSRect wr = [win frame];
diff --git a/src/nsterm.h b/src/nsterm.h
index bef2c1011bc..878923cbb41 100644
--- a/src/nsterm.h
+++ b/src/nsterm.h
@@ -585,6 +585,8 @@ typedef id instancetype;
}
- (instancetype) init;
- (void) setText: (char *)text;
+- (void) setBackgroundColor: (NSColor *)col;
+- (void) setForegroundColor: (NSColor *)col;
- (void) showAtX: (int)x Y: (int)y for: (int)seconds;
- (void) hide;
- (BOOL) isActive;