Index: generic/tkMenubutton.c ================================================================== --- generic/tkMenubutton.c +++ generic/tkMenubutton.c @@ -129,10 +129,16 @@ {TK_OPTION_INDEX, "-underline", "underline", "Underline", TK_OPTION_UNDERLINE_DEF(TkMenuButton, underline), 0}, {TK_OPTION_STRING, "-width", "width", "Width", DEF_MENUBUTTON_WIDTH, TCL_INDEX_NONE, offsetof(TkMenuButton, widthString), 0, 0, 0}, + {TK_OPTION_STRING, "-indwidth", "indWidth", "IndWidth", + DEF_MENUBUTTON_INDICATORWIDTH, TCL_INDEX_NONE, offsetof(TkMenuButton, indicatorWidthString), + 0, 0, 0}, + {TK_OPTION_STRING, "-indheight", "indHeight", "IndHeight", + DEF_MENUBUTTON_INDICATORHEIGHT, TCL_INDEX_NONE, offsetof(TkMenuButton, indicatorHeightString), + 0, 0, 0}, {TK_OPTION_PIXELS, "-wraplength", "wrapLength", "WrapLength", DEF_MENUBUTTON_WRAP_LENGTH, TCL_INDEX_NONE, offsetof(TkMenuButton, wrapLength), 0, 0, 0}, {TK_OPTION_END, NULL, NULL, NULL, NULL, 0, 0, 0, NULL, 0} }; @@ -267,10 +273,12 @@ mbPtr->stippleGC = NULL; mbPtr->leftBearing = 0; mbPtr->rightBearing = 0; mbPtr->widthString = NULL; mbPtr->heightString = NULL; + mbPtr->indicatorWidthString = NULL; + mbPtr->indicatorHeightString = NULL; mbPtr->width = 0; mbPtr->width = 0; mbPtr->wrapLength = 0; mbPtr->padX = 0; mbPtr->padY = 0; @@ -278,10 +286,12 @@ mbPtr->justify = TK_JUSTIFY_CENTER; mbPtr->textLayout = NULL; mbPtr->indicatorOn = 0; mbPtr->indicatorWidth = 0; mbPtr->indicatorHeight = 0; + mbPtr->indWidthStore = 0; + mbPtr->indHeightStore = 0; mbPtr->direction = DIRECTION_FLUSH; mbPtr->cursor = NULL; mbPtr->takeFocus = NULL; mbPtr->flags = 0; @@ -579,18 +589,38 @@ &mbPtr->height) != TCL_OK) { heightError: Tcl_AddErrorInfo(interp, "\n (processing -height option)"); continue; } + if (Tk_GetPixels(interp, mbPtr->tkwin, mbPtr->indicatorWidthString, + &mbPtr->indWidthStore) != TCL_OK) { + indicatorWidthError: + Tcl_AddErrorInfo(interp, "\n (processing -indicatorwidth option)"); + continue; + } + if (Tk_GetPixels(interp, mbPtr->tkwin, mbPtr->indicatorHeightString, + &mbPtr->indHeightStore) != TCL_OK) { + indicatorHeightError: + Tcl_AddErrorInfo(interp, "\n (processing -indicatorheight option)"); + continue; + } } else { if (Tcl_GetInt(interp, mbPtr->widthString, &mbPtr->width) != TCL_OK) { goto widthError; } if (Tcl_GetInt(interp, mbPtr->heightString, &mbPtr->height) != TCL_OK) { goto heightError; + } + if (Tcl_GetInt(interp, mbPtr->indicatorWidthString, &mbPtr->indWidthStore) + != TCL_OK) { + goto indicatorWidthError; + } + if (Tcl_GetInt(interp, mbPtr->indicatorHeightString, &mbPtr->indHeightStore) + != TCL_OK) { + goto indicatorHeightError; } } break; } Index: generic/tkMenubutton.h ================================================================== --- generic/tkMenubutton.h +++ generic/tkMenubutton.h @@ -121,10 +121,12 @@ * pixel (positive means to right). */ int rightBearing; /* Amount text sticks right from its * origin. */ char *widthString; /* Value of -width option. Malloc'ed. */ char *heightString; /* Value of -height option. Malloc'ed. */ + char *indicatorWidthString; /* Value of -indicatorwidth option */ + char *indicatorHeightString;/* Value of -indicatorheight option */ int width, height; /* If > 0, these specify dimensions to request * for window, in characters for text and in * pixels for bitmaps. In this case the actual * size of the text string or bitmap is * ignored in computing desired window @@ -150,10 +152,12 @@ * side of the indicator. 0 if no * indicator. */ int indicatorWidth; /* Width of indicator in pixels, including * indicatorHeight in padding on each side. 0 * if no indicator. */ + int indWidthStore; /* Unchanging indicator width */ + int indHeightStore; /* Unchanging indicator height */ /* * Miscellaneous information: */ Index: macosx/tkMacOSXDefault.h ================================================================== --- macosx/tkMacOSXDefault.h +++ macosx/tkMacOSXDefault.h @@ -359,10 +359,12 @@ #define DEF_MENUBUTTON_STATE "normal" #define DEF_MENUBUTTON_TAKE_FOCUS "0" #define DEF_MENUBUTTON_TEXT "" #define DEF_MENUBUTTON_TEXT_VARIABLE "" #define DEF_MENUBUTTON_WIDTH "0" +#define DEF_MENUBUTTON_INDICATORWIDTH "0" +#define DEF_MENUBUTTON_INDICATORHEIGHT "0" #define DEF_MENUBUTTON_WRAP_LENGTH "0" /* * Defaults for messages: */ Index: tests/menubut.test ================================================================== --- tests/menubut.test +++ tests/menubut.test @@ -365,11 +365,11 @@ .mb configure -highlightthickness 3 .mb cget -highlightthickness } -result 3 test menubutton-3.7 {ButtonWidgetCmd procedure, "configure" option} -body { llength [.mb configure] -} -result 33 +} -result 35 test menubutton-3.8 {ButtonWidgetCmd procedure, "configure" option} -body { .mb configure -gorp } -returnCodes error -result {unknown option "-gorp"} test menubutton-3.9 {ButtonWidgetCmd procedure, "configure" option} -body { .mb co -bg #ffffff -fg Index: unix/tkUnixDefault.h ================================================================== --- unix/tkUnixDefault.h +++ unix/tkUnixDefault.h @@ -331,10 +331,12 @@ #define DEF_MENUBUTTON_STATE "normal" #define DEF_MENUBUTTON_TAKE_FOCUS "0" #define DEF_MENUBUTTON_TEXT "" #define DEF_MENUBUTTON_TEXT_VARIABLE "" #define DEF_MENUBUTTON_WIDTH "0" +#define DEF_MENUBUTTON_INDICATORWIDTH "0" +#define DEF_MENUBUTTON_INDICATORHEIGHT "0" #define DEF_MENUBUTTON_WRAP_LENGTH "0" /* * Defaults for messages: */ Index: unix/tkUnixMenubu.c ================================================================== --- unix/tkUnixMenubu.c +++ unix/tkUnixMenubu.c @@ -450,13 +450,22 @@ } if (mbPtr->indicatorOn) { mm = WidthMMOfScreen(Tk_Screen(mbPtr->tkwin)); pixels = WidthOfScreen(Tk_Screen(mbPtr->tkwin)); - mbPtr->indicatorHeight= (INDICATOR_HEIGHT * pixels)/(10*mm); - mbPtr->indicatorWidth = (INDICATOR_WIDTH * pixels)/(10*mm) - + 2*mbPtr->indicatorHeight; + if (mbPtr->indHeightStore == 0) { + mbPtr->indicatorHeight = (INDICATOR_HEIGHT * pixels)/(10*mm); + } else { + mbPtr->indicatorHeight = (mbPtr->indHeightStore * pixels)/(10*mm); + } + if (mbPtr->indWidthStore == 0) { + mbPtr->indicatorWidth = (INDICATOR_WIDTH * pixels)/(10*mm) + + 2*mbPtr->indicatorHeight; + } else { + mbPtr->indicatorWidth = (mbPtr->indWidthStore * pixels)/(10*mm) + + 2*mbPtr->indicatorHeight; + } width += mbPtr->indicatorWidth; } else { mbPtr->indicatorHeight = 0; mbPtr->indicatorWidth = 0; } Index: win/tkWinDefault.h ================================================================== --- win/tkWinDefault.h +++ win/tkWinDefault.h @@ -333,10 +333,12 @@ #define DEF_MENUBUTTON_STATE "normal" #define DEF_MENUBUTTON_TAKE_FOCUS "0" #define DEF_MENUBUTTON_TEXT "" #define DEF_MENUBUTTON_TEXT_VARIABLE "" #define DEF_MENUBUTTON_WIDTH "0" +#define DEF_MENUBUTTON_INDICATORWIDTH "0" +#define DEF_MENUBUTTON_INDICATORHEIGHT "0" #define DEF_MENUBUTTON_WRAP_LENGTH "0" /* * Defaults for messages: */