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