From bb3a7b29672682e6ed7dfd992a6356232826ae00 Mon Sep 17 00:00:00 2001 From: lfb Date: Sat, 13 Feb 1999 05:38:48 +0000 Subject: Removed Tk_Uids from Menubutton widget. --- ChangeLog | 5 +++++ generic/tkMenubutton.c | 24 ++++++++++++++---------- generic/tkMenubutton.h | 4 ++-- mac/tkMacMenubutton.c | 13 ++++++------- unix/tkUnixMenubu.c | 10 ++++++---- 5 files changed, 33 insertions(+), 23 deletions(-) diff --git a/ChangeLog b/ChangeLog index 1df82a2..4875712 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,10 @@ 1999-02-12 + * generic/tkMenuButton.h: + * generic/tkMenuButton.c: + * mac/tkMacMenubutton.c: + * unix/tkUnixMenubu.c: Eliminated Tk_Uids used by -state option. + * generic/tk.h: * generic/tkScale.h: * generic/tkScale.c: diff --git a/generic/tkMenubutton.c b/generic/tkMenubutton.c index f4960fa..dfef406 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.1.4.4 1999/01/07 02:42:50 lfb Exp $ + * RCS: @(#) $Id: tkMenubutton.c,v 1.1.4.5 1999/02/13 05:38:48 lfb Exp $ */ #include "tkMenubutton.h" @@ -109,7 +109,7 @@ static Tk_ConfigSpec configSpecs[] = { DEF_MENUBUTTON_PADY, Tk_Offset(TkMenuButton, padY), 0}, {TK_CONFIG_RELIEF, "-relief", "relief", "Relief", DEF_MENUBUTTON_RELIEF, Tk_Offset(TkMenuButton, relief), 0}, - {TK_CONFIG_STATE, "-state", "state", "State", + {TK_CONFIG_STRING, "-state", "state", "State", DEF_MENUBUTTON_STATE, Tk_Offset(TkMenuButton, state), 0}, {TK_CONFIG_STRING, "-takefocus", "takeFocus", "TakeFocus", DEF_MENUBUTTON_TAKE_FOCUS, Tk_Offset(TkMenuButton, takeFocus), @@ -216,7 +216,7 @@ Tk_MenubuttonCmd(clientData, interp, argc, argv) mbPtr->bitmap = None; mbPtr->imageString = NULL; mbPtr->image = NULL; - mbPtr->state = TK_STATE_NORMAL; + mbPtr->state = "normal"; mbPtr->normalBorder = NULL; mbPtr->activeBorder = NULL; mbPtr->borderWidth = 0; @@ -260,7 +260,7 @@ Tk_MenubuttonCmd(clientData, interp, argc, argv) rightUid = Tk_GetUid("right"); flushUid = Tk_GetUid("flush"); } - Tcl_MutexLock(&menuButMutex); + Tcl_MutexUnlock(&menuButMutex); } mbPtr->direction = flushUid; @@ -458,16 +458,20 @@ ConfigureMenuButton(interp, mbPtr, argc, argv, flags) * defaults that couldn't be specified to Tk_ConfigureWidget. */ - if ((mbPtr->state == TK_STATE_ACTIVE) && !Tk_StrictMotif(mbPtr->tkwin)) { + if ((mbPtr->state[0] == 'a') && (strcmp(mbPtr->state, "active") == 0) + && !Tk_StrictMotif(mbPtr->tkwin)) { Tk_SetBackgroundFromBorder(mbPtr->tkwin, mbPtr->activeBorder); } else { Tk_SetBackgroundFromBorder(mbPtr->tkwin, mbPtr->normalBorder); - if ((mbPtr->state != TK_STATE_NORMAL) - && (mbPtr->state != TK_STATE_ACTIVE) - && (mbPtr->state != TK_STATE_DISABLED)) { + if ((mbPtr->state[0] != 'a') + && (strcmp(mbPtr->state, "active") != 0) + && (mbPtr->state[0] != 'd') + && (strcmp(mbPtr->state, "disabled") != 0) + && (mbPtr->state[0] != 'n') + && (strcmp(mbPtr->state, "normal") != 0)) { Tcl_AppendResult(interp, "bad state value \"", mbPtr->state, - "\": must be normal, active, or disabled", (char *) NULL); - mbPtr->state = TK_STATE_NORMAL; + "\": must be normal, active, or disabled", (char *) NULL); + mbPtr->state = "normal"; return TCL_ERROR; } } diff --git a/generic/tkMenubutton.h b/generic/tkMenubutton.h index e9481ab..f934b51 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.1.4.2 1999/01/07 02:42:50 lfb Exp $ + * RCS: @(#) $Id: tkMenubutton.h,v 1.1.4.3 1999/02/13 05:38:49 lfb Exp $ */ #ifndef _TKMENUBUTTON @@ -65,7 +65,7 @@ typedef struct { * Information used when displaying widget: */ - int state; /* State of button for display purposes: + char * state; /* State of button for display purposes: * normal, active, or disabled. */ Tk_3DBorder normalBorder; /* Structure used to draw 3-D * border and background when window diff --git a/mac/tkMacMenubutton.c b/mac/tkMacMenubutton.c index b4c4f78..49bdb94 100644 --- a/mac/tkMacMenubutton.c +++ b/mac/tkMacMenubutton.c @@ -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: tkMacMenubutton.c,v 1.1.4.2 1999/01/07 02:42:56 lfb Exp $ + * RCS: @(#) $Id: tkMacMenubutton.c,v 1.1.4.3 1999/02/13 05:38:49 lfb Exp $ */ #include "tkMenubutton.h" @@ -110,9 +110,11 @@ TkpDisplayMenuButton( SetGWorld(destPort, NULL); macDraw = (MacDrawable *) Tk_WindowId(tkwin); - if ((mbPtr->state == TK_STATE_DISABLED) && (mbPtr->disabledFg != NULL)) { + if ((mbPtr->state[0] == 'd') && (strcmp(mbPtr->state, "disabled")) + && (mbPtr->disabledFg != NULL)) { gc = mbPtr->disabledGC; - } else if ((mbPtr->state == TK_STATE_ACTIVE) && !Tk_StrictMotif(mbPtr->tkwin)) { + } else if ((mbPtr->state[0] == 'a') && (strcmp(mbPtr->state, "active")) + && !Tk_StrictMotif(mbPtr->tkwin)) { gc = mbPtr->activeTextGC; } else { gc = mbPtr->normalTextGC; @@ -162,7 +164,7 @@ TkpDisplayMenuButton( * foreground color, generate the stippled effect. */ - if ((mbPtr->state == TK_STATE_DISABLED) + if ((mbPtr->state[0] == 'd') && (strcmp(mbPtr->state, "disabled")) && ((mbPtr->disabledFg == NULL) || (mbPtr->image != NULL))) { XFillRectangle(mbPtr->display, Tk_WindowId(tkwin), mbPtr->disabledGC, mbPtr->inset, mbPtr->inset, @@ -221,9 +223,6 @@ TkpDisplayMenuButton( LineTo(r.left + kShadowOffset, r.bottom); } - if (mbPtr->state == TK_STATE_DISABLED) { - } - if (mbPtr->highlightWidth != 0) { GC gc; diff --git a/unix/tkUnixMenubu.c b/unix/tkUnixMenubu.c index 6d756d3..cf1ed7a 100644 --- a/unix/tkUnixMenubu.c +++ b/unix/tkUnixMenubu.c @@ -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: tkUnixMenubu.c,v 1.1.4.2 1999/01/07 02:42:57 lfb Exp $ + * RCS: @(#) $Id: tkUnixMenubu.c,v 1.1.4.3 1999/02/13 05:38:49 lfb Exp $ */ #include "tkMenubutton.h" @@ -84,10 +84,12 @@ TkpDisplayMenuButton(clientData) return; } - if ((mbPtr->state == TK_STATE_DISABLED) && (mbPtr->disabledFg != NULL)) { + if ((mbPtr->state[0] == 'd') && (strcmp(mbPtr->state, "disabled") == 0) + && (mbPtr->disabledFg != NULL)) { gc = mbPtr->disabledGC; border = mbPtr->normalBorder; - } else if ((mbPtr->state == TK_STATE_ACTIVE) + } else if ((mbPtr->state[0] == 'a') + && (strcmp(mbPtr->state, "active") == 0) && !Tk_StrictMotif(mbPtr->tkwin)) { gc = mbPtr->activeTextGC; border = mbPtr->activeBorder; @@ -143,7 +145,7 @@ TkpDisplayMenuButton(clientData) * foreground color, generate the stippled effect. */ - if ((mbPtr->state == TK_STATE_DISABLED) + if ((mbPtr->state[0] == 'd') && (strcmp(mbPtr->state, "disabled") ==0) && ((mbPtr->disabledFg == NULL) || (mbPtr->image != NULL))) { XFillRectangle(mbPtr->display, pixmap, mbPtr->disabledGC, mbPtr->inset, mbPtr->inset, -- cgit v0.12