emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] master 15cd189: Allow setting tooltip colors in NS port


From: Alan Third
Subject: [Emacs-diffs] master 15cd189: Allow setting tooltip colors in NS port
Date: Sat, 6 Jan 2018 17:55:12 -0500 (EST)

branch: master
commit 15cd18991c1d9a9bafeef7bf9b4dad91ecc0332a
Author: Alan Third <address@hidden>
Commit: Alan Third <address@hidden>

    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.
---
 src/nsfns.m  | 10 ++++++++++
 src/nsmenu.m | 10 ++++++++++
 src/nsterm.h |  2 ++
 3 files changed, 22 insertions(+)

diff --git a/src/nsfns.m b/src/nsfns.m
index d5049a7..3ede63f 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 20b4e58..5748b20 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 bef2c10..878923c 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;



reply via email to

[Prev in Thread] Current Thread [Next in Thread]