]>
Commit | Line | Data |
---|---|---|
2bda0e17 KB |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: 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 and Markus Holzem | |
9 | // Licence: wxWindows license | |
10 | ///////////////////////////////////////////////////////////////////////////// | |
11 | ||
12 | #ifdef __GNUG__ | |
13 | #pragma implementation | |
14 | #endif | |
15 | ||
16 | // For compilers that support precompilation, includes "wx.h". | |
2bda0e17 KB |
17 | #include "wx/wxprec.h" |
18 | ||
a3b46648 | 19 | #ifdef __BORLANDC__ |
2bda0e17 KB |
20 | #pragma hdrstop |
21 | #endif | |
22 | ||
23 | #ifndef WX_PRECOMP | |
24 | #include "wx/setup.h" | |
2432b92d | 25 | #include "wx/window.h" |
2bda0e17 KB |
26 | #endif |
27 | ||
28 | #include "wx/msw/private.h" | |
29 | ||
47d67540 | 30 | #if wxUSE_PENWINDOWS |
2bda0e17 KB |
31 | |
32 | #ifdef __BORLANDC__ | |
33 | #define RPA_DEFAULT 1 | |
34 | #else | |
35 | #include <penwin.h> | |
36 | #endif | |
37 | ||
81d66cf3 | 38 | HANDLE g_hPenWin = (HANDLE)NULL; |
2bda0e17 KB |
39 | typedef void (CALLBACK * PENREGPROC)(WORD,BOOL); |
40 | ||
41 | // The routine below allows Windows applications (binaries) to | |
42 | // support Pen input when running under Microsoft Windows for | |
43 | // Pen Computing 1.0 without need of the PenPalete. | |
44 | // | |
45 | // Should masked edit functions be added to wxWindows we would | |
46 | // be a new class of functions to support BEDIT controls. | |
47 | // | |
48 | // (The function is a NOOP for native Windows-NT) | |
49 | #ifndef __WIN32__ | |
50 | static void (CALLBACK * RegPenApp) (WORD, BOOL) = NULL; | |
51 | #endif | |
52 | ||
53 | // Where is this called?? | |
54 | void wxEnablePenAppHooks (bool hook) | |
55 | { | |
56 | #ifndef __WIN32__ | |
57 | if (hook) | |
58 | { | |
81d66cf3 | 59 | if (g_hPenWin) |
2bda0e17 KB |
60 | return; |
61 | ||
62 | /////////////////////////////////////////////////////////////////////// | |
63 | // If running on a Pen Windows system, register this app so all | |
64 | // EDIT controls in dialogs are replaced by HEDIT controls. | |
81d66cf3 | 65 | if ((g_hPenWin = (HANDLE)GetSystemMetrics (SM_PENWINDOWS)) != (HANDLE) NULL) |
2bda0e17 KB |
66 | { |
67 | // We do this fancy GetProcAddress simply because we don't | |
68 | // know if we're running Pen Windows. | |
81d66cf3 | 69 | if ((RegPenApp = (PENREGPROC)GetProcAddress (g_hPenWin, "RegisterPenApp")) != NULL) |
2bda0e17 KB |
70 | (*RegPenApp) (RPA_DEFAULT, TRUE); |
71 | } | |
72 | } | |
73 | else | |
74 | { | |
75 | /////////////////////////////////////////////////////////////////////// | |
76 | // If running on a Pen Windows system, unregister | |
81d66cf3 | 77 | if (g_hPenWin) |
2bda0e17 KB |
78 | { |
79 | // Unregister this app | |
80 | if (RegPenApp != NULL) | |
81 | (*RegPenApp) (RPA_DEFAULT, FALSE); | |
81d66cf3 | 82 | g_hPenWin = (HANDLE) NULL; |
2bda0e17 KB |
83 | } |
84 | } | |
85 | #endif /* ! Windows-NT */ | |
86 | } | |
87 | ||
88 | #endif | |
47d67540 | 89 | // End wxUSE_PENWINDOWS |
2bda0e17 KB |
90 | |
91 | void wxRegisterPenWin(void) | |
92 | { | |
47d67540 | 93 | #if wxUSE_PENWINDOWS |
2bda0e17 KB |
94 | /////////////////////////////////////////////////////////////////////// |
95 | // If running on a Pen Windows system, register this app so all | |
96 | // EDIT controls in dialogs are replaced by HEDIT controls. | |
e90c1d2a | 97 | // (Notice the CONTROL statement in the RC file is "EDIT(", |
2bda0e17 KB |
98 | // RegisterPenApp will automatically change that control to |
99 | // an HEDIT. | |
81d66cf3 | 100 | if ((g_hPenWin = (HANDLE)GetSystemMetrics(SM_PENWINDOWS)) != (HANDLE)NULL) { |
2bda0e17 KB |
101 | // We do this fancy GetProcAddress simply because we don't |
102 | // know if we're running Pen Windows. | |
81d66cf3 | 103 | if ( (RegPenApp = (void (CALLBACK *)(WORD, BOOL))GetProcAddress(g_hPenWin, "RegisterPenApp"))!= NULL) |
2bda0e17 KB |
104 | (*RegPenApp)(RPA_DEFAULT, TRUE); |
105 | } | |
106 | /////////////////////////////////////////////////////////////////////// | |
107 | #endif | |
108 | } | |
109 | ||
110 | void wxCleanUpPenWin(void) | |
111 | { | |
47d67540 | 112 | #if wxUSE_PENWINDOWS |
81d66cf3 JS |
113 | if (g_hPenWin) { |
114 | // Unregister this app | |
2bda0e17 KB |
115 | if (RegPenApp != NULL) |
116 | (*RegPenApp)(RPA_DEFAULT, FALSE); | |
117 | } | |
118 | #endif | |
119 | } | |
120 |