aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAlan Third2017-12-23 11:00:35 +0000
committerAlan Third2018-01-06 22:50:35 +0000
commit15cd18991c1d9a9bafeef7bf9b4dad91ecc0332a (patch)
treefca8d2460b73c843ac270c6ce9c0194ec59ca326 /src
parent5fd229735384a5fa479466124a181bf7d4ea8dab (diff)
downloademacs-15cd18991c1d9a9bafeef7bf9b4dad91ecc0332a.tar.gz
emacs-15cd18991c1d9a9bafeef7bf9b4dad91ecc0332a.zip
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. */)
2873 struct frame *f; 2873 struct frame *f;
2874 char *str; 2874 char *str;
2875 NSSize size; 2875 NSSize size;
2876 NSColor *color;
2877 Lisp_Object t;
2876 2878
2877 specbind (Qinhibit_redisplay, Qt); 2879 specbind (Qinhibit_redisplay, Qt);
2878 2880
@@ -2900,6 +2902,14 @@ Text larger than the specified size is clipped. */)
2900 else 2902 else
2901 Fx_hide_tip (); 2903 Fx_hide_tip ();
2902 2904
2905 t = x_get_arg (NULL, parms, Qbackground_color, NULL, NULL, RES_TYPE_STRING);
2906 if (ns_lisp_to_color (t, &color) == 0)
2907 [ns_tooltip setBackgroundColor: color];
2908
2909 t = x_get_arg (NULL, parms, Qforeground_color, NULL, NULL, RES_TYPE_STRING);
2910 if (ns_lisp_to_color (t, &color) == 0)
2911 [ns_tooltip setForegroundColor: color];
2912
2903 [ns_tooltip setText: str]; 2913 [ns_tooltip setText: str];
2904 size = [ns_tooltip frame].size; 2914 size = [ns_tooltip frame].size;
2905 2915
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)
1364 [textField setFrame: r]; 1364 [textField setFrame: r];
1365} 1365}
1366 1366
1367- (void) setBackgroundColor: (NSColor *)col
1368{
1369 [textField setBackgroundColor: col];
1370}
1371
1372- (void) setForegroundColor: (NSColor *)col
1373{
1374 [textField setTextColor: col];
1375}
1376
1367- (void) showAtX: (int)x Y: (int)y for: (int)seconds 1377- (void) showAtX: (int)x Y: (int)y for: (int)seconds
1368{ 1378{
1369 NSRect wr = [win frame]; 1379 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;
585 } 585 }
586- (instancetype) init; 586- (instancetype) init;
587- (void) setText: (char *)text; 587- (void) setText: (char *)text;
588- (void) setBackgroundColor: (NSColor *)col;
589- (void) setForegroundColor: (NSColor *)col;
588- (void) showAtX: (int)x Y: (int)y for: (int)seconds; 590- (void) showAtX: (int)x Y: (int)y for: (int)seconds;
589- (void) hide; 591- (void) hide;
590- (BOOL) isActive; 592- (BOOL) isActive;