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