summaryrefslogtreecommitdiffstats
path: root/generic/tkButton.c
diff options
context:
space:
mode:
authorhobbs <hobbs>2003-04-26 02:53:46 (GMT)
committerhobbs <hobbs>2003-04-26 02:53:46 (GMT)
commit4f6612c9be450714fe3648318ad9197fd03f5c56 (patch)
tree1f1c2de747a6f561c6d8c626dc62f29b10b137e2 /generic/tkButton.c
parent8633e2e39dce296414dc81d26fb64dabbbbf4a76 (diff)
downloadtk-4f6612c9be450714fe3648318ad9197fd03f5c56.zip
tk-4f6612c9be450714fe3648318ad9197fd03f5c56.tar.gz
tk-4f6612c9be450714fe3648318ad9197fd03f5c56.tar.bz2
* generic/tkButton.h: Rewrote the handling
* generic/tkButton.c (TkButtonWorldChanged): of compound *buttons * mac/tkMacButton.c (TkpDisplayButton): to correctly display * macosx/tkMacOSXButton.c (TkpDisplayButton): mixture of disabledfg, * unix/tkUnixButton.c (TkpDisplayButton): selectcolor, indicator, * win/tkWinButton.c (TkpDisplayButton): etc. *buttons will now only stipple the image, unless no disabledfg is given, in which case it will stipple the whole button.
Diffstat (limited to 'generic/tkButton.c')
-rw-r--r--generic/tkButton.c34
1 files changed, 23 insertions, 11 deletions
diff --git a/generic/tkButton.c b/generic/tkButton.c
index 07e226b..7e629cb 100644
--- a/generic/tkButton.c
+++ b/generic/tkButton.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: tkButton.c,v 1.20 2002/08/08 09:35:34 hobbs Exp $
+ * RCS: @(#) $Id: tkButton.c,v 1.20.2.1 2003/04/26 02:53:46 hobbs Exp $
*/
#include "tkButton.h"
@@ -699,6 +699,7 @@ ButtonCreate(clientData, interp, objc, objv, type)
butPtr->normalTextGC = None;
butPtr->activeTextGC = None;
butPtr->disabledGC = None;
+ butPtr->stippleGC = None;
butPtr->gray = None;
butPtr->copyGC = None;
butPtr->widthPtr = NULL;
@@ -980,6 +981,9 @@ DestroyButton(butPtr)
if (butPtr->disabledGC != None) {
Tk_FreeGC(butPtr->display, butPtr->disabledGC);
}
+ if (butPtr->stippleGC != None) {
+ Tk_FreeGC(butPtr->display, butPtr->stippleGC);
+ }
if (butPtr->gray != None) {
Tk_FreeBitmap(butPtr->display, butPtr->gray);
}
@@ -1337,20 +1341,15 @@ TkButtonWorldChanged(instanceData)
butPtr->activeTextGC = newGC;
}
+ gcValues.background = Tk_3DBorderColor(butPtr->normalBorder)->pixel;
+
/*
- * Allocate the disabled graphics context, for drawing the widget in
- * its disabled state
+ * Create the GC that can be used for stippling
*/
- gcValues.background = Tk_3DBorderColor(butPtr->normalBorder)->pixel;
- if ((butPtr->disabledFg != NULL) && (butPtr->imagePtr == NULL)) {
- gcValues.foreground = butPtr->disabledFg->pixel;
- mask = GCForeground | GCBackground | GCFont;
- } else {
+
+ if (butPtr->stippleGC == None) {
gcValues.foreground = gcValues.background;
mask = GCForeground;
- if (butPtr->compound != COMPOUND_NONE) {
- mask |= GCFont;
- }
if (butPtr->gray == None) {
butPtr->gray = Tk_GetBitmap(NULL, butPtr->tkwin, "gray50");
}
@@ -1359,6 +1358,19 @@ TkButtonWorldChanged(instanceData)
gcValues.stipple = butPtr->gray;
mask |= GCFillStyle | GCStipple;
}
+ butPtr->stippleGC = Tk_GetGC(butPtr->tkwin, mask, &gcValues);
+ }
+
+ /*
+ * Allocate the disabled graphics context, for drawing text in
+ * its disabled state.
+ */
+
+ mask = GCForeground | GCBackground | GCFont;
+ if (butPtr->disabledFg != NULL) {
+ gcValues.foreground = butPtr->disabledFg->pixel;
+ } else {
+ gcValues.foreground = gcValues.background;
}
newGC = Tk_GetGC(butPtr->tkwin, mask, &gcValues);
if (butPtr->disabledGC != None) {