diff options
author | hobbs <hobbs> | 2003-04-26 02:59:19 (GMT) |
---|---|---|
committer | hobbs <hobbs> | 2003-04-26 02:59:19 (GMT) |
commit | 8fe2867a148cb06c060d7c663b90eb79a41895bf (patch) | |
tree | 566771aaa15411ffcc5ed06c7d1055c573128211 /generic | |
parent | 056ce9c5bfeb97685012ee0992ac0b5e3f0c59f2 (diff) | |
download | tk-8fe2867a148cb06c060d7c663b90eb79a41895bf.zip tk-8fe2867a148cb06c060d7c663b90eb79a41895bf.tar.gz tk-8fe2867a148cb06c060d7c663b90eb79a41895bf.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.c | 34 | ||||
-rw-r--r-- | generic/tkButton.h | 12 |
2 files changed, 28 insertions, 18 deletions
diff --git a/generic/tkButton.c b/generic/tkButton.c index 07e226b..640921f 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.21 2003/04/26 02:59:20 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..d3f7cfa 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.10 2003/04/26 02:59:20 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 |