]>
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". | |
17 | #define IN_WX_MAIN_CPP | |
18 | #include "wx/wxprec.h" | |
19 | ||
20 | #if defined(__BORLANDC__) | |
21 | #pragma hdrstop | |
22 | #endif | |
23 | ||
24 | #ifndef WX_PRECOMP | |
25 | #include "wx/setup.h" | |
26 | #endif | |
27 | ||
28 | #include "wx/msw/private.h" | |
29 | ||
30 | #if USE_PENWINDOWS | |
31 | ||
32 | #ifdef __BORLANDC__ | |
33 | #define RPA_DEFAULT 1 | |
34 | #else | |
35 | #include <penwin.h> | |
36 | #endif | |
37 | ||
38 | HANDLE s_hPenWin = (HANDLE)NULL; | |
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 | { | |
59 | if (s_hPenWin) | |
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. | |
65 | if ((s_hPenWin = (HANDLE)GetSystemMetrics (SM_PENWINDOWS)) != (HANDLE) NULL) | |
66 | { | |
67 | // We do this fancy GetProcAddress simply because we don't | |
68 | // know if we're running Pen Windows. | |
69 | if ((RegPenApp = (PENREGPROC)GetProcAddress (s_hPenWin, "RegisterPenApp")) != NULL) | |
70 | (*RegPenApp) (RPA_DEFAULT, TRUE); | |
71 | } | |
72 | } | |
73 | else | |
74 | { | |
75 | /////////////////////////////////////////////////////////////////////// | |
76 | // If running on a Pen Windows system, unregister | |
77 | if (s_hPenWin) | |
78 | { | |
79 | // Unregister this app | |
80 | if (RegPenApp != NULL) | |
81 | (*RegPenApp) (RPA_DEFAULT, FALSE); | |
82 | s_hPenWin = (HANDLE) NULL; | |
83 | } | |
84 | } | |
85 | #endif /* ! Windows-NT */ | |
86 | } | |
87 | ||
88 | #endif | |
89 | // End USE_PENWINDOWS | |
90 | ||
91 | void wxRegisterPenWin(void) | |
92 | { | |
93 | #if USE_PENWINDOWS | |
94 | /////////////////////////////////////////////////////////////////////// | |
95 | // If running on a Pen Windows system, register this app so all | |
96 | // EDIT controls in dialogs are replaced by HEDIT controls. | |
97 | // (Notice the CONTROL statement in the RC file is "EDIT", | |
98 | // RegisterPenApp will automatically change that control to | |
99 | // an HEDIT. | |
100 | if ((s_hPenWin = (HANDLE)GetSystemMetrics(SM_PENWINDOWS)) != (HANDLE)NULL) { | |
101 | // We do this fancy GetProcAddress simply because we don't | |
102 | // know if we're running Pen Windows. | |
103 | if ( (RegPenApp = (void (CALLBACK *)(WORD, BOOL))GetProcAddress(s_hPenWin, "RegisterPenApp"))!= NULL) | |
104 | (*RegPenApp)(RPA_DEFAULT, TRUE); | |
105 | } | |
106 | /////////////////////////////////////////////////////////////////////// | |
107 | #endif | |
108 | } | |
109 | ||
110 | void wxCleanUpPenWin(void) | |
111 | { | |
112 | #if USE_PENWINDOWS | |
113 | if (s_hPenWin) { | |
114 | // Unregister this app | |
115 | if (RegPenApp != NULL) | |
116 | (*RegPenApp)(RPA_DEFAULT, FALSE); | |
117 | } | |
118 | #endif | |
119 | } | |
120 |