diff options
Diffstat (limited to 'win/tkWinMenu.c')
| -rw-r--r-- | win/tkWinMenu.c | 75 |
1 files changed, 34 insertions, 41 deletions
diff --git a/win/tkWinMenu.c b/win/tkWinMenu.c index 6d974b2..12bfef4 100644 --- a/win/tkWinMenu.c +++ b/win/tkWinMenu.c @@ -333,7 +333,7 @@ TkpNewMenu( if (winMenuHdl == NULL) { Tcl_SetObjResult(menuPtr->interp, Tcl_NewStringObj( "No more menus can be allocated.", TCL_INDEX_NONE)); - Tcl_SetErrorCode(menuPtr->interp, "TK", "MENU", "SYSTEM_RESOURCES", NULL); + Tcl_SetErrorCode(menuPtr->interp, "TK", "MENU", "SYSTEM_RESOURCES", (char *)NULL); return TCL_ERROR; } @@ -576,7 +576,8 @@ ReconfigureWindowsMenu( LPCWSTR lpNewItem; UINT flags; UINT itemID; - int i, count, systemMenu = 0, base; + Tcl_Size i, count; + int systemMenu = 0, base; Tcl_DString translatedText; if (NULL == winMenuHdl) { @@ -652,7 +653,7 @@ ReconfigureWindowsMenu( flags |= MF_MENUBREAK; } - itemID = PTR2INT(mePtr->platformEntryData); + itemID = (UINT)PTR2INT(mePtr->platformEntryData); if ((mePtr->type == CASCADE_ENTRY) && (mePtr->childMenuRefPtr != NULL) && (mePtr->childMenuRefPtr->menuPtr != NULL)) { @@ -672,7 +673,7 @@ ReconfigureWindowsMenu( * If the MF_POPUP flag is set, then the id is interpreted * as the handle of a submenu. */ - itemID = PTR2INT(childMenuHdl); + itemID = (UINT)PTR2INT(childMenuHdl); } } if ((menuPtr->menuType == MENUBAR) @@ -1925,18 +1926,16 @@ DrawMenuEntryAccelerator( * Draw disabled 3D text highlight only with the Win95/98 look. */ - if (TkWinGetPlatformTheme() != TK_THEME_WIN_XP) { - if ((mePtr->state == ENTRY_DISABLED) - && (menuPtr->disabledFgPtr != NULL) && (accel != NULL)) { - COLORREF oldFgColor = gc->foreground; + if ((mePtr->state == ENTRY_DISABLED) + && (menuPtr->disabledFgPtr != NULL) && (accel != NULL)) { + COLORREF oldFgColor = gc->foreground; - gc->foreground = GetSysColor(COLOR_3DHILIGHT); - if (!(mePtr->entryFlags & ENTRY_PLATFORM_FLAG1)) { - Tk_DrawChars(menuPtr->display, d, gc, tkfont, accel, - mePtr->accelLength, leftEdge + 1, baseline + 1); - } - gc->foreground = oldFgColor; + gc->foreground = GetSysColor(COLOR_3DHILIGHT); + if (!(mePtr->entryFlags & ENTRY_PLATFORM_FLAG1)) { + Tk_DrawChars(menuPtr->display, d, gc, tkfont, accel, + mePtr->accelLength, leftEdge + 1, baseline + 1); } + gc->foreground = oldFgColor; } if (accel != NULL) { @@ -2063,9 +2062,9 @@ DrawMenuSeparator( XPoint points[2]; Tk_3DBorder border; - points[0].x = x; - points[0].y = y + height / 2; - points[1].x = x + width - 1; + points[0].x = (short)x; + points[0].y = (short)(y + height / 2); + points[1].x = (short)(x + width - 1); points[1].y = points[0].y; border = Tk_Get3DBorderFromObj(menuPtr->tkwin, menuPtr->borderPtr); Tk_Draw3DPolygon(menuPtr->tkwin, d, border, points, 2, 1, @@ -2102,7 +2101,7 @@ DrawMenuUnderline( int height) /* Height of entry */ { if ((mePtr->underline >= 0) && (mePtr->labelPtr != NULL)) { - int len; + Tcl_Size len; len = Tcl_GetCharLength(mePtr->labelPtr); if (mePtr->underline < len) { @@ -2469,22 +2468,20 @@ DrawMenuEntryLabel( int baseline = y + (height + fmPtr->ascent - fmPtr->descent) / 2; const char *label = Tcl_GetString(mePtr->labelPtr); - if (TkWinGetPlatformTheme() != TK_THEME_WIN_XP) { - /* - * Win 95/98 systems draw disabled menu text with a 3D - * highlight, unless the menu item is highlighted, - */ + /* + * Win 95/98 systems draw disabled menu text with a 3D + * highlight, unless the menu item is highlighted, + */ - if ((mePtr->state == ENTRY_DISABLED) && - !(mePtr->entryFlags & ENTRY_PLATFORM_FLAG1)) { - COLORREF oldFgColor = gc->foreground; + if ((mePtr->state == ENTRY_DISABLED) && + !(mePtr->entryFlags & ENTRY_PLATFORM_FLAG1)) { + COLORREF oldFgColor = gc->foreground; - gc->foreground = GetSysColor(COLOR_3DHILIGHT); - Tk_DrawChars(menuPtr->display, d, gc, tkfont, label, - mePtr->labelLength, leftEdge + textXOffset + 1, - baseline + textYOffset + 1); - gc->foreground = oldFgColor; - } + gc->foreground = GetSysColor(COLOR_3DHILIGHT); + Tk_DrawChars(menuPtr->display, d, gc, tkfont, label, + mePtr->labelLength, leftEdge + textXOffset + 1, + baseline + textYOffset + 1); + gc->foreground = oldFgColor; } Tk_DrawChars(menuPtr->display, d, gc, tkfont, label, mePtr->labelLength, leftEdge + textXOffset, @@ -2570,21 +2567,21 @@ DrawTearoffEntry( return; } - points[0].x = x; - points[0].y = y + height/2; + points[0].x = (short)x; + points[0].y = (short)(y + height/2); points[1].y = points[0].y; segmentWidth = 6; maxX = x + width - 1; border = Tk_Get3DBorderFromObj(menuPtr->tkwin, menuPtr->borderPtr); while (points[0].x < maxX) { - points[1].x = points[0].x + segmentWidth; + points[1].x = points[0].x + (short)segmentWidth; if (points[1].x > maxX) { - points[1].x = maxX; + points[1].x = (short)maxX; } Tk_Draw3DPolygon(menuPtr->tkwin, d, border, points, 2, 1, TK_RELIEF_RAISED); - points[0].x += 2*segmentWidth; + points[0].x += (short)(2*segmentWidth); } } @@ -3383,10 +3380,6 @@ SetDefaults( metrics.cbSize = sizeof(metrics); - if (TkWinGetPlatformTheme() != TK_THEME_WIN_VISTA) { - metrics.cbSize -= sizeof(int); - } - SystemParametersInfoW(SPI_GETNONCLIENTMETRICS, metrics.cbSize, &metrics, 0); menuFont = CreateFontIndirectW(&metrics.lfMenuFont); |
