]> git.saurik.com Git - wxWidgets.git/blame - src/msw/penwin.cpp
wxMessageBox off the main thread lost result code.
[wxWidgets.git] / src / msw / penwin.cpp
CommitLineData
2bda0e17 1/////////////////////////////////////////////////////////////////////////////
521bf4ff 2// Name: src/msw/penwin.cpp
2bda0e17
KB
3// Purpose: PenWindows code
4// Author: Julian Smart
5// Modified by:
6// Created: 04/01/98
6c9a19aa 7// Copyright: (c) Julian Smart
078cf5cb 8// Licence: wxWindows licence
2bda0e17
KB
9/////////////////////////////////////////////////////////////////////////////
10
2bda0e17 11// For compilers that support precompilation, includes "wx.h".
2bda0e17
KB
12#include "wx/wxprec.h"
13
a3b46648 14#ifdef __BORLANDC__
2bda0e17
KB
15#pragma hdrstop
16#endif
17
18#ifndef WX_PRECOMP
521bf4ff 19 #include "wx/window.h"
2bda0e17
KB
20#endif
21
22#include "wx/msw/private.h"
23
47d67540 24#if wxUSE_PENWINDOWS
2bda0e17
KB
25
26#ifdef __BORLANDC__
27#define RPA_DEFAULT 1
28#else
29#include <penwin.h>
30#endif
31
81d66cf3 32HANDLE g_hPenWin = (HANDLE)NULL;
2bda0e17
KB
33typedef 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//
77ffb593 39// Should masked edit functions be added to wxWidgets we would
2bda0e17
KB
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__
44static void (CALLBACK * RegPenApp) (WORD, BOOL) = NULL;
45#endif
46
47// Where is this called??
48void wxEnablePenAppHooks (bool hook)
49{
50#ifndef __WIN32__
51 if (hook)
52 {
81d66cf3 53 if (g_hPenWin)
078cf5cb 54 return;
2bda0e17
KB
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.
46697f31 59 if ((g_hPenWin = (HANDLE)::GetSystemMetrics (SM_PENWINDOWS)) != (HANDLE) NULL)
078cf5cb
WS
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 }
2bda0e17
KB
66 }
67 else
68 {
69 ///////////////////////////////////////////////////////////////////////
70 // If running on a Pen Windows system, unregister
81d66cf3 71 if (g_hPenWin)
078cf5cb
WS
72 {
73 // Unregister this app
74 if (RegPenApp != NULL)
75 (*RegPenApp) (RPA_DEFAULT, FALSE);
76 g_hPenWin = (HANDLE) NULL;
77 }
2bda0e17 78 }
078cf5cb 79#endif /* ! Windows-NT */
2bda0e17
KB
80}
81
82#endif
47d67540 83 // End wxUSE_PENWINDOWS
2bda0e17
KB
84
85void wxRegisterPenWin(void)
86{
47d67540 87#if wxUSE_PENWINDOWS
2bda0e17
KB
88///////////////////////////////////////////////////////////////////////
89// If running on a Pen Windows system, register this app so all
90// EDIT controls in dialogs are replaced by HEDIT controls.
9b64e798 91// (Notice the CONTROL statement in the RC file is "EDIT",
2bda0e17
KB
92// RegisterPenApp will automatically change that control to
93// an HEDIT.
46697f31 94 if ((g_hPenWin = (HANDLE)::GetSystemMetrics(SM_PENWINDOWS)) != (HANDLE)NULL) {
2bda0e17
KB
95 // We do this fancy GetProcAddress simply because we don't
96 // know if we're running Pen Windows.
81d66cf3 97 if ( (RegPenApp = (void (CALLBACK *)(WORD, BOOL))GetProcAddress(g_hPenWin, "RegisterPenApp"))!= NULL)
2bda0e17
KB
98 (*RegPenApp)(RPA_DEFAULT, TRUE);
99 }
100///////////////////////////////////////////////////////////////////////
101#endif
102}
103
104void wxCleanUpPenWin(void)
105{
47d67540 106#if wxUSE_PENWINDOWS
81d66cf3
JS
107 if (g_hPenWin) {
108 // Unregister this app
2bda0e17 109 if (RegPenApp != NULL)
078cf5cb 110 (*RegPenApp)(RPA_DEFAULT, FALSE);
2bda0e17
KB
111 }
112#endif
113}