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