summaryrefslogtreecommitdiffstats
path: root/mac
diff options
context:
space:
mode:
authorjingham <jingham>1999-08-10 05:04:45 (GMT)
committerjingham <jingham>1999-08-10 05:04:45 (GMT)
commit4904c2fefb18f2f2cc5e3e70d58e1750f52fa659 (patch)
tree7316e518597bb3d84ce7a7a7cabcf5b05832add8 /mac
parent1cdd5fb850d1be603e0994761bd0271233c964c4 (diff)
downloadtk-4904c2fefb18f2f2cc5e3e70d58e1750f52fa659.zip
tk-4904c2fefb18f2f2cc5e3e70d58e1750f52fa659.tar.gz
tk-4904c2fefb18f2f2cc5e3e70d58e1750f52fa659.tar.bz2
New Function: TkpDrawHighlightBorder. Use this in place of Tk_DrawFocusHighlight. The latter did not work on the Mac, since you need to know both foreground & background color when you draw the active focus ring.
Diffstat (limited to 'mac')
-rw-r--r--mac/tkMacDraw.c45
-rw-r--r--mac/tkMacMenubutton.c14
-rw-r--r--mac/tkMacScrlbr.c17
3 files changed, 62 insertions, 14 deletions
diff --git a/mac/tkMacDraw.c b/mac/tkMacDraw.c
index a346a3c..bb04f05 100644
--- a/mac/tkMacDraw.c
+++ b/mac/tkMacDraw.c
@@ -10,7 +10,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkMacDraw.c,v 1.5 1999/05/22 06:32:50 jingham Exp $
+ * RCS: @(#) $Id: tkMacDraw.c,v 1.6 1999/08/10 05:04:53 jingham Exp $
*/
#include "tkInt.h"
@@ -1129,3 +1129,46 @@ InvertByte(
}
return result;
}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TkpDrawpHighlightBorder --
+ *
+ * This procedure draws a rectangular ring around the outside of
+ * a widget to indicate that it has received the input focus.
+ *
+ * On the Macintosh, this puts a 1 pixel border in the bgGC color
+ * between the widget and the focus ring, except in the case where
+ * highlightWidth is 1, in which case the border is left out.
+ *
+ * For proper Mac L&F, use highlightWidth of 3.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * A rectangle "width" pixels wide is drawn in "drawable",
+ * corresponding to the outer area of "tkwin".
+ *
+ *----------------------------------------------------------------------
+ */
+
+void
+TkpDrawHighlightBorder (
+ Tk_Window tkwin,
+ GC fgGC,
+ GC bgGC,
+ int highlightWidth,
+ Drawable drawable)
+{
+ if (highlightWidth == 1) {
+ TkDrawInsetFocusHighlight (tkwin, fgGC, highlightWidth, drawable, 0);
+ } else {
+ TkDrawInsetFocusHighlight (tkwin, bgGC, highlightWidth, drawable, 0);
+ if (fgGC != bgGC) {
+ TkDrawInsetFocusHighlight (tkwin, fgGC, highlightWidth - 1, drawable, 0);
+ }
+ }
+}
+ \ No newline at end of file
diff --git a/mac/tkMacMenubutton.c b/mac/tkMacMenubutton.c
index 830be01..698ac97 100644
--- a/mac/tkMacMenubutton.c
+++ b/mac/tkMacMenubutton.c
@@ -9,7 +9,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkMacMenubutton.c,v 1.4 1999/05/22 06:33:38 jingham Exp $
+ * RCS: @(#) $Id: tkMacMenubutton.c,v 1.5 1999/08/10 05:05:02 jingham Exp $
*/
#include "tkMenubutton.h"
@@ -223,15 +223,17 @@ TkpDisplayMenuButton(
}
if (mbPtr->highlightWidth != 0) {
- GC gc;
+ GC fgGC, bgGC;
+ bgGC = Tk_GCForColor(mbPtr->highlightBgColorPtr, Tk_WindowId(tkwin));
if (mbPtr->flags & GOT_FOCUS) {
- gc = Tk_GCForColor(mbPtr->highlightColorPtr, Tk_WindowId(tkwin));
+ fgGC = Tk_GCForColor(mbPtr->highlightColorPtr, Tk_WindowId(tkwin));
+ TkpDrawHighlightBorder(tkwin, fgGC, bgGC, mbPtr->highlightWidth,
+ Tk_WindowId(tkwin));
} else {
- gc = Tk_GCForColor(mbPtr->highlightBgColorPtr, Tk_WindowId(tkwin));
+ TkpDrawHighlightBorder(tkwin, bgGC, bgGC, mbPtr->highlightWidth,
+ Tk_WindowId(tkwin));
}
- Tk_DrawFocusHighlight(tkwin, gc, mbPtr->highlightWidth,
- Tk_WindowId(tkwin));
}
SetGWorld(saveWorld, saveDevice);
diff --git a/mac/tkMacScrlbr.c b/mac/tkMacScrlbr.c
index e54c3c9..333cc27 100644
--- a/mac/tkMacScrlbr.c
+++ b/mac/tkMacScrlbr.c
@@ -10,7 +10,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkMacScrlbr.c,v 1.2 1998/09/14 18:23:39 stanton Exp $
+ * RCS: @(#) $Id: tkMacScrlbr.c,v 1.3 1999/08/10 05:05:18 jingham Exp $
*/
#include "tkScrollbar.h"
@@ -210,17 +210,20 @@ TkpDisplayScrollbar(
* Draw the focus or any 3D relief we may have.
*/
if (scrollPtr->highlightWidth != 0) {
- GC gc;
+ GC fgGC, bgGC;
+
+ bgGC = Tk_GCForColor(scrollPtr->highlightBgColorPtr,
+ Tk_WindowId(tkwin));
if (scrollPtr->flags & GOT_FOCUS) {
- gc = Tk_GCForColor(scrollPtr->highlightColorPtr,
+ fgGC = Tk_GCForColor(scrollPtr->highlightColorPtr,
Tk_WindowId(tkwin));
+ TkpDrawHighlightBorder(tkwin, fgGC, bgGC, scrollPtr->highlightWidth,
+ Tk_WindowId(tkwin));
} else {
- gc = Tk_GCForColor(scrollPtr->highlightBgColorPtr,
- Tk_WindowId(tkwin));
- }
- Tk_DrawFocusHighlight(tkwin, gc, scrollPtr->highlightWidth,
+ TkpDrawHighlightBorder(tkwin, bgGC, bgGC, scrollPtr->highlightWidth,
Tk_WindowId(tkwin));
+ }
}
Tk_Draw3DRectangle(tkwin, Tk_WindowId(tkwin), scrollPtr->bgBorder,
scrollPtr->highlightWidth, scrollPtr->highlightWidth,