]> git.saurik.com Git - wxWidgets.git/blob - src/msw/penwin.cpp
GdiplusStartup() takes ULONG_PTR, not DWORD (patch 1596318); also deTABified
[wxWidgets.git] / src / msw / penwin.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: src/msw/penwin.cpp
3 // Purpose: PenWindows code
4 // Author: Julian Smart
5 // Modified by:
6 // Created: 04/01/98
7 // RCS-ID: $Id$
8 // Copyright: (c) Julian Smart
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
11
12 // For compilers that support precompilation, includes "wx.h".
13 #include "wx/wxprec.h"
14
15 #ifdef __BORLANDC__
16 #pragma hdrstop
17 #endif
18
19 #ifndef WX_PRECOMP
20 #include "wx/window.h"
21 #endif
22
23 #include "wx/msw/private.h"
24
25 #if wxUSE_PENWINDOWS
26
27 #ifdef __BORLANDC__
28 #define RPA_DEFAULT 1
29 #else
30 #include <penwin.h>
31 #endif
32
33 HANDLE g_hPenWin = (HANDLE)NULL;
34 typedef void (CALLBACK * PENREGPROC)(WORD,BOOL);
35
36 // The routine below allows Windows applications (binaries) to
37 // support Pen input when running under Microsoft Windows for
38 // Pen Computing 1.0 without need of the PenPalete.
39 //
40 // Should masked edit functions be added to wxWidgets we would
41 // be a new class of functions to support BEDIT controls.
42 //
43 // (The function is a NOOP for native Windows-NT)
44 #ifndef __WIN32__
45 static void (CALLBACK * RegPenApp) (WORD, BOOL) = NULL;
46 #endif
47
48 // Where is this called??
49 void wxEnablePenAppHooks (bool hook)
50 {
51 #ifndef __WIN32__
52 if (hook)
53 {
54 if (g_hPenWin)
55 return;
56
57 ///////////////////////////////////////////////////////////////////////
58 // If running on a Pen Windows system, register this app so all
59 // EDIT controls in dialogs are replaced by HEDIT controls.
60 if ((g_hPenWin = (HANDLE)::GetSystemMetrics (SM_PENWINDOWS)) != (HANDLE) NULL)
61 {
62 // We do this fancy GetProcAddress simply because we don't
63 // know if we're running Pen Windows.
64 if ((RegPenApp = (PENREGPROC)GetProcAddress (g_hPenWin, "RegisterPenApp")) != NULL)
65 (*RegPenApp) (RPA_DEFAULT, TRUE);
66 }
67 }
68 else
69 {
70 ///////////////////////////////////////////////////////////////////////
71 // If running on a Pen Windows system, unregister
72 if (g_hPenWin)
73 {
74 // Unregister this app
75 if (RegPenApp != NULL)
76 (*RegPenApp) (RPA_DEFAULT, FALSE);
77 g_hPenWin = (HANDLE) NULL;
78 }
79 }
80 #endif /* ! Windows-NT */
81 }
82
83 #endif
84 // End wxUSE_PENWINDOWS
85
86 void wxRegisterPenWin(void)
87 {
88 #if wxUSE_PENWINDOWS
89 ///////////////////////////////////////////////////////////////////////
90 // If running on a Pen Windows system, register this app so all
91 // EDIT controls in dialogs are replaced by HEDIT controls.
92 // (Notice the CONTROL statement in the RC file is "EDIT",
93 // RegisterPenApp will automatically change that control to
94 // an HEDIT.
95 if ((g_hPenWin = (HANDLE)::GetSystemMetrics(SM_PENWINDOWS)) != (HANDLE)NULL) {
96 // We do this fancy GetProcAddress simply because we don't
97 // know if we're running Pen Windows.
98 if ( (RegPenApp = (void (CALLBACK *)(WORD, BOOL))GetProcAddress(g_hPenWin, "RegisterPenApp"))!= NULL)
99 (*RegPenApp)(RPA_DEFAULT, TRUE);
100 }
101 ///////////////////////////////////////////////////////////////////////
102 #endif
103 }
104
105 void wxCleanUpPenWin(void)
106 {
107 #if wxUSE_PENWINDOWS
108 if (g_hPenWin) {
109 // Unregister this app
110 if (RegPenApp != NULL)
111 (*RegPenApp)(RPA_DEFAULT, FALSE);
112 }
113 #endif
114 }