summaryrefslogtreecommitdiffstats
path: root/generic
diff options
context:
space:
mode:
authorhobbs <hobbs>2003-11-17 23:12:43 (GMT)
committerhobbs <hobbs>2003-11-17 23:12:43 (GMT)
commit3d4310e751a063d749094f93cefd45289e283509 (patch)
tree7008d9995e94e7eab0aabb354357b348f54f0c2e /generic
parentefcbe5870a41ae03fb35107532faee500e1431c5 (diff)
downloadtk-3d4310e751a063d749094f93cefd45289e283509.zip
tk-3d4310e751a063d749094f93cefd45289e283509.tar.gz
tk-3d4310e751a063d749094f93cefd45289e283509.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')
-rw-r--r--generic/tkMenubutton.c37
-rw-r--r--generic/tkMenubutton.h11
2 files changed, 30 insertions, 18 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) {
diff --git a/generic/tkMenubutton.h b/generic/tkMenubutton.h
index 332d770..d41e64e 100644
--- a/generic/tkMenubutton.h
+++ b/generic/tkMenubutton.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: tkMenubutton.h,v 1.8 2001/10/12 13:30:31 tmh Exp $
+ * RCS: @(#) $Id: tkMenubutton.h,v 1.9 2003/11/17 23:12:44 hobbs Exp $
*/
#ifndef _TKMENUBUTTON
@@ -124,12 +124,9 @@ typedef struct {
* means use normalTextGC). */
Pixmap gray; /* Pixmap for displaying disabled text/icon if
* disabledFg is NULL. */
- 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. */
+ GC disabledGC; /* Used to produce disabled effect for text. */
+ GC stippleGC; /* Used to produce disabled stipple effect
+ * for images when disabled. */
int leftBearing; /* Distance from text origin to leftmost drawn
* pixel (positive means to right). */
int rightBearing; /* Amount text sticks right from its origin. */