summaryrefslogtreecommitdiffstats
path: root/win/tkWinX.c
diff options
context:
space:
mode:
authorhobbs <hobbs>2001-12-28 23:43:21 (GMT)
committerhobbs <hobbs>2001-12-28 23:43:21 (GMT)
commit7b1529cc14e1ea3e8b766e74e6cc0ead467dd887 (patch)
tree268b5309eda5408a6fb55016bbb638b0a0e73731 /win/tkWinX.c
parent65eb91e24d86d9e7ad1bd55dec69b13e1c28b1d0 (diff)
downloadtk-7b1529cc14e1ea3e8b766e74e6cc0ead467dd887.zip
tk-7b1529cc14e1ea3e8b766e74e6cc0ead467dd887.tar.gz
tk-7b1529cc14e1ea3e8b766e74e6cc0ead467dd887.tar.bz2
* win/tkWinInt.h:
* win/tkWinX.c: added TkWinProcs that represent a function table to switch between unicode and ansi procs on Windows. This is analogous to the TclWinProcs. Using Tcl_WinUtfToTChar, we can easily take advantage of using unicode functions where available without having to switch on the platform id each time.
Diffstat (limited to 'win/tkWinX.c')
-rw-r--r--win/tkWinX.c38
1 files changed, 37 insertions, 1 deletions
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;