]> git.saurik.com Git - wxWidgets.git/blame - src/msw/penwin.cpp
implementing pure carbon event behaviour, getting rid of doubly executed events
[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$
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
20#include "wx/setup.h"
2432b92d 21#include "wx/window.h"
2bda0e17
KB
22#endif
23
24#include "wx/msw/private.h"
25
47d67540 26#if wxUSE_PENWINDOWS
2bda0e17
KB
27
28#ifdef __BORLANDC__
29#define RPA_DEFAULT 1
30#else
31#include <penwin.h>
32#endif
33
81d66cf3 34HANDLE g_hPenWin = (HANDLE)NULL;
2bda0e17
KB
35typedef 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//
77ffb593 41// Should masked edit functions be added to wxWidgets we would
2bda0e17
KB
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__
46static void (CALLBACK * RegPenApp) (WORD, BOOL) = NULL;
47#endif
48
49// Where is this called??
50void wxEnablePenAppHooks (bool hook)
51{
52#ifndef __WIN32__
53 if (hook)
54 {
81d66cf3 55 if (g_hPenWin)
078cf5cb 56 return;
2bda0e17
KB
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.
46697f31 61 if ((g_hPenWin = (HANDLE)::GetSystemMetrics (SM_PENWINDOWS)) != (HANDLE) NULL)
078cf5cb
WS
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 }
2bda0e17
KB
68 }
69 else
70 {
71 ///////////////////////////////////////////////////////////////////////
72 // If running on a Pen Windows system, unregister
81d66cf3 73 if (g_hPenWin)
078cf5cb
WS
74 {
75 // Unregister this app
76 if (RegPenApp != NULL)
77 (*RegPenApp) (RPA_DEFAULT, FALSE);
78 g_hPenWin = (HANDLE) NULL;
79 }
2bda0e17 80 }
078cf5cb 81#endif /* ! Windows-NT */
2bda0e17
KB
82}
83
84#endif
47d67540 85 // End wxUSE_PENWINDOWS
2bda0e17
KB
86
87void wxRegisterPenWin(void)
88{
47d67540 89#if wxUSE_PENWINDOWS
2bda0e17
KB
90///////////////////////////////////////////////////////////////////////
91// If running on a Pen Windows system, register this app so all
92// EDIT controls in dialogs are replaced by HEDIT controls.
9b64e798 93// (Notice the CONTROL statement in the RC file is "EDIT",
2bda0e17
KB
94// RegisterPenApp will automatically change that control to
95// an HEDIT.
46697f31 96 if ((g_hPenWin = (HANDLE)::GetSystemMetrics(SM_PENWINDOWS)) != (HANDLE)NULL) {
2bda0e17
KB
97 // We do this fancy GetProcAddress simply because we don't
98 // know if we're running Pen Windows.
81d66cf3 99 if ( (RegPenApp = (void (CALLBACK *)(WORD, BOOL))GetProcAddress(g_hPenWin, "RegisterPenApp"))!= NULL)
2bda0e17
KB
100 (*RegPenApp)(RPA_DEFAULT, TRUE);
101 }
102///////////////////////////////////////////////////////////////////////
103#endif
104}
105
106void wxCleanUpPenWin(void)
107{
47d67540 108#if wxUSE_PENWINDOWS
81d66cf3
JS
109 if (g_hPenWin) {
110 // Unregister this app
2bda0e17 111 if (RegPenApp != NULL)
078cf5cb 112 (*RegPenApp)(RPA_DEFAULT, FALSE);
2bda0e17
KB
113 }
114#endif
115}
116