summaryrefslogtreecommitdiffstats
path: root/generic
diff options
context:
space:
mode:
authorhobbs <hobbs>2003-04-26 02:53:46 (GMT)
committerhobbs <hobbs>2003-04-26 02:53:46 (GMT)
commit34e11ed4fccaf6e7e181ecf0b874e60582744ee1 (patch)
tree1f1c2de747a6f561c6d8c626dc62f29b10b137e2 /generic
parent165b227f9936ee73db655e68bb22b4ddf1ad3065 (diff)
downloadtk-34e11ed4fccaf6e7e181ecf0b874e60582744ee1.zip
tk-34e11ed4fccaf6e7e181ecf0b874e60582744ee1.tar.gz
tk-34e11ed4fccaf6e7e181ecf0b874e60582744ee1.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')
-rw-r--r--generic/tkButton.c34
-rw-r--r--generic/tkButton.h12
2 files changed, 28 insertions, 18 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) {
diff --git a/generic/tkButton.h b/generic/tkButton.h
index be195c6..d0ecfea 100644
--- a/generic/tkButton.h
+++ b/generic/tkButton.h
@@ -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: tkButton.h,v 1.9 2002/06/17 10:54:29 drh Exp $
+ * RCS: @(#) $Id: tkButton.h,v 1.9.2.1 2003/04/26 02:53:46 hobbs Exp $
*/
#ifndef _TKBUTTON
@@ -159,12 +159,10 @@ typedef struct {
* screen. */
GC activeTextGC; /* GC for drawing text in active mode (NULL
* means use normalTextGC). */
- GC disabledGC; /* Used to produce disabled effect. If
- * disabledFg isn't NULL, this GC is used to
- * draw button text or icon. Otherwise
- * text or icon is drawn with normalGC and
- * this GC is used to stipple background
- * across it. For labels this is None. */
+ GC disabledGC; /* Used to produce disabled effect for text
+ * and check/radio marks. */
+ GC stippleGC; /* Used to produce disabled stipple effect
+ * for images when disabled. */
Pixmap gray; /* Pixmap for displaying disabled text if
* disabledFg is NULL. */
GC copyGC; /* Used for copying information from an