diff options
author | hobbs <hobbs> | 2003-11-17 23:12:43 (GMT) |
---|---|---|
committer | hobbs <hobbs> | 2003-11-17 23:12:43 (GMT) |
commit | 69bd0b5addc827fd96263e1adbb4fa03d4795417 (patch) | |
tree | 7008d9995e94e7eab0aabb354357b348f54f0c2e /generic/tkMenubutton.c | |
parent | 8d3b4278e41bd5302246e4c3b151e6924a33a9de (diff) | |
download | tk-69bd0b5addc827fd96263e1adbb4fa03d4795417.zip tk-69bd0b5addc827fd96263e1adbb4fa03d4795417.tar.gz tk-69bd0b5addc827fd96263e1adbb4fa03d4795417.tar.bz2 |
* generic/tkMenubutton.h: fixed compound menubutton handling like
* generic/tkMenubutton.c: *button corrections of 2003-04-25.
* mac/tkMacMenubutton.c (TkpDisplayMenuButton):
* unix/tkUnixMenubu.c (TkpDisplayMenuButton):
Diffstat (limited to 'generic/tkMenubutton.c')
-rw-r--r-- | generic/tkMenubutton.c | 37 |
1 files changed, 26 insertions, 11 deletions
diff --git a/generic/tkMenubutton.c b/generic/tkMenubutton.c index 0d22be5..504495a 100644 --- a/generic/tkMenubutton.c +++ b/generic/tkMenubutton.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: tkMenubutton.c,v 1.12 2002/08/05 04:30:40 dgp Exp $ + * RCS: @(#) $Id: tkMenubutton.c,v 1.13 2003/11/17 23:12:44 hobbs Exp $ */ #include "tkMenubutton.h" @@ -276,6 +276,7 @@ Tk_MenubuttonObjCmd(clientData, interp, objc, objv) mbPtr->activeTextGC = None; mbPtr->gray = None; mbPtr->disabledGC = None; + mbPtr->stippleGC = None; mbPtr->leftBearing = 0; mbPtr->rightBearing = 0; mbPtr->widthString = NULL; @@ -451,14 +452,16 @@ DestroyMenuButton(memPtr) if (mbPtr->disabledGC != None) { Tk_FreeGC(mbPtr->display, mbPtr->disabledGC); } + if (mbPtr->stippleGC != None) { + Tk_FreeGC(mbPtr->display, mbPtr->stippleGC); + } if (mbPtr->gray != None) { Tk_FreeBitmap(mbPtr->display, mbPtr->gray); } if (mbPtr->textLayout != NULL) { Tk_FreeTextLayout(mbPtr->textLayout); } - Tk_FreeConfigOptions((char *) mbPtr, mbPtr->optionTable, - mbPtr->tkwin); + Tk_FreeConfigOptions((char *) mbPtr, mbPtr->optionTable, mbPtr->tkwin); mbPtr->tkwin = NULL; Tcl_EventuallyFree((ClientData) mbPtr, TCL_DYNAMIC); } @@ -702,7 +705,6 @@ TkMenuButtonWorldChanged(instanceData) } mbPtr->normalTextGC = gc; - gcValues.font = Tk_FontId(mbPtr->tkfont); gcValues.foreground = mbPtr->activeFg->pixel; gcValues.background = Tk_3DBorderColor(mbPtr->activeBorder)->pixel; mask = GCForeground | GCBackground | GCFont; @@ -712,23 +714,36 @@ TkMenuButtonWorldChanged(instanceData) } mbPtr->activeTextGC = gc; - gcValues.font = Tk_FontId(mbPtr->tkfont); gcValues.background = Tk_3DBorderColor(mbPtr->normalBorder)->pixel; - if ((mbPtr->disabledFg != NULL) && (mbPtr->imageString == NULL)) { - gcValues.foreground = mbPtr->disabledFg->pixel; - mask = GCForeground | GCBackground | GCFont; - } else { + + /* + * Create the GC that can be used for stippling + */ + + if (mbPtr->stippleGC == None) { gcValues.foreground = gcValues.background; mask = GCForeground; if (mbPtr->gray == None) { - mbPtr->gray = Tk_GetBitmap(NULL, mbPtr->tkwin, - Tk_GetUid("gray50")); + mbPtr->gray = Tk_GetBitmap(NULL, mbPtr->tkwin, "gray50"); } if (mbPtr->gray != None) { gcValues.fill_style = FillStippled; gcValues.stipple = mbPtr->gray; mask |= GCFillStyle | GCStipple; } + mbPtr->stippleGC = Tk_GetGC(mbPtr->tkwin, mask, &gcValues); + } + + /* + * Allocate the disabled graphics context, for drawing text in + * its disabled state. + */ + + mask = GCForeground | GCBackground | GCFont; + if (mbPtr->disabledFg != NULL) { + gcValues.foreground = mbPtr->disabledFg->pixel; + } else { + gcValues.foreground = gcValues.background; } gc = Tk_GetGC(mbPtr->tkwin, mask, &gcValues); if (mbPtr->disabledGC != None) { |