]> git.saurik.com Git - wxWidgets.git/blob - src/msw/penwin.cpp
Fixed missing brace in app.cpp
[wxWidgets.git] / src / msw / penwin.cpp
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 #include "wx/wxprec.h"
18
19 #ifdef __BORLANDC__
20 #pragma hdrstop
21 #endif
22
23 #ifndef WX_PRECOMP
24 #include "wx/setup.h"
25 #include "wx/window.h"
26 #endif
27
28 #include "wx/msw/private.h"
29
30 #if wxUSE_PENWINDOWS
31
32 #ifdef __BORLANDC__
33 #define RPA_DEFAULT 1
34 #else
35 #include <penwin.h>
36 #endif
37
38 HANDLE g_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 (g_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 ((g_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 (g_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 (g_hPenWin)
78 {
79 // Unregister this app
80 if (RegPenApp != NULL)
81 (*RegPenApp) (RPA_DEFAULT, FALSE);
82 g_hPenWin = (HANDLE) NULL;
83 }
84 }
85 #endif /* ! Windows-NT */
86 }
87
88 #endif
89 // End wxUSE_PENWINDOWS
90
91 void wxRegisterPenWin(void)
92 {
93 #if wxUSE_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 ((g_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(g_hPenWin, "RegisterPenApp"))!= NULL)
104 (*RegPenApp)(RPA_DEFAULT, TRUE);
105 }
106 ///////////////////////////////////////////////////////////////////////
107 #endif
108 }
109
110 void wxCleanUpPenWin(void)
111 {
112 #if wxUSE_PENWINDOWS
113 if (g_hPenWin) {
114 // Unregister this app
115 if (RegPenApp != NULL)
116 (*RegPenApp)(RPA_DEFAULT, FALSE);
117 }
118 #endif
119 }
120