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)
commitfabb85e7160c59852d9595c2afdcaca9673ad047 (patch)
tree268b5309eda5408a6fb55016bbb638b0a0e73731 /win/tkWinX.c
parent84de53d6089bbb82a7027bd2f05e576fa8e8ebbd (diff)
downloadtk-fabb85e7160c59852d9595c2afdcaca9673ad047.zip
tk-fabb85e7160c59852d9595c2afdcaca9673ad047.tar.gz
tk-fabb85e7160c59852d9595c2afdcaca9673ad047.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;