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