diff options
author | mdejong <mdejong> | 2004-09-23 00:56:13 (GMT) |
---|---|---|
committer | mdejong <mdejong> | 2004-09-23 00:56:13 (GMT) |
commit | 14c82c0776968423852d4646b4b51457f835e088 (patch) | |
tree | a5ef654dd2cffd06d968ff35befb088f3e4a8054 /win/tkWinX.c | |
parent | 7624de17c0d78e511a0c17d019665df34f3cc073 (diff) | |
download | tk-14c82c0776968423852d4646b4b51457f835e088.zip tk-14c82c0776968423852d4646b4b51457f835e088.tar.gz tk-14c82c0776968423852d4646b4b51457f835e088.tar.bz2 |
* generic/tkInt.decls: Add decl for TkWinGetPlatformTheme.
It is only defined under Win32.
* generic/tkIntPlatDecls.h: Regen.
* generic/tkStubInit.c: Regen.
* win/tkWinInt.h: Define TK_THEME_WIN_CLASSIC and
TK_THEME_WIN_XP.
* win/tkWinMenu.c (DrawMenuEntryAccelerator, DrawMenuEntryLabel):
Draw a disabled 3D text highlight for the accelerator only
with the Win95/98 look. Same goes for the menu entry text.
* win/tkWinX.c (TkWinGetPlatformId, TkWinGetPlatformTheme):
Automatically detect the Windows theme in use and return
either TK_THEME_WIN_CLASSIC or TK_THEME_WIN_XP when the
TkWinGetPlatformTheme function is invoked.
[Patch 866194]
* win/tkWinMenu.c: only provide a submenu handle when the
MF_POPUP flag is given, fixing a recently-introduced crash
when submenus are disabled. Also better error checking for
this sort of situation in the future.
* win/tkWinMenu.c (ReconfigureWindowsMenu): Fix drawing of a disabled
(TkWinHandleMenuEvent, DrawMenuEntryArrow): cascade menu arrow. Tk was
displaying a disabled cascade menu arrow in black instead of
gray. This was caused by a bug in the Win32 code for user drawn
menu items. The fix is to avoid telling Windows that the menu item
is a cascade type and then draw the gray arrow bitmap on our own.
[Patch 865842]
* win/tkWinMenu.c (DrawWindowsSystemBitmap): Fix a strange Win32
bug where the logical coordinates returned by a call to DPtoLP are
wrong the first time a menu is posted. This bug manifested itself
by drawing the bitmap in the wrong place in a menu. The fix was
to pass the newly created DC instead of the DC from the window.
* win/tkWinMenu.c (DrawMenuEntryAccelerator):
(DrawMenuEntryLabel): When drawing the label text and accelerator
text for a disabled menu entry be sure to draw a 3D highlight.
The only exception to this is when a disabled menu entry is
highlighted, in that case do not draw a 3D hightlight.
* win/tkWinMenu.c (DrawMenuEntryAccelerator, DrawMenuEntryArrow):
Move the unused menu arrow drawing code in
DrawMenuEntryAccelerator into a new function named
DrawMenuEntryArrow. This makes no functional change but it will
make it easier to fix things in the future.
Diffstat (limited to 'win/tkWinX.c')
-rw-r--r-- | win/tkWinX.c | 57 |
1 files changed, 56 insertions, 1 deletions
diff --git a/win/tkWinX.c b/win/tkWinX.c index 550bc34..94b3c6c 100644 --- a/win/tkWinX.c +++ b/win/tkWinX.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: tkWinX.c,v 1.25.2.2 2004/05/03 22:40:58 hobbs Exp $ + * RCS: @(#) $Id: tkWinX.c,v 1.25.2.3 2004/09/23 00:56:15 mdejong Exp $ */ #include "tkWinInt.h" @@ -84,6 +84,7 @@ static HINSTANCE tkInstance = NULL; /* Application instance handle. */ static int childClassInitialized; /* Registered child class? */ static WNDCLASS childClass; /* Window class for child windows. */ static int tkPlatformId = 0; /* version of Windows platform */ +static int tkWinTheme = 0; /* See TkWinGetPlatformTheme */ static Tcl_Encoding keyInputEncoding = NULL;/* The current character * encoding for keyboard input */ static int keyInputCharset = -1; /* The Win32 CHARSET for the keyboard @@ -356,6 +357,33 @@ TkWinGetPlatformId() os.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); GetVersionEx(&os); tkPlatformId = os.dwPlatformId; + + /* Set tkWinTheme to be TK_THEME_WIN_XP or TK_THEME_WIN_CLASSIC. + * The TK_THEME_WIN_CLASSIC could be set even when running + * under XP if the windows classic theme was selected. */ + if ((os.dwPlatformId == VER_PLATFORM_WIN32_NT) && + (os.dwMajorVersion == 5 && os.dwMinorVersion == 1)) { + HKEY hKey; + LPCSTR szSubKey = TEXT("Control Panel\\Appearance"); + LPCSTR szCurrent = TEXT("Current"); + DWORD dwSize = 200; + char pBuffer[200]; + memset(pBuffer, 0, dwSize); + if (RegOpenKeyEx(HKEY_CURRENT_USER, szSubKey, 0L, + KEY_READ, &hKey) != ERROR_SUCCESS) { + tkWinTheme = TK_THEME_WIN_XP; + } else { + RegQueryValueEx(hKey, szCurrent, NULL, NULL, pBuffer, &dwSize); + RegCloseKey(hKey); + if (strcmp(pBuffer, "Windows Standard") == 0) { + tkWinTheme = TK_THEME_WIN_CLASSIC; + } else { + tkWinTheme = TK_THEME_WIN_XP; + } + } + } else { + tkWinTheme = TK_THEME_WIN_CLASSIC; + } } return tkPlatformId; } @@ -363,6 +391,33 @@ TkWinGetPlatformId() /* *---------------------------------------------------------------------- * + * TkWinGetPlatformTheme -- + * + * Return the Windows drawing style we should be using. + * + * Results: + * The return value is one of: + * TK_THEME_WIN_CLASSIC 95/98/NT or XP in classic mode + * TK_THEME_WIN_XP XP not in classic mode + * + * Side effects: + * Could invoke TkWinGetPlatformId. + * + *---------------------------------------------------------------------- + */ + +int +TkWinGetPlatformTheme() +{ + if (tkPlatformId == 0) { + TkWinGetPlatformId(); + } + return tkWinTheme; +} + +/* + *---------------------------------------------------------------------- + * * TkGetDefaultScreenName -- * * Returns the name of the screen that Tk should use during |