diff options
-rw-r--r-- | generic/tkCanvas.c | 17 | ||||
-rw-r--r-- | generic/tkEntry.c | 13 | ||||
-rw-r--r-- | generic/tkFrame.c | 15 | ||||
-rw-r--r-- | generic/tkInt.decls | 7 | ||||
-rw-r--r-- | generic/tkIntDecls.h | 11 | ||||
-rw-r--r-- | generic/tkListbox.c | 13 | ||||
-rw-r--r-- | generic/tkMessage.c | 14 | ||||
-rw-r--r-- | generic/tkStubInit.c | 3 | ||||
-rw-r--r-- | generic/tkTextDisp.c | 16 | ||||
-rw-r--r-- | mac/tkMacDraw.c | 45 | ||||
-rw-r--r-- | mac/tkMacMenubutton.c | 14 | ||||
-rw-r--r-- | mac/tkMacScrlbr.c | 17 | ||||
-rw-r--r-- | unix/tkUnixDraw.c | 35 | ||||
-rw-r--r-- | win/tkWinDraw.c | 36 |
14 files changed, 200 insertions, 56 deletions
diff --git a/generic/tkCanvas.c b/generic/tkCanvas.c index 40f3555..a184769 100644 --- a/generic/tkCanvas.c +++ b/generic/tkCanvas.c @@ -12,7 +12,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkCanvas.c,v 1.6 1999/04/21 21:53:24 rjohnson Exp $ + * RCS: @(#) $Id: tkCanvas.c,v 1.7 1999/08/10 05:05:20 jingham Exp $ */ #include "default.h" @@ -1839,17 +1839,20 @@ DisplayCanvas(clientData) canvasPtr->borderWidth, canvasPtr->relief); } if (canvasPtr->highlightWidth != 0) { - GC gc; + GC fgGC, bgGC; + + bgGC = Tk_GCForColor(canvasPtr->highlightColorPtr, + Tk_WindowId(tkwin)); if (canvasPtr->textInfo.gotFocus) { - gc = Tk_GCForColor(canvasPtr->highlightColorPtr, + fgGC = Tk_GCForColor(canvasPtr->highlightBgColorPtr, Tk_WindowId(tkwin)); + TkpDrawHighlightBorder(tkwin, fgGC, bgGC, canvasPtr->highlightWidth, + Tk_WindowId(tkwin)); } else { - gc = Tk_GCForColor(canvasPtr->highlightBgColorPtr, - Tk_WindowId(tkwin)); + TkpDrawHighlightBorder(tkwin, bgGC, bgGC, canvasPtr->highlightWidth, + Tk_WindowId(tkwin)); } - Tk_DrawFocusHighlight(tkwin, gc, canvasPtr->highlightWidth, - Tk_WindowId(tkwin)); } } diff --git a/generic/tkEntry.c b/generic/tkEntry.c index fb3af5e..fd46cb3 100644 --- a/generic/tkEntry.c +++ b/generic/tkEntry.c @@ -11,7 +11,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkEntry.c,v 1.4 1999/04/24 01:50:47 stanton Exp $ + * RCS: @(#) $Id: tkEntry.c,v 1.5 1999/08/10 05:05:48 jingham Exp $ */ #include "tkInt.h" @@ -1405,14 +1405,17 @@ DisplayEntry(clientData) entryPtr->borderWidth, entryPtr->relief); } if (entryPtr->highlightWidth != 0) { - GC gc; + GC fgGC, bgGC; + bgGC = Tk_GCForColor(entryPtr->highlightBgColorPtr, pixmap); if (entryPtr->flags & GOT_FOCUS) { - gc = Tk_GCForColor(entryPtr->highlightColorPtr, pixmap); + fgGC = Tk_GCForColor(entryPtr->highlightColorPtr, pixmap); + TkpDrawHighlightBorder(tkwin, fgGC, bgGC, + entryPtr->highlightWidth, pixmap); } else { - gc = Tk_GCForColor(entryPtr->highlightBgColorPtr, pixmap); + TkpDrawHighlightBorder(tkwin, bgGC, bgGC, + entryPtr->highlightWidth, pixmap); } - Tk_DrawFocusHighlight(tkwin, gc, entryPtr->highlightWidth, pixmap); } /* diff --git a/generic/tkFrame.c b/generic/tkFrame.c index 9bdee9a..9284deb 100644 --- a/generic/tkFrame.c +++ b/generic/tkFrame.c @@ -12,7 +12,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkFrame.c,v 1.3 1999/04/16 01:51:14 stanton Exp $ + * RCS: @(#) $Id: tkFrame.c,v 1.4 1999/08/10 05:06:01 jingham Exp $ */ #include "default.h" @@ -694,7 +694,6 @@ DisplayFrame(clientData) { register Frame *framePtr = (Frame *) clientData; register Tk_Window tkwin = framePtr->tkwin; - GC gc; framePtr->flags &= ~REDRAW_PENDING; if ((framePtr->tkwin == NULL) || !Tk_IsMapped(tkwin) @@ -711,15 +710,19 @@ DisplayFrame(clientData) framePtr->borderWidth, framePtr->relief); } if (framePtr->highlightWidth != 0) { + GC fgGC, bgGC; + + bgGC = Tk_GCForColor(framePtr->highlightBgColorPtr, + Tk_WindowId(tkwin)); if (framePtr->flags & GOT_FOCUS) { - gc = Tk_GCForColor(framePtr->highlightColorPtr, + fgGC = Tk_GCForColor(framePtr->highlightColorPtr, + Tk_WindowId(tkwin)); + TkpDrawHighlightBorder(tkwin, fgGC, bgGC, framePtr->highlightWidth, Tk_WindowId(tkwin)); } else { - gc = Tk_GCForColor(framePtr->highlightBgColorPtr, + TkpDrawHighlightBorder(tkwin, bgGC, bgGC, framePtr->highlightWidth, Tk_WindowId(tkwin)); } - Tk_DrawFocusHighlight(tkwin, gc, framePtr->highlightWidth, - Tk_WindowId(tkwin)); } } diff --git a/generic/tkInt.decls b/generic/tkInt.decls index 0ab34b2..ed501e5 100644 --- a/generic/tkInt.decls +++ b/generic/tkInt.decls @@ -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: tkInt.decls,v 1.9 1999/07/31 03:36:49 hobbs Exp $ +# RCS: @(#) $Id: tkInt.decls,v 1.10 1999/08/10 05:06:14 jingham Exp $ library tk @@ -610,7 +610,10 @@ declare 134 mac { int width, int height, int flags) } - +declare 135 generic { + void TkpDrawHighlightBorder (Tk_Window tkwin, GC fgGC, GC bgGC, \ + int highlightWidth, Drawable drawable) +} ############################################################################## diff --git a/generic/tkIntDecls.h b/generic/tkIntDecls.h index 8019da4..8aa82f7 100644 --- a/generic/tkIntDecls.h +++ b/generic/tkIntDecls.h @@ -11,7 +11,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkIntDecls.h,v 1.6 1999/05/25 01:31:05 stanton Exp $ + * RCS: @(#) $Id: tkIntDecls.h,v 1.7 1999/08/10 05:06:26 jingham Exp $ */ #ifndef _TKINTDECLS @@ -499,6 +499,10 @@ EXTERN void TkGenWMConfigureEvent _ANSI_ARGS_((Tk_Window tkwin, int x, int y, int width, int height, int flags)); #endif /* MAC_TCL */ +/* 135 */ +EXTERN void TkpDrawHighlightBorder _ANSI_ARGS_((Tk_Window tkwin, + GC fgGC, GC bgGC, int highlightWidth, + Drawable drawable)); typedef struct TkIntStubs { int magic; @@ -799,6 +803,7 @@ typedef struct TkIntStubs { #ifdef MAC_TCL void (*tkGenWMConfigureEvent) _ANSI_ARGS_((Tk_Window tkwin, int x, int y, int width, int height, int flags)); /* 134 */ #endif /* MAC_TCL */ + void (*tkpDrawHighlightBorder) _ANSI_ARGS_((Tk_Window tkwin, GC fgGC, GC bgGC, int highlightWidth, Drawable drawable)); /* 135 */ } TkIntStubs; #ifdef __cplusplus @@ -1431,6 +1436,10 @@ extern TkIntStubs *tkIntStubsPtr; (tkIntStubsPtr->tkGenWMConfigureEvent) /* 134 */ #endif #endif /* MAC_TCL */ +#ifndef TkpDrawHighlightBorder +#define TkpDrawHighlightBorder \ + (tkIntStubsPtr->tkpDrawHighlightBorder) /* 135 */ +#endif #endif /* defined(USE_TK_STUBS) && !defined(USE_TK_STUB_PROCS) */ diff --git a/generic/tkListbox.c b/generic/tkListbox.c index 241c05b..487ba3b 100644 --- a/generic/tkListbox.c +++ b/generic/tkListbox.c @@ -11,7 +11,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkListbox.c,v 1.3 1999/04/16 01:51:19 stanton Exp $ + * RCS: @(#) $Id: tkListbox.c,v 1.4 1999/08/10 05:06:47 jingham Exp $ */ #include "tkPort.h" @@ -1272,14 +1272,17 @@ DisplayListbox(clientData) Tk_Height(tkwin) - 2*listPtr->highlightWidth, listPtr->borderWidth, listPtr->relief); if (listPtr->highlightWidth > 0) { - GC gc; + GC fgGC, bgGC; + bgGC = Tk_GCForColor(listPtr->highlightBgColorPtr, pixmap); if (listPtr->flags & GOT_FOCUS) { - gc = Tk_GCForColor(listPtr->highlightColorPtr, pixmap); + fgGC = Tk_GCForColor(listPtr->highlightColorPtr, pixmap); + TkpDrawHighlightBorder(tkwin, fgGC, bgGC, + listPtr->highlightWidth, pixmap); } else { - gc = Tk_GCForColor(listPtr->highlightBgColorPtr, pixmap); + TkpDrawHighlightBorder(tkwin, bgGC, bgGC, + listPtr->highlightWidth, pixmap); } - Tk_DrawFocusHighlight(tkwin, gc, listPtr->highlightWidth, pixmap); } XCopyArea(listPtr->display, pixmap, Tk_WindowId(tkwin), listPtr->textGC, 0, 0, (unsigned) Tk_Width(tkwin), diff --git a/generic/tkMessage.c b/generic/tkMessage.c index 3f7a4e7..4001ac2 100644 --- a/generic/tkMessage.c +++ b/generic/tkMessage.c @@ -11,7 +11,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkMessage.c,v 1.3 1999/04/16 01:51:20 stanton Exp $ + * RCS: @(#) $Id: tkMessage.c,v 1.4 1999/08/10 05:06:59 jingham Exp $ */ #include "tkPort.h" @@ -670,15 +670,17 @@ DisplayMessage(clientData) msgPtr->borderWidth, msgPtr->relief); } if (msgPtr->highlightWidth != 0) { - GC gc; + GC fgGC, bgGC; + bgGC = Tk_GCForColor(msgPtr->highlightBgColorPtr, Tk_WindowId(tkwin)); if (msgPtr->flags & GOT_FOCUS) { - gc = Tk_GCForColor(msgPtr->highlightColorPtr, Tk_WindowId(tkwin)); + fgGC = Tk_GCForColor(msgPtr->highlightColorPtr, Tk_WindowId(tkwin)); + TkpDrawHighlightBorder(tkwin, fgGC, bgGC, msgPtr->highlightWidth, + Tk_WindowId(tkwin)); } else { - gc = Tk_GCForColor(msgPtr->highlightBgColorPtr, Tk_WindowId(tkwin)); + TkpDrawHighlightBorder(tkwin, bgGC, bgGC, msgPtr->highlightWidth, + Tk_WindowId(tkwin)); } - Tk_DrawFocusHighlight(tkwin, gc, msgPtr->highlightWidth, - Tk_WindowId(tkwin)); } } diff --git a/generic/tkStubInit.c b/generic/tkStubInit.c index 3fd720f..c020383 100644 --- a/generic/tkStubInit.c +++ b/generic/tkStubInit.c @@ -8,7 +8,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkStubInit.c,v 1.10 1999/07/31 03:36:49 hobbs Exp $ + * RCS: @(#) $Id: tkStubInit.c,v 1.11 1999/08/10 05:07:06 jingham Exp $ */ #include "tkInt.h" @@ -337,6 +337,7 @@ TkIntStubs tkIntStubs = { #ifdef MAC_TCL TkGenWMConfigureEvent, /* 134 */ #endif /* MAC_TCL */ + TkpDrawHighlightBorder, /* 135 */ }; TkIntPlatStubs tkIntPlatStubs = { diff --git a/generic/tkTextDisp.c b/generic/tkTextDisp.c index 486f167..90b1bd2 100644 --- a/generic/tkTextDisp.c +++ b/generic/tkTextDisp.c @@ -11,7 +11,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkTextDisp.c,v 1.6 1999/04/21 21:53:28 rjohnson Exp $ + * RCS: @(#) $Id: tkTextDisp.c,v 1.7 1999/08/10 05:07:36 jingham Exp $ */ #include "tkPort.h" @@ -2241,17 +2241,19 @@ DisplayText(clientData) Tk_Height(textPtr->tkwin) - 2*textPtr->highlightWidth, textPtr->borderWidth, textPtr->relief); if (textPtr->highlightWidth != 0) { - GC gc; + GC fgGC, bgGC; + bgGC = Tk_GCForColor(textPtr->highlightBgColorPtr, + Tk_WindowId(textPtr->tkwin)); if (textPtr->flags & GOT_FOCUS) { - gc = Tk_GCForColor(textPtr->highlightColorPtr, + fgGC = Tk_GCForColor(textPtr->highlightColorPtr, Tk_WindowId(textPtr->tkwin)); + TkpDrawHighlightBorder(textPtr->tkwin, fgGC, bgGC, + textPtr->highlightWidth, Tk_WindowId(textPtr->tkwin)); } else { - gc = Tk_GCForColor(textPtr->highlightBgColorPtr, - Tk_WindowId(textPtr->tkwin)); + TkpDrawHighlightBorder(textPtr->tkwin, bgGC, bgGC, + textPtr->highlightWidth, Tk_WindowId(textPtr->tkwin)); } - Tk_DrawFocusHighlight(textPtr->tkwin, gc, textPtr->highlightWidth, - Tk_WindowId(textPtr->tkwin)); } borders = textPtr->borderWidth + textPtr->highlightWidth; if (textPtr->padY > 0) { 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, diff --git a/unix/tkUnixDraw.c b/unix/tkUnixDraw.c index adb86dc..d7ac932 100644 --- a/unix/tkUnixDraw.c +++ b/unix/tkUnixDraw.c @@ -8,7 +8,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkUnixDraw.c,v 1.3 1999/03/10 07:04:45 stanton Exp $ + * RCS: @(#) $Id: tkUnixDraw.c,v 1.4 1999/08/10 05:04:45 jingham Exp $ */ #include "tkPort.h" @@ -173,3 +173,36 @@ ScrollRestrictProc(arg, eventPtr) return TK_DISCARD_EVENT; } +/* + *---------------------------------------------------------------------- + * + * TkpDrawHighlightBorder -- + * + * This procedure draws a rectangular ring around the outside of + * a widget to indicate that it has received the input focus. + * + * On Unix, we just draw the simple inset ring. On other sytems, + * e.g. the Mac, the focus ring is a little more complicated, so we + * need this abstraction. + * + * 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) +{ + TkDrawInsetFocusHighlight (tkwin, fgGC, highlightWidth, drawable, 0); +} + diff --git a/win/tkWinDraw.c b/win/tkWinDraw.c index 43a2197..13a15bd 100644 --- a/win/tkWinDraw.c +++ b/win/tkWinDraw.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: tkWinDraw.c,v 1.4 1999/04/16 01:51:51 stanton Exp $ + * RCS: @(#) $Id: tkWinDraw.c,v 1.5 1999/08/10 05:04:56 jingham Exp $ */ #include "tkWinInt.h" @@ -1269,3 +1269,37 @@ TkWinFillRect(dc, x, y, width, height, pixel) ExtTextOut(dc, 0, 0, ETO_OPAQUE, &rect, NULL, 0, NULL); SetBkColor(dc, oldColor); } + +/* + *---------------------------------------------------------------------- + * + * TkpDrawHighlightBorder -- + * + * This procedure draws a rectangular ring around the outside of + * a widget to indicate that it has received the input focus. + * + * On Windows, we just draw the simple inset ring. On other sytems, + * e.g. the Mac, the focus ring is a little more complicated, so we + * need this abstraction. + * + * 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) +{ + TkDrawInsetFocusHighlight (tkwin, fgGC, highlightWidth, drawable, 0); +} +
\ No newline at end of file |