2025-11-28 00:35:46 +09:00

167 lines
5.5 KiB
C++

// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF
// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO
// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
// PARTICULAR PURPOSE.
//
// Copyright (c) Microsoft Corporation. All rights reserved.
// CustomRenderer.h : Declaration of the CCustomRenderer
// $(VCInstallDir)PlatformSDK\include
#pragma once
#include "resource.h" // main symbols
#include "COMRTS.h"
#include "rtscom.h"
#if defined(_WIN32_WCE) && !defined(_CE_DCOM) && !defined(_CE_ALLOW_SINGLE_THREADED_OBJECTS_IN_MTA)
#error "Single-threaded COM objects are not properly supported on Windows CE platform, such as the Windows Mobile platforms that do not include full DCOM support. Define _CE_ALLOW_SINGLE_THREADED_OBJECTS_IN_MTA to force ATL to support creating single-thread COM object's and allow use of it's single-threaded COM object implementations. The threading model in your rgs file was set to 'Free' as that is the only threading model supported in non DCOM Windows CE platforms."
#endif
// CCustomRenderer
class ATL_NO_VTABLE CCustomRenderer :
public CComObjectRootEx<CComMultiThreadModel>,
public CComCoClass<CCustomRenderer, &CLSID_CustomRenderer>,
public ICustomRenderer,
public IStylusSyncPlugin
{
public:
CCustomRenderer()
{
m_pUnkMarshaler = NULL;
}
DECLARE_REGISTRY_RESOURCEID(IDR_CUSTOMRENDERER)
BEGIN_COM_MAP(CCustomRenderer)
COM_INTERFACE_ENTRY(ICustomRenderer)
COM_INTERFACE_ENTRY_AGGREGATE(IID_IMarshal, m_pUnkMarshaler.p)
COM_INTERFACE_ENTRY(IStylusSyncPlugin)
END_COM_MAP()
DECLARE_PROTECT_FINAL_CONSTRUCT()
DECLARE_GET_CONTROLLING_UNKNOWN()
HRESULT FinalConstruct()
{
return CoCreateFreeThreadedMarshaler(
GetControllingUnknown(), &m_pUnkMarshaler.p);
}
void FinalRelease()
{
m_pUnkMarshaler.Release();
}
CComPtr<IUnknown> m_pUnkMarshaler;
public:
STDMETHOD (SetHDC)(HDC hDC);
private:
HDC m_hDC;
void HiMetricToPixel(LONG* pfX, LONG* pfY);
// IStylusSyncPlugin Methods
public:
STDMETHODIMP RealTimeStylusEnabled(
/* [in] */ IRealTimeStylus *piRtsSrc,
/* [in] */ ULONG cTcidCount,
/* [size_is][in] */ const TABLET_CONTEXT_ID *pTcids);
STDMETHODIMP RealTimeStylusDisabled(
/* [in] */ IRealTimeStylus *piRtsSrc,
/* [in] */ ULONG cTcidCount,
/* [size_is][in] */ const TABLET_CONTEXT_ID *pTcids);
STDMETHODIMP StylusInRange(
/* [in] */ IRealTimeStylus *piRtsSrc,
/* [in] */ TABLET_CONTEXT_ID tcid,
/* [in] */ STYLUS_ID sid);
STDMETHODIMP StylusOutOfRange(
/* [in] */ IRealTimeStylus *piRtsSrc,
/* [in] */ TABLET_CONTEXT_ID tcid,
/* [in] */ STYLUS_ID sid);
STDMETHODIMP StylusDown(
/* [in] */ IRealTimeStylus *piRtsSrc,
/* [in] */ const StylusInfo *pStylusInfo,
/* [in] */ ULONG cPropCountPerPkt,
/* [size_is][in] */ LONG *pPackets,
/* [out][in] */ LONG **ppInOutPkts);
STDMETHODIMP StylusUp(
/* [in] */ IRealTimeStylus *piRtsSrc,
/* [in] */ const StylusInfo *pStylusInfo,
/* [in] */ ULONG cPropCountPerPkt,
/* [size_is][in] */ LONG *pPackets,
/* [out][in] */ LONG **ppInOutPkts);
STDMETHODIMP StylusButtonDown(
/* [in] */ IRealTimeStylus *piRtsSrc,
/* [in] */ STYLUS_ID sid,
/* [in] */ const GUID *pGuidStylusButton,
/* [out][in] */ POINT *pStylusPos);
STDMETHODIMP StylusButtonUp(
/* [in] */ IRealTimeStylus *piRtsSrc,
/* [in] */ STYLUS_ID sid,
/* [in] */ const GUID *pGuidStylusButton,
/* [out][in] */ POINT *pStylusPos);
STDMETHODIMP InAirPackets(
/* [in] */ IRealTimeStylus *piRtsSrc,
/* [in] */ const StylusInfo *pStylusInfo,
/* [in] */ ULONG cPktCount,
/* [in] */ ULONG cPktBuffLength,
/* [size_is][in] */ LONG *pPackets,
/* [out][in] */ ULONG *pcInOutPkts,
/* [out][in] */ LONG **ppInOutPkts);
STDMETHODIMP Packets(
/* [in] */ IRealTimeStylus *piRtsSrc,
/* [in] */ const StylusInfo *pStylusInfo,
/* [in] */ ULONG cPktCount,
/* [in] */ ULONG cPktBuffLength,
/* [size_is][in] */ LONG *pPackets,
/* [out][in] */ ULONG *pcInOutPkts,
/* [out][in] */ LONG **ppInOutPkts);
STDMETHODIMP CustomStylusDataAdded(
/* [in] */ IRealTimeStylus *piRtsSrc,
/* [in] */ const GUID *pGuidId,
/* [in] */ ULONG cbData,
/* [in] */ const BYTE *pbData);
STDMETHODIMP SystemEvent(
/* [in] */ IRealTimeStylus *piRtsSrc,
/* [in] */ TABLET_CONTEXT_ID tcid,
/* [in] */ STYLUS_ID sid,
/* [in] */ SYSTEM_EVENT event,
/* [in] */ SYSTEM_EVENT_DATA eventdata);
STDMETHODIMP TabletAdded(
/* [in] */ IRealTimeStylus *piRtsSrc,
/* [in] */ IInkTablet *piTablet);
STDMETHODIMP TabletRemoved(
/* [in] */ IRealTimeStylus *piRtsSrc,
/* [in] */ LONG iTabletIndex);
STDMETHODIMP Error(
/* [in] */ IRealTimeStylus *piRtsSrc,
/* [in] */ IStylusPlugin *piPlugin,
/* [in] */ RealTimeStylusDataInterest dataInterest,
/* [in] */ HRESULT hrErrorCode,
/* [out][in] */ LONG_PTR *lptrKey);
STDMETHODIMP UpdateMapping(
/* [in] */ IRealTimeStylus *piRtsSrc);
STDMETHODIMP DataInterest(
/* [retval][out] */ RealTimeStylusDataInterest *pDataInterest);
};