Index: doc/menu.n ================================================================== --- doc/menu.n +++ doc/menu.n @@ -17,11 +17,11 @@ \fBtk_menuSetFocus\fR \fIpathName\fR .SO \-activebackground \-borderwidth \-foreground \-activeborderwidth \-cursor \-relief \-activeforeground \-disabledforeground \-takefocus -\-background \-font +\-background \-font \-activerelief .SE .SH "WIDGET-SPECIFIC OPTIONS" .OP \-postcommand postCommand Command If this option is specified then it provides a Tcl command to execute each time the menu is posted. The command is invoked by the \fBpost\fR Index: doc/options.n ================================================================== --- doc/options.n +++ doc/options.n @@ -56,10 +56,13 @@ This option is typically only available in widgets displaying more than one element at a time (e.g. menus but not buttons). .OP \-activeforeground activeForeground Background Specifies foreground color to use when drawing active elements. See above for definition of active elements. +.OP \-activerelief activeRelief Relief +Specifies the 3-D effect desired for the active item of the widget. +See the \fB-relief\fR option for details. .OP \-anchor anchor Anchor Specifies how the information in a widget (e.g. text or a bitmap) is to be displayed in the widget. Must be one of the values \fBn\fR, \fBne\fR, \fBe\fR, \fBse\fR, \fBs\fR, \fBsw\fR, \fBw\fR, \fBnw\fR, or \fBcenter\fR. Index: generic/tkMenu.c ================================================================== --- generic/tkMenu.c +++ generic/tkMenu.c @@ -257,10 +257,13 @@ Tk_Offset(TkMenu, activeBorderWidthPtr), -1, 0, NULL, 0}, {TK_OPTION_COLOR, "-activeforeground", "activeForeground", "Background", DEF_MENU_ACTIVE_FG_COLOR, Tk_Offset(TkMenu, activeFgPtr), -1, 0, (ClientData) DEF_MENU_ACTIVE_FG_MONO, 0}, + {TK_OPTION_RELIEF, "-activerelief", "activeRelief", "Relief", + DEF_MENU_ACTIVE_RELIEF, Tk_Offset(TkMenu, activeReliefPtr), + -1, 0, NULL, 0}, {TK_OPTION_BORDER, "-background", "background", "Background", DEF_MENU_BG_COLOR, Tk_Offset(TkMenu, borderPtr), -1, 0, (ClientData) DEF_MENU_BG_MONO, 0}, {TK_OPTION_SYNONYM, "-bd", NULL, NULL, NULL, 0, -1, 0, "-borderwidth", 0}, Index: generic/tkMenu.h ================================================================== --- generic/tkMenu.h +++ generic/tkMenu.h @@ -295,10 +295,11 @@ Tcl_Obj *activeBorderPtr; /* Used to draw background and border for * active element (if any). */ Tcl_Obj *activeBorderWidthPtr; /* Width of border around active element. */ Tcl_Obj *reliefPtr; /* 3-d effect: TK_RELIEF_RAISED, etc. */ + Tcl_Obj *activeReliefPtr; /* 3-d effect for active element. */ Tcl_Obj *fontPtr; /* Text font for menu entries. */ Tcl_Obj *fgPtr; /* Foreground color for entries. */ Tcl_Obj *disabledFgPtr; /* Foreground color when disabled. NULL means * use normalFg with a 50% stipple instead. */ Tcl_Obj *activeFgPtr; /* Foreground color for active entry. */ Index: macosx/tkMacOSXDefault.h ================================================================== --- macosx/tkMacOSXDefault.h +++ macosx/tkMacOSXDefault.h @@ -312,10 +312,11 @@ #define DEF_MENU_ACTIVE_BG_COLOR "systemMenuActive" #define DEF_MENU_ACTIVE_BG_MONO BLACK #define DEF_MENU_ACTIVE_BORDER_WIDTH "0" #define DEF_MENU_ACTIVE_FG_COLOR "systemMenuActiveText" #define DEF_MENU_ACTIVE_FG_MONO WHITE +#define DEF_MENU_ACTIVE_RELIEF "flat" #define DEF_MENU_BG_COLOR "systemMenu" #define DEF_MENU_BG_MONO WHITE #define DEF_MENU_BORDER_WIDTH "0" #define DEF_MENU_CURSOR "arrow" #define DEF_MENU_DISABLED_FG_COLOR "systemMenuDisabled" Index: tests/menu.test ================================================================== --- tests/menu.test +++ tests/menu.test @@ -173,10 +173,18 @@ } -result {#ff0000} test menu-2.6 {configuration options -activeforeground non-existent} -body { .m1 configure -activeforeground non-existent } -returnCodes error -result {unknown color name "non-existent"} +test menu-2.6a {configuration options -activerelief sunken} -body { + .m1 configure -activerelief sunken + .m1 cget -activerelief +} -result {sunken} +test menu-2.6b {configuration options -activerelief badValue} -body { + .m1 configure -activerelief badValue +} -returnCodes error -result {bad relief "badValue": must be flat, groove, raised, ridge, solid, or sunken} + test menu-2.7 {configuration options -background #ff0000} -body { .m1 configure -background #ff0000 .m1 cget -background } -result {#ff0000} test menu-2.8 {configuration options -background non-existent} -body { @@ -1357,11 +1365,11 @@ } -body { menu .m1 llength [.m1 configure] } -cleanup { destroy .m1 -} -result {20} +} -result {21} test menu-3.19 {MenuWidgetCmd procedure, "configure" option} -setup { destroy .m1 } -body { menu .m1 .m1 configure -gorp Index: unix/tkUnixDefault.h ================================================================== --- unix/tkUnixDefault.h +++ unix/tkUnixDefault.h @@ -274,10 +274,11 @@ #define DEF_MENU_ACTIVE_BG_COLOR ACTIVE_BG #define DEF_MENU_ACTIVE_BG_MONO BLACK #define DEF_MENU_ACTIVE_BORDER_WIDTH "1" #define DEF_MENU_ACTIVE_FG_COLOR BLACK #define DEF_MENU_ACTIVE_FG_MONO WHITE +#define DEF_MENU_ACTIVE_RELIEF "raised" #define DEF_MENU_BG_COLOR NORMAL_BG #define DEF_MENU_BG_MONO WHITE #define DEF_MENU_BORDER_WIDTH "1" #define DEF_MENU_CURSOR "arrow" #define DEF_MENU_DISABLED_FG_COLOR DISABLED Index: unix/tkUnixMenu.c ================================================================== --- unix/tkUnixMenu.c +++ unix/tkUnixMenu.c @@ -441,13 +441,12 @@ if ((menuPtr->menuType == MENUBAR) && ((menuPtr->postedCascade == NULL) || (menuPtr->postedCascade != mePtr))) { relief = TK_RELIEF_FLAT; } else { - relief = TK_RELIEF_RAISED; + Tk_GetReliefFromObj(NULL, menuPtr->activeReliefPtr, &relief); } - Tk_GetPixelsFromObj(NULL, menuPtr->tkwin, menuPtr->activeBorderWidthPtr, &activeBorderWidth); Tk_Fill3DRectangle(menuPtr->tkwin, d, bgBorder, x, y, width, height, activeBorderWidth, relief); } else { Index: win/tkWinDefault.h ================================================================== --- win/tkWinDefault.h +++ win/tkWinDefault.h @@ -277,10 +277,11 @@ #define DEF_MENU_ACTIVE_BG_COLOR SELECT_BG #define DEF_MENU_ACTIVE_BG_MONO BLACK #define DEF_MENU_ACTIVE_BORDER_WIDTH "0" #define DEF_MENU_ACTIVE_FG_COLOR SELECT_FG #define DEF_MENU_ACTIVE_FG_MONO WHITE +#define DEF_MENU_ACTIVE_RELIEF "flat" #define DEF_MENU_BG_COLOR MENU_BG #define DEF_MENU_BG_MONO WHITE #define DEF_MENU_BORDER_WIDTH "0" #define DEF_MENU_CURSOR "arrow" #define DEF_MENU_DISABLED_FG_COLOR DISABLED Index: win/tkWinMenu.c ================================================================== --- win/tkWinMenu.c +++ win/tkWinMenu.c @@ -2788,14 +2788,30 @@ int width, /* width of rectangle to draw */ int height) /* height of rectangle to draw */ { if (mePtr->state == ENTRY_ACTIVE || (mePtr->entryFlags & ENTRY_PLATFORM_FLAG1)!=0 ) { + int relief; + int activeBorderWidth; + bgBorder = activeBorder; + + if ((menuPtr->menuType == MENUBAR) + && ((menuPtr->postedCascade == NULL) + || (menuPtr->postedCascade != mePtr))) { + relief = TK_RELIEF_FLAT; + } else { + Tk_GetReliefFromObj(NULL, menuPtr->activeReliefPtr, &relief); + } + Tk_GetPixelsFromObj(NULL, menuPtr->tkwin, + menuPtr->activeBorderWidthPtr, &activeBorderWidth); + Tk_Fill3DRectangle(menuPtr->tkwin, d, bgBorder, x, y, width, height, + activeBorderWidth, relief); + } else { + Tk_Fill3DRectangle(menuPtr->tkwin, d, bgBorder, x, y, width, height, 0, + TK_RELIEF_FLAT); } - Tk_Fill3DRectangle(menuPtr->tkwin, d, bgBorder, x, y, width, height, 0, - TK_RELIEF_FLAT); } /* *-------------------------------------------------------------- *