diff options
Diffstat (limited to 'win')
-rw-r--r-- | win/tkWinInt.h | 28 | ||||
-rw-r--r-- | win/tkWinX.c | 38 |
2 files changed, 64 insertions, 2 deletions
diff --git a/win/tkWinInt.h b/win/tkWinInt.h index 57eef8d..49c3267 100644 --- a/win/tkWinInt.h +++ b/win/tkWinInt.h @@ -11,7 +11,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkWinInt.h,v 1.11 2001/03/30 23:50:17 hobbs Exp $ + * RCS: @(#) $Id: tkWinInt.h,v 1.12 2001/12/28 23:43:21 hobbs Exp $ */ #ifndef _TKWININT @@ -164,6 +164,32 @@ EXTERN LRESULT CALLBACK TkWinChildProc _ANSI_ARGS_((HWND hwnd, UINT message, */ EXTERN void TkWinUpdatingClipboard(int mode); +/* + * The following structure keeps track of whether we are using the + * multi-byte or the wide-character interfaces to the operating system. + * System calls should be made through the following function table. + * + * While some system calls need to use this A/W jump-table, it is not + * necessary for all calls to do it, which is why you won't see this + * used throughout the Tk code, but only in key areas. -- hobbs + */ + +typedef struct TkWinProcs { + int useWide; + LRESULT (WINAPI *callWindowProc)(WNDPROC lpPrevWndFunc, HWND hWnd, + UINT Msg, WPARAM wParam, LPARAM lParam); + LRESULT (WINAPI *defWindowProc)(HWND hWnd, UINT Msg, WPARAM wParam, + LPARAM lParam); + ATOM (WINAPI *registerClass)(CONST WNDCLASS *lpWndClass); + BOOL (WINAPI *setWindowText)(HWND hWnd, LPCTSTR lpString); + HWND (WINAPI *createWindowEx)(DWORD dwExStyle, LPCTSTR lpClassName, + LPCTSTR lpWindowName, DWORD dwStyle, int x, int y, + int nWidth, int nHeight, HWND hWndParent, HMENU hMenu, + HINSTANCE hInstance, LPVOID lpParam); +} TkWinProcs; + +EXTERN TkWinProcs *tkWinProcs; + #undef TCL_STORAGE_CLASS #define TCL_STORAGE_CLASS DLLIMPORT diff --git a/win/tkWinX.c b/win/tkWinX.c index e7ec13d..d277fc7 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.16 2001/11/10 00:58:51 hobbs Exp $ + * RCS: @(#) $Id: tkWinX.c,v 1.17 2001/12/28 23:43:24 hobbs Exp $ */ #include "tkWinInt.h" @@ -28,6 +28,38 @@ #include <imm.h> +static TkWinProcs asciiProcs = { + 0, + + (LRESULT (WINAPI *)(WNDPROC lpPrevWndFunc, HWND hWnd, UINT Msg, + WPARAM wParam, LPARAM lParam)) CallWindowProcA, + (LRESULT (WINAPI *)(HWND hWnd, UINT Msg, WPARAM wParam, + LPARAM lParam)) DefWindowProcA, + (ATOM (WINAPI *)(CONST WNDCLASS *lpWndClass)) RegisterClassA, + (BOOL (WINAPI *)(HWND hWnd, LPCTSTR lpString)) SetWindowTextA, + (HWND (WINAPI *)(DWORD dwExStyle, LPCTSTR lpClassName, + LPCTSTR lpWindowName, DWORD dwStyle, int x, int y, + int nWidth, int nHeight, HWND hWndParent, HMENU hMenu, + HINSTANCE hInstance, LPVOID lpParam)) CreateWindowExA, +}; + +static TkWinProcs unicodeProcs = { + 1, + + (LRESULT (WINAPI *)(WNDPROC lpPrevWndFunc, HWND hWnd, UINT Msg, + WPARAM wParam, LPARAM lParam)) CallWindowProcW, + (LRESULT (WINAPI *)(HWND hWnd, UINT Msg, WPARAM wParam, + LPARAM lParam)) DefWindowProcW, + (ATOM (WINAPI *)(CONST WNDCLASS *lpWndClass)) RegisterClassW, + (BOOL (WINAPI *)(HWND hWnd, LPCTSTR lpString)) SetWindowTextW, + (HWND (WINAPI *)(DWORD dwExStyle, LPCTSTR lpClassName, + LPCTSTR lpWindowName, DWORD dwStyle, int x, int y, + int nWidth, int nHeight, HWND hWndParent, HMENU hMenu, + HINSTANCE hInstance, LPVOID lpParam)) CreateWindowExW, +}; + +TkWinProcs *tkWinProcs; + /* * Declarations of static variables used in this file. */ @@ -164,6 +196,10 @@ TkWinXInit(hInstance) INITCOMMONCONTROLSEX comctl; ZeroMemory(&comctl, sizeof(comctl)); (void) InitCommonControlsEx(&comctl); + + tkWinProcs = &unicodeProcs; + } else { + tkWinProcs = &asciiProcs; } tkInstance = hInstance; |