Initial commit: Complete open-source Decal rebuild
All 5 phases of the open-source Decal rebuild: Phase 1: 14 decompiled .NET projects (Interop.*, Adapter, FileService, DecalUtil) Phase 2: 10 native DLLs rewritten as C# COM servers with matching GUIDs - DecalDat, DHS, SpellFilter, DecalInput, DecalNet, DecalFilters - Decal.Core, DecalControls, DecalRender, D3DService Phase 3: C++ shims for Inject.DLL (D3D9 hooking) and LauncherHook.DLL Phase 4: DenAgent WinForms tray application Phase 5: WiX installer and build script 25 C# projects building with 0 errors. Native C++ projects require VS 2022 + Windows SDK (x86). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
commit
d1442e3747
1382 changed files with 170725 additions and 0 deletions
BIN
Native/DecalControls/Attic/DecalControls.aps
Normal file
BIN
Native/DecalControls/Attic/DecalControls.aps
Normal file
Binary file not shown.
0
Native/DecalControls/Attic/Image.cpp
Normal file
0
Native/DecalControls/Attic/Image.cpp
Normal file
0
Native/DecalControls/Attic/Image.h
Normal file
0
Native/DecalControls/Attic/Image.h
Normal file
0
Native/DecalControls/Attic/Image.rgs
Normal file
0
Native/DecalControls/Attic/Image.rgs
Normal file
0
Native/DecalControls/Attic/ImageControl.cpp
Normal file
0
Native/DecalControls/Attic/ImageControl.cpp
Normal file
0
Native/DecalControls/Attic/ImageControl.h
Normal file
0
Native/DecalControls/Attic/ImageControl.h
Normal file
197
Native/DecalControls/BorderLayout.cpp
Normal file
197
Native/DecalControls/BorderLayout.cpp
Normal file
|
|
@ -0,0 +1,197 @@
|
|||
// BorderLayout.cpp : Implementation of cBorderLayout
|
||||
#include "stdafx.h"
|
||||
#include "DecalControls.h"
|
||||
#include "BorderLayout.h"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// cBorderLayout
|
||||
|
||||
void cBorderLayout::onSchemaLoad( IView *pView, MSXML::IXMLDOMElementPtr &pElement )
|
||||
{
|
||||
static _bstr_t _strEdge = _T( "border" ),
|
||||
_strCenter = _T( "center" );
|
||||
static _variant_t
|
||||
_strLeft = _T( "left" ),
|
||||
_strRight = _T( "right" ),
|
||||
_strTop = _T( "top" ),
|
||||
_strBottom = _T( "bottom" );
|
||||
|
||||
// Walk through the list of children - select all elements
|
||||
MSXML::IXMLDOMElementPtr pChild;
|
||||
for( MSXML::IXMLDOMNodeListPtr pChildren = pElement->selectNodes( _T( "*" ) );
|
||||
( pChild = pChildren->nextNode() ).GetInterfacePtr() != NULL; )
|
||||
{
|
||||
if( pChild->tagName == _strEdge )
|
||||
{
|
||||
// Attempt to extract the edge indicator and the size indicator
|
||||
_variant_t vEdge = pChild->getAttribute( _T( "edge" ) ),
|
||||
vSize = pChild->getAttribute( _T( "size" ) );
|
||||
|
||||
_ASSERTE( vEdge.vt != VT_NULL );
|
||||
_ASSERTE( vSize.vt != VT_NULL );
|
||||
|
||||
// Got values, check if they're good
|
||||
eBorderEdge eEdge;
|
||||
|
||||
if( _strLeft == vEdge )
|
||||
eEdge = eEdgeLeft;
|
||||
else if( vEdge == _strRight )
|
||||
eEdge = eEdgeRight;
|
||||
else if( vEdge == _strTop )
|
||||
eEdge = eEdgeTop;
|
||||
else if( vEdge == _strBottom )
|
||||
eEdge = eEdgeBottom;
|
||||
#ifdef _DEBUG
|
||||
else
|
||||
// Invalid value here
|
||||
_ASSERTE( FALSE );
|
||||
#endif
|
||||
|
||||
// Convert the size
|
||||
try
|
||||
{
|
||||
long nSize = vSize;
|
||||
|
||||
// Cannot have a 0 or negative edge size
|
||||
_ASSERTE( nSize > 0 );
|
||||
|
||||
cEdgePlacement ep = { eEdge, nSize, loadChildControl( pView, pChild->selectSingleNode( _T( "control" ) ) ) };
|
||||
m_edges.push_back( ep );
|
||||
}
|
||||
catch( ... )
|
||||
{
|
||||
// The size could no be converted to a long value
|
||||
_ASSERTE( FALSE );
|
||||
}
|
||||
}
|
||||
else if( pChild->tagName == _strCenter )
|
||||
{
|
||||
// Make sure there isn't a center already created
|
||||
_ASSERTE( m_nCenterID == -1 );
|
||||
|
||||
m_nCenterID = loadChildControl( pView, pChild->selectSingleNode( _T( "control" ) ) );
|
||||
}
|
||||
#ifdef _DEBUG
|
||||
else
|
||||
// This is an invalid child element type
|
||||
_ASSERTE( FALSE );
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
void cBorderLayout::onChildDestroy( long nID )
|
||||
{
|
||||
// Check if this is the center
|
||||
if( nID == m_nCenterID )
|
||||
{
|
||||
m_nCenterID = -1;
|
||||
m_pSite->Reformat();
|
||||
return;
|
||||
}
|
||||
|
||||
// Check if it on an edge
|
||||
for( cEdgePlacementList::iterator i = m_edges.begin(); i != m_edges.end(); ++ i )
|
||||
{
|
||||
if( i->m_nID == nID )
|
||||
{
|
||||
m_edges.erase( i );
|
||||
m_pSite->Reformat();
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
STDMETHODIMP cBorderLayout::CreateEdge(eBorderEdge eEdge, long nSize, ILayer *pSink)
|
||||
{
|
||||
_ASSERTE( nSize > 0 );
|
||||
_ASSERTE( pSink != NULL );
|
||||
|
||||
LayerParams lp = { dispenseID(), { 0, 0, 0, 0 }, eRenderClipped };
|
||||
m_pSite->CreateChild( &lp, pSink );
|
||||
|
||||
cEdgePlacement ep = { eEdge, nSize, lp.ID };
|
||||
m_edges.push_back( ep );
|
||||
m_pSite->Reformat();
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP cBorderLayout::CreateCenter(ILayer *pSink)
|
||||
{
|
||||
_ASSERTE( m_nCenterID == -1 );
|
||||
|
||||
LayerParams lp = { dispenseID(), { 0, 0, 0, 0 }, eRenderClipped };
|
||||
m_pSite->CreateChild( &lp, pSink );
|
||||
|
||||
m_nCenterID = lp.ID;
|
||||
m_pSite->Reformat();
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP cBorderLayout::Reformat()
|
||||
{
|
||||
// Walk through the list of edges in order and
|
||||
// set their positions
|
||||
|
||||
RECT rcLayer;
|
||||
m_pSite->get_Position( &rcLayer );
|
||||
|
||||
RECT rcClient = { 0, 0, rcLayer.right - rcLayer.left, rcLayer.bottom - rcLayer.top };
|
||||
|
||||
for( cEdgePlacementList::iterator i = m_edges.begin(); i != m_edges.end(); ++ i )
|
||||
{
|
||||
RECT rcPosition = rcClient;
|
||||
|
||||
switch( i->m_edge )
|
||||
{
|
||||
case eEdgeLeft:
|
||||
rcPosition.right = rcPosition.left + i->m_nSize;
|
||||
rcClient.left += i->m_nSize;
|
||||
break;
|
||||
|
||||
case eEdgeTop:
|
||||
rcPosition.bottom = rcPosition.top + i->m_nSize;
|
||||
rcClient.top += i->m_nSize;
|
||||
break;
|
||||
|
||||
case eEdgeRight:
|
||||
rcPosition.left = rcPosition.right - i->m_nSize;
|
||||
rcClient.right -= i->m_nSize;
|
||||
break;
|
||||
|
||||
case eEdgeBottom:
|
||||
rcPosition.top = rcPosition.bottom - i->m_nSize;
|
||||
rcClient.bottom -= i->m_nSize;
|
||||
break;
|
||||
|
||||
default:
|
||||
// Invalid edge value
|
||||
_ASSERTE( FALSE );
|
||||
}
|
||||
|
||||
// Sanity checks to make sure we haven't overrun our area
|
||||
//_ASSERTE( rcClient.bottom > rcClient.top );
|
||||
_ASSERTE( rcClient.right > rcClient.left );
|
||||
_ASSERTE( rcPosition.bottom > rcPosition.top );
|
||||
_ASSERTE( rcPosition.right > rcPosition.left );
|
||||
|
||||
CComPtr< ILayerSite > pChild;
|
||||
HRESULT hRes = m_pSite->get_Child( i->m_nID, ePositionByID, &pChild );
|
||||
_ASSERTE( SUCCEEDED( hRes ) );
|
||||
|
||||
pChild->put_Position( &rcPosition );
|
||||
}
|
||||
|
||||
if( m_nCenterID != -1 )
|
||||
{
|
||||
CComPtr< ILayerSite > pChild;
|
||||
HRESULT hRes = m_pSite->get_Child( m_nCenterID, ePositionByID, &pChild );
|
||||
_ASSERTE( SUCCEEDED( hRes ) );
|
||||
|
||||
pChild->put_Position( &rcClient );
|
||||
}
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
73
Native/DecalControls/BorderLayout.h
Normal file
73
Native/DecalControls/BorderLayout.h
Normal file
|
|
@ -0,0 +1,73 @@
|
|||
// BorderLayout.h : Declaration of the cBorderLayout
|
||||
|
||||
#ifndef __BORDERLAYOUT_H_
|
||||
#define __BORDERLAYOUT_H_
|
||||
|
||||
#include "resource.h" // main symbols
|
||||
#include "DecalControlsCP.h"
|
||||
|
||||
#include "ControlImpl.h"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// cBorderLayout
|
||||
class ATL_NO_VTABLE cBorderLayout :
|
||||
public CComObjectRootEx<CComMultiThreadModel>,
|
||||
public CComCoClass<cBorderLayout, &CLSID_BorderLayout>,
|
||||
public ILayerImpl< cBorderLayout >,
|
||||
public ILayoutImpl< cBorderLayout, IBorderLayout, &IID_ILayout, &LIBID_DecalControls >,
|
||||
public IProvideClassInfo2Impl< &CLSID_BorderLayout, &DIID_IControlEvents, &LIBID_DecalControls >,
|
||||
public IConnectionPointContainerImpl<cBorderLayout>,
|
||||
public CProxyIControlEvents< cBorderLayout >
|
||||
{
|
||||
public:
|
||||
cBorderLayout()
|
||||
: m_nCenterID( -1 )
|
||||
{
|
||||
}
|
||||
|
||||
// Data members
|
||||
struct cEdgePlacement
|
||||
{
|
||||
eBorderEdge m_edge;
|
||||
long m_nSize;
|
||||
long m_nID;
|
||||
};
|
||||
|
||||
typedef std::list< cEdgePlacement > cEdgePlacementList;
|
||||
cEdgePlacementList m_edges;
|
||||
long m_nCenterID;
|
||||
|
||||
void onChildDestroy( long nID );
|
||||
void onSchemaLoad( IView *pView, MSXML::IXMLDOMElementPtr &pElement );
|
||||
|
||||
DECLARE_REGISTRY_RESOURCEID(IDR_BORDERLAYOUT)
|
||||
|
||||
DECLARE_PROTECT_FINAL_CONSTRUCT()
|
||||
|
||||
BEGIN_COM_MAP(cBorderLayout)
|
||||
COM_INTERFACE_ENTRY(ILayerRender)
|
||||
COM_INTERFACE_ENTRY(ILayer)
|
||||
COM_INTERFACE_ENTRY(ILayerSchema)
|
||||
COM_INTERFACE_ENTRY(IDispatch)
|
||||
COM_INTERFACE_ENTRY(IControl)
|
||||
COM_INTERFACE_ENTRY(ILayout)
|
||||
COM_INTERFACE_ENTRY(IBorderLayout)
|
||||
COM_INTERFACE_ENTRY(IProvideClassInfo)
|
||||
COM_INTERFACE_ENTRY(IProvideClassInfo2)
|
||||
COM_INTERFACE_ENTRY_IMPL(IConnectionPointContainer)
|
||||
END_COM_MAP()
|
||||
|
||||
BEGIN_CONNECTION_POINT_MAP(cBorderLayout)
|
||||
CONNECTION_POINT_ENTRY(DIID_IControlEvents)
|
||||
END_CONNECTION_POINT_MAP()
|
||||
|
||||
public:
|
||||
// IBorderLayout Methods
|
||||
STDMETHOD(CreateCenter)(ILayer *pSink);
|
||||
STDMETHOD(CreateEdge)(eBorderEdge eEdge, long nSize, ILayer *pSink);
|
||||
|
||||
// ILayerRender Methods
|
||||
STDMETHOD(Reformat)();
|
||||
};
|
||||
|
||||
#endif //__BORDERLAYOUT_H_
|
||||
25
Native/DecalControls/BorderLayout.rgs
Normal file
25
Native/DecalControls/BorderLayout.rgs
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
HKCR
|
||||
{
|
||||
DecalControls.BorderLayout.1 = s 'BorderLayout Class'
|
||||
{
|
||||
CLSID = s '{CA121762-31BB-4073-8597-33BAB4BDCAA3}'
|
||||
}
|
||||
DecalControls.BorderLayout = s 'BorderLayout Class'
|
||||
{
|
||||
CLSID = s '{CA121762-31BB-4073-8597-33BAB4BDCAA3}'
|
||||
CurVer = s 'DecalControls.BorderLayout.1'
|
||||
}
|
||||
NoRemove CLSID
|
||||
{
|
||||
ForceRemove {CA121762-31BB-4073-8597-33BAB4BDCAA3} = s 'BorderLayout Class'
|
||||
{
|
||||
ProgID = s 'DecalControls.BorderLayout.1'
|
||||
VersionIndependentProgID = s 'DecalControls.BorderLayout'
|
||||
InprocServer32 = s '%MODULE%'
|
||||
{
|
||||
val ThreadingModel = s 'Both'
|
||||
}
|
||||
'TypeLib' = s '{1C4B007A-04DD-4DF8-BA29-2CFBD0220B89}'
|
||||
}
|
||||
}
|
||||
}
|
||||
114
Native/DecalControls/CheckColumn.cpp
Normal file
114
Native/DecalControls/CheckColumn.cpp
Normal file
|
|
@ -0,0 +1,114 @@
|
|||
// CheckColumn.cpp : Implementation of cCheckColumn
|
||||
#include "stdafx.h"
|
||||
#include "DecalControls.h"
|
||||
#include "CheckColumn.h"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// cCheckColumn
|
||||
|
||||
STDMETHODIMP cCheckColumn::get_FixedWidth(VARIANT_BOOL *pVal)
|
||||
{
|
||||
*pVal = VARIANT_TRUE;
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP cCheckColumn::get_Width(long *pVal)
|
||||
{
|
||||
*pVal = 20;
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP cCheckColumn::put_Width(long newVal)
|
||||
{
|
||||
// m_Width = newVal;
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP cCheckColumn::Render(ICanvas *pCanvas, LPPOINT ptCell, long nColor)
|
||||
{
|
||||
_variant_t vCheck, vHidden;
|
||||
bool bHidden, bCheck;
|
||||
|
||||
m_pList->get_Data( ptCell->x, ptCell->y, 0, &vCheck );
|
||||
bCheck = vCheck.vt == VT_NULL ? false : static_cast<bool>(vCheck);
|
||||
|
||||
m_pList->get_Data( ptCell->x, ptCell->y, 1, &vHidden );
|
||||
bHidden = vHidden.vt == VT_NULL ? false : static_cast<bool>(vHidden);
|
||||
|
||||
// Converted nicely now ...
|
||||
// Find our checked and unchecked images
|
||||
CComPtr< IIconCache > pIcons;
|
||||
|
||||
SIZE sz = { 13, 13 };
|
||||
m_pSite->GetIconCache( &sz, &pIcons );
|
||||
|
||||
POINT pt = { 3, 3 };
|
||||
if( !bHidden )
|
||||
pIcons->DrawIcon( &pt, bCheck ? 0x0600128B : 0x0600128D, 0, pCanvas );
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP cCheckColumn::get_DataColumns(long *pVal)
|
||||
{
|
||||
*pVal = 2;
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP cCheckColumn::Initialize(IList *newVal, IPluginSite *pSite)
|
||||
{
|
||||
m_pList = newVal;
|
||||
m_pSite = pSite;
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP cCheckColumn::SchemaLoad(IUnknown *pSchema)
|
||||
{
|
||||
// TODO: Add your implementation code here
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP cCheckColumn::get_Height(long *pVal)
|
||||
{
|
||||
*pVal = 20;
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP cCheckColumn::Activate(LPPOINT ptCell)
|
||||
{
|
||||
_variant_t vCheck, vHidden;
|
||||
|
||||
bool bHidden, bCheck;
|
||||
|
||||
m_pList->get_Data( ptCell->x, ptCell->y, 0, &vCheck );
|
||||
bCheck = vCheck.vt == VT_NULL ? false : static_cast<bool>(vCheck);
|
||||
|
||||
m_pList->get_Data( ptCell->x, ptCell->y, 1, &vHidden );
|
||||
bHidden = vHidden.vt == VT_NULL ? false : static_cast<bool>(vHidden);
|
||||
|
||||
if( !bHidden )
|
||||
m_pList->put_Data( ptCell->x, ptCell->y, 0, &_variant_t( !bCheck ) );
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP cCheckColumn::get_Color(long nRow, long *pVal)
|
||||
{
|
||||
// TODO: Add your implementation code here
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP cCheckColumn::put_Color(long nRow, long newVal)
|
||||
{
|
||||
// TODO: Add your implementation code here
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
46
Native/DecalControls/CheckColumn.h
Normal file
46
Native/DecalControls/CheckColumn.h
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
// CheckColumn.h : Declaration of the cCheckColumn
|
||||
|
||||
#ifndef __CHECKCOLUMN_H_
|
||||
#define __CHECKCOLUMN_H_
|
||||
|
||||
#include "resource.h" // main symbols
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// cCheckColumn
|
||||
class ATL_NO_VTABLE cCheckColumn :
|
||||
public CComObjectRootEx<CComMultiThreadModel>,
|
||||
public CComCoClass<cCheckColumn, &CLSID_CheckColumn>,
|
||||
public IListColumn
|
||||
{
|
||||
public:
|
||||
cCheckColumn()
|
||||
{
|
||||
}
|
||||
|
||||
CComPtr< IList > m_pList;
|
||||
CComPtr< IPluginSite > m_pSite;
|
||||
|
||||
DECLARE_REGISTRY_RESOURCEID(IDR_CHECKCOLUMN)
|
||||
|
||||
DECLARE_PROTECT_FINAL_CONSTRUCT()
|
||||
|
||||
BEGIN_COM_MAP(cCheckColumn)
|
||||
COM_INTERFACE_ENTRY(IListColumn)
|
||||
END_COM_MAP()
|
||||
|
||||
// IListColumn
|
||||
public:
|
||||
STDMETHOD(get_Color)(long nRow, /*[out, retval]*/ long *pVal);
|
||||
STDMETHOD(put_Color)(long nRow, /*[in]*/ long newVal);
|
||||
STDMETHOD(Activate)(LPPOINT ptCell);
|
||||
STDMETHOD(get_Height)(/*[out, retval]*/ long *pVal);
|
||||
STDMETHOD(SchemaLoad)(IUnknown *pSchema);
|
||||
STDMETHOD(Initialize)(/*[in]*/ IList * newVal, IPluginSite *pSite);
|
||||
STDMETHOD(get_DataColumns)(/*[out, retval]*/ long *pVal);
|
||||
STDMETHOD(Render)(ICanvas *, LPPOINT ptCell, long nColor);
|
||||
STDMETHOD(get_Width)(/*[out, retval]*/ long *pVal);
|
||||
STDMETHOD(get_FixedWidth)(/*[out, retval]*/ VARIANT_BOOL *pVal);
|
||||
STDMETHOD(put_Width)(/*[in]*/ long newVal);
|
||||
};
|
||||
|
||||
#endif //__CHECKCOLUMN_H_
|
||||
25
Native/DecalControls/CheckColumn.rgs
Normal file
25
Native/DecalControls/CheckColumn.rgs
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
HKCR
|
||||
{
|
||||
DecalControls.CheckColumn.1 = s 'DecalControls CheckColumn'
|
||||
{
|
||||
CLSID = s '{48E444F1-8E30-4E4C-B203-4C87FC901586}'
|
||||
}
|
||||
DecalControls.CheckColumn = s 'DecalControls CheckColumn'
|
||||
{
|
||||
CLSID = s '{48E444F1-8E30-4E4C-B203-4C87FC901586}'
|
||||
CurVer = s 'DecalControls.CheckColumn.1'
|
||||
}
|
||||
NoRemove CLSID
|
||||
{
|
||||
ForceRemove {48E444F1-8E30-4E4C-B203-4C87FC901586} = s 'DecalControls CheckColumn'
|
||||
{
|
||||
ProgID = s 'DecalControls.CheckColumn.1'
|
||||
VersionIndependentProgID = s 'DecalControls.CheckColumn'
|
||||
InprocServer32 = s '%MODULE%'
|
||||
{
|
||||
val ThreadingModel = s 'Both'
|
||||
}
|
||||
'TypeLib' = s '{3559E08B-827E-4DFE-9D33-3567246849CC}'
|
||||
}
|
||||
}
|
||||
}
|
||||
349
Native/DecalControls/Checkbox.cpp
Normal file
349
Native/DecalControls/Checkbox.cpp
Normal file
|
|
@ -0,0 +1,349 @@
|
|||
// Checkbox.cpp : Implementation of cCheckbox
|
||||
#include "stdafx.h"
|
||||
#include "DecalControls.h"
|
||||
#include "Checkbox.h"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// cCheckbox
|
||||
|
||||
cCheckbox::cCheckbox()
|
||||
: m_bChecked( VARIANT_FALSE ),
|
||||
m_bRightToLeft( VARIANT_FALSE ),
|
||||
m_nTextColor( RGB( 0, 0, 0 ) ),
|
||||
m_bPressed( VARIANT_FALSE ),
|
||||
m_bMouseIn( VARIANT_FALSE )
|
||||
{
|
||||
}
|
||||
|
||||
STDMETHODIMP cCheckbox::get_Font(IFontCacheDisp **pVal)
|
||||
{
|
||||
_ASSERTE( pVal != NULL );
|
||||
|
||||
if( m_pFont.p == NULL )
|
||||
*pVal = NULL;
|
||||
else
|
||||
m_pFont->QueryInterface( pVal );
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP cCheckbox::putref_Font(IFontCacheDisp *newVal)
|
||||
{
|
||||
_ASSERTE( newVal != NULL );
|
||||
|
||||
if( m_pFont.p )
|
||||
m_pFont.Release();
|
||||
|
||||
HRESULT hRes = newVal->QueryInterface( &m_pFont );
|
||||
|
||||
_ASSERTE( SUCCEEDED( hRes ) );
|
||||
m_pSite->Reformat();
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP cCheckbox::get_Text(BSTR *pVal)
|
||||
{
|
||||
_ASSERTE( pVal != NULL );
|
||||
|
||||
*pVal = OLE2BSTR( m_strText );
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP cCheckbox::put_Text(BSTR newVal)
|
||||
{
|
||||
_ASSERTE( newVal != NULL );
|
||||
|
||||
m_strText = newVal;
|
||||
m_pSite->Reformat();
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP cCheckbox::get_TextColor(long *pVal)
|
||||
{
|
||||
_ASSERTE( pVal != NULL );
|
||||
|
||||
*pVal = m_nTextColor;
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP cCheckbox::put_TextColor(long newVal)
|
||||
{
|
||||
_ASSERTE( ( newVal & 0xFF000000L ) == 0 );
|
||||
|
||||
m_nTextColor = newVal;
|
||||
m_pSite->Invalidate();
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP cCheckbox::get_Checked(VARIANT_BOOL *pVal)
|
||||
{
|
||||
_ASSERTE( pVal != NULL );
|
||||
*pVal = m_bChecked;
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP cCheckbox::put_Checked(VARIANT_BOOL newVal)
|
||||
{
|
||||
if( m_bChecked == newVal )
|
||||
return S_OK;
|
||||
|
||||
m_bChecked = newVal;
|
||||
m_pSite->Invalidate();
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP cCheckbox::get_RightToLeft(VARIANT_BOOL *pVal)
|
||||
{
|
||||
_ASSERTE( pVal != NULL );
|
||||
|
||||
*pVal = m_bRightToLeft;
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP cCheckbox::put_RightToLeft(VARIANT_BOOL newVal)
|
||||
{
|
||||
m_bRightToLeft = newVal;
|
||||
m_pSite->Reformat();
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP cCheckbox::SchemaLoad(IView *pView, IUnknown *pSchema)
|
||||
{
|
||||
// First attempt to load the font
|
||||
CComPtr< IPluginSite > pPlugin;
|
||||
m_pSite->get_PluginSite( &pPlugin );
|
||||
|
||||
pPlugin->CreateFontSchema( 14, 0, pSchema, &m_pFont );
|
||||
|
||||
MSXML::IXMLDOMElementPtr pElement = pSchema;
|
||||
|
||||
_variant_t vText = pElement->getAttribute( _T( "text" ) ),
|
||||
vTextColor = pElement->getAttribute( _T( "textcolor" ) ),
|
||||
vRightToLeft = pElement->getAttribute( _T( "righttoleft" ) ),
|
||||
vChecked = pElement->getAttribute( _T( "checked" ) ),
|
||||
vOutline = pElement->getAttribute( _T( "outlinecolor" ) ),
|
||||
vAntialias = pElement->getAttribute( _T( "aa" ) );
|
||||
|
||||
// Text must exist
|
||||
_ASSERTE( vText.vt == VT_BSTR );
|
||||
m_strText = vText.bstrVal;
|
||||
|
||||
if( vTextColor.vt != VT_NULL )
|
||||
{
|
||||
try
|
||||
{
|
||||
m_nTextColor = static_cast< long >( vTextColor );
|
||||
}
|
||||
catch( ... )
|
||||
{
|
||||
// Type conversion error
|
||||
_ASSERTE( FALSE );
|
||||
}
|
||||
}
|
||||
|
||||
if( vRightToLeft.vt != VT_NULL )
|
||||
{
|
||||
try
|
||||
{
|
||||
m_bRightToLeft = ( static_cast< bool >( vRightToLeft ) ) ? VARIANT_TRUE : VARIANT_FALSE;
|
||||
}
|
||||
catch( ... )
|
||||
{
|
||||
// Type conversion error
|
||||
_ASSERTE( FALSE );
|
||||
}
|
||||
}
|
||||
|
||||
if( vChecked.vt != VT_NULL )
|
||||
{
|
||||
try
|
||||
{
|
||||
m_bChecked = ( static_cast< bool >( vChecked ) ) ? VARIANT_TRUE : VARIANT_FALSE;
|
||||
}
|
||||
catch( ... )
|
||||
{
|
||||
// Type conversion error
|
||||
_ASSERTE( FALSE );
|
||||
}
|
||||
}
|
||||
|
||||
m_nOutlineColor = 0;
|
||||
m_bOutline = false;
|
||||
if( vOutline.vt != VT_NULL )
|
||||
{
|
||||
try
|
||||
{
|
||||
m_bOutline = true;
|
||||
m_nOutlineColor = static_cast< long >( vOutline );
|
||||
}
|
||||
catch( ... )
|
||||
{
|
||||
// Type conversion error
|
||||
_ASSERTE( FALSE );
|
||||
}
|
||||
}
|
||||
|
||||
m_bAA = true;
|
||||
if( vAntialias.vt != VT_NULL )
|
||||
{
|
||||
try
|
||||
{
|
||||
m_bAA = static_cast< bool >( vAntialias );
|
||||
}
|
||||
catch( ... )
|
||||
{
|
||||
// Type conversion error
|
||||
_ASSERTE( FALSE );
|
||||
}
|
||||
}
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
#define CHECK_SIZE 13
|
||||
#define TEXT_OFFSET 4
|
||||
|
||||
STDMETHODIMP cCheckbox::Reformat()
|
||||
{
|
||||
if( m_pFont.p == NULL )
|
||||
{
|
||||
// No font was specified, create the default font
|
||||
CComPtr< IPluginSite > pPlugin;
|
||||
m_pSite->get_PluginSite( &pPlugin );
|
||||
|
||||
BSTR bstrFontName;
|
||||
pPlugin->get_FontName(&bstrFontName);
|
||||
pPlugin->CreateFont( bstrFontName /*_bstr_t( _T( "Times New Roman" ) )*/, 14, 0, &m_pFont );
|
||||
}
|
||||
|
||||
RECT rc;
|
||||
m_pSite->get_Position( &rc );
|
||||
|
||||
SIZE szText;
|
||||
m_pFont->MeasureText( m_strText, &szText );
|
||||
|
||||
if( szText.cy >= CHECK_SIZE )
|
||||
{
|
||||
m_ptCheck.y = ( szText.cy - CHECK_SIZE ) / 2;
|
||||
m_ptText.y = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_ptCheck.y = 0;
|
||||
m_ptText.y = ( CHECK_SIZE - szText.cy ) / 2;
|
||||
}
|
||||
|
||||
if( m_bRightToLeft )
|
||||
{
|
||||
m_ptText.x = ( rc.right - rc.left ) - ( CHECK_SIZE + TEXT_OFFSET ) - szText.cx;
|
||||
m_ptCheck.x = ( rc.right - rc.left ) - CHECK_SIZE;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_ptText.x = CHECK_SIZE + TEXT_OFFSET;
|
||||
m_ptCheck.x = 0;
|
||||
}
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP cCheckbox::Render( ICanvas *pCanvas )
|
||||
{
|
||||
bool bChecked = ( m_bPressed && m_bMouseIn ) ? !m_bChecked : !!m_bChecked;
|
||||
|
||||
CComPtr< IPluginSite > pPlugin;
|
||||
m_pSite->get_PluginSite( &pPlugin );
|
||||
|
||||
CComPtr< IIconCache > pIcon;
|
||||
SIZE szIcon = { CHECK_SIZE, CHECK_SIZE };
|
||||
pPlugin->GetIconCache( &szIcon, &pIcon );
|
||||
|
||||
pIcon->DrawIcon( &m_ptCheck, ( bChecked ) ? 0x0600128B : 0x0600128D, 0, pCanvas );
|
||||
|
||||
long lFlags = 0;
|
||||
|
||||
if( m_bAA )
|
||||
lFlags |= eAA;
|
||||
|
||||
if( m_bOutline )
|
||||
lFlags |= eOutlined;
|
||||
|
||||
m_pFont->DrawTextEx( &m_ptText, m_strText, m_nTextColor, m_nOutlineColor, lFlags, pCanvas );
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP cCheckbox::MouseEnter(struct MouseState *)
|
||||
{
|
||||
_ASSERTE( !m_bMouseIn );
|
||||
|
||||
m_bMouseIn = VARIANT_TRUE;
|
||||
|
||||
if( m_bPressed )
|
||||
{
|
||||
_ASSERTE( m_pSite.p != NULL );
|
||||
|
||||
m_pSite->Invalidate();
|
||||
}
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP cCheckbox::MouseExit(struct MouseState *)
|
||||
{
|
||||
_ASSERTE( m_bMouseIn );
|
||||
|
||||
m_bMouseIn = VARIANT_FALSE;
|
||||
|
||||
if( m_bPressed )
|
||||
{
|
||||
_ASSERTE( m_pSite.p != NULL );
|
||||
|
||||
m_pSite->Invalidate();
|
||||
}
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP cCheckbox::MouseDown(struct MouseState *)
|
||||
{
|
||||
_ASSERTE( m_pSite != NULL );
|
||||
|
||||
m_bPressed = VARIANT_TRUE;
|
||||
m_pSite->Invalidate();
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP cCheckbox::MouseUp(struct MouseState *)
|
||||
{
|
||||
m_bPressed = VARIANT_FALSE;
|
||||
|
||||
long nID;
|
||||
m_pSite->get_ID( &nID );
|
||||
|
||||
if( m_bMouseIn )
|
||||
{
|
||||
_ASSERTE( m_pSite.p != NULL );
|
||||
|
||||
m_bChecked = ( m_bChecked ) ? VARIANT_FALSE : VARIANT_TRUE;
|
||||
m_pSite->Invalidate();
|
||||
|
||||
// NOTE: The command may destroy the control synchronously
|
||||
// so we make a stack copy of the target in case our instance is destroyed
|
||||
// for the purpose of completing the command
|
||||
Fire_Change( nID, m_bChecked );
|
||||
}
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
91
Native/DecalControls/Checkbox.h
Normal file
91
Native/DecalControls/Checkbox.h
Normal file
|
|
@ -0,0 +1,91 @@
|
|||
// Checkbox.h : Declaration of the cCheckbox
|
||||
|
||||
#ifndef __CHECKBOX_H_
|
||||
#define __CHECKBOX_H_
|
||||
|
||||
#include "resource.h" // main symbols
|
||||
#include "DecalControlsCP.h"
|
||||
|
||||
#include "SinkImpl.h"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// cCheckbox
|
||||
class ATL_NO_VTABLE cCheckbox :
|
||||
public CComObjectRootEx<CComMultiThreadModel>,
|
||||
public CComCoClass<cCheckbox, &CLSID_Checkbox>,
|
||||
public IControlImpl< cCheckbox, ICheckbox, &IID_ICheckbox, &LIBID_DecalControls >,
|
||||
public ILayerMouseImpl,
|
||||
public ILayerRenderImpl,
|
||||
public ILayerImpl< cCheckbox >,
|
||||
public ILayerSchema,
|
||||
public IProvideClassInfo2Impl< &CLSID_Checkbox, &DIID_ICheckboxEvents, &LIBID_DecalControls >,
|
||||
public IConnectionPointContainerImpl<cCheckbox>,
|
||||
public CProxyICheckboxEvents< cCheckbox >
|
||||
{
|
||||
public:
|
||||
cCheckbox();
|
||||
|
||||
_bstr_t m_strText;
|
||||
CComPtr< IFontCache > m_pFont;
|
||||
|
||||
VARIANT_BOOL m_bChecked,
|
||||
m_bRightToLeft;
|
||||
|
||||
long m_nTextColor, m_nOutlineColor;
|
||||
bool m_bAA, m_bOutline;
|
||||
|
||||
POINT m_ptText,
|
||||
m_ptCheck;
|
||||
|
||||
VARIANT_BOOL m_bPressed,
|
||||
m_bMouseIn;
|
||||
|
||||
DECLARE_REGISTRY_RESOURCEID(IDR_CHECKBOX)
|
||||
|
||||
DECLARE_PROTECT_FINAL_CONSTRUCT()
|
||||
|
||||
BEGIN_COM_MAP(cCheckbox)
|
||||
COM_INTERFACE_ENTRY(ILayerRender)
|
||||
COM_INTERFACE_ENTRY(ILayerMouse)
|
||||
COM_INTERFACE_ENTRY(ILayerSchema)
|
||||
COM_INTERFACE_ENTRY(ICheckbox)
|
||||
COM_INTERFACE_ENTRY(IControl)
|
||||
COM_INTERFACE_ENTRY(IDispatch)
|
||||
COM_INTERFACE_ENTRY(ILayer)
|
||||
COM_INTERFACE_ENTRY(IProvideClassInfo)
|
||||
COM_INTERFACE_ENTRY(IProvideClassInfo2)
|
||||
COM_INTERFACE_ENTRY_IMPL(IConnectionPointContainer)
|
||||
END_COM_MAP()
|
||||
|
||||
BEGIN_CONNECTION_POINT_MAP(cCheckbox)
|
||||
CONNECTION_POINT_ENTRY(DIID_ICheckboxEvents)
|
||||
END_CONNECTION_POINT_MAP()
|
||||
|
||||
public:
|
||||
// ICheckbox Methods
|
||||
STDMETHOD(get_RightToLeft)(/*[out, retval]*/ VARIANT_BOOL *pVal);
|
||||
STDMETHOD(put_RightToLeft)(/*[in]*/ VARIANT_BOOL newVal);
|
||||
STDMETHOD(get_Checked)(/*[out, retval]*/ VARIANT_BOOL *pVal);
|
||||
STDMETHOD(put_Checked)(/*[in]*/ VARIANT_BOOL newVal);
|
||||
STDMETHOD(get_TextColor)(/*[out, retval]*/ long *pVal);
|
||||
STDMETHOD(put_TextColor)(/*[in]*/ long newVal);
|
||||
STDMETHOD(get_Text)(/*[out, retval]*/ BSTR *pVal);
|
||||
STDMETHOD(put_Text)(/*[in]*/ BSTR newVal);
|
||||
STDMETHOD(get_Font)(/*[out, retval]*/ IFontCacheDisp * *pVal);
|
||||
STDMETHOD(putref_Font)(/*[in]*/ IFontCacheDisp * newVal);
|
||||
|
||||
// ILayerSchema Methods
|
||||
STDMETHOD(SchemaLoad)(IView *pView, IUnknown *pSchema);
|
||||
|
||||
// ILayerRender Methods
|
||||
STDMETHOD(Reformat)();
|
||||
STDMETHOD(Render)(ICanvas *pCanvas);
|
||||
|
||||
// ILayerMouse Methods
|
||||
STDMETHOD(MouseEnter)(struct MouseState *);
|
||||
STDMETHOD(MouseExit)(struct MouseState *);
|
||||
STDMETHOD(MouseDown)(struct MouseState *);
|
||||
STDMETHOD(MouseUp)(struct MouseState *);
|
||||
};
|
||||
|
||||
#endif //__CHECKBOX_H_
|
||||
25
Native/DecalControls/Checkbox.rgs
Normal file
25
Native/DecalControls/Checkbox.rgs
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
HKCR
|
||||
{
|
||||
DecalControls.Checkbox.1 = s 'Checkbox Class'
|
||||
{
|
||||
CLSID = s '{5AE37451-F79C-478A-834E-EDCF95F01B0E}'
|
||||
}
|
||||
DecalControls.Checkbox = s 'Checkbox Class'
|
||||
{
|
||||
CLSID = s '{5AE37451-F79C-478A-834E-EDCF95F01B0E}'
|
||||
CurVer = s 'DecalControls.Checkbox.1'
|
||||
}
|
||||
NoRemove CLSID
|
||||
{
|
||||
ForceRemove {5AE37451-F79C-478A-834E-EDCF95F01B0E} = s 'Checkbox Class'
|
||||
{
|
||||
ProgID = s 'DecalControls.Checkbox.1'
|
||||
VersionIndependentProgID = s 'DecalControls.Checkbox'
|
||||
InprocServer32 = s '%MODULE%'
|
||||
{
|
||||
val ThreadingModel = s 'Both'
|
||||
}
|
||||
'TypeLib' = s '{1C4B007A-04DD-4DF8-BA29-2CFBD0220B89}'
|
||||
}
|
||||
}
|
||||
}
|
||||
426
Native/DecalControls/Choice.cpp
Normal file
426
Native/DecalControls/Choice.cpp
Normal file
|
|
@ -0,0 +1,426 @@
|
|||
// Choice.cpp : Implementation of cChoice
|
||||
#include "stdafx.h"
|
||||
#include "DecalControls.h"
|
||||
#include "Choice.h"
|
||||
|
||||
#include "ChoicePopup.h"
|
||||
#include "ChoiceDropDown.h"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// cChoice
|
||||
|
||||
cChoice::cChoice()
|
||||
: m_nSelected( -1 ),
|
||||
m_nHotSelect( -1 ),
|
||||
m_nDropLines( 8 ),
|
||||
m_bPopup( false ),
|
||||
m_bMouseDown( false ),
|
||||
m_bMouseOver( false )
|
||||
{
|
||||
}
|
||||
|
||||
void cChoice::setPopup( bool bPopup )
|
||||
{
|
||||
// Always reset hot select
|
||||
m_bPopup = bPopup;
|
||||
m_nHotSelect = -1;
|
||||
|
||||
if( bPopup )
|
||||
{
|
||||
long nID;
|
||||
m_pSite->get_ID( &nID );
|
||||
Fire_DropDown( nID );
|
||||
m_pPopup->put_Popup( VARIANT_TRUE );
|
||||
}
|
||||
|
||||
// Redraw everything
|
||||
m_pSite->Reformat();
|
||||
m_pSite->Invalidate();
|
||||
}
|
||||
|
||||
void cChoice::onCreate()
|
||||
{
|
||||
CComPtr< IPluginSite > pPluginSite;
|
||||
m_pSite->get_PluginSite( &pPluginSite );
|
||||
|
||||
// Create the image info
|
||||
pPluginSite->LoadBitmapPortal( 0x06001276, &m_pInactive );
|
||||
BSTR bstrFontName;
|
||||
pPluginSite->get_FontName(&bstrFontName);
|
||||
pPluginSite->CreateFont( bstrFontName /*_bstr_t( _T( "Times New Roman" ) )*/, 14, 0, &m_pFont );
|
||||
|
||||
// Create the dropdown
|
||||
CComObject< cChoiceDropDown > *pDropDown;
|
||||
CComObject< cChoiceDropDown >::CreateInstance( &pDropDown );
|
||||
|
||||
pDropDown->m_pChoice = this;
|
||||
|
||||
LayerParams lp = { 0, { -1, -1, 0, 0 }, 0 };
|
||||
m_pSite->CreateChild( &lp, pDropDown );
|
||||
|
||||
m_pPopup = pDropDown->m_pSite;
|
||||
|
||||
// Create the scroller
|
||||
CComPtr< ILayer > pScrollerLayer;
|
||||
HRESULT hRes = ::CoCreateInstance( CLSID_Scroller, NULL, CLSCTX_INPROC_SERVER, IID_ILayer, reinterpret_cast< void ** >( &pScrollerLayer ) );
|
||||
_ASSERTE( SUCCEEDED( hRes ) );
|
||||
pScrollerLayer->QueryInterface( &m_pScroller );
|
||||
|
||||
// Create the scroller object
|
||||
LayerParams lpScroller = { 0, { 0, 0, 0, 0 }, eRenderClipped };
|
||||
m_pPopup->CreateChild( &lpScroller, pScrollerLayer );
|
||||
|
||||
// Configure the scroller
|
||||
SIZE szLine = { 18, 1 };
|
||||
m_pScroller->put_Increments( &szLine );
|
||||
|
||||
// Create the popup window
|
||||
CComObject< cChoicePopup > *pPopup;
|
||||
CComObject< cChoicePopup >::CreateInstance( &pPopup );
|
||||
|
||||
pPopup->m_pChoice = this;
|
||||
m_pScroller->CreateClient( pPopup );
|
||||
|
||||
m_pPopup->put_Transparent( VARIANT_FALSE );
|
||||
m_pSite->put_Transparent( VARIANT_FALSE );
|
||||
}
|
||||
|
||||
void cChoice::onDestroy()
|
||||
{
|
||||
m_pPopup.Release();
|
||||
|
||||
m_pFont.Release();
|
||||
m_pInactive.Release();
|
||||
}
|
||||
|
||||
STDMETHODIMP cChoice::MouseUp(MouseState *)
|
||||
{
|
||||
m_bMouseDown = false;
|
||||
|
||||
if( m_bMouseOver )
|
||||
{
|
||||
setPopup( !m_bPopup );
|
||||
|
||||
if( !m_bPopup )
|
||||
m_pPopup->put_Popup( VARIANT_FALSE );
|
||||
}
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
#define RENDER_LEFTSTRETCH 10
|
||||
#define RENDER_RIGHTSTRETCH 7
|
||||
#define ROW_HEIGHT 18
|
||||
|
||||
#define ICON_WIDTH 20
|
||||
#define ICON_HEIGHT 19
|
||||
|
||||
STDMETHODIMP cChoice::Render(ICanvas *pCanvas)
|
||||
{
|
||||
// First draw the background
|
||||
RECT rcPos;
|
||||
m_pSite->get_Position( &rcPos );
|
||||
|
||||
SIZE szImage;
|
||||
m_pInactive->get_Size( &szImage );
|
||||
|
||||
static POINT ptBack = { 0, 0 };
|
||||
m_pInactive->StretchBlt( pCanvas, &ptBack, rcPos.right - rcPos.left, RENDER_LEFTSTRETCH, szImage.cx - RENDER_RIGHTSTRETCH );
|
||||
|
||||
if( m_nSelected != -1 )
|
||||
{
|
||||
// Draw the selected text
|
||||
static POINT ptText = { 12, 2 };
|
||||
m_pFont->DrawTextEx( &ptText, m_options[ m_nSelected ].m_strText, 0, 0, eAA, pCanvas );
|
||||
}
|
||||
|
||||
// Draw the up/down icon
|
||||
CComPtr< IPluginSite > pPluginSite;
|
||||
m_pSite->get_PluginSite( &pPluginSite );
|
||||
|
||||
SIZE szIcon = { ICON_WIDTH, ICON_HEIGHT };
|
||||
CComPtr< IIconCache > pIconCache;
|
||||
pPluginSite->GetIconCache( &szIcon, &pIconCache );
|
||||
|
||||
POINT ptIcon = { rcPos.right - rcPos.left - ICON_WIDTH, 0 };
|
||||
pIconCache->DrawIcon( &ptIcon, ( ( m_bMouseDown && m_bMouseOver ) ? !m_bPopup : m_bPopup ) ? 0x06001275 : 0x06001274, 0, pCanvas );
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP cChoice::Reformat()
|
||||
{
|
||||
if( !m_bPopup || m_options.size() == 0 )
|
||||
{
|
||||
// If it's hidden great, hide it well
|
||||
static RECT rcHidden = { -1, -1, 0, 0 };
|
||||
m_pPopup->put_Position( &rcHidden );
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
// Calculate the correct position
|
||||
RECT rc;
|
||||
m_pSite->get_ScreenPosition( &rc );
|
||||
|
||||
// Two modes, with scroll bar and without
|
||||
if( m_options.size() > m_nDropLines )
|
||||
{
|
||||
// With a scroller
|
||||
RECT rcPopup = { rc.left, rc.bottom, rc.right - ICON_WIDTH + 16, rc.bottom +
|
||||
ROW_HEIGHT * m_nDropLines };
|
||||
m_pPopup->put_Position( &rcPopup );
|
||||
|
||||
m_pScroller->put_VerticalEnabled( VARIANT_TRUE );
|
||||
|
||||
SIZE szArea = { rc.right - ICON_WIDTH, ROW_HEIGHT * m_options.size() };
|
||||
m_pScroller->put_Area( &szArea );
|
||||
}
|
||||
else
|
||||
{
|
||||
RECT rcPopup = { rc.left, rc.bottom, rc.right - ICON_WIDTH, rc.bottom +
|
||||
ROW_HEIGHT * m_options.size() };
|
||||
m_pPopup->put_Position( &rcPopup );
|
||||
|
||||
POINT ptOffset = { 0, 0 };
|
||||
m_pScroller->put_Offset( &ptOffset );
|
||||
m_pScroller->put_VerticalEnabled( VARIANT_FALSE );
|
||||
|
||||
SIZE szArea = { rc.right - ICON_WIDTH, ROW_HEIGHT * m_options.size() };
|
||||
m_pScroller->put_Area( &szArea );
|
||||
}
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP cChoice::SchemaLoad(IView *pView, IUnknown *pSchema)
|
||||
{
|
||||
// Load the data from the schema
|
||||
|
||||
MSXML::IXMLDOMElementPtr pElement = pSchema;
|
||||
|
||||
MSXML::IXMLDOMElementPtr pRow;
|
||||
for( MSXML::IXMLDOMNodeListPtr pRows = pElement->selectNodes( _T( "option" ) );
|
||||
( pRow = pRows->nextNode() ).GetInterfacePtr() != NULL; )
|
||||
{
|
||||
_variant_t vRow = pRow->getAttribute( _T( "text" ) ),
|
||||
vData = pRow->getAttribute( _T( "data" ) );
|
||||
_ASSERTE( vRow.vt == VT_BSTR );
|
||||
|
||||
cOption o;
|
||||
o.m_strText = vRow;
|
||||
o.m_value = vData;
|
||||
|
||||
m_options.push_back( o );
|
||||
}
|
||||
|
||||
_variant_t vDropRows = pElement->getAttribute( "droplines" ),
|
||||
vSelected = pElement->getAttribute( "selected" );
|
||||
|
||||
if( vDropRows.vt != VT_NULL )
|
||||
{
|
||||
try
|
||||
{
|
||||
m_nDropLines = static_cast< long >( vDropRows );
|
||||
_ASSERTE( m_nDropLines > 0 );
|
||||
}
|
||||
catch( ... )
|
||||
{
|
||||
// Type conversion error
|
||||
_ASSERTE( FALSE );
|
||||
}
|
||||
}
|
||||
|
||||
if( vSelected.vt != VT_NULL )
|
||||
{
|
||||
try
|
||||
{
|
||||
m_nSelected = static_cast< long >( vSelected );
|
||||
_ASSERTE( m_nSelected >= 0 );
|
||||
}
|
||||
catch( ... )
|
||||
{
|
||||
// Type conversion error
|
||||
_ASSERTE( FALSE );
|
||||
}
|
||||
}
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP cChoice::AddChoice(BSTR strDisplay, VARIANT vData)
|
||||
{
|
||||
cOption o;
|
||||
o.m_strText = strDisplay;
|
||||
o.m_value = vData;
|
||||
|
||||
m_options.push_back( o );
|
||||
m_pSite->Reformat();
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP cChoice::get_ChoiceCount(long *pVal)
|
||||
{
|
||||
_ASSERTE( pVal != NULL );
|
||||
|
||||
*pVal = m_options.size();
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP cChoice::get_Data(long nIndex, VARIANT *pVal)
|
||||
{
|
||||
if( pVal == NULL )
|
||||
return E_POINTER;
|
||||
|
||||
if( nIndex < 0 || nIndex > m_options.size() )
|
||||
{
|
||||
pVal->lVal = -1;
|
||||
pVal->vt = VT_I4;
|
||||
}
|
||||
|
||||
else
|
||||
::VariantCopy( pVal, &m_options[ nIndex ].m_value );
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP cChoice::put_Data(long nIndex, VARIANT newVal)
|
||||
{
|
||||
_ASSERTE( nIndex >= 0 );
|
||||
_ASSERTE( nIndex < m_options.size() );
|
||||
|
||||
::VariantCopy( &m_options[ nIndex ].m_value, &newVal );
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP cChoice::get_Text(long nIndex, BSTR *pVal)
|
||||
{
|
||||
USES_CONVERSION;
|
||||
|
||||
_ASSERTE( nIndex >= 0 );
|
||||
_ASSERTE( nIndex < m_options.size() );
|
||||
_ASSERTE( pVal != NULL );
|
||||
|
||||
*pVal = OLE2BSTR( m_options[ nIndex ].m_strText );
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP cChoice::put_Text(long nIndex, BSTR newVal)
|
||||
{
|
||||
_ASSERTE( nIndex >= 0 );
|
||||
_ASSERTE( nIndex < m_options.size() );
|
||||
_ASSERTE( newVal != NULL );
|
||||
|
||||
m_options[ nIndex ].m_strText = newVal;
|
||||
m_pPopup->Invalidate();
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP cChoice::RemoveChoice(long nIndex)
|
||||
{
|
||||
_ASSERTE( nIndex >= 0 );
|
||||
_ASSERTE( nIndex < m_options.size() );
|
||||
|
||||
m_options.erase( m_options.begin() + nIndex );
|
||||
|
||||
if( m_nSelected >= m_options.size() )
|
||||
m_nSelected = m_options.size() - 1;
|
||||
|
||||
long nID;
|
||||
m_pSite->get_ID( &nID );
|
||||
Fire_Change( nID, m_nSelected );
|
||||
|
||||
// Redraw the concerned
|
||||
m_pSite->Reformat();
|
||||
m_pPopup->Invalidate();
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP cChoice::get_Dropped(VARIANT_BOOL *pVal)
|
||||
{
|
||||
_ASSERTE( pVal != NULL );
|
||||
|
||||
*pVal = ( m_bPopup ) ? VARIANT_TRUE : VARIANT_FALSE;
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP cChoice::put_Dropped(VARIANT_BOOL newVal)
|
||||
{
|
||||
if( !!newVal != m_bPopup )
|
||||
setPopup( !!newVal );
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP cChoice::get_Selected(long *pVal)
|
||||
{
|
||||
_ASSERTE( pVal != NULL );
|
||||
*pVal = m_nSelected;
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP cChoice::put_Selected(long newVal)
|
||||
{
|
||||
_ASSERTE( newVal >= -1 );
|
||||
//_ASSERTE( newVal < m_options.size() );
|
||||
//back out if out of bounds, don't error to prevent breaking vb plugs
|
||||
//this should fix the crash on display bug
|
||||
if (newVal >= m_options.size())
|
||||
return S_OK;
|
||||
|
||||
if( newVal == m_nSelected )
|
||||
return S_OK;
|
||||
|
||||
m_nSelected = newVal;
|
||||
|
||||
long nID;
|
||||
m_pSite->get_ID( &nID );
|
||||
Fire_Change( nID, m_nSelected );
|
||||
|
||||
// Redraw the concerned
|
||||
m_pSite->Invalidate();
|
||||
m_pPopup->Invalidate();
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP cChoice::get_DropLines(long *pVal)
|
||||
{
|
||||
_ASSERTE( pVal != NULL );
|
||||
|
||||
*pVal = m_nDropLines;
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP cChoice::put_DropLines(long newVal)
|
||||
{
|
||||
_ASSERTE( newVal > 0 );
|
||||
|
||||
m_nDropLines = newVal;
|
||||
m_pSite->Reformat();
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP cChoice::Clear()
|
||||
{
|
||||
m_options.clear();
|
||||
m_nSelected = -1;
|
||||
|
||||
long nID;
|
||||
m_pSite->get_ID( &nID );
|
||||
Fire_Change( nID, m_nSelected );
|
||||
|
||||
m_pSite->Reformat();
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
128
Native/DecalControls/Choice.h
Normal file
128
Native/DecalControls/Choice.h
Normal file
|
|
@ -0,0 +1,128 @@
|
|||
// Choice.h : Declaration of the cChoice
|
||||
|
||||
#ifndef __CHOICE_H_
|
||||
#define __CHOICE_H_
|
||||
|
||||
#include "resource.h" // main symbols
|
||||
|
||||
#include "SinkImpl.h"
|
||||
#include "DecalControlsCP.h"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// cChoice
|
||||
class ATL_NO_VTABLE cChoice :
|
||||
public CComObjectRootEx<CComMultiThreadModel>,
|
||||
public CComCoClass<cChoice, &CLSID_Choice>,
|
||||
public IConnectionPointContainerImpl<cChoice>,
|
||||
public ILayerImpl< cChoice >,
|
||||
public ILayerRenderImpl,
|
||||
public ILayerMouseImpl,
|
||||
public ILayerSchema,
|
||||
public IControlImpl< cChoice, IChoice, &IID_IChoice, &LIBID_DecalControls >,
|
||||
public IProvideClassInfo2Impl< &CLSID_Choice, &DIID_IChoiceEvents, &LIBID_DecalControls >,
|
||||
public CProxyIChoiceEvents< cChoice >
|
||||
{
|
||||
public:
|
||||
cChoice();
|
||||
|
||||
long m_nSelected;
|
||||
long m_nHotSelect;
|
||||
long m_nDropLines;
|
||||
|
||||
struct cOption
|
||||
{
|
||||
_variant_t m_value;
|
||||
_bstr_t m_strText;
|
||||
};
|
||||
|
||||
typedef std::deque< cOption > cOptionList;
|
||||
cOptionList m_options;
|
||||
|
||||
CComPtr< IImageCache > m_pInactive;
|
||||
CComPtr< IFontCache > m_pFont;
|
||||
CComPtr< ILayerSite > m_pPopup;
|
||||
CComPtr< IScroller > m_pScroller;
|
||||
|
||||
bool m_bMouseDown;
|
||||
bool m_bMouseOver;
|
||||
bool m_bPopup;
|
||||
|
||||
void setPopup( bool bPopup );
|
||||
|
||||
void onCreate();
|
||||
void onDestroy();
|
||||
|
||||
DECLARE_REGISTRY_RESOURCEID(IDR_CHOICE)
|
||||
|
||||
DECLARE_PROTECT_FINAL_CONSTRUCT()
|
||||
|
||||
BEGIN_COM_MAP(cChoice)
|
||||
COM_INTERFACE_ENTRY(ILayerRender)
|
||||
COM_INTERFACE_ENTRY(ILayerMouse)
|
||||
COM_INTERFACE_ENTRY(ILayer)
|
||||
COM_INTERFACE_ENTRY(ILayerSchema)
|
||||
COM_INTERFACE_ENTRY(IChoice)
|
||||
COM_INTERFACE_ENTRY(IControl)
|
||||
COM_INTERFACE_ENTRY(IDispatch)
|
||||
COM_INTERFACE_ENTRY(IProvideClassInfo)
|
||||
COM_INTERFACE_ENTRY(IProvideClassInfo2)
|
||||
COM_INTERFACE_ENTRY_IMPL(IConnectionPointContainer)
|
||||
END_COM_MAP()
|
||||
|
||||
BEGIN_CONNECTION_POINT_MAP(cChoice)
|
||||
CONNECTION_POINT_ENTRY(DIID_IChoiceEvents)
|
||||
END_CONNECTION_POINT_MAP()
|
||||
|
||||
public:
|
||||
STDMETHOD(Clear)();
|
||||
// IChoice Methods
|
||||
STDMETHOD(get_Selected)(/*[out, retval]*/ long *pVal);
|
||||
STDMETHOD(put_Selected)(/*[in]*/ long newVal);
|
||||
STDMETHOD(get_Dropped)(/*[out, retval]*/ VARIANT_BOOL *pVal);
|
||||
STDMETHOD(put_Dropped)(/*[in]*/ VARIANT_BOOL newVal);
|
||||
STDMETHOD(RemoveChoice)(long nIndex);
|
||||
STDMETHOD(get_Text)(long nIndex, /*[out, retval]*/ BSTR *pVal);
|
||||
STDMETHOD(put_Text)(long nIndex, /*[in]*/ BSTR newVal);
|
||||
STDMETHOD(get_Data)(long nIndex, /*[out, retval]*/ VARIANT *pVal);
|
||||
STDMETHOD(put_Data)(long nIndex, /*[in]*/ VARIANT newVal);
|
||||
STDMETHOD(get_ChoiceCount)(/*[out, retval]*/ long *pVal);
|
||||
STDMETHOD(AddChoice)(BSTR strDisplay, /*[optional]*/ VARIANT vData);
|
||||
STDMETHOD(get_DropLines)(/*[out, retval]*/ long *pVal);
|
||||
STDMETHOD(put_DropLines)(/*[in]*/ long newVal);
|
||||
|
||||
// ILayerMouse Methods
|
||||
STDMETHOD(MouseDown)(MouseState *)
|
||||
{
|
||||
m_bMouseDown = true;
|
||||
m_pSite->Invalidate();
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHOD(MouseEnter)(MouseState *pMS)
|
||||
{
|
||||
m_bMouseOver = true;
|
||||
m_pSite->Invalidate();
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHOD(MouseExit)(MouseState *pMS)
|
||||
{
|
||||
m_bMouseOver = false;
|
||||
m_pSite->Invalidate();
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHOD(MouseUp)(MouseState *pMS);
|
||||
|
||||
// ILayerRender Methods
|
||||
STDMETHOD(Render)(ICanvas *pCanvas);
|
||||
STDMETHOD(Reformat)();
|
||||
|
||||
// ILayerSchema Methods
|
||||
STDMETHOD(SchemaLoad)(IView *pView, IUnknown *pSchema);
|
||||
};
|
||||
|
||||
#endif //__CHOICE_H_
|
||||
25
Native/DecalControls/Choice.rgs
Normal file
25
Native/DecalControls/Choice.rgs
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
HKCR
|
||||
{
|
||||
DecalControls.Choice.1 = s 'DecalControls Choice'
|
||||
{
|
||||
CLSID = s '{E099DC60-0F19-4690-AB7C-8B5834DA286E}'
|
||||
}
|
||||
DecalControls.Choice = s 'DecalControls Choice'
|
||||
{
|
||||
CLSID = s '{E099DC60-0F19-4690-AB7C-8B5834DA286E}'
|
||||
CurVer = s 'DecalControls.Choice.1'
|
||||
}
|
||||
NoRemove CLSID
|
||||
{
|
||||
ForceRemove {E099DC60-0F19-4690-AB7C-8B5834DA286E} = s 'DecalControls Choice'
|
||||
{
|
||||
ProgID = s 'DecalControls.Choice.1'
|
||||
VersionIndependentProgID = s 'DecalControls.Choice'
|
||||
InprocServer32 = s '%MODULE%'
|
||||
{
|
||||
val ThreadingModel = s 'Both'
|
||||
}
|
||||
'TypeLib' = s '{1C4B007A-04DD-4DF8-BA29-2CFBD0220B89}'
|
||||
}
|
||||
}
|
||||
}
|
||||
46
Native/DecalControls/ChoiceDropDown.cpp
Normal file
46
Native/DecalControls/ChoiceDropDown.cpp
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
// ChoiceDropDown.cpp : Implementation of cChoiceDropDown
|
||||
#include "stdafx.h"
|
||||
#include "DecalControls.h"
|
||||
#include "ChoiceDropDown.h"
|
||||
|
||||
#include "Choice.h"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// cChoiceDropDown
|
||||
|
||||
STDMETHODIMP cChoiceDropDown::Reformat()
|
||||
{
|
||||
RECT rcLayer;
|
||||
m_pSite->get_Position( &rcLayer );
|
||||
|
||||
// Move our only child to cover the entire client
|
||||
CComPtr< ILayerSite > pChild;
|
||||
m_pSite->get_Child( 0, ePositionByIndex, &pChild );
|
||||
|
||||
if( ( rcLayer.right - rcLayer.left ) < 16 || ( rcLayer.bottom - rcLayer.top ) < 16 )
|
||||
{
|
||||
RECT rcClient = { 0, 0, 0, 0 };
|
||||
pChild->put_Position( &rcClient );
|
||||
}
|
||||
else
|
||||
{
|
||||
RECT rcClient = { 0, 0, rcLayer.right - rcLayer.left, rcLayer.bottom - rcLayer.top };
|
||||
pChild->put_Position( &rcClient );
|
||||
}
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP cChoiceDropDown::PopupCancel(MouseState *pMS, VARIANT_BOOL *pbContinue)
|
||||
{
|
||||
// Allow clicks in the parent object
|
||||
*pbContinue = ( pMS->over == m_pChoice ) ? VARIANT_TRUE : VARIANT_FALSE;
|
||||
|
||||
if( !( *pbContinue ) )
|
||||
{
|
||||
m_pChoice->m_nHotSelect = -1;
|
||||
m_pChoice->setPopup( false );
|
||||
}
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
49
Native/DecalControls/ChoiceDropDown.h
Normal file
49
Native/DecalControls/ChoiceDropDown.h
Normal file
|
|
@ -0,0 +1,49 @@
|
|||
// ChoiceDropDown.h : Declaration of the cChoiceDropDown
|
||||
|
||||
#ifndef __CHOICEDROPDOWN_H_
|
||||
#define __CHOICEDROPDOWN_H_
|
||||
|
||||
#include "resource.h" // main symbols
|
||||
|
||||
#include <SinkImpl.h>
|
||||
|
||||
class cChoice;
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// cChoiceDropDown
|
||||
class ATL_NO_VTABLE cChoiceDropDown :
|
||||
public CComObjectRootEx<CComMultiThreadModel>,
|
||||
public ILayerImpl< cChoiceDropDown >,
|
||||
public ILayerRenderImpl,
|
||||
public ILayerPopup,
|
||||
public cNoEventsImpl,
|
||||
public IChoiceDropDown
|
||||
{
|
||||
public:
|
||||
cChoiceDropDown()
|
||||
: m_pChoice( NULL )
|
||||
{
|
||||
}
|
||||
|
||||
cChoice *m_pChoice;
|
||||
|
||||
DECLARE_PROTECT_FINAL_CONSTRUCT()
|
||||
|
||||
BEGIN_COM_MAP(cChoiceDropDown)
|
||||
COM_INTERFACE_ENTRY(ILayerRender)
|
||||
COM_INTERFACE_ENTRY(ILayerPopup)
|
||||
COM_INTERFACE_ENTRY(ILayer)
|
||||
COM_INTERFACE_ENTRY(IChoiceDropDown)
|
||||
END_COM_MAP()
|
||||
|
||||
// IChoiceDropDown
|
||||
public:
|
||||
|
||||
// ILayerRender Methods
|
||||
STDMETHOD(Reformat)();
|
||||
|
||||
// ILayerPopup Methods
|
||||
STDMETHOD(PopupCancel)(MouseState *pMS, VARIANT_BOOL *pbContinue);
|
||||
};
|
||||
|
||||
#endif //__CHOICEDROPDOWN_H_
|
||||
25
Native/DecalControls/ChoiceDropDown.rgs
Normal file
25
Native/DecalControls/ChoiceDropDown.rgs
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
HKCR
|
||||
{
|
||||
DecalControls.ChoiceDropDown.1 = s 'ChoiceDropDown Class'
|
||||
{
|
||||
CLSID = s '{DF7D18FA-A3AE-4AED-BEE3-7936F25EC95A}'
|
||||
}
|
||||
DecalControls.ChoiceDropDown = s 'ChoiceDropDown Class'
|
||||
{
|
||||
CLSID = s '{DF7D18FA-A3AE-4AED-BEE3-7936F25EC95A}'
|
||||
CurVer = s 'DecalControls.ChoiceDropDown.1'
|
||||
}
|
||||
NoRemove CLSID
|
||||
{
|
||||
ForceRemove {DF7D18FA-A3AE-4AED-BEE3-7936F25EC95A} = s 'ChoiceDropDown Class'
|
||||
{
|
||||
ProgID = s 'DecalControls.ChoiceDropDown.1'
|
||||
VersionIndependentProgID = s 'DecalControls.ChoiceDropDown'
|
||||
InprocServer32 = s '%MODULE%'
|
||||
{
|
||||
val ThreadingModel = s 'Both'
|
||||
}
|
||||
'TypeLib' = s '{1C4B007A-04DD-4DF8-BA29-2CFBD0220B89}'
|
||||
}
|
||||
}
|
||||
}
|
||||
97
Native/DecalControls/ChoicePopup.cpp
Normal file
97
Native/DecalControls/ChoicePopup.cpp
Normal file
|
|
@ -0,0 +1,97 @@
|
|||
// ChoicePopup.cpp : Implementation of cChoicePopup
|
||||
#include "stdafx.h"
|
||||
#include "DecalControls.h"
|
||||
#include "ChoicePopup.h"
|
||||
|
||||
#include "Choice.h"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// cChoicePopup
|
||||
|
||||
#define ROW_HEIGHT 18
|
||||
|
||||
void cChoicePopup::hotSelect( MouseState *pMS )
|
||||
{
|
||||
if( pMS->over != this )
|
||||
m_pChoice->m_nHotSelect = -1;
|
||||
else
|
||||
{
|
||||
m_pChoice->m_nHotSelect = pMS->client.y / ROW_HEIGHT;
|
||||
|
||||
if( m_pChoice->m_nHotSelect >= m_pChoice->m_options.size() )
|
||||
// If we went over the edge, kill the selection
|
||||
m_pChoice->m_nHotSelect = -1;
|
||||
}
|
||||
|
||||
m_pSite->Invalidate();
|
||||
}
|
||||
|
||||
void cChoicePopup::onCreate()
|
||||
{
|
||||
CComPtr< IPluginSite > pPlugin;
|
||||
m_pSite->get_PluginSite( &pPlugin );
|
||||
|
||||
pPlugin->LoadBitmapPortal( 0x0600127A, &m_pActive );
|
||||
|
||||
m_pSite->put_Transparent( VARIANT_FALSE );
|
||||
}
|
||||
|
||||
void cChoicePopup::onDestroy()
|
||||
{
|
||||
m_pActive.Release();
|
||||
}
|
||||
|
||||
#define RENDER_LEFTSTRETCH 10
|
||||
#define RENDER_RIGHTSTRETCH 7
|
||||
|
||||
STDMETHODIMP cChoicePopup::Render(ICanvas *pCanvas)
|
||||
{
|
||||
int nHighlight = ( m_pChoice->m_nHotSelect == -1 ) ? m_pChoice->m_nSelected : m_pChoice->m_nHotSelect;
|
||||
|
||||
RECT rc;
|
||||
m_pSite->get_Position( &rc );
|
||||
|
||||
long nWidth = rc.right - rc.left;
|
||||
|
||||
SIZE szImage;
|
||||
m_pActive->get_Size( &szImage );
|
||||
|
||||
long nRightStretch = szImage.cx - RENDER_RIGHTSTRETCH;
|
||||
|
||||
for( cChoice::cOptionList::iterator i = m_pChoice->m_options.begin(); i != m_pChoice->m_options.end(); ++ i )
|
||||
{
|
||||
int nRow = i - m_pChoice->m_options.begin();
|
||||
bool bHighlight = ( nRow == nHighlight );
|
||||
POINT ptDest = { 0, nRow * ROW_HEIGHT };
|
||||
|
||||
// Draw the background image
|
||||
( ( bHighlight ) ? m_pActive : m_pChoice->m_pInactive )->StretchBlt( pCanvas, &ptDest, nWidth, RENDER_LEFTSTRETCH, nRightStretch );
|
||||
|
||||
// Draw the text
|
||||
POINT ptText = { 12, nRow * ROW_HEIGHT + 2 };
|
||||
m_pChoice->m_pFont->DrawTextEx( &ptText, i->m_strText, 0, 0, eAA, pCanvas );
|
||||
}
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP cChoicePopup::MouseUp(MouseState *pMS)
|
||||
{
|
||||
// Set the selection
|
||||
m_bMouseDown = false;
|
||||
hotSelect( pMS );
|
||||
|
||||
if( m_pChoice->m_nHotSelect != -1 )
|
||||
m_pChoice->put_Selected( m_pChoice->m_nHotSelect );
|
||||
|
||||
m_pChoice->m_pSite->Invalidate();
|
||||
|
||||
// Hide the popup
|
||||
m_pChoice->setPopup( false );
|
||||
m_pChoice->m_pPopup->put_Popup( VARIANT_FALSE );
|
||||
|
||||
// Clear the selection
|
||||
m_pSite->Invalidate();
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
87
Native/DecalControls/ChoicePopup.h
Normal file
87
Native/DecalControls/ChoicePopup.h
Normal file
|
|
@ -0,0 +1,87 @@
|
|||
// ChoicePopup.h : Declaration of the cChoicePopup
|
||||
|
||||
#ifndef __CHOICEPOPUP_H_
|
||||
#define __CHOICEPOPUP_H_
|
||||
|
||||
#include "resource.h" // main symbols
|
||||
|
||||
#include "SinkImpl.h"
|
||||
|
||||
class cChoice;
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// cChoicePopup
|
||||
class ATL_NO_VTABLE cChoicePopup :
|
||||
public CComObjectRootEx<CComMultiThreadModel>,
|
||||
public ILayerImpl< cChoicePopup >,
|
||||
public ILayerRenderImpl,
|
||||
public ILayerMouseImpl,
|
||||
public cNoEventsImpl,
|
||||
public IChoicePopup
|
||||
{
|
||||
public:
|
||||
cChoicePopup()
|
||||
: m_pChoice( NULL ),
|
||||
m_bMouseDown( false )
|
||||
{
|
||||
}
|
||||
|
||||
cChoice *m_pChoice;
|
||||
CComPtr< IImageCache > m_pActive;
|
||||
bool m_bMouseDown;
|
||||
|
||||
void onCreate();
|
||||
void onDestroy();
|
||||
|
||||
BEGIN_COM_MAP(cChoicePopup)
|
||||
COM_INTERFACE_ENTRY(ILayerRender)
|
||||
COM_INTERFACE_ENTRY(ILayerMouse)
|
||||
COM_INTERFACE_ENTRY(ILayer)
|
||||
COM_INTERFACE_ENTRY(IChoicePopup)
|
||||
END_COM_MAP()
|
||||
|
||||
void hotSelect( MouseState *pMS );
|
||||
|
||||
public:
|
||||
// IChoicePopup Methods
|
||||
|
||||
// ILayerRender Methods
|
||||
STDMETHOD(Render)(ICanvas *pCanvas);
|
||||
|
||||
// ILayerMouse Methods
|
||||
STDMETHOD(MouseDown)(MouseState *pMS)
|
||||
{
|
||||
m_bMouseDown = true;
|
||||
hotSelect( pMS );
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHOD(MouseEnter)(MouseState *pMS)
|
||||
{
|
||||
if( m_bMouseDown )
|
||||
hotSelect( pMS );
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHOD(MouseExit)(MouseState *pMS)
|
||||
{
|
||||
if( m_bMouseDown )
|
||||
hotSelect( pMS );
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHOD(MouseMove)(MouseState *pMS)
|
||||
{
|
||||
if( m_bMouseDown )
|
||||
hotSelect( pMS );
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHOD(MouseUp)(MouseState *pMS);
|
||||
};
|
||||
|
||||
#endif //__CHOICEPOPUP_H_
|
||||
37
Native/DecalControls/Client.cpp
Normal file
37
Native/DecalControls/Client.cpp
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
// Client.cpp : Implementation of cClient
|
||||
#include "stdafx.h"
|
||||
#include "DecalControls.h"
|
||||
#include "Client.h"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// cClient
|
||||
|
||||
STDMETHODIMP cClient::LayerCreate( ILayerSite *pSite )
|
||||
{
|
||||
m_pSite = pSite;
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP cClient::LayerDestroy()
|
||||
{
|
||||
m_pSite.Release();
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP cClient::SchemaLoad(IView *pView, IUnknown *pXMLSchema)
|
||||
{
|
||||
MSXML::IXMLDOMElementPtr pElement = pXMLSchema;
|
||||
|
||||
long nID = 1000;
|
||||
|
||||
// Create all child controls from schema and let them be
|
||||
// placed wherever they like
|
||||
MSXML::IXMLDOMElementPtr pChild;
|
||||
for( MSXML::IXMLDOMNodeListPtr pChildren = pElement->selectNodes( _T( "control" ) );
|
||||
( pChild = pChildren->nextNode() ).GetInterfacePtr() != NULL; )
|
||||
pView->LoadControl( m_pSite, nID ++, pChild );
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
50
Native/DecalControls/Client.h
Normal file
50
Native/DecalControls/Client.h
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
// Client.h : Declaration of the cClient
|
||||
|
||||
#ifndef __CLIENT_H_
|
||||
#define __CLIENT_H_
|
||||
|
||||
#include "resource.h" // main symbols
|
||||
|
||||
#include "SinkImpl.h"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// cClient
|
||||
class ATL_NO_VTABLE cClient :
|
||||
public CComObjectRootEx<CComMultiThreadModel>,
|
||||
public CComCoClass<cClient, &CLSID_Client>,
|
||||
public ILayerImpl,
|
||||
public ILayerSchema,
|
||||
public IClient
|
||||
{
|
||||
public:
|
||||
cClient()
|
||||
{
|
||||
}
|
||||
|
||||
CComPtr< ILayerSite > m_pSite;
|
||||
|
||||
// TODO: Add support for background image and possibly
|
||||
// scrolling
|
||||
|
||||
DECLARE_REGISTRY_RESOURCEID(IDR_CLIENT)
|
||||
|
||||
DECLARE_PROTECT_FINAL_CONSTRUCT()
|
||||
|
||||
BEGIN_COM_MAP(cClient)
|
||||
COM_INTERFACE_ENTRY(ILayerSchema)
|
||||
COM_INTERFACE_ENTRY(ILayer)
|
||||
COM_INTERFACE_ENTRY(IClient)
|
||||
END_COM_MAP()
|
||||
|
||||
public:
|
||||
// IClient Methods
|
||||
|
||||
// ILayer Methods
|
||||
STDMETHOD(LayerCreate)(ILayerSite *pSite);
|
||||
STDMETHOD(LayerDestroy)();
|
||||
|
||||
// ILayerSchema Methods
|
||||
STDMETHOD(SchemaLoad)(IView *pView, IUnknown *pXMLSchema);
|
||||
};
|
||||
|
||||
#endif //__CLIENT_H_
|
||||
25
Native/DecalControls/Client.rgs
Normal file
25
Native/DecalControls/Client.rgs
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
HKCR
|
||||
{
|
||||
DecalControls.Client.1 = s 'DecalControls Client'
|
||||
{
|
||||
CLSID = s '{CD6556CD-F8D9-4CB0-AB7C-7C33058294E4}'
|
||||
}
|
||||
DecalControls.Client = s 'DecalControls Client'
|
||||
{
|
||||
CLSID = s '{CD6556CD-F8D9-4CB0-AB7C-7C33058294E4}'
|
||||
CurVer = s 'DecalControls.Client.1'
|
||||
}
|
||||
NoRemove CLSID
|
||||
{
|
||||
ForceRemove {CD6556CD-F8D9-4CB0-AB7C-7C33058294E4} = s 'DecalControls Client'
|
||||
{
|
||||
ProgID = s 'DecalControls.Client.1'
|
||||
VersionIndependentProgID = s 'DecalControls.Client'
|
||||
InprocServer32 = s '%MODULE%'
|
||||
{
|
||||
val ThreadingModel = s 'Both'
|
||||
}
|
||||
'TypeLib' = s '{1C4B007A-04DD-4DF8-BA29-2CFBD0220B89}'
|
||||
}
|
||||
}
|
||||
}
|
||||
155
Native/DecalControls/ControlImpl.h
Normal file
155
Native/DecalControls/ControlImpl.h
Normal file
|
|
@ -0,0 +1,155 @@
|
|||
// ControlImpl.h
|
||||
// Default interface Implementations for controls
|
||||
|
||||
#ifndef __CONTROLIMPL_H
|
||||
#define __CONTROLIMPL_H
|
||||
|
||||
#include "..\Inject\SinkImpl.h"
|
||||
|
||||
template< class cImpl, class ILayoutItf, const IID *pDispIID, const GUID *pLib >
|
||||
class ATL_NO_VTABLE ILayoutImpl
|
||||
: public IControlImpl< cImpl, ILayoutItf, pDispIID, pLib >,
|
||||
public ILayerRenderImpl,
|
||||
public ILayerSchema
|
||||
{
|
||||
public:
|
||||
ILayoutImpl()
|
||||
// Initialize in the static range
|
||||
: m_nNextControlID( 1000 )
|
||||
{
|
||||
}
|
||||
|
||||
long m_nNextControlID;
|
||||
|
||||
// Override this function for custom schema fun
|
||||
void onSchemaLoad( IView *, MSXML::IXMLDOMElementPtr & )
|
||||
{
|
||||
}
|
||||
|
||||
long loadChildControl( IView *pView, const MSXML::IXMLDOMElementPtr &pChild )
|
||||
{
|
||||
_ASSERTE( pView != NULL );
|
||||
_ASSERTE( pChild.GetInterfacePtr() != NULL );
|
||||
|
||||
long nAssigned;
|
||||
pView->LoadControl( static_cast< cImpl * >( this )->m_pSite, ++ m_nNextControlID, pChild, &nAssigned );
|
||||
|
||||
return nAssigned;
|
||||
}
|
||||
|
||||
long dispenseID()
|
||||
{
|
||||
return ++ m_nNextControlID;
|
||||
}
|
||||
|
||||
CComPtr< IImageCache > m_pBackground;
|
||||
|
||||
// ILayout Methods
|
||||
STDMETHOD(get_Background)( IImageCacheDisp **ppVal )
|
||||
{
|
||||
_ASSERTE( ppVal != NULL );
|
||||
|
||||
if( m_pBackground.p == NULL )
|
||||
*ppVal = NULL;
|
||||
else
|
||||
m_pBackground->QueryInterface( ppVal );
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHOD(putref_Background)( IImageCacheDisp *pCache )
|
||||
{
|
||||
if( m_pBackground.p )
|
||||
m_pBackground.Release();
|
||||
|
||||
if( pCache != NULL )
|
||||
pCache->QueryInterface( &m_pBackground );
|
||||
|
||||
static_cast< cImpl * >( this )->m_pSite->Invalidate();
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
// ILayerRender Methods
|
||||
STDMETHOD(Render)( ICanvas *pCanvas )
|
||||
{
|
||||
if( m_pBackground.p == NULL )
|
||||
// No background means no drawing
|
||||
return S_OK;
|
||||
|
||||
// Tile the background into the clipping area
|
||||
ClipParams cp;
|
||||
pCanvas->GetClipParams( &cp );
|
||||
|
||||
RECT rc = { cp.org.x, cp.org.y, cp.org.x + ( cp.window.right - cp.window.left ),
|
||||
cp.org.y + ( cp.window.bottom - cp.window.top ) };
|
||||
|
||||
m_pBackground->PatBlt( pCanvas, &rc, &cp.org );
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
// ILayerSchema Methods
|
||||
STDMETHOD(SchemaLoad)(IView *pView, IUnknown *pXMLSchema )
|
||||
{
|
||||
MSXML::IXMLDOMElementPtr pElement = pXMLSchema;
|
||||
CComPtr< IPluginSite > pPluginSite;
|
||||
static_cast< cImpl * >( this )->m_pSite->get_PluginSite( &pPluginSite );
|
||||
|
||||
HRESULT hRes = pPluginSite->LoadImageSchema( pXMLSchema, &m_pBackground );
|
||||
_ASSERTE( SUCCEEDED( hRes ) );
|
||||
|
||||
static_cast< cImpl * >( this )->onSchemaLoad( pView, pElement );
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
};
|
||||
|
||||
template< UINT nID, class cImpl >
|
||||
class IScrollerEventsImpl
|
||||
: public IControlEventsImpl< nID, cImpl, &DIID_IScrollerEvents, &LIBID_DecalControls >
|
||||
{
|
||||
};
|
||||
|
||||
template< UINT nID, class cImpl >
|
||||
class IListEventsImpl
|
||||
: public IControlEventsImpl< nID, cImpl, &DIID_IListEvents, &LIBID_DecalControls >
|
||||
{
|
||||
};
|
||||
|
||||
template< UINT nID, class cImpl >
|
||||
class INotebookEventsImpl
|
||||
: public IControlEventsImpl< nID, cImpl, &DIID_INotebookEvents, &LIBID_DecalControls >
|
||||
{
|
||||
};
|
||||
|
||||
#define DISPID_BEGIN 10
|
||||
#define DISPID_END 11
|
||||
|
||||
template< UINT nID, class cImpl >
|
||||
class IEditEventsImpl
|
||||
: public IControlEventsImpl< nID, cImpl, &DIID_IEditEvents, &LIBID_DecalControls >
|
||||
{
|
||||
};
|
||||
|
||||
#define DISPID_DROPDOWN 12
|
||||
|
||||
template< UINT nID, class cImpl >
|
||||
class IChoiceEventsImpl
|
||||
: public IControlEventsImpl< nID, cImpl, &DIID_IChoiceEvents, &LIBID_DecalControls >
|
||||
{
|
||||
};
|
||||
|
||||
template< UINT nID, class cImpl >
|
||||
class ICheckboxEventsImpl
|
||||
: public IControlEventsImpl< nID, cImpl, &DIID_ICheckboxEvents, &LIBID_DecalControls >
|
||||
{
|
||||
};
|
||||
|
||||
template< UINT nID, class cImpl >
|
||||
class ISliderEventsImpl
|
||||
: public IControlEventsImpl< nID, cImpl, &DIID_ISliderEvents, &LIBID_DecalControls >
|
||||
{
|
||||
};
|
||||
|
||||
#endif
|
||||
14
Native/DecalControls/DecalControls.clw
Normal file
14
Native/DecalControls/DecalControls.clw
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
; CLW file contains information for the MFC ClassWizard
|
||||
|
||||
[General Info]
|
||||
Version=1
|
||||
LastClass=
|
||||
LastTemplate=CDialog
|
||||
NewFileInclude1=#include "stdafx.h"
|
||||
NewFileInclude2=#include "decalcontrols.h"
|
||||
LastPage=0
|
||||
|
||||
ClassCount=0
|
||||
|
||||
ResourceCount=0
|
||||
|
||||
105
Native/DecalControls/DecalControls.cpp
Normal file
105
Native/DecalControls/DecalControls.cpp
Normal file
|
|
@ -0,0 +1,105 @@
|
|||
// DecalControls.cpp : Implementation of DLL Exports.
|
||||
|
||||
|
||||
// Note: Proxy/Stub Information
|
||||
// To build a separate proxy/stub DLL,
|
||||
// run nmake -f DecalControlsps.mk in the project directory.
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "resource.h"
|
||||
#include <initguid.h>
|
||||
#include "DecalControls.h"
|
||||
|
||||
#include "Scroller.h"
|
||||
#include "List.h"
|
||||
|
||||
#include "TextColumn.h"
|
||||
#include "IconColumn.h"
|
||||
#include "CheckColumn.h"
|
||||
#include "Notebook.h"
|
||||
|
||||
#include "DecalControls_i.c"
|
||||
#include "Edit.h"
|
||||
#include "Choice.h"
|
||||
#include "FixedLayout.h"
|
||||
#include "BorderLayout.h"
|
||||
#include "PageLayout.h"
|
||||
#include "PushButton.h"
|
||||
#include "Static.h"
|
||||
#include "Checkbox.h"
|
||||
#include "DerethMap.h"
|
||||
#include "Slider.h"
|
||||
#include "Progress.h"
|
||||
|
||||
CComModule _Module;
|
||||
|
||||
BEGIN_OBJECT_MAP(ObjectMap)
|
||||
OBJECT_ENTRY(CLSID_Scroller, cScroller)
|
||||
OBJECT_ENTRY(CLSID_List, cList)
|
||||
OBJECT_ENTRY(CLSID_TextColumn, cTextColumn)
|
||||
OBJECT_ENTRY(CLSID_IconColumn, cIconColumn)
|
||||
OBJECT_ENTRY(CLSID_CheckColumn, cCheckColumn)
|
||||
OBJECT_ENTRY(CLSID_Notebook, cNotebook)
|
||||
OBJECT_ENTRY(CLSID_Edit, cEdit)
|
||||
OBJECT_ENTRY(CLSID_Choice, cChoice)
|
||||
OBJECT_ENTRY(CLSID_FixedLayout, cFixedLayout)
|
||||
OBJECT_ENTRY(CLSID_BorderLayout, cBorderLayout)
|
||||
OBJECT_ENTRY(CLSID_PageLayout, cPageLayout)
|
||||
OBJECT_ENTRY(CLSID_PushButton, cPushButton)
|
||||
OBJECT_ENTRY(CLSID_StaticText, cStatic)
|
||||
OBJECT_ENTRY(CLSID_Checkbox, cCheckbox)
|
||||
OBJECT_ENTRY(CLSID_DerethMap, cDerethMap)
|
||||
OBJECT_ENTRY(CLSID_Slider, cSlider)
|
||||
OBJECT_ENTRY(CLSID_Progress, cProgress)
|
||||
END_OBJECT_MAP()
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// DLL Entry Point
|
||||
|
||||
extern "C"
|
||||
BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID /*lpReserved*/)
|
||||
{
|
||||
if (dwReason == DLL_PROCESS_ATTACH)
|
||||
{
|
||||
_Module.Init(ObjectMap, hInstance, &LIBID_DecalControls);
|
||||
DisableThreadLibraryCalls(hInstance);
|
||||
}
|
||||
else if (dwReason == DLL_PROCESS_DETACH)
|
||||
_Module.Term();
|
||||
return TRUE; // ok
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Used to determine whether the DLL can be unloaded by OLE
|
||||
|
||||
STDAPI DllCanUnloadNow(void)
|
||||
{
|
||||
return (_Module.GetLockCount()==0) ? S_OK : S_FALSE;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Returns a class factory to create an object of the requested type
|
||||
|
||||
STDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID* ppv)
|
||||
{
|
||||
return _Module.GetClassObject(rclsid, riid, ppv);
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// DllRegisterServer - Adds entries to the system registry
|
||||
|
||||
STDAPI DllRegisterServer(void)
|
||||
{
|
||||
// registers object, typelib and all interfaces in typelib
|
||||
return _Module.RegisterServer(TRUE);
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// DllUnregisterServer - Removes entries from the system registry
|
||||
|
||||
STDAPI DllUnregisterServer(void)
|
||||
{
|
||||
return _Module.UnregisterServer(TRUE);
|
||||
}
|
||||
|
||||
|
||||
9
Native/DecalControls/DecalControls.def
Normal file
9
Native/DecalControls/DecalControls.def
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
; DecalControls.def : Declares the module parameters.
|
||||
|
||||
LIBRARY "DecalControls.DLL"
|
||||
|
||||
EXPORTS
|
||||
DllCanUnloadNow PRIVATE
|
||||
DllGetClassObject PRIVATE
|
||||
DllRegisterServer PRIVATE
|
||||
DllUnregisterServer PRIVATE
|
||||
402
Native/DecalControls/DecalControls.dsp
Normal file
402
Native/DecalControls/DecalControls.dsp
Normal file
|
|
@ -0,0 +1,402 @@
|
|||
# Microsoft Developer Studio Project File - Name="DecalControls" - Package Owner=<4>
|
||||
# Microsoft Developer Studio Generated Build File, Format Version 6.00
|
||||
# ** DO NOT EDIT **
|
||||
|
||||
# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
|
||||
|
||||
CFG=DecalControls - Win32 Debug
|
||||
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
|
||||
!MESSAGE use the Export Makefile command and run
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "DecalControls.mak".
|
||||
!MESSAGE
|
||||
!MESSAGE You can specify a configuration when running NMAKE
|
||||
!MESSAGE by defining the macro CFG on the command line. For example:
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "DecalControls.mak" CFG="DecalControls - Win32 Debug"
|
||||
!MESSAGE
|
||||
!MESSAGE Possible choices for configuration are:
|
||||
!MESSAGE
|
||||
!MESSAGE "DecalControls - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
|
||||
!MESSAGE "DecalControls - Win32 Release MinDependency" (based on "Win32 (x86) Dynamic-Link Library")
|
||||
!MESSAGE
|
||||
|
||||
# Begin Project
|
||||
# PROP AllowPerConfigDependencies 0
|
||||
# PROP Scc_ProjName ""
|
||||
# PROP Scc_LocalPath ""
|
||||
CPP=cl.exe
|
||||
MTL=midl.exe
|
||||
RSC=rc.exe
|
||||
|
||||
!IF "$(CFG)" == "DecalControls - Win32 Debug"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 1
|
||||
# PROP BASE Output_Dir "Debug"
|
||||
# PROP BASE Intermediate_Dir "Debug"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 1
|
||||
# PROP Output_Dir "..\Debug"
|
||||
# PROP Intermediate_Dir "Debug"
|
||||
# PROP Ignore_Export_Lib 1
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /MTd /W3 /Gm /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /Yu"stdafx.h" /FD /GZ /c
|
||||
# ADD CPP /nologo /MDd /W3 /Gm /Gi /GX /ZI /Od /I "..\Inject" /I "..\Include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /Yu"stdafx.h" /FD /GZ /c
|
||||
# ADD MTL /nologo /I "..\Include" /Oicf
|
||||
# ADD BASE RSC /l 0x1009 /d "_DEBUG"
|
||||
# ADD RSC /l 0x1009 /d "_DEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386 /pdbtype:sept
|
||||
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386
|
||||
# Begin Custom Build - Performing registration
|
||||
OutDir=.\..\Debug
|
||||
TargetPath=\Decal\source\Debug\DecalControls.dll
|
||||
InputPath=\Decal\source\Debug\DecalControls.dll
|
||||
SOURCE="$(InputPath)"
|
||||
|
||||
"$(OutDir)\regsvr32.trg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
|
||||
regsvr32 /s /c "$(TargetPath)"
|
||||
echo regsvr32 exec. time > "$(OutDir)\regsvr32.trg"
|
||||
|
||||
# End Custom Build
|
||||
|
||||
!ELSEIF "$(CFG)" == "DecalControls - Win32 Release MinDependency"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 0
|
||||
# PROP BASE Output_Dir "ReleaseMinDependency"
|
||||
# PROP BASE Intermediate_Dir "ReleaseMinDependency"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 0
|
||||
# PROP Output_Dir "..\Release"
|
||||
# PROP Intermediate_Dir "ReleaseMinDependency"
|
||||
# PROP Ignore_Export_Lib 1
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /MT /W3 /O1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "_ATL_STATIC_REGISTRY" /D "_ATL_MIN_CRT" /Yu"stdafx.h" /FD /c
|
||||
# ADD CPP /nologo /MD /W3 /GX /Zi /Oa /Og /Oi /Os /Oy /Ob1 /Gf /Gy /I "..\Inject" /I "..\Include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /Yu"stdafx.h" /FD /c
|
||||
# ADD MTL /nologo /I "..\Include" /Oicf
|
||||
# ADD BASE RSC /l 0x1009 /d "NDEBUG"
|
||||
# ADD RSC /l 0x1009 /d "NDEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386
|
||||
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386 /pdbtype:sept /libpath:"..\Release"
|
||||
# Begin Custom Build - Performing registration
|
||||
OutDir=.\..\Release
|
||||
TargetPath=\Decal\source\Release\DecalControls.dll
|
||||
InputPath=\Decal\source\Release\DecalControls.dll
|
||||
SOURCE="$(InputPath)"
|
||||
|
||||
"$(OutDir)\regsvr32.trg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
|
||||
regsvr32 /s /c "$(TargetPath)"
|
||||
echo regsvr32 exec. time > "$(OutDir)\regsvr32.trg"
|
||||
|
||||
# End Custom Build
|
||||
|
||||
!ENDIF
|
||||
|
||||
# Begin Target
|
||||
|
||||
# Name "DecalControls - Win32 Debug"
|
||||
# Name "DecalControls - Win32 Release MinDependency"
|
||||
# Begin Group "Source Files"
|
||||
|
||||
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\BorderLayout.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\Checkbox.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\CheckColumn.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\Choice.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\ChoiceDropDown.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\ChoicePopup.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\DecalControls.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\DecalControls.def
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\DecalControls.idl
|
||||
# ADD MTL /tlb ".\DecalControls.tlb" /h "DecalControls.h" /iid "DecalControls_i.c" /Oicf
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\DecalControls.rc
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\DerethMap.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\Edit.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\FixedLayout.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\IconColumn.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\Inject\Inject_i.c
|
||||
# SUBTRACT CPP /YX /Yc /Yu
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\List.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\ListView.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\Notebook.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\PageLayout.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\Progress.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\PushButton.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\Scroller.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\Slider.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\Static.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\StdAfx.cpp
|
||||
# ADD CPP /Yc"stdafx.h"
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\TextColumn.cpp
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "Header Files"
|
||||
|
||||
# PROP Default_Filter "h;hpp;hxx;hm;inl"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\BorderLayout.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\Checkbox.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\CheckColumn.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\Choice.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\ChoiceDropDown.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\ChoicePopup.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\ControlImpl.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\DecalControlsCP.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\DerethMap.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\Edit.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\FixedLayout.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\IconColumn.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\List.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\ListView.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\Notebook.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\PageLayout.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\Progress.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\PushButton.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\Resource.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\Scroller.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\Slider.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\Static.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\StdAfx.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\TextColumn.h
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "Resource Files"
|
||||
|
||||
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\BorderLayout.rgs
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\Checkbox.rgs
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\CheckColumn.rgs
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\Choice.rgs
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\ChoiceDropDown.rgs
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\Client.rgs
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\DerethMap.rgs
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\Edit.rgs
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\FixedLayout.rgs
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\IconColumn.rgs
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\List.rgs
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\Notebook.rgs
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\PageLayout.rgs
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\Progress.rgs
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\PushButton.rgs
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\Scroller.rgs
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\Slider.rgs
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\Static.rgs
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\TextColumn.rgs
|
||||
# End Source File
|
||||
# End Group
|
||||
# End Target
|
||||
# End Project
|
||||
663
Native/DecalControls/DecalControls.idl
Normal file
663
Native/DecalControls/DecalControls.idl
Normal file
|
|
@ -0,0 +1,663 @@
|
|||
// DecalControls.idl : IDL source for DecalControls.dll
|
||||
//
|
||||
|
||||
// This file will be processed by the MIDL tool to
|
||||
// produce the type library (DecalControls.tlb) and marshalling code.
|
||||
|
||||
import "oaidl.idl";
|
||||
import "ocidl.idl";
|
||||
|
||||
import "..\Inject\Inject.idl";
|
||||
|
||||
interface IListColumn;
|
||||
|
||||
enum eBorderEdge
|
||||
{
|
||||
eEdgeLeft,
|
||||
eEdgeTop,
|
||||
eEdgeRight,
|
||||
eEdgeBottom
|
||||
};
|
||||
|
||||
[
|
||||
object,
|
||||
uuid(24CFCE12-88A0-437A-89E6-31982EA92899),
|
||||
helpstring("IScroller Interface"),
|
||||
pointer_default(unique)
|
||||
]
|
||||
interface IScroller : IControl
|
||||
{
|
||||
[propget, helpstring("property Viewport")] HRESULT Viewport([out, retval] LPSIZE pVal);
|
||||
[propget, helpstring("property Area")] HRESULT Area([out, retval] LPSIZE pVal);
|
||||
[propput, helpstring("property Area")] HRESULT Area([in] LPSIZE newVal);
|
||||
[propget, helpstring("property HorizontalEnabled")] HRESULT HorizontalEnabled([out, retval] VARIANT_BOOL *pVal);
|
||||
[propput, helpstring("property HorizontalEnabled")] HRESULT HorizontalEnabled([in] VARIANT_BOOL newVal);
|
||||
[propget, helpstring("property VerticalEnabled")] HRESULT VerticalEnabled([out, retval] VARIANT_BOOL *pVal);
|
||||
[propput, helpstring("property VerticalEnabled")] HRESULT VerticalEnabled([in] VARIANT_BOOL newVal);
|
||||
[helpstring("method CreateClient")] HRESULT CreateClient(ILayer *pChild);
|
||||
[propget, helpstring("property Offset")] HRESULT Offset([out, retval] LPPOINT pVal);
|
||||
[propput, helpstring("property Offset")] HRESULT Offset([in] LPPOINT newVal);
|
||||
[helpstring("method ScrollTo")] HRESULT ScrollTo(LPPOINT ptOffset);
|
||||
[propget, helpstring("property Increments")] HRESULT Increments([out, retval] LPSIZE pVal);
|
||||
[propput, helpstring("property Increments")] HRESULT Increments([in] LPSIZE newVal);
|
||||
[helpstring("method ResetScroller")] HRESULT ResetScroller();
|
||||
};
|
||||
|
||||
[
|
||||
uuid(DEE67370-16C9-4f81-80CC-1F1B61112299),
|
||||
helpstring("IScrollerEvents Interface")
|
||||
]
|
||||
dispinterface IScrollerEvents
|
||||
{
|
||||
properties:
|
||||
methods:
|
||||
[id(1), helpstring("This control is about to be destroyed, release any references to this object.")] void Destroy(long nID);
|
||||
[id(6), helpstring("method ScrollChange")] HRESULT Change(long nID, long nX, long nY);
|
||||
};
|
||||
|
||||
[
|
||||
object,
|
||||
uuid(A54D70F6-8CFE-4259-9F16-AF0111541278),
|
||||
dual,
|
||||
helpstring("IList Interface"),
|
||||
pointer_default(unique)
|
||||
]
|
||||
interface IListDisp : IControl
|
||||
{
|
||||
[id(101), helpstring("method AddRow")] HRESULT AddRow([out, retval] long *pnNewIndex);
|
||||
[id(102), helpstring("method DeleteRow")] HRESULT DeleteRow(long nIndex);
|
||||
[id(103), propget, helpstring("property Data")] HRESULT Data(long nX, long nY, [defaultvalue(0)] long nSubValue, [out, retval] VARIANT* pVal);
|
||||
[id(103), propput, helpstring("property Data")] HRESULT Data(long nX, long nY, [defaultvalue(0)] long nSubValue, [in] VARIANT* newVal);
|
||||
[id(104), propput, helpstring("property RowEstimate")] HRESULT RowEstimate([in] long newVal);
|
||||
[propget, id(105), helpstring("property Count")] HRESULT Count([out, retval] long *pVal);
|
||||
[id(106), helpstring("method Clear")] HRESULT Clear();
|
||||
[id(107), helpstring("method InsertRow")] HRESULT InsertRow(long lIndex);
|
||||
[id(108), propget, helpstring("method GetColumnWidth")] HRESULT ColumnWidth(long nColumn, [out, retval] long *nWidth);
|
||||
[id(108), propput, helpstring("method SetColumnWidth")] HRESULT ColumnWidth(long nColumn, long nWidth);
|
||||
[propget, id(109), helpstring("property Color")] HRESULT Color(long nX, long nY, [out, retval] long *pVal);
|
||||
[propput, id(109), helpstring("property Color")] HRESULT Color(long nX, long nY, [in] long newVal);
|
||||
[propget, id(110), helpstring("property AutoScroll")] HRESULT AutoScroll([out, retval] VARIANT_BOOL *pVal);
|
||||
[propput, id(110), helpstring("property AutoScroll")] HRESULT AutoScroll([in] VARIANT_BOOL newVal);
|
||||
[propget, id(111), helpstring("property ScrollPosition")] HRESULT ScrollPosition([out, retval] long *pVal);
|
||||
[propput, id(111), helpstring("property ScrollPosition")] HRESULT ScrollPosition([in] long newVal);
|
||||
[id(112), helpstring("method JumpToPosition")] HRESULT JumpToPosition(long newVal);
|
||||
[propget, id(113), helpstring("property CountCols")] HRESULT CountCols([out, retval] long *pVal);
|
||||
};
|
||||
|
||||
[
|
||||
object,
|
||||
uuid(D648F00A-FE27-4E88-895B-72F58AF50C0C),
|
||||
helpstring("IList Interface"),
|
||||
pointer_default(unique)
|
||||
]
|
||||
interface IList : IListDisp
|
||||
{
|
||||
[helpstring("method AddColumn")] HRESULT AddColumn(IListColumn *pNewColumn, [out, retval] long *nIndex);
|
||||
[propget, helpstring("property CellRect")] HRESULT CellRect(LPPOINT pt, [out, retval] LPRECT pVal);
|
||||
};
|
||||
|
||||
[
|
||||
uuid(88456660-8132-433b-A4CD-E252BDF147C5),
|
||||
helpstring("IListEvents Interface")
|
||||
]
|
||||
dispinterface IListEvents
|
||||
{
|
||||
properties:
|
||||
methods:
|
||||
[id(1), helpstring("This control is about to be destroyed, release any references to this object.")] void Destroy(long nID);
|
||||
[id(6), helpstring("method ListDataChange")] void Change(long nID, long nX, long nY);
|
||||
};
|
||||
|
||||
[
|
||||
object,
|
||||
uuid(E28573F0-36FC-4D64-B8E1-60A2D475A2A8),
|
||||
helpstring("IListColumn Interface"),
|
||||
pointer_default(unique)
|
||||
]
|
||||
interface IListColumn : IUnknown
|
||||
{
|
||||
[propget, helpstring("property FixedWidth")] HRESULT FixedWidth([out, retval] VARIANT_BOOL *pVal);
|
||||
[propget, helpstring("property Width")] HRESULT Width([out, retval] long *pVal);
|
||||
[helpstring("method Render")] HRESULT Render(ICanvas *, LPPOINT ptCell, long nColor);
|
||||
[propget, helpstring("property DataColumns")] HRESULT DataColumns([out, retval] long *pVal);
|
||||
[helpstring("property List")] HRESULT Initialize([in] IList * newVal, [in] IPluginSite *pSite);
|
||||
[helpstring("method SchemaLoad")] HRESULT SchemaLoad(IUnknown *pSchema);
|
||||
[propget, helpstring("property Height")] HRESULT Height([out, retval] long *pVal);
|
||||
[helpstring("method Activate")] HRESULT Activate(LPPOINT ptCell);
|
||||
[propput, helpstring("property Width")] HRESULT Width(long newVal);
|
||||
};
|
||||
|
||||
[
|
||||
object,
|
||||
uuid(1A11BEA0-A0ED-41C1-9057-46084DE9AEDC),
|
||||
helpstring("IListView Interface"),
|
||||
pointer_default(unique)
|
||||
]
|
||||
interface IListView : IUnknown
|
||||
{
|
||||
[propput, helpstring("property Area")] HRESULT Area([in] LPSIZE newVal);
|
||||
[helpstring("method SetCacheInfo")] HRESULT SetCacheInfo(long nRowHeight, long nRowsToCache);
|
||||
[helpstring("method InvalidateFrom")] HRESULT InvalidateFrom(long nRow);
|
||||
[propget, helpstring("property Color")] HRESULT Color(long nCol, long nRow, [out, retval] long *pVal);
|
||||
[propput, helpstring("property Color")] HRESULT Color(long nCol, long nRow, [in] long newVal);
|
||||
};
|
||||
|
||||
[
|
||||
object,
|
||||
uuid(78B62B0F-B3A4-47FF-A9A4-C68CA3FA80B6),
|
||||
dual,
|
||||
helpstring("INotebook Interface"),
|
||||
pointer_default(unique)
|
||||
]
|
||||
interface INotebook : IControl
|
||||
{
|
||||
[id(101), helpstring("method AddPage")] HRESULT AddPage(BSTR strText, IControl *pClient);
|
||||
[id(102), propget, helpstring("property ActiveTab")] HRESULT ActiveTab([out, retval] long *pVal);
|
||||
[id(102), propput, helpstring("property ActiveTab")] HRESULT ActiveTab([in] long newVal);
|
||||
[id(103), propget, helpstring("property PageText")] HRESULT PageText(long nIndex, [out, retval] BSTR *pVal);
|
||||
[id(103), propput, helpstring("property PageText")] HRESULT PageText(long nIndex, [in] BSTR newVal);
|
||||
};
|
||||
|
||||
[
|
||||
uuid(C964E99A-7C1C-46e9-AEA6-09FF5D1BFDD0),
|
||||
helpstring("INotebookEvents Interface")
|
||||
]
|
||||
dispinterface INotebookEvents
|
||||
{
|
||||
properties:
|
||||
methods:
|
||||
[id(1), helpstring("This control is about to be destroyed, release any references to this object.")] void Destroy(long nID);
|
||||
[id(6), helpstring("method NotebookPageChange")] HRESULT Change(long nID, long nNewPage);
|
||||
};
|
||||
|
||||
[
|
||||
object,
|
||||
uuid(D7EA9129-E36A-4317-BF24-76DA5967DA75),
|
||||
dual,
|
||||
helpstring("IEdit Interface"),
|
||||
pointer_default(unique)
|
||||
]
|
||||
interface IEdit : IControl
|
||||
{
|
||||
[id(101), propget, helpstring("property Text")] HRESULT Text([out, retval] BSTR *pVal);
|
||||
[id(101), propput, helpstring("property Text")] HRESULT Text([in] BSTR newVal);
|
||||
[id(102), propget, helpstring("property Caret")] HRESULT Caret([out, retval] long *pVal);
|
||||
[id(102), propput, helpstring("property Caret")] HRESULT Caret([in] long newVal);
|
||||
[id(103), helpstring("method Select")] HRESULT Select(long nStart, long nEnd);
|
||||
[id(104), propget, helpstring("property SelectedText")] HRESULT SelectedText([out, retval] BSTR *pVal);
|
||||
[id(104), propput, helpstring("property SelectedText")] HRESULT SelectedText([in] BSTR newVal);
|
||||
[id(105), propget, helpstring("property Background")] HRESULT Background([out, retval] IImageCacheDisp * *pVal);
|
||||
[id(105), propputref, helpstring("property Background")] HRESULT Background([in] IImageCacheDisp * newVal);
|
||||
[id(106), propget, helpstring("property Font")] HRESULT Font([out, retval] IFontCacheDisp * *pVal);
|
||||
[id(106), propputref, helpstring("property Font")] HRESULT Font([in] IFontCacheDisp * newVal);
|
||||
[id(107), propget, helpstring("property TextColor")] HRESULT TextColor([out, retval] long *pVal);
|
||||
[id(107), propput, helpstring("property TextColor")] HRESULT TextColor([in] long newVal);
|
||||
[id(108), helpstring("property Margins")] HRESULT SetMargins(long nX, long nY);
|
||||
[id(109), helpstring("method Capture")] HRESULT Capture();
|
||||
};
|
||||
|
||||
[
|
||||
uuid(4A3E384D-39A5-4bc2-A548-66634C8FACCE),
|
||||
helpstring("IEditEvents Interface")
|
||||
]
|
||||
dispinterface IEditEvents
|
||||
{
|
||||
properties:
|
||||
methods:
|
||||
[id(1), helpstring("This control is about to be destroyed, release any references to this object")] void Destroy(long nID);
|
||||
[id(10), helpstring("method EditBegin")] void Begin(long nID);
|
||||
[id(6), helpstring("method EditChange")] void Change(long nID, BSTR strText);
|
||||
[id(11), helpstring("method EditEnd")] void End(long nID, VARIANT_BOOL bSuccess);
|
||||
};
|
||||
|
||||
[
|
||||
object,
|
||||
uuid(6450E486-03E6-493c-9D3B-9B36A5F50E65),
|
||||
dual,
|
||||
helpstring("Base interface for layout classes"),
|
||||
pointer_default(unique)
|
||||
]
|
||||
interface ILayout : IControl
|
||||
{
|
||||
[id(101), propget, helpstring("property Background")] HRESULT Background([out, retval] IImageCacheDisp * *pVal);
|
||||
[id(101), propputref, helpstring("property Background")] HRESULT Background([in] IImageCacheDisp * newVal);
|
||||
};
|
||||
|
||||
[
|
||||
object,
|
||||
uuid(58CBF550-DFBE-433C-88EC-3FED4A5E09F1),
|
||||
helpstring("IClient Interface"),
|
||||
pointer_default(unique)
|
||||
]
|
||||
interface IFixedLayout : ILayout
|
||||
{
|
||||
[helpstring("method CreateChild")] HRESULT CreateChild(struct LayerParams *params, ILayer *pSink);
|
||||
[helpstring("method PositionChild")] HRESULT PositionChild(long nID, LPRECT prcNew);
|
||||
};
|
||||
|
||||
[
|
||||
object,
|
||||
uuid(BD2B37B8-80DE-4F50-ACF8-ED2525B27336),
|
||||
dual,
|
||||
helpstring("IChoice Interface"),
|
||||
pointer_default(unique)
|
||||
]
|
||||
interface IChoice : IControl
|
||||
{
|
||||
[id(101), helpstring("method AddChoice")] HRESULT AddChoice(BSTR strDisplay, [optional] VARIANT vData);
|
||||
[id(102), propget, helpstring("property ChoiceCount")] HRESULT ChoiceCount([out, retval] long *pVal);
|
||||
[id(103), propget, helpstring("property Data")] HRESULT Data(long nIndex, [out, retval] VARIANT *pVal);
|
||||
[id(103), propput, helpstring("property Data")] HRESULT Data(long nIndex, [in] VARIANT newVal);
|
||||
[id(104), propget, helpstring("property Text")] HRESULT Text(long nIndex, [out, retval] BSTR *pVal);
|
||||
[id(104), propput, helpstring("property Text")] HRESULT Text(long nIndex, [in] BSTR newVal);
|
||||
[id(105), helpstring("method RemoveChoice")] HRESULT RemoveChoice(long nIndex);
|
||||
[id(106), propget, helpstring("property Dropped")] HRESULT Dropped([out, retval] VARIANT_BOOL *pVal);
|
||||
[id(106), propput, helpstring("property Dropped")] HRESULT Dropped([in] VARIANT_BOOL newVal);
|
||||
[id(107), propget, helpstring("property Selected")] HRESULT Selected([out, retval] long *pVal);
|
||||
[id(107), propput, helpstring("property Selected")] HRESULT Selected([in] long newVal);
|
||||
[id(108), propget, helpstring("property DropLines")] HRESULT DropLines([out, retval] long *pVal);
|
||||
[id(108), propput, helpstring("property DropLines")] HRESULT DropLines([in] long newVal);
|
||||
[id(109), helpstring("method Clear")] HRESULT Clear();
|
||||
};
|
||||
|
||||
[
|
||||
uuid(763E36A3-389C-42eb-A5F3-C208D028F9AB),
|
||||
helpstring("IChoiceEvents Interface")
|
||||
]
|
||||
dispinterface IChoiceEvents
|
||||
{
|
||||
properties:
|
||||
methods:
|
||||
[id(1), helpstring("This control is about to be destroyed, release any references to this object")] void Destroy(long nID);
|
||||
[id(6), helpstring("Sent when the user changes the selection")] void Change(long nID, long nIndex);
|
||||
[id(12), helpstring("Sent before drop down - you can add items at this point")] void DropDown(long nID);
|
||||
};
|
||||
|
||||
[
|
||||
object,
|
||||
uuid(B40F3CEA-5DAD-413A-B779-D6FCB0663B7D),
|
||||
helpstring("IChoicePopup Interface"),
|
||||
pointer_default(unique)
|
||||
]
|
||||
interface IChoicePopup : IUnknown
|
||||
{
|
||||
};
|
||||
|
||||
[
|
||||
object,
|
||||
uuid(CF0438EB-8299-48E8-B766-9E9BDDA50203),
|
||||
helpstring("IBorderLayout Interface"),
|
||||
pointer_default(unique)
|
||||
]
|
||||
interface IBorderLayout : ILayout
|
||||
{
|
||||
[helpstring("method CreateEdge")] HRESULT CreateEdge(enum eBorderEdge eEdge, long nSize, ILayer *pSink);
|
||||
[helpstring("method CreateCenter")] HRESULT CreateCenter(ILayer *pSink);
|
||||
};
|
||||
|
||||
[
|
||||
object,
|
||||
uuid(1E39FB9E-2C07-4287-B2D7-58EE0BFC9BBB),
|
||||
dual,
|
||||
helpstring("IPageLayout Interface"),
|
||||
pointer_default(unique)
|
||||
]
|
||||
interface IPageLayoutDisp : ILayout
|
||||
{
|
||||
[id(201), propget, helpstring("property Active")] HRESULT Active([out, retval] long *pVal);
|
||||
[id(201), propput, helpstring("property Active")] HRESULT Active([in] long newVal);
|
||||
[id(202), propget, helpstring("property Count")] HRESULT Count([out, retval] long *pVal);
|
||||
};
|
||||
|
||||
[
|
||||
object,
|
||||
uuid(2DF39739-2EFC-4F67-B3AC-712D774B57A9),
|
||||
helpstring("IPageLayout Interface"),
|
||||
pointer_default(unique)
|
||||
]
|
||||
interface IPageLayout : IPageLayoutDisp
|
||||
{
|
||||
[helpstring("method CreatePage")] HRESULT CreatePage(ILayer *pChild);
|
||||
};
|
||||
|
||||
[
|
||||
object,
|
||||
uuid(AAAB9EEA-06E8-4F0A-A926-3A9AB45939FF),
|
||||
dual,
|
||||
helpstring("IPushButton Interface"),
|
||||
pointer_default(unique)
|
||||
]
|
||||
interface IPushButton : IControl
|
||||
{
|
||||
[id(101), propget, helpstring("property Image")] HRESULT Image([out, retval] IImageCacheDisp * *pVal);
|
||||
[id(101), propputref, helpstring("property Image")] HRESULT Image([in] IImageCacheDisp * newVal);
|
||||
[id(102), propget, helpstring("property Font")] HRESULT Font([out, retval] IFontCacheDisp * *pVal);
|
||||
[id(102), propputref, helpstring("property Font")] HRESULT Font([in] IFontCacheDisp * newVal);
|
||||
[id(103), propget, helpstring("property Text")] HRESULT Text([out, retval] BSTR *pVal);
|
||||
[id(103), propput, helpstring("property Text")] HRESULT Text([in] BSTR newVal);
|
||||
[id(104), propget, helpstring("property FaceColor")] HRESULT FaceColor([out, retval] long *pVal);
|
||||
[id(104), propput, helpstring("property FaceColor")] HRESULT FaceColor([in] long newVal);
|
||||
[id(105), propget, helpstring("property TextColor")] HRESULT TextColor([out, retval] long *pVal);
|
||||
[id(105), propput, helpstring("property TextColor")] HRESULT TextColor([in] long newVal);
|
||||
};
|
||||
|
||||
[
|
||||
object,
|
||||
uuid(93C28CFF-DCF4-4B63-AB00-A89453940CFE),
|
||||
dual,
|
||||
helpstring("IStatic Interface"),
|
||||
pointer_default(unique)
|
||||
]
|
||||
interface IStatic : IControl
|
||||
{
|
||||
[id(101), propget, helpstring("property Font")] HRESULT Font([out, retval] IFontCacheDisp * *pVal);
|
||||
[id(101), propputref, helpstring("property Font")] HRESULT Font([in] IFontCacheDisp * newVal);
|
||||
[id(102), propget, helpstring("property Text")] HRESULT Text([out, retval] BSTR *pVal);
|
||||
[id(102), propput, helpstring("property Text")] HRESULT Text([in] BSTR newVal);
|
||||
[id(103), propget, helpstring("property TextColor")] HRESULT TextColor([out, retval] long *pVal);
|
||||
[id(103), propput, helpstring("property TextColor")] HRESULT TextColor([in] long newVal);
|
||||
};
|
||||
|
||||
[
|
||||
object,
|
||||
uuid(63D0BB56-1552-4F8C-99CC-52006DD47E9E),
|
||||
dual,
|
||||
helpstring("ICheckbox Interface"),
|
||||
pointer_default(unique)
|
||||
]
|
||||
interface ICheckbox : IControl
|
||||
{
|
||||
[id(101), propget, helpstring("property Font")] HRESULT Font([out, retval] IFontCacheDisp * *pVal);
|
||||
[id(101), propputref, helpstring("property Font")] HRESULT Font([in] IFontCacheDisp * newVal);
|
||||
[id(102), propget, helpstring("property Text")] HRESULT Text([out, retval] BSTR *pVal);
|
||||
[id(102), propput, helpstring("property Text")] HRESULT Text([in] BSTR newVal);
|
||||
[id(103), propget, helpstring("property TextColor")] HRESULT TextColor([out, retval] long *pVal);
|
||||
[id(103), propput, helpstring("property TextColor")] HRESULT TextColor([in] long newVal);
|
||||
[id(104), propget, helpstring("property Checked")] HRESULT Checked([out, retval] VARIANT_BOOL *pVal);
|
||||
[id(104), propput, helpstring("property Checked")] HRESULT Checked([in] VARIANT_BOOL newVal);
|
||||
[id(105), propget, helpstring("property RightToLeft")] HRESULT RightToLeft([out, retval] VARIANT_BOOL *pVal);
|
||||
[id(105), propput, helpstring("property RightToLeft")] HRESULT RightToLeft([in] VARIANT_BOOL newVal);
|
||||
};
|
||||
|
||||
[
|
||||
uuid(D56CB28A-9BAD-40b1-A011-70F466DC8F05),
|
||||
helpstring("ICheckboxEvents Interface")
|
||||
]
|
||||
dispinterface ICheckboxEvents
|
||||
{
|
||||
properties:
|
||||
methods:
|
||||
[id(1), helpstring("This control is about to be destroyed, release any references to this object")] void Destroy(long nID);
|
||||
[id(6), helpstring("method CheckboxToggle")] void Change(long nID, VARIANT_BOOL bChecked);
|
||||
};
|
||||
|
||||
[
|
||||
object,
|
||||
uuid(10D12549-8F59-4f06-83FB-D08FB76337F3),
|
||||
dual,
|
||||
helpstring("ISlider Interface"),
|
||||
pointer_default(unique)
|
||||
]
|
||||
interface ISlider : IControl
|
||||
{
|
||||
[id(101), propget, helpstring("property Font")] HRESULT Font([out, retval] IFontCacheDisp * *pVal);
|
||||
[id(101), propputref, helpstring("property Font")] HRESULT Font([in] IFontCacheDisp * newVal);
|
||||
[id(103), propget, helpstring("property TextColor")] HRESULT TextColor([out, retval] long *pVal);
|
||||
[id(103), propput, helpstring("property TextColor")] HRESULT TextColor([in] long newVal);
|
||||
[id(104), propget, helpstring("property SliderPosition")] HRESULT SliderPosition([out, retval] long *pVal);
|
||||
[id(104), propput, helpstring("property SliderPosition")] HRESULT SliderPosition([in] long newVal);
|
||||
[id(105), propget, helpstring("property Minimum")] HRESULT Minimum([out, retval] long *pVal);
|
||||
[id(105), propput, helpstring("property Minimum")] HRESULT Minimum([in] long newVal);
|
||||
[id(106), propget, helpstring("property Maximum")] HRESULT Maximum([out, retval] long *pVal);
|
||||
[id(106), propput, helpstring("property Maximum")] HRESULT Maximum([in] long newVal);
|
||||
};
|
||||
|
||||
[
|
||||
uuid(F881B44D-67FA-4770-B10A-05DA14409E8F),
|
||||
helpstring("ISliderEvents Interface")
|
||||
]
|
||||
dispinterface ISliderEvents
|
||||
{
|
||||
properties:
|
||||
methods:
|
||||
[id(1), helpstring("This control is about to be destroyed, release any references to this object")] void Destroy(long nID);
|
||||
[id(6), helpstring("method Change")] void Change(long nID, long lValue);
|
||||
};
|
||||
|
||||
[
|
||||
object,
|
||||
uuid(5BAD2CC0-6F03-4EA9-8D7E-1DFD9D134648),
|
||||
|
||||
helpstring("IChoiceDropDown Interface"),
|
||||
pointer_default(unique)
|
||||
]
|
||||
interface IChoiceDropDown : IUnknown
|
||||
{
|
||||
};
|
||||
|
||||
[
|
||||
object,
|
||||
uuid(D4FBCA22-45B4-4775-A181-1D4EEC3BFEA1),
|
||||
helpstring("IDerethMap Interface"),
|
||||
pointer_default(unique)
|
||||
]
|
||||
interface IDerethMap : IControl
|
||||
{
|
||||
};
|
||||
|
||||
[
|
||||
object,
|
||||
uuid(2EC89916-3E65-422B-977C-9277BA693E82),
|
||||
dual,
|
||||
helpstring("IProgress Interface"),
|
||||
pointer_default(unique)
|
||||
]
|
||||
interface IProgress : IControl
|
||||
{
|
||||
[propget, id(101), helpstring("property Value")] HRESULT Value([out, retval] long *pVal);
|
||||
[propput, id(101), helpstring("property Value")] HRESULT Value([in] long newVal);
|
||||
[propput, id(102), helpstring("property FaceColor")] HRESULT FaceColor([in] long newVal);
|
||||
[propput, id(103), helpstring("property FillColor")] HRESULT FillColor([in] long newVal);
|
||||
[propput, id(104), helpstring("property TextColor")] HRESULT TextColor([in] long newVal);
|
||||
[propput, id(105), helpstring("property MaxValue")] HRESULT MaxValue([in] long newVal);
|
||||
[propput, id(106), helpstring("property PostText")] HRESULT PostText([in] BSTR newVal);
|
||||
[propput, id(107), helpstring("property Alignment")] HRESULT Alignment([in] BSTR newVal);
|
||||
[propput, id(108), helpstring("property DrawText")] HRESULT DrawText([in] VARIANT_BOOL newVal);
|
||||
[propput, id(109), helpstring("property PreText")] HRESULT PreText([in] BSTR newVal);
|
||||
[propput, id(110), helpstring("property BorderWidth")] HRESULT BorderWidth([in] long newVal);
|
||||
[propput, id(111), helpstring("property BorderColor")] HRESULT BorderColor([in] long newVal);
|
||||
};
|
||||
|
||||
[
|
||||
uuid(1C4B007A-04DD-4DF8-BA29-2CFBD0220B89),
|
||||
version(1.0),
|
||||
helpstring("Decal Controls Type Library")
|
||||
]
|
||||
library DecalControls
|
||||
{
|
||||
importlib("stdole32.tlb");
|
||||
importlib("stdole2.tlb");
|
||||
|
||||
interface ILayout;
|
||||
interface IListView;
|
||||
interface IChoicePopup;
|
||||
|
||||
dispinterface IListEvents;
|
||||
dispinterface IChoiceEvents;
|
||||
dispinterface IScrollerEvents;
|
||||
dispinterface INotebookEvents;
|
||||
dispinterface IEditEvents;
|
||||
dispinterface IChoiceEvents;
|
||||
dispinterface ICheckboxEvents;
|
||||
dispinterface ISliderEvents;
|
||||
|
||||
interface IListDisp;
|
||||
interface IPageLayoutDisp;
|
||||
|
||||
[
|
||||
uuid(8FC80D21-1731-4816-9AD3-B0364D5F2C27),
|
||||
helpstring("Scroller Class")
|
||||
]
|
||||
coclass Scroller
|
||||
{
|
||||
[default] interface IControl;
|
||||
[default, source] interface IScrollerEvents;
|
||||
};
|
||||
|
||||
[
|
||||
uuid(3839008F-AF5B-43FC-9F6A-3376B99E3DAF),
|
||||
helpstring("List Class")
|
||||
]
|
||||
coclass List
|
||||
{
|
||||
[default] interface IListDisp;
|
||||
[default, source] interface IListEvents;
|
||||
};
|
||||
|
||||
[
|
||||
uuid(864DEABF-D079-4B61-A8CF-081418179239),
|
||||
helpstring("TextColumn Class")
|
||||
]
|
||||
coclass TextColumn
|
||||
{
|
||||
[default] interface IListColumn;
|
||||
};
|
||||
|
||||
[
|
||||
uuid(F12A2C4C-3B78-46EB-8722-68B27A75AE55),
|
||||
helpstring("IconColumn Class")
|
||||
]
|
||||
coclass IconColumn
|
||||
{
|
||||
[default] interface IListColumn;
|
||||
};
|
||||
|
||||
[
|
||||
uuid(48E444F1-8E30-4E4C-B203-4C87FC901586),
|
||||
helpstring("CheckColumn Class")
|
||||
]
|
||||
coclass CheckColumn
|
||||
{
|
||||
[default] interface IListColumn;
|
||||
};
|
||||
|
||||
[
|
||||
uuid(ED14E7C5-11BE-4DFD-9829-873AB6BE3CFC),
|
||||
helpstring("Notebook Class")
|
||||
]
|
||||
coclass Notebook
|
||||
{
|
||||
[default] interface INotebook;
|
||||
[default, source] interface INotebookEvents;
|
||||
};
|
||||
|
||||
[
|
||||
uuid(8E8F88D2-AA47-474E-9DB7-912D49C8BE9D),
|
||||
helpstring("Edit Class")
|
||||
]
|
||||
coclass Edit
|
||||
{
|
||||
[default] interface IEdit;
|
||||
[default, source] interface IEditEvents;
|
||||
};
|
||||
|
||||
[
|
||||
uuid(E099DC60-0F19-4690-AB7C-8B5834DA286E),
|
||||
helpstring("Choice Class")
|
||||
]
|
||||
coclass Choice
|
||||
{
|
||||
[default] interface IChoice;
|
||||
[default, source] interface IChoiceEvents;
|
||||
};
|
||||
|
||||
[
|
||||
uuid(CD6556CD-F8D9-4CB0-AB7C-7C33058294E4),
|
||||
helpstring("FixedLayout Class")
|
||||
]
|
||||
coclass FixedLayout
|
||||
{
|
||||
[default] interface ILayout;
|
||||
[default, source] interface IControlEvents;
|
||||
};
|
||||
|
||||
[
|
||||
uuid(CA121762-31BB-4073-8597-33BAB4BDCAA3),
|
||||
helpstring("BorderLayout Class")
|
||||
]
|
||||
coclass BorderLayout
|
||||
{
|
||||
[default] interface ILayout;
|
||||
[default, source] interface IControlEvents;
|
||||
};
|
||||
|
||||
[
|
||||
uuid(5AD04D45-D4BF-4729-8A2E-5D37CF726CAA),
|
||||
helpstring("PageLayout Class")
|
||||
]
|
||||
coclass PageLayout
|
||||
{
|
||||
[default] interface IPageLayoutDisp;
|
||||
[default, source] interface IControlEvents;
|
||||
};
|
||||
|
||||
[
|
||||
uuid(AE4525BE-81D1-40FB-9170-77172077EB49),
|
||||
helpstring("PushButton Class")
|
||||
]
|
||||
coclass PushButton
|
||||
{
|
||||
[default] interface IPushButton;
|
||||
[default, source] interface ICommandEvents;
|
||||
};
|
||||
|
||||
[
|
||||
uuid(4887101C-A9F9-495B-921B-EF22822CFB97),
|
||||
helpstring("Static Class")
|
||||
]
|
||||
coclass StaticText
|
||||
{
|
||||
[default] interface IStatic;
|
||||
[default, source] interface IControlEvents;
|
||||
};
|
||||
|
||||
[
|
||||
uuid(5AE37451-F79C-478A-834E-EDCF95F01B0E),
|
||||
helpstring("Checkbox Class")
|
||||
]
|
||||
coclass Checkbox
|
||||
{
|
||||
[default] interface ICheckbox;
|
||||
[default, source] interface ICheckboxEvents;
|
||||
};
|
||||
|
||||
[
|
||||
uuid(5D14557A-1268-43c6-A283-3B5B271359AA),
|
||||
helpstring("Slider Class")
|
||||
]
|
||||
coclass Slider
|
||||
{
|
||||
[default] interface ISlider;
|
||||
[default, source] interface ISliderEvents;
|
||||
};
|
||||
|
||||
[
|
||||
uuid(3035299A-C5FB-4CC7-A63C-66400B80DCA4),
|
||||
helpstring("DerethMap Class")
|
||||
]
|
||||
coclass DerethMap
|
||||
{
|
||||
[default] interface IDerethMap;
|
||||
[default, source] interface ICommandEvents;
|
||||
};
|
||||
|
||||
[
|
||||
uuid(FE361225-6BB7-4AE0-A10C-8A6420621680),
|
||||
helpstring("Progress Class")
|
||||
]
|
||||
coclass Progress
|
||||
{
|
||||
[default] interface IProgress;
|
||||
[default, source] interface IControlEvents;
|
||||
};
|
||||
};
|
||||
142
Native/DecalControls/DecalControls.rc
Normal file
142
Native/DecalControls/DecalControls.rc
Normal file
|
|
@ -0,0 +1,142 @@
|
|||
// Microsoft Visual C++ generated resource script.
|
||||
//
|
||||
#include "resource.h"
|
||||
#include "..\Include\DecalVersion.h"
|
||||
|
||||
#define APSTUDIO_READONLY_SYMBOLS
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Generated from the TEXTINCLUDE 2 resource.
|
||||
//
|
||||
#include "winres.h"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
#undef APSTUDIO_READONLY_SYMBOLS
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// English (U.S.) resources
|
||||
|
||||
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
|
||||
#ifdef _WIN32
|
||||
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
|
||||
#pragma code_page(1252)
|
||||
#endif //_WIN32
|
||||
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// TEXTINCLUDE
|
||||
//
|
||||
|
||||
1 TEXTINCLUDE
|
||||
BEGIN
|
||||
"resource.h\0"
|
||||
END
|
||||
|
||||
2 TEXTINCLUDE
|
||||
BEGIN
|
||||
"#include ""winres.h""\r\n"
|
||||
"\0"
|
||||
END
|
||||
|
||||
3 TEXTINCLUDE
|
||||
BEGIN
|
||||
"1 TYPELIB ""DecalControls.tlb""\r\n"
|
||||
"\0"
|
||||
END
|
||||
|
||||
#endif // APSTUDIO_INVOKED
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Version
|
||||
//
|
||||
|
||||
VS_VERSION_INFO VERSIONINFO
|
||||
FILEVERSION DECAL_MAJOR, DECAL_MINOR, DECAL_BUGFIX, DECAL_RELEASE
|
||||
PRODUCTVERSION DECAL_MAJOR, DECAL_MINOR, DECAL_BUGFIX, DECAL_RELEASE
|
||||
FILEFLAGSMASK 0x3fL
|
||||
#ifdef _DEBUG
|
||||
FILEFLAGS 0x1L
|
||||
#else
|
||||
FILEFLAGS 0x0L
|
||||
#endif
|
||||
FILEOS 0x4L
|
||||
FILETYPE 0x2L
|
||||
FILESUBTYPE 0x0L
|
||||
BEGIN
|
||||
BLOCK "StringFileInfo"
|
||||
BEGIN
|
||||
BLOCK "040904b0"
|
||||
BEGIN
|
||||
VALUE "Comments", "DecalControls is a group of control objects that give plug-in developers a basic group of UI elements to work with"
|
||||
VALUE "FileDescription", "DecalControls Module"
|
||||
VALUE "FileVersion", DECAL_VERSION_STRING
|
||||
VALUE "InternalName", "DecalControls"
|
||||
VALUE "LegalCopyright", "Copyright 2001"
|
||||
VALUE "OriginalFilename", "DecalControls.DLL"
|
||||
VALUE "ProductName", "DecalControls Module"
|
||||
VALUE "ProductVersion", DECAL_VERSION_STRING
|
||||
END
|
||||
END
|
||||
BLOCK "VarFileInfo"
|
||||
BEGIN
|
||||
VALUE "Translation", 0x409, 1200
|
||||
END
|
||||
END
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// REGISTRY
|
||||
//
|
||||
|
||||
IDR_TEXTCOLUMN REGISTRY "TextColumn.rgs"
|
||||
IDR_ICONCOLUMN REGISTRY "IconColumn.rgs"
|
||||
IDR_LIST REGISTRY "List.rgs"
|
||||
IDR_NOTEBOOK REGISTRY "Notebook.rgs"
|
||||
IDR_SCROLLER REGISTRY "Scroller.rgs"
|
||||
IDR_CHECKCOLUMN REGISTRY "CheckColumn.rgs"
|
||||
IDR_EDIT REGISTRY "Edit.rgs"
|
||||
IDR_CHOICE REGISTRY "Choice.rgs"
|
||||
IDR_FIXEDLAYOUT REGISTRY "FixedLayout.rgs"
|
||||
IDR_BORDERLAYOUT REGISTRY "BorderLayout.rgs"
|
||||
IDR_PAGELAYOUT REGISTRY "PageLayout.rgs"
|
||||
IDR_PUSHBUTTON REGISTRY "PushButton.rgs"
|
||||
IDR_STATIC REGISTRY "Static.rgs"
|
||||
IDR_CHECKBOX REGISTRY "Checkbox.rgs"
|
||||
IDR_DerethMap REGISTRY "DerethMap.rgs"
|
||||
IDR_SLIDER REGISTRY "Slider.rgs"
|
||||
IDR_PROGRESS REGISTRY "Progress.rgs"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// String Table
|
||||
//
|
||||
|
||||
STRINGTABLE
|
||||
BEGIN
|
||||
IDS_PROJNAME "DecalControls"
|
||||
END
|
||||
|
||||
STRINGTABLE
|
||||
BEGIN
|
||||
IDS_DERETHMAP_DESC "DerethMap Class"
|
||||
END
|
||||
|
||||
#endif // English (U.S.) resources
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
|
||||
#ifndef APSTUDIO_INVOKED
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Generated from the TEXTINCLUDE 3 resource.
|
||||
//
|
||||
1 TYPELIB "DecalControls.tlb"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
#endif // not APSTUDIO_INVOKED
|
||||
|
||||
788
Native/DecalControls/DecalControls.vcproj
Normal file
788
Native/DecalControls/DecalControls.vcproj
Normal file
|
|
@ -0,0 +1,788 @@
|
|||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="7.10"
|
||||
Name="DecalControls"
|
||||
SccProjectName=""
|
||||
SccLocalPath="">
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"/>
|
||||
</Platforms>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Release MinDependency|Win32"
|
||||
OutputDirectory=".\..\Release"
|
||||
IntermediateDirectory=".\ReleaseMinDependency"
|
||||
ConfigurationType="2"
|
||||
UseOfMFC="0"
|
||||
ATLMinimizesCRunTimeLibraryUsage="FALSE"
|
||||
CharacterSet="2">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="4"
|
||||
GlobalOptimizations="TRUE"
|
||||
InlineFunctionExpansion="1"
|
||||
EnableIntrinsicFunctions="TRUE"
|
||||
FavorSizeOrSpeed="2"
|
||||
OmitFramePointers="TRUE"
|
||||
AdditionalIncludeDirectories="..\Inject,..\Include"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL"
|
||||
StringPooling="TRUE"
|
||||
RuntimeLibrary="0"
|
||||
EnableFunctionLevelLinking="TRUE"
|
||||
UsePrecompiledHeader="3"
|
||||
PrecompiledHeaderThrough="stdafx.h"
|
||||
PrecompiledHeaderFile=".\ReleaseMinDependency/DecalControls.pch"
|
||||
AssemblerListingLocation=".\ReleaseMinDependency/"
|
||||
ObjectFile=".\ReleaseMinDependency/"
|
||||
ProgramDataBaseFileName=".\ReleaseMinDependency/"
|
||||
WarningLevel="3"
|
||||
SuppressStartupBanner="TRUE"
|
||||
DebugInformationFormat="3"
|
||||
CompileAs="0"/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
IgnoreImportLibrary="TRUE"
|
||||
OutputFile=".\..\Release/DecalControls.dll"
|
||||
LinkIncremental="1"
|
||||
SuppressStartupBanner="TRUE"
|
||||
AdditionalLibraryDirectories="..\Release"
|
||||
ModuleDefinitionFile=".\DecalControls.def"
|
||||
GenerateDebugInformation="TRUE"
|
||||
ProgramDatabaseFile=".\..\Release/DecalControls.pdb"
|
||||
SubSystem="2"
|
||||
ImportLibrary=".\..\Release/DecalControls.lib"
|
||||
TargetMachine="1"/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
AdditionalIncludeDirectories="..\Include"
|
||||
SuppressStartupBanner="TRUE"
|
||||
TargetEnvironment="1"
|
||||
GenerateStublessProxies="TRUE"
|
||||
TypeLibraryName=".\..\Release/DecalControls.tlb"
|
||||
HeaderFileName=""/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
PreprocessorDefinitions="NDEBUG"
|
||||
Culture="4105"/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"/>
|
||||
<Tool
|
||||
Name="VCManagedWrapperGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
OutputDirectory=".\..\Debug"
|
||||
IntermediateDirectory=".\Debug"
|
||||
ConfigurationType="2"
|
||||
UseOfMFC="0"
|
||||
ATLMinimizesCRunTimeLibraryUsage="FALSE"
|
||||
CharacterSet="2">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="..\Inject,..\Include"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="3"
|
||||
UsePrecompiledHeader="3"
|
||||
PrecompiledHeaderThrough="stdafx.h"
|
||||
PrecompiledHeaderFile=".\Debug/DecalControls.pch"
|
||||
AssemblerListingLocation=".\Debug/"
|
||||
ObjectFile=".\Debug/"
|
||||
ProgramDataBaseFileName=".\Debug/"
|
||||
WarningLevel="3"
|
||||
SuppressStartupBanner="TRUE"
|
||||
DebugInformationFormat="4"
|
||||
CompileAs="0"/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
IgnoreImportLibrary="TRUE"
|
||||
OutputFile=".\..\Debug/DecalControls.dll"
|
||||
LinkIncremental="1"
|
||||
SuppressStartupBanner="TRUE"
|
||||
ModuleDefinitionFile=".\DecalControls.def"
|
||||
GenerateDebugInformation="TRUE"
|
||||
ProgramDatabaseFile=".\..\Debug/DecalControls.pdb"
|
||||
SubSystem="2"
|
||||
ImportLibrary=".\..\Debug/DecalControls.lib"
|
||||
TargetMachine="1"/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
AdditionalIncludeDirectories="..\Include"
|
||||
SuppressStartupBanner="TRUE"
|
||||
TargetEnvironment="1"
|
||||
GenerateStublessProxies="TRUE"
|
||||
TypeLibraryName=".\..\Debug/DecalControls.tlb"
|
||||
HeaderFileName=""/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
PreprocessorDefinitions="_DEBUG"
|
||||
Culture="4105"/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"/>
|
||||
<Tool
|
||||
Name="VCManagedWrapperGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
<References>
|
||||
</References>
|
||||
<Files>
|
||||
<Filter
|
||||
Name="Source Files"
|
||||
Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat">
|
||||
<File
|
||||
RelativePath="BorderLayout.cpp">
|
||||
<FileConfiguration
|
||||
Name="Release MinDependency|Win32">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories=""
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;_USRDLL;$(NoInherit)"/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories=""
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_MBCS;_USRDLL;$(NoInherit)"
|
||||
BasicRuntimeChecks="3"/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="Checkbox.cpp">
|
||||
<FileConfiguration
|
||||
Name="Release MinDependency|Win32">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories=""
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;_USRDLL;$(NoInherit)"/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories=""
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_MBCS;_USRDLL;$(NoInherit)"
|
||||
BasicRuntimeChecks="3"/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="CheckColumn.cpp">
|
||||
<FileConfiguration
|
||||
Name="Release MinDependency|Win32">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories=""
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;_USRDLL;$(NoInherit)"/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories=""
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_MBCS;_USRDLL;$(NoInherit)"
|
||||
BasicRuntimeChecks="3"/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="Choice.cpp">
|
||||
<FileConfiguration
|
||||
Name="Release MinDependency|Win32">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories=""
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;_USRDLL;$(NoInherit)"/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories=""
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_MBCS;_USRDLL;$(NoInherit)"
|
||||
BasicRuntimeChecks="3"/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="ChoiceDropDown.cpp">
|
||||
<FileConfiguration
|
||||
Name="Release MinDependency|Win32">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories=""
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;_USRDLL;$(NoInherit)"/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories=""
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_MBCS;_USRDLL;$(NoInherit)"
|
||||
BasicRuntimeChecks="3"/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="ChoicePopup.cpp">
|
||||
<FileConfiguration
|
||||
Name="Release MinDependency|Win32">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories=""
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;_USRDLL;$(NoInherit)"/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories=""
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_MBCS;_USRDLL;$(NoInherit)"
|
||||
BasicRuntimeChecks="3"/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="DecalControls.cpp">
|
||||
<FileConfiguration
|
||||
Name="Release MinDependency|Win32">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories=""
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;_USRDLL;$(NoInherit)"/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories=""
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_MBCS;_USRDLL;$(NoInherit)"
|
||||
BasicRuntimeChecks="3"/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="DecalControls.def">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="DecalControls.idl">
|
||||
<FileConfiguration
|
||||
Name="Release MinDependency|Win32">
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
AdditionalIncludeDirectories=""
|
||||
TargetEnvironment="1"
|
||||
TypeLibraryName=".\DecalControls.tlb"
|
||||
HeaderFileName="DecalControls.h"
|
||||
InterfaceIdentifierFileName="DecalControls_i.c"/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32">
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
AdditionalIncludeDirectories=""
|
||||
TargetEnvironment="1"
|
||||
TypeLibraryName=".\DecalControls.tlb"
|
||||
HeaderFileName="DecalControls.h"
|
||||
InterfaceIdentifierFileName="DecalControls_i.c"/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="DecalControls.rc">
|
||||
<FileConfiguration
|
||||
Name="Release MinDependency|Win32">
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
PreprocessorDefinitions=""
|
||||
AdditionalIncludeDirectories="$(OUTDIR)"/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32">
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
PreprocessorDefinitions=""
|
||||
AdditionalIncludeDirectories="$(OUTDIR)"/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="DerethMap.cpp">
|
||||
<FileConfiguration
|
||||
Name="Release MinDependency|Win32">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories=""
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;_USRDLL;$(NoInherit)"/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories=""
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_MBCS;_USRDLL;$(NoInherit)"
|
||||
BasicRuntimeChecks="3"/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="Edit.cpp">
|
||||
<FileConfiguration
|
||||
Name="Release MinDependency|Win32">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories=""
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;_USRDLL;$(NoInherit)"/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories=""
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_MBCS;_USRDLL;$(NoInherit)"
|
||||
BasicRuntimeChecks="3"/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="FixedLayout.cpp">
|
||||
<FileConfiguration
|
||||
Name="Release MinDependency|Win32">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories=""
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;_USRDLL;$(NoInherit)"/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories=""
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_MBCS;_USRDLL;$(NoInherit)"
|
||||
BasicRuntimeChecks="3"/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="IconColumn.cpp">
|
||||
<FileConfiguration
|
||||
Name="Release MinDependency|Win32">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories=""
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;_USRDLL;$(NoInherit)"/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories=""
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_MBCS;_USRDLL;$(NoInherit)"
|
||||
BasicRuntimeChecks="3"/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\Inject\Inject_i.c">
|
||||
<FileConfiguration
|
||||
Name="Release MinDependency|Win32">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories=""
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;_USRDLL;$(NoInherit)"
|
||||
UsePrecompiledHeader="0"/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories=""
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_MBCS;_USRDLL;$(NoInherit)"
|
||||
BasicRuntimeChecks="3"
|
||||
UsePrecompiledHeader="0"/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="List.cpp">
|
||||
<FileConfiguration
|
||||
Name="Release MinDependency|Win32">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories=""
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;_USRDLL;$(NoInherit)"/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories=""
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_MBCS;_USRDLL;$(NoInherit)"
|
||||
BasicRuntimeChecks="3"/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="ListView.cpp">
|
||||
<FileConfiguration
|
||||
Name="Release MinDependency|Win32">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories=""
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;_USRDLL;$(NoInherit)"/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories=""
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_MBCS;_USRDLL;$(NoInherit)"
|
||||
BasicRuntimeChecks="3"/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="Notebook.cpp">
|
||||
<FileConfiguration
|
||||
Name="Release MinDependency|Win32">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories=""
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;_USRDLL;$(NoInherit)"/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories=""
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_MBCS;_USRDLL;$(NoInherit)"
|
||||
BasicRuntimeChecks="3"/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="PageLayout.cpp">
|
||||
<FileConfiguration
|
||||
Name="Release MinDependency|Win32">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories=""
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;_USRDLL;$(NoInherit)"/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories=""
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_MBCS;_USRDLL;$(NoInherit)"
|
||||
BasicRuntimeChecks="3"/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="Progress.cpp">
|
||||
<FileConfiguration
|
||||
Name="Release MinDependency|Win32">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories=""
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;_USRDLL;$(NoInherit)"/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories=""
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_MBCS;_USRDLL;$(NoInherit)"
|
||||
BasicRuntimeChecks="3"/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="PushButton.cpp">
|
||||
<FileConfiguration
|
||||
Name="Release MinDependency|Win32">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories=""
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;_USRDLL;$(NoInherit)"/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories=""
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_MBCS;_USRDLL;$(NoInherit)"
|
||||
BasicRuntimeChecks="3"/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="Scroller.cpp">
|
||||
<FileConfiguration
|
||||
Name="Release MinDependency|Win32">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories=""
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;_USRDLL;$(NoInherit)"/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories=""
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_MBCS;_USRDLL;$(NoInherit)"
|
||||
BasicRuntimeChecks="3"/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="Slider.cpp">
|
||||
<FileConfiguration
|
||||
Name="Release MinDependency|Win32">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories=""
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;_USRDLL;$(NoInherit)"/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories=""
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_MBCS;_USRDLL;$(NoInherit)"
|
||||
BasicRuntimeChecks="3"/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="Static.cpp">
|
||||
<FileConfiguration
|
||||
Name="Release MinDependency|Win32">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories=""
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;_USRDLL;$(NoInherit)"/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories=""
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_MBCS;_USRDLL;$(NoInherit)"
|
||||
BasicRuntimeChecks="3"/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="StdAfx.cpp">
|
||||
<FileConfiguration
|
||||
Name="Release MinDependency|Win32">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories=""
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;_USRDLL;$(NoInherit)"
|
||||
UsePrecompiledHeader="1"/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories=""
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_MBCS;_USRDLL;$(NoInherit)"
|
||||
BasicRuntimeChecks="3"
|
||||
UsePrecompiledHeader="1"/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="TextColumn.cpp">
|
||||
<FileConfiguration
|
||||
Name="Release MinDependency|Win32">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories=""
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;_USRDLL;$(NoInherit)"/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories=""
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_MBCS;_USRDLL;$(NoInherit)"
|
||||
BasicRuntimeChecks="3"/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Header Files"
|
||||
Filter="h;hpp;hxx;hm;inl">
|
||||
<File
|
||||
RelativePath="BorderLayout.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="Checkbox.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="CheckColumn.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="Choice.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="ChoiceDropDown.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="ChoicePopup.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="ControlImpl.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="DecalControlsCP.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="DerethMap.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="Edit.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="FixedLayout.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="IconColumn.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="List.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="ListView.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="Notebook.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="PageLayout.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="Progress.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="PushButton.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="Resource.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="Scroller.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="Slider.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="Static.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="StdAfx.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="TextColumn.h">
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Resource Files"
|
||||
Filter="ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe">
|
||||
<File
|
||||
RelativePath="BorderLayout.rgs">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="Checkbox.rgs">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="CheckColumn.rgs">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="Choice.rgs">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="ChoiceDropDown.rgs">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="Client.rgs">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="DerethMap.rgs">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="Edit.rgs">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="FixedLayout.rgs">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="IconColumn.rgs">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="List.rgs">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="Notebook.rgs">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="PageLayout.rgs">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="Progress.rgs">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="PushButton.rgs">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="Scroller.rgs">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="Slider.rgs">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="Static.rgs">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="TextColumn.rgs">
|
||||
</File>
|
||||
</Filter>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
||||
821
Native/DecalControls/DecalControlsCP.h
Normal file
821
Native/DecalControls/DecalControlsCP.h
Normal file
|
|
@ -0,0 +1,821 @@
|
|||
#ifndef _DECALCONTROLSCP_H_
|
||||
#define _DECALCONTROLSCP_H_
|
||||
|
||||
template <class T>
|
||||
class CProxyISliderEvents : public IConnectionPointImpl<T, &DIID_ISliderEvents, CComDynamicUnkArray>
|
||||
{
|
||||
//Warning this class may be recreated by the wizard.
|
||||
public:
|
||||
HRESULT Fire_Destroy(LONG nID)
|
||||
{
|
||||
try
|
||||
{
|
||||
CComVariant varResult;
|
||||
T* pT = static_cast<T*>(this);
|
||||
int nConnectionIndex;
|
||||
CComVariant* pvars = new CComVariant[1];
|
||||
int nConnections = m_vec.GetSize();
|
||||
|
||||
for (nConnectionIndex = 0; nConnectionIndex < nConnections; nConnectionIndex++)
|
||||
{
|
||||
pT->Lock();
|
||||
CComPtr<IUnknown> sp = m_vec.GetAt(nConnectionIndex);
|
||||
pT->Unlock();
|
||||
IDispatch* pDispatch = reinterpret_cast<IDispatch*>(sp.p);
|
||||
if (pDispatch != NULL)
|
||||
{
|
||||
VariantClear(&varResult);
|
||||
pvars[0] = nID;
|
||||
DISPPARAMS disp = { pvars, NULL, 1, 0 };
|
||||
pDispatch->Invoke(0x1, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, &varResult, NULL, NULL);
|
||||
}
|
||||
}
|
||||
delete[] pvars;
|
||||
return varResult.scode;
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
// In debug mode warn the user
|
||||
_ASSERTE( FALSE );
|
||||
|
||||
// Return failure
|
||||
return E_FAIL;
|
||||
}
|
||||
}
|
||||
|
||||
HRESULT Fire_Change(LONG nID, LONG nValue)
|
||||
{
|
||||
try
|
||||
{
|
||||
CComVariant varResult;
|
||||
T* pT = static_cast<T*>(this);
|
||||
int nConnectionIndex;
|
||||
CComVariant* pvars = new CComVariant[2];
|
||||
int nConnections = m_vec.GetSize();
|
||||
|
||||
for (nConnectionIndex = 0; nConnectionIndex < nConnections; nConnectionIndex++)
|
||||
{
|
||||
pT->Lock();
|
||||
CComPtr<IUnknown> sp = m_vec.GetAt(nConnectionIndex);
|
||||
pT->Unlock();
|
||||
IDispatch* pDispatch = reinterpret_cast<IDispatch*>(sp.p);
|
||||
if (pDispatch != NULL)
|
||||
{
|
||||
VariantClear(&varResult);
|
||||
pvars[1] = nID;
|
||||
pvars[0] = nValue;
|
||||
DISPPARAMS disp = { pvars, NULL, 2, 0 };
|
||||
pDispatch->Invoke(0x6, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, &varResult, NULL, NULL);
|
||||
}
|
||||
}
|
||||
delete[] pvars;
|
||||
return varResult.scode;
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
// In debug mode warn the user
|
||||
_ASSERTE( FALSE );
|
||||
|
||||
// Return failure
|
||||
return E_FAIL;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
template <class T>
|
||||
class CProxyICheckboxEvents : public IConnectionPointImpl<T, &DIID_ICheckboxEvents, CComDynamicUnkArray>
|
||||
{
|
||||
//Warning this class may be recreated by the wizard.
|
||||
public:
|
||||
HRESULT Fire_Destroy(LONG nID)
|
||||
{
|
||||
try
|
||||
{
|
||||
CComVariant varResult;
|
||||
T* pT = static_cast<T*>(this);
|
||||
int nConnectionIndex;
|
||||
CComVariant* pvars = new CComVariant[1];
|
||||
int nConnections = m_vec.GetSize();
|
||||
|
||||
for (nConnectionIndex = 0; nConnectionIndex < nConnections; nConnectionIndex++)
|
||||
{
|
||||
pT->Lock();
|
||||
CComPtr<IUnknown> sp = m_vec.GetAt(nConnectionIndex);
|
||||
pT->Unlock();
|
||||
IDispatch* pDispatch = reinterpret_cast<IDispatch*>(sp.p);
|
||||
if (pDispatch != NULL)
|
||||
{
|
||||
VariantClear(&varResult);
|
||||
pvars[0] = nID;
|
||||
DISPPARAMS disp = { pvars, NULL, 1, 0 };
|
||||
pDispatch->Invoke(0x1, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, &varResult, NULL, NULL);
|
||||
}
|
||||
}
|
||||
delete[] pvars;
|
||||
return varResult.scode;
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
// In debug mode warn the user
|
||||
_ASSERTE( FALSE );
|
||||
|
||||
// Return failure
|
||||
return E_FAIL;
|
||||
}
|
||||
}
|
||||
|
||||
HRESULT Fire_Change(LONG nID, VARIANT_BOOL bChecked)
|
||||
{
|
||||
try
|
||||
{
|
||||
CComVariant varResult;
|
||||
T* pT = static_cast<T*>(this);
|
||||
int nConnectionIndex;
|
||||
CComVariant* pvars = new CComVariant[2];
|
||||
int nConnections = m_vec.GetSize();
|
||||
|
||||
for (nConnectionIndex = 0; nConnectionIndex < nConnections; nConnectionIndex++)
|
||||
{
|
||||
pT->Lock();
|
||||
CComPtr<IUnknown> sp = m_vec.GetAt(nConnectionIndex);
|
||||
pT->Unlock();
|
||||
IDispatch* pDispatch = reinterpret_cast<IDispatch*>(sp.p);
|
||||
if (pDispatch != NULL)
|
||||
{
|
||||
VariantClear(&varResult);
|
||||
pvars[1] = nID;
|
||||
pvars[0] = bChecked;
|
||||
DISPPARAMS disp = { pvars, NULL, 2, 0 };
|
||||
pDispatch->Invoke(0x6, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, &varResult, NULL, NULL);
|
||||
}
|
||||
}
|
||||
delete[] pvars;
|
||||
return varResult.scode;
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
// In debug mode warn the user
|
||||
_ASSERTE( FALSE );
|
||||
|
||||
// Return failure
|
||||
return E_FAIL;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
template <class T>
|
||||
class CProxyIChoiceEvents : public IConnectionPointImpl<T, &DIID_IChoiceEvents, CComDynamicUnkArray>
|
||||
{
|
||||
//Warning this class may be recreated by the wizard.
|
||||
public:
|
||||
VOID Fire_Destroy(LONG nID)
|
||||
{
|
||||
try
|
||||
{
|
||||
T* pT = static_cast<T*>(this);
|
||||
int nConnectionIndex;
|
||||
CComVariant* pvars = new CComVariant[1];
|
||||
int nConnections = m_vec.GetSize();
|
||||
|
||||
for (nConnectionIndex = 0; nConnectionIndex < nConnections; nConnectionIndex++)
|
||||
{
|
||||
pT->Lock();
|
||||
CComPtr<IUnknown> sp = m_vec.GetAt(nConnectionIndex);
|
||||
pT->Unlock();
|
||||
IDispatch* pDispatch = reinterpret_cast<IDispatch*>(sp.p);
|
||||
if (pDispatch != NULL)
|
||||
{
|
||||
pvars[0] = nID;
|
||||
DISPPARAMS disp = { pvars, NULL, 1, 0 };
|
||||
pDispatch->Invoke(0x1, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, NULL, NULL, NULL);
|
||||
}
|
||||
}
|
||||
delete[] pvars;
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
// In debug mode warn the user
|
||||
_ASSERTE( FALSE );
|
||||
}
|
||||
}
|
||||
|
||||
VOID Fire_Change(LONG nID, LONG nIndex)
|
||||
{
|
||||
try
|
||||
{
|
||||
T* pT = static_cast<T*>(this);
|
||||
int nConnectionIndex;
|
||||
CComVariant* pvars = new CComVariant[2];
|
||||
int nConnections = m_vec.GetSize();
|
||||
|
||||
for (nConnectionIndex = 0; nConnectionIndex < nConnections; nConnectionIndex++)
|
||||
{
|
||||
pT->Lock();
|
||||
CComPtr<IUnknown> sp = m_vec.GetAt(nConnectionIndex);
|
||||
pT->Unlock();
|
||||
IDispatch* pDispatch = reinterpret_cast<IDispatch*>(sp.p);
|
||||
if (pDispatch != NULL)
|
||||
{
|
||||
pvars[1] = nID;
|
||||
pvars[0] = nIndex;
|
||||
DISPPARAMS disp = { pvars, NULL, 2, 0 };
|
||||
pDispatch->Invoke(0x6, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, NULL, NULL, NULL);
|
||||
}
|
||||
}
|
||||
delete[] pvars;
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
// In debug mode warn the user
|
||||
_ASSERTE( FALSE );
|
||||
}
|
||||
}
|
||||
|
||||
VOID Fire_DropDown(LONG nID)
|
||||
{
|
||||
try
|
||||
{
|
||||
T* pT = static_cast<T*>(this);
|
||||
int nConnectionIndex;
|
||||
CComVariant* pvars = new CComVariant[1];
|
||||
int nConnections = m_vec.GetSize();
|
||||
|
||||
for (nConnectionIndex = 0; nConnectionIndex < nConnections; nConnectionIndex++)
|
||||
{
|
||||
pT->Lock();
|
||||
CComPtr<IUnknown> sp = m_vec.GetAt(nConnectionIndex);
|
||||
pT->Unlock();
|
||||
IDispatch* pDispatch = reinterpret_cast<IDispatch*>(sp.p);
|
||||
if (pDispatch != NULL)
|
||||
{
|
||||
pvars[0] = nID;
|
||||
DISPPARAMS disp = { pvars, NULL, 1, 0 };
|
||||
pDispatch->Invoke(0xc, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, NULL, NULL, NULL);
|
||||
}
|
||||
}
|
||||
delete[] pvars;
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
// In debug mode warn the user
|
||||
_ASSERTE( FALSE );
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
template <class T>
|
||||
class CProxyIListEvents : public IConnectionPointImpl<T, &DIID_IListEvents, CComDynamicUnkArray>
|
||||
{
|
||||
//Warning this class may be recreated by the wizard.
|
||||
public:
|
||||
VOID Fire_Destroy(LONG nID)
|
||||
{
|
||||
try
|
||||
{
|
||||
T* pT = static_cast<T*>(this);
|
||||
int nConnectionIndex;
|
||||
CComVariant* pvars = new CComVariant[1];
|
||||
int nConnections = m_vec.GetSize();
|
||||
|
||||
for (nConnectionIndex = 0; nConnectionIndex < nConnections; nConnectionIndex++)
|
||||
{
|
||||
pT->Lock();
|
||||
CComPtr<IUnknown> sp = m_vec.GetAt(nConnectionIndex);
|
||||
pT->Unlock();
|
||||
IDispatch* pDispatch = reinterpret_cast<IDispatch*>(sp.p);
|
||||
if (pDispatch != NULL)
|
||||
{
|
||||
pvars[0] = nID;
|
||||
DISPPARAMS disp = { pvars, NULL, 1, 0 };
|
||||
pDispatch->Invoke(0x1, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, NULL, NULL, NULL);
|
||||
}
|
||||
}
|
||||
delete[] pvars;
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
// In debug mode warn the user
|
||||
_ASSERTE( FALSE );
|
||||
}
|
||||
}
|
||||
|
||||
VOID Fire_Change(LONG nID, LONG nX, LONG nY)
|
||||
{
|
||||
try
|
||||
{
|
||||
T* pT = static_cast<T*>(this);
|
||||
int nConnectionIndex;
|
||||
CComVariant* pvars = new CComVariant[3];
|
||||
int nConnections = m_vec.GetSize();
|
||||
|
||||
for (nConnectionIndex = 0; nConnectionIndex < nConnections; nConnectionIndex++)
|
||||
{
|
||||
pT->Lock();
|
||||
CComPtr<IUnknown> sp = m_vec.GetAt(nConnectionIndex);
|
||||
pT->Unlock();
|
||||
IDispatch* pDispatch = reinterpret_cast<IDispatch*>(sp.p);
|
||||
if (pDispatch != NULL)
|
||||
{
|
||||
pvars[2] = nID;
|
||||
pvars[1] = nX;
|
||||
pvars[0] = nY;
|
||||
DISPPARAMS disp = { pvars, NULL, 3, 0 };
|
||||
pDispatch->Invoke(0x6, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, NULL, NULL, NULL);
|
||||
}
|
||||
}
|
||||
delete[] pvars;
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
// In debug mode warn the user
|
||||
_ASSERTE( FALSE );
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
template <class T>
|
||||
class CProxyINotebookEvents : public IConnectionPointImpl<T, &DIID_INotebookEvents, CComDynamicUnkArray>
|
||||
{
|
||||
//Warning this class may be recreated by the wizard.
|
||||
public:
|
||||
VOID Fire_Destroy(LONG nID)
|
||||
{
|
||||
try
|
||||
{
|
||||
T* pT = static_cast<T*>(this);
|
||||
int nConnectionIndex;
|
||||
CComVariant* pvars = new CComVariant[1];
|
||||
int nConnections = m_vec.GetSize();
|
||||
|
||||
for (nConnectionIndex = 0; nConnectionIndex < nConnections; nConnectionIndex++)
|
||||
{
|
||||
pT->Lock();
|
||||
CComPtr<IUnknown> sp = m_vec.GetAt(nConnectionIndex);
|
||||
pT->Unlock();
|
||||
IDispatch* pDispatch = reinterpret_cast<IDispatch*>(sp.p);
|
||||
if (pDispatch != NULL)
|
||||
{
|
||||
pvars[0] = nID;
|
||||
DISPPARAMS disp = { pvars, NULL, 1, 0 };
|
||||
pDispatch->Invoke(0x1, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, NULL, NULL, NULL);
|
||||
}
|
||||
}
|
||||
delete[] pvars;
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
// In debug mode warn the user
|
||||
_ASSERTE( FALSE );
|
||||
}
|
||||
}
|
||||
|
||||
HRESULT Fire_Change(LONG nID, LONG nNewPage)
|
||||
{
|
||||
try
|
||||
{
|
||||
CComVariant varResult;
|
||||
T* pT = static_cast<T*>(this);
|
||||
int nConnectionIndex;
|
||||
CComVariant* pvars = new CComVariant[2];
|
||||
int nConnections = m_vec.GetSize();
|
||||
|
||||
for (nConnectionIndex = 0; nConnectionIndex < nConnections; nConnectionIndex++)
|
||||
{
|
||||
pT->Lock();
|
||||
CComPtr<IUnknown> sp = m_vec.GetAt(nConnectionIndex);
|
||||
pT->Unlock();
|
||||
IDispatch* pDispatch = reinterpret_cast<IDispatch*>(sp.p);
|
||||
if (pDispatch != NULL)
|
||||
{
|
||||
VariantClear(&varResult);
|
||||
pvars[1] = nID;
|
||||
pvars[0] = nNewPage;
|
||||
DISPPARAMS disp = { pvars, NULL, 2, 0 };
|
||||
pDispatch->Invoke(0x6, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, &varResult, NULL, NULL);
|
||||
}
|
||||
}
|
||||
delete[] pvars;
|
||||
return varResult.scode;
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
// In debug mode warn the user
|
||||
_ASSERTE( FALSE );
|
||||
|
||||
// Return failure
|
||||
return E_FAIL;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
template <class T>
|
||||
class CProxyICommandEvents : public IConnectionPointImpl<T, &DIID_ICommandEvents, CComDynamicUnkArray>
|
||||
{
|
||||
//Warning this class may be recreated by the wizard.
|
||||
public:
|
||||
VOID Fire_Destroy(LONG nID)
|
||||
{
|
||||
try
|
||||
{
|
||||
T* pT = static_cast<T*>(this);
|
||||
int nConnectionIndex;
|
||||
CComVariant* pvars = new CComVariant[1];
|
||||
int nConnections = m_vec.GetSize();
|
||||
|
||||
for (nConnectionIndex = 0; nConnectionIndex < nConnections; nConnectionIndex++)
|
||||
{
|
||||
pT->Lock();
|
||||
CComPtr<IUnknown> sp = m_vec.GetAt(nConnectionIndex);
|
||||
pT->Unlock();
|
||||
IDispatch* pDispatch = reinterpret_cast<IDispatch*>(sp.p);
|
||||
if (pDispatch != NULL)
|
||||
{
|
||||
pvars[0] = nID;
|
||||
DISPPARAMS disp = { pvars, NULL, 1, 0 };
|
||||
pDispatch->Invoke(0x1, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, NULL, NULL, NULL);
|
||||
}
|
||||
}
|
||||
delete[] pvars;
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
// In debug mode warn the user
|
||||
_ASSERTE( FALSE );
|
||||
}
|
||||
}
|
||||
|
||||
VOID Fire_Hit(LONG nID)
|
||||
{
|
||||
try
|
||||
{
|
||||
T* pT = static_cast<T*>(this);
|
||||
int nConnectionIndex;
|
||||
CComVariant* pvars = new CComVariant[1];
|
||||
int nConnections = m_vec.GetSize();
|
||||
|
||||
for (nConnectionIndex = 0; nConnectionIndex < nConnections; nConnectionIndex++)
|
||||
{
|
||||
pT->Lock();
|
||||
CComPtr<IUnknown> sp = m_vec.GetAt(nConnectionIndex);
|
||||
pT->Unlock();
|
||||
IDispatch* pDispatch = reinterpret_cast<IDispatch*>(sp.p);
|
||||
if (pDispatch != NULL)
|
||||
{
|
||||
pvars[0] = nID;
|
||||
DISPPARAMS disp = { pvars, NULL, 1, 0 };
|
||||
pDispatch->Invoke(0x2, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, NULL, NULL, NULL);
|
||||
}
|
||||
}
|
||||
delete[] pvars;
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
// In debug mode warn the user
|
||||
_ASSERTE( FALSE );
|
||||
}
|
||||
}
|
||||
|
||||
VOID Fire_Unhit(LONG nID)
|
||||
{
|
||||
try
|
||||
{
|
||||
T* pT = static_cast<T*>(this);
|
||||
int nConnectionIndex;
|
||||
CComVariant* pvars = new CComVariant[1];
|
||||
int nConnections = m_vec.GetSize();
|
||||
|
||||
for (nConnectionIndex = 0; nConnectionIndex < nConnections; nConnectionIndex++)
|
||||
{
|
||||
pT->Lock();
|
||||
CComPtr<IUnknown> sp = m_vec.GetAt(nConnectionIndex);
|
||||
pT->Unlock();
|
||||
IDispatch* pDispatch = reinterpret_cast<IDispatch*>(sp.p);
|
||||
if (pDispatch != NULL)
|
||||
{
|
||||
pvars[0] = nID;
|
||||
DISPPARAMS disp = { pvars, NULL, 1, 0 };
|
||||
pDispatch->Invoke(0x3, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, NULL, NULL, NULL);
|
||||
}
|
||||
}
|
||||
delete[] pvars;
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
// In debug mode warn the user
|
||||
_ASSERTE( FALSE );
|
||||
}
|
||||
}
|
||||
|
||||
VOID Fire_Accepted(LONG nID)
|
||||
{
|
||||
try
|
||||
{
|
||||
T* pT = static_cast<T*>(this);
|
||||
int nConnectionIndex;
|
||||
CComVariant* pvars = new CComVariant[1];
|
||||
int nConnections = m_vec.GetSize();
|
||||
|
||||
for (nConnectionIndex = 0; nConnectionIndex < nConnections; nConnectionIndex++)
|
||||
{
|
||||
pT->Lock();
|
||||
CComPtr<IUnknown> sp = m_vec.GetAt(nConnectionIndex);
|
||||
pT->Unlock();
|
||||
IDispatch* pDispatch = reinterpret_cast<IDispatch*>(sp.p);
|
||||
if (pDispatch != NULL)
|
||||
{
|
||||
pvars[0] = nID;
|
||||
DISPPARAMS disp = { pvars, NULL, 1, 0 };
|
||||
pDispatch->Invoke(0x4, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, NULL, NULL, NULL);
|
||||
}
|
||||
}
|
||||
delete[] pvars;
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
// In debug mode warn the user
|
||||
_ASSERTE( FALSE );
|
||||
}
|
||||
}
|
||||
|
||||
VOID Fire_Canceled(LONG nID)
|
||||
{
|
||||
try
|
||||
{
|
||||
T* pT = static_cast<T*>(this);
|
||||
int nConnectionIndex;
|
||||
CComVariant* pvars = new CComVariant[1];
|
||||
int nConnections = m_vec.GetSize();
|
||||
|
||||
for (nConnectionIndex = 0; nConnectionIndex < nConnections; nConnectionIndex++)
|
||||
{
|
||||
pT->Lock();
|
||||
CComPtr<IUnknown> sp = m_vec.GetAt(nConnectionIndex);
|
||||
pT->Unlock();
|
||||
IDispatch* pDispatch = reinterpret_cast<IDispatch*>(sp.p);
|
||||
if (pDispatch != NULL)
|
||||
{
|
||||
pvars[0] = nID;
|
||||
DISPPARAMS disp = { pvars, NULL, 1, 0 };
|
||||
pDispatch->Invoke(0x5, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, NULL, NULL, NULL);
|
||||
}
|
||||
}
|
||||
delete[] pvars;
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
// In debug mode warn the user
|
||||
_ASSERTE( FALSE );
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
template <class T>
|
||||
class CProxyIScrollerEvents : public IConnectionPointImpl<T, &DIID_IScrollerEvents, CComDynamicUnkArray>
|
||||
{
|
||||
//Warning this class may be recreated by the wizard.
|
||||
public:
|
||||
VOID Fire_Destroy(LONG nID)
|
||||
{
|
||||
try
|
||||
{
|
||||
T* pT = static_cast<T*>(this);
|
||||
int nConnectionIndex;
|
||||
CComVariant* pvars = new CComVariant[1];
|
||||
int nConnections = m_vec.GetSize();
|
||||
|
||||
for (nConnectionIndex = 0; nConnectionIndex < nConnections; nConnectionIndex++)
|
||||
{
|
||||
pT->Lock();
|
||||
CComPtr<IUnknown> sp = m_vec.GetAt(nConnectionIndex);
|
||||
pT->Unlock();
|
||||
IDispatch* pDispatch = reinterpret_cast<IDispatch*>(sp.p);
|
||||
if (pDispatch != NULL)
|
||||
{
|
||||
pvars[0] = nID;
|
||||
DISPPARAMS disp = { pvars, NULL, 1, 0 };
|
||||
pDispatch->Invoke(0x1, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, NULL, NULL, NULL);
|
||||
}
|
||||
}
|
||||
delete[] pvars;
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
// In debug mode warn the user
|
||||
_ASSERTE( FALSE );
|
||||
}
|
||||
}
|
||||
|
||||
HRESULT Fire_Change(LONG nID, LONG nX, LONG nY)
|
||||
{
|
||||
try
|
||||
{
|
||||
CComVariant varResult;
|
||||
T* pT = static_cast<T*>(this);
|
||||
int nConnectionIndex;
|
||||
CComVariant* pvars = new CComVariant[3];
|
||||
int nConnections = m_vec.GetSize();
|
||||
|
||||
for (nConnectionIndex = 0; nConnectionIndex < nConnections; nConnectionIndex++)
|
||||
{
|
||||
pT->Lock();
|
||||
CComPtr<IUnknown> sp = m_vec.GetAt(nConnectionIndex);
|
||||
pT->Unlock();
|
||||
IDispatch* pDispatch = reinterpret_cast<IDispatch*>(sp.p);
|
||||
if (pDispatch != NULL)
|
||||
{
|
||||
VariantClear(&varResult);
|
||||
pvars[2] = nID;
|
||||
pvars[1] = nX;
|
||||
pvars[0] = nY;
|
||||
DISPPARAMS disp = { pvars, NULL, 3, 0 };
|
||||
pDispatch->Invoke(0x6, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, &varResult, NULL, NULL);
|
||||
}
|
||||
}
|
||||
delete[] pvars;
|
||||
return varResult.scode;
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
// In debug mode warn the user
|
||||
_ASSERTE( FALSE );
|
||||
|
||||
// Return failure
|
||||
return E_FAIL;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
template <class T>
|
||||
class CProxyIControlEvents : public IConnectionPointImpl<T, &DIID_IControlEvents, CComDynamicUnkArray>
|
||||
{
|
||||
//Warning this class may be recreated by the wizard.
|
||||
public:
|
||||
VOID Fire_Destroy(LONG nID)
|
||||
{
|
||||
try
|
||||
{
|
||||
T* pT = static_cast<T*>(this);
|
||||
int nConnectionIndex;
|
||||
CComVariant* pvars = new CComVariant[1];
|
||||
int nConnections = m_vec.GetSize();
|
||||
|
||||
for (nConnectionIndex = 0; nConnectionIndex < nConnections; nConnectionIndex++)
|
||||
{
|
||||
pT->Lock();
|
||||
CComPtr<IUnknown> sp = m_vec.GetAt(nConnectionIndex);
|
||||
pT->Unlock();
|
||||
IDispatch* pDispatch = reinterpret_cast<IDispatch*>(sp.p);
|
||||
if (pDispatch != NULL)
|
||||
{
|
||||
pvars[0] = nID;
|
||||
DISPPARAMS disp = { pvars, NULL, 1, 0 };
|
||||
pDispatch->Invoke(0x1, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, NULL, NULL, NULL);
|
||||
}
|
||||
}
|
||||
delete[] pvars;
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
// In debug mode warn the user
|
||||
_ASSERTE( FALSE );
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
template <class T>
|
||||
class CProxyIEditEvents : public IConnectionPointImpl<T, &DIID_IEditEvents, CComDynamicUnkArray>
|
||||
{
|
||||
//Warning this class may be recreated by the wizard.
|
||||
public:
|
||||
VOID Fire_Destroy(LONG nID)
|
||||
{
|
||||
try
|
||||
{
|
||||
T* pT = static_cast<T*>(this);
|
||||
int nConnectionIndex;
|
||||
CComVariant* pvars = new CComVariant[1];
|
||||
int nConnections = m_vec.GetSize();
|
||||
|
||||
for (nConnectionIndex = 0; nConnectionIndex < nConnections; nConnectionIndex++)
|
||||
{
|
||||
pT->Lock();
|
||||
CComPtr<IUnknown> sp = m_vec.GetAt(nConnectionIndex);
|
||||
pT->Unlock();
|
||||
IDispatch* pDispatch = reinterpret_cast<IDispatch*>(sp.p);
|
||||
if (pDispatch != NULL)
|
||||
{
|
||||
pvars[0] = nID;
|
||||
DISPPARAMS disp = { pvars, NULL, 1, 0 };
|
||||
pDispatch->Invoke(0x1, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, NULL, NULL, NULL);
|
||||
}
|
||||
}
|
||||
delete[] pvars;
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
// In debug mode warn the user
|
||||
_ASSERTE( FALSE );
|
||||
}
|
||||
}
|
||||
|
||||
VOID Fire_Begin(LONG nID)
|
||||
{
|
||||
try
|
||||
{
|
||||
T* pT = static_cast<T*>(this);
|
||||
int nConnectionIndex;
|
||||
CComVariant* pvars = new CComVariant[1];
|
||||
int nConnections = m_vec.GetSize();
|
||||
|
||||
for (nConnectionIndex = 0; nConnectionIndex < nConnections; nConnectionIndex++)
|
||||
{
|
||||
pT->Lock();
|
||||
CComPtr<IUnknown> sp = m_vec.GetAt(nConnectionIndex);
|
||||
pT->Unlock();
|
||||
IDispatch* pDispatch = reinterpret_cast<IDispatch*>(sp.p);
|
||||
if (pDispatch != NULL)
|
||||
{
|
||||
pvars[0] = nID;
|
||||
DISPPARAMS disp = { pvars, NULL, 1, 0 };
|
||||
pDispatch->Invoke(0xa, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, NULL, NULL, NULL);
|
||||
}
|
||||
}
|
||||
delete[] pvars;
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
// In debug mode warn the user
|
||||
_ASSERTE( FALSE );
|
||||
}
|
||||
}
|
||||
|
||||
VOID Fire_Change(LONG nID, BSTR strText)
|
||||
{
|
||||
try
|
||||
{
|
||||
T* pT = static_cast<T*>(this);
|
||||
int nConnectionIndex;
|
||||
CComVariant* pvars = new CComVariant[2];
|
||||
int nConnections = m_vec.GetSize();
|
||||
|
||||
for (nConnectionIndex = 0; nConnectionIndex < nConnections; nConnectionIndex++)
|
||||
{
|
||||
pT->Lock();
|
||||
CComPtr<IUnknown> sp = m_vec.GetAt(nConnectionIndex);
|
||||
pT->Unlock();
|
||||
IDispatch* pDispatch = reinterpret_cast<IDispatch*>(sp.p);
|
||||
if (pDispatch != NULL)
|
||||
{
|
||||
pvars[1] = nID;
|
||||
pvars[0] = strText;
|
||||
DISPPARAMS disp = { pvars, NULL, 2, 0 };
|
||||
pDispatch->Invoke(0x6, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, NULL, NULL, NULL);
|
||||
}
|
||||
}
|
||||
delete[] pvars;
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
// In debug mode warn the user
|
||||
_ASSERTE( FALSE );
|
||||
}
|
||||
}
|
||||
|
||||
VOID Fire_End(LONG nID, VARIANT_BOOL bSuccess)
|
||||
{
|
||||
try
|
||||
{
|
||||
T* pT = static_cast<T*>(this);
|
||||
int nConnectionIndex;
|
||||
CComVariant* pvars = new CComVariant[2];
|
||||
int nConnections = m_vec.GetSize();
|
||||
|
||||
for (nConnectionIndex = 0; nConnectionIndex < nConnections; nConnectionIndex++)
|
||||
{
|
||||
pT->Lock();
|
||||
CComPtr<IUnknown> sp = m_vec.GetAt(nConnectionIndex);
|
||||
pT->Unlock();
|
||||
IDispatch* pDispatch = reinterpret_cast<IDispatch*>(sp.p);
|
||||
if (pDispatch != NULL)
|
||||
{
|
||||
pvars[1] = nID;
|
||||
pvars[0] = bSuccess;
|
||||
DISPPARAMS disp = { pvars, NULL, 2, 0 };
|
||||
pDispatch->Invoke(0xb, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, NULL, NULL, NULL);
|
||||
}
|
||||
}
|
||||
delete[] pvars;
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
// In debug mode warn the user
|
||||
_ASSERTE( FALSE );
|
||||
}
|
||||
}
|
||||
};
|
||||
#endif
|
||||
11
Native/DecalControls/DecalControlsps.def
Normal file
11
Native/DecalControls/DecalControlsps.def
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
|
||||
LIBRARY "DecalControlsPS"
|
||||
|
||||
DESCRIPTION 'Proxy/Stub DLL'
|
||||
|
||||
EXPORTS
|
||||
DllGetClassObject @1 PRIVATE
|
||||
DllCanUnloadNow @2 PRIVATE
|
||||
GetProxyDllInfo @3 PRIVATE
|
||||
DllRegisterServer @4 PRIVATE
|
||||
DllUnregisterServer @5 PRIVATE
|
||||
16
Native/DecalControls/DecalControlsps.mk
Normal file
16
Native/DecalControls/DecalControlsps.mk
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
|
||||
DecalControlsps.dll: dlldata.obj DecalControls_p.obj DecalControls_i.obj
|
||||
link /dll /out:DecalControlsps.dll /def:DecalControlsps.def /entry:DllMain dlldata.obj DecalControls_p.obj DecalControls_i.obj \
|
||||
kernel32.lib rpcndr.lib rpcns4.lib rpcrt4.lib oleaut32.lib uuid.lib \
|
||||
|
||||
.c.obj:
|
||||
cl /c /Ox /DWIN32 /D_WIN32_WINNT=0x0400 /DREGISTER_PROXY_DLL \
|
||||
$<
|
||||
|
||||
clean:
|
||||
@del DecalControlsps.dll
|
||||
@del DecalControlsps.lib
|
||||
@del DecalControlsps.exp
|
||||
@del dlldata.obj
|
||||
@del DecalControls_p.obj
|
||||
@del DecalControls_i.obj
|
||||
120
Native/DecalControls/DerethMap.cpp
Normal file
120
Native/DecalControls/DerethMap.cpp
Normal file
|
|
@ -0,0 +1,120 @@
|
|||
// DerethMap.cpp : Implementation of CDecalControlsApp and DLL registration.
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "DecalControls.h"
|
||||
#include "DerethMap.h"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
cDerethMap::cDerethMap()
|
||||
{
|
||||
m_rcMapSrc.left = m_rcMapSrc.top = 100;
|
||||
m_rcMapSrc.right = m_rcMapSrc.bottom = 200;
|
||||
}
|
||||
|
||||
cDerethMap::~cDerethMap()
|
||||
{
|
||||
}
|
||||
|
||||
void cDerethMap::onCreate()
|
||||
{
|
||||
CComPtr< IButton > pRollup;
|
||||
|
||||
HRESULT hRes = ::CoCreateInstance( CLSID_Button, NULL, CLSCTX_INPROC_SERVER, IID_IButton, reinterpret_cast< void ** >( &pRollup ) );
|
||||
|
||||
_ASSERTE( SUCCEEDED( hRes ) );
|
||||
|
||||
CComPtr< ILayer > pBtnLayer;
|
||||
pRollup->QueryInterface( &pBtnLayer );
|
||||
|
||||
LayerParams lp = { 1, { 180 - 22, 0, 180, 31 }, eRenderTransparent };
|
||||
m_pSite->CreateChild( &lp, pBtnLayer );
|
||||
|
||||
pRollup->put_Matte( RGB( 0, 0, 0 ) );
|
||||
pRollup->SetImages( 0, 0x06001127, 0x06001128 );
|
||||
}
|
||||
|
||||
void cDerethMap::onDestroy()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
STDMETHODIMP cDerethMap::SchemaLoad( IView *pView, IUnknown *pSchema )
|
||||
{
|
||||
CComPtr< IPluginSite > pPlugin;
|
||||
m_pSite->get_PluginSite( &pPlugin );
|
||||
pPlugin->LoadImageSchema( pSchema, &m_pBackground );
|
||||
|
||||
pPlugin->LoadBitmapFile( _bstr_t( "MapObject.bmp" ), &m_pObjectImage );
|
||||
BSTR bstrFontName;
|
||||
pPlugin->get_FontName(&bstrFontName);
|
||||
pPlugin->CreateFont( bstrFontName /*_bstr_t( _T( "Times New Roman" ) )*/, 14, 0, &m_pFont );
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
void cDerethMap::checkFont()
|
||||
{
|
||||
if( m_pFont.p == NULL )
|
||||
{
|
||||
CComPtr< IPluginSite > pPlugin;
|
||||
m_pSite->get_PluginSite( &pPlugin );
|
||||
|
||||
BSTR bstrFontName;
|
||||
pPlugin->get_FontName(&bstrFontName);
|
||||
pPlugin->CreateFont( bstrFontName /*_bstr_t( _T( "Times New Roman" ) )*/, 14, 0, &m_pFont );
|
||||
}
|
||||
}
|
||||
|
||||
STDMETHODIMP cDerethMap::MouseEnter(struct MouseState *)
|
||||
{
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP cDerethMap::MouseExit(struct MouseState *)
|
||||
{
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP cDerethMap::MouseDown(struct MouseState *pms)
|
||||
{
|
||||
m_rcMapSrc.left += 5;
|
||||
m_rcMapSrc.right = 600;
|
||||
m_pSite->Invalidate( );
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP cDerethMap::MouseUp(struct MouseState *)
|
||||
{
|
||||
m_rcMapSrc.left += 5;
|
||||
m_rcMapSrc.right = 600;
|
||||
m_pSite->Invalidate( );
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP cDerethMap::Reformat()
|
||||
{
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP cDerethMap::Render( ICanvas *pCanvas )
|
||||
{
|
||||
_ASSERTE( pCanvas != NULL );
|
||||
_ASSERTE( m_pSite.p != NULL );
|
||||
|
||||
static POINT ptOff = { 0, 0 };
|
||||
|
||||
RECT rcPos;
|
||||
m_pSite->get_Position( &rcPos );
|
||||
|
||||
RECT rcClient = { 0, 12, rcPos.right - rcPos.left, rcPos.bottom - rcPos.top + 12 };
|
||||
|
||||
RECT rcDest = { 0, 12, rcPos.right - rcPos.left, rcPos.bottom - rcPos.top + 12 };
|
||||
|
||||
if( m_pBackground.p != NULL )
|
||||
m_pBackground->StretchBltArea( &m_rcMapSrc, pCanvas, &rcDest );
|
||||
|
||||
checkFont( );
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
92
Native/DecalControls/DerethMap.h
Normal file
92
Native/DecalControls/DerethMap.h
Normal file
|
|
@ -0,0 +1,92 @@
|
|||
// DerethMap.h: Definition of the cDerethMap class
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
#ifndef __DERETHMAP_H_
|
||||
#define __DERETHMAP_H_
|
||||
|
||||
#if !defined(AFX_DERETHMAP_H__D110354A_8D4A_485A_9379_961C3A6E445D__INCLUDED_)
|
||||
#define AFX_DERETHMAP_H__D110354A_8D4A_485A_9379_961C3A6E445D__INCLUDED_
|
||||
|
||||
#if _MSC_VER > 1000
|
||||
#pragma once
|
||||
#endif // _MSC_VER > 1000
|
||||
|
||||
#include "resource.h" // main symbols
|
||||
|
||||
#include "SinkImpl.h"
|
||||
#include "DecalControlsCP.h"
|
||||
|
||||
#define MAPSIZE_X 245
|
||||
#define MAPSIZE_Y 245
|
||||
#define MAPBORDER_X 6
|
||||
#define MAPBORDER_Y 11
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// cDerethMap
|
||||
|
||||
class ATL_NO_VTABLE cDerethMap :
|
||||
public CComObjectRootEx<CComMultiThreadModel>,
|
||||
public CComCoClass<cDerethMap,&CLSID_DerethMap>,
|
||||
public IControlImpl< cDerethMap, IDerethMap, &IID_IDerethMap, &LIBID_DecalControls >,
|
||||
public ILayerImpl< cDerethMap >,
|
||||
public ILayerRenderImpl,
|
||||
public ILayerSchema,
|
||||
public ILayerMouseImpl,
|
||||
public IProvideClassInfo2Impl< &CLSID_DerethMap, &DIID_ICommandEvents, &LIBID_DecalControls >,
|
||||
public IConnectionPointContainerImpl<cDerethMap>,
|
||||
public CProxyICommandEvents< cDerethMap >
|
||||
{
|
||||
public:
|
||||
cDerethMap();
|
||||
~cDerethMap();
|
||||
|
||||
CComPtr< IImageCache > m_pBackground;
|
||||
CComPtr< IImageCache > m_pObjectImage;
|
||||
CComPtr< IFontCache > m_pFont;
|
||||
|
||||
RECT m_rcMapSrc;
|
||||
|
||||
DECLARE_REGISTRY_RESOURCEID(IDR_DerethMap)
|
||||
|
||||
DECLARE_PROTECT_FINAL_CONSTRUCT()
|
||||
|
||||
BEGIN_COM_MAP(cDerethMap)
|
||||
COM_INTERFACE_ENTRY(ILayerRender)
|
||||
COM_INTERFACE_ENTRY(ILayerMouse)
|
||||
COM_INTERFACE_ENTRY(ILayerSchema)
|
||||
COM_INTERFACE_ENTRY(ILayer)
|
||||
COM_INTERFACE_ENTRY(IControl)
|
||||
COM_INTERFACE_ENTRY(IDispatch)
|
||||
COM_INTERFACE_ENTRY(IDerethMap)
|
||||
COM_INTERFACE_ENTRY(IProvideClassInfo)
|
||||
COM_INTERFACE_ENTRY(IProvideClassInfo2)
|
||||
COM_INTERFACE_ENTRY_IMPL(IConnectionPointContainer)
|
||||
END_COM_MAP()
|
||||
|
||||
BEGIN_CONNECTION_POINT_MAP(cDerethMap)
|
||||
CONNECTION_POINT_ENTRY(DIID_ICommandEvents)
|
||||
END_CONNECTION_POINT_MAP()
|
||||
|
||||
|
||||
void onCreate();
|
||||
void onDestroy();
|
||||
void checkFont();
|
||||
|
||||
public:
|
||||
|
||||
// ILayerMouse Methods
|
||||
STDMETHOD(MouseEnter)(struct MouseState *);
|
||||
STDMETHOD(MouseExit)(struct MouseState *);
|
||||
STDMETHOD(MouseDown)(struct MouseState *);
|
||||
STDMETHOD(MouseUp)(struct MouseState *);
|
||||
|
||||
// ILayerRender Methods
|
||||
STDMETHOD(Reformat)();
|
||||
STDMETHOD(Render)(ICanvas *pCanvas);
|
||||
|
||||
// ILayerSchema Methods
|
||||
STDMETHOD(SchemaLoad)( IView *pView, IUnknown *pSchema );
|
||||
};
|
||||
|
||||
#endif // !defined(AFX_DERETHMAP_H__D110354A_8D4A_485A_9379_961C3A6E445D__INCLUDED_)
|
||||
#endif
|
||||
23
Native/DecalControls/DerethMap.rgs
Normal file
23
Native/DecalControls/DerethMap.rgs
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
HKCR
|
||||
{
|
||||
DecalControls.DerethMap.1 = s 'DerethMap Class'
|
||||
{
|
||||
CLSID = s '{3035299A-C5FB-4CC7-A63C-66400B80DCA4}'
|
||||
}
|
||||
DecalControls.DerethMap = s 'DerethMap Class'
|
||||
{
|
||||
CLSID = s '{3035299A-C5FB-4CC7-A63C-66400B80DCA4}'
|
||||
}
|
||||
NoRemove CLSID
|
||||
{
|
||||
ForceRemove {3035299A-C5FB-4CC7-A63C-66400B80DCA4} = s 'DerethMap Class'
|
||||
{
|
||||
ProgID = s 'DecalControls.DerethMap.1'
|
||||
VersionIndependentProgID = s 'DecalControls.DerethMap'
|
||||
InprocServer32 = s '%MODULE%'
|
||||
{
|
||||
val ThreadingModel = s 'both'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
990
Native/DecalControls/Edit.cpp
Normal file
990
Native/DecalControls/Edit.cpp
Normal file
|
|
@ -0,0 +1,990 @@
|
|||
// Edit.cpp : Implementation of cEdit
|
||||
#include "stdafx.h"
|
||||
#include "DecalControls.h"
|
||||
#include "Edit.h"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// cEdit
|
||||
|
||||
#define TIMER_CARET 1
|
||||
#define TIMER_REPEAT 2
|
||||
|
||||
#define END -1
|
||||
|
||||
#ifndef MIN
|
||||
#define MIN(x,y) (((x) < (y)) ? (x) : (y))
|
||||
#endif
|
||||
#ifndef MAX
|
||||
#define MAX(x,y) (((x) > (y)) ? (x) : (y))
|
||||
#endif
|
||||
|
||||
|
||||
cEdit::cEdit()
|
||||
: m_bAllowCapture( true ), // cyn -- 15/10/2002
|
||||
m_bCapture( false ),
|
||||
m_bDrawCaret( false ),
|
||||
m_bSelecting( false ),
|
||||
m_nSelStartChar( 0 ),
|
||||
m_nSelStart( 0 ),
|
||||
m_nCaretChar( 0 ),
|
||||
m_nCaret( 0 ),
|
||||
m_nOffset( 0 ),
|
||||
m_nTextColor( 0 ),
|
||||
m_nCaretHeight( 0 )
|
||||
{
|
||||
m_szMargin.cx = 3;
|
||||
m_szMargin.cy = 1;
|
||||
}
|
||||
|
||||
void cEdit::checkFont()
|
||||
{
|
||||
if( m_pFont.p == NULL )
|
||||
{
|
||||
CComPtr< IPluginSite > pPlugin;
|
||||
m_pSite->get_PluginSite( &pPlugin );
|
||||
|
||||
BSTR bstrFontName;
|
||||
pPlugin->get_FontName(&bstrFontName);
|
||||
pPlugin->CreateFont( bstrFontName /*_bstr_t( _T( "Times New Roman" ) )*/, 14, 0, &m_pFont );
|
||||
}
|
||||
}
|
||||
|
||||
void cEdit::sendTextChange()
|
||||
{
|
||||
long nID;
|
||||
m_pSite->get_ID( &nID );
|
||||
|
||||
Fire_Change( nID, _bstr_t( m_strText.c_str() ) );
|
||||
}
|
||||
|
||||
void cEdit::Delete() {
|
||||
if (m_nCaretChar == m_nSelStartChar) {
|
||||
return;
|
||||
}
|
||||
m_strText.assign( m_strText.substr(0, MIN(m_nCaretChar, m_nSelStartChar)) + m_strText.substr(MAX(m_nCaretChar, m_nSelStartChar), m_strText.length()) );
|
||||
if (m_bPassword) { /* This is bad, someone fix it */
|
||||
m_strPass.assign( m_strPass.substr(0, MIN(m_nCaretChar, m_nSelStartChar)) + m_strPass.substr(MAX(m_nCaretChar, m_nSelStartChar), m_strPass.length()) );
|
||||
}
|
||||
m_nSelStartChar = MIN(m_nCaretChar, m_nSelStartChar);
|
||||
put_Caret( m_nSelStartChar );
|
||||
}
|
||||
|
||||
void cEdit::Copy() {
|
||||
HGLOBAL hMem;
|
||||
HRESULT hr;
|
||||
long hWnd;
|
||||
IPluginSite *Plug;
|
||||
char *lpMem;
|
||||
int Start, Length;
|
||||
|
||||
if (m_bPassword) {
|
||||
return;
|
||||
}
|
||||
|
||||
hr = m_pSite->get_PluginSite(&Plug);
|
||||
if (FAILED(hr)) {
|
||||
return;
|
||||
}
|
||||
hr = Plug->get_HWND(&hWnd);
|
||||
Plug->Release();
|
||||
Plug = NULL;
|
||||
if (FAILED(hr)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (m_nCaretChar < m_nSelStartChar) {
|
||||
Start = m_nCaretChar;
|
||||
Length = m_nSelStartChar - Start;
|
||||
} else {
|
||||
Start = m_nSelStartChar;
|
||||
Length = m_nCaretChar - Start;
|
||||
}
|
||||
|
||||
hMem = GlobalAlloc(GMEM_MOVEABLE, Length+1);
|
||||
if (!hMem) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
lpMem = (char *)GlobalLock(hMem);
|
||||
if (!lpMem) {
|
||||
GlobalFree(hMem);
|
||||
return;
|
||||
}
|
||||
|
||||
/* This is gauranteed to nul-terminate */
|
||||
lstrcpyn( lpMem, m_strText.c_str() + Start, Length + 1);
|
||||
|
||||
GlobalUnlock(hMem);
|
||||
|
||||
if (!OpenClipboard((HWND)hWnd)) {
|
||||
GlobalFree(hMem);
|
||||
return;
|
||||
}
|
||||
|
||||
EmptyClipboard();
|
||||
GetLastError();
|
||||
SetClipboardData(CF_TEXT, hMem);
|
||||
GetLastError();
|
||||
CloseClipboard();
|
||||
}
|
||||
|
||||
|
||||
void cEdit::Cut() {
|
||||
if (!m_bPassword) {
|
||||
Copy();
|
||||
Delete();
|
||||
}
|
||||
}
|
||||
|
||||
// OK, this paste code isn't pretty, but it's functional for now. Look for a full rewrite later!
|
||||
// cyn, 22/10/2002
|
||||
void cEdit::Paste() {
|
||||
HANDLE hClipboardData;
|
||||
char *sData;
|
||||
int Count, Length;
|
||||
|
||||
Delete();
|
||||
|
||||
if (!OpenClipboard(NULL)) {
|
||||
return;
|
||||
}
|
||||
|
||||
hClipboardData = GetClipboardData(CF_TEXT);
|
||||
|
||||
if (hClipboardData) {
|
||||
sData = (char *)GlobalLock(hClipboardData);
|
||||
|
||||
if (sData) {
|
||||
Length = lstrlen(sData);
|
||||
for (Count=0;Count<Length;Count++) {
|
||||
if ((sData[Count] == 13) || (sData[Count] == 10)) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
m_strText.insert(m_strText.begin() + m_nCaretChar, sData, sData + Count);
|
||||
if (m_bPassword) {
|
||||
m_strPass.insert(m_strPass.begin(), Count, '*');
|
||||
}
|
||||
put_Caret(m_nCaretChar + Count);
|
||||
GlobalUnlock(hClipboardData);
|
||||
}
|
||||
}
|
||||
|
||||
CloseClipboard();
|
||||
}
|
||||
|
||||
int cEdit::Normalize(int Offset) {
|
||||
int Length;
|
||||
Length = m_strText.length();
|
||||
if (Offset == END) {
|
||||
return Length;
|
||||
} else if (Offset < END) {
|
||||
return 0;
|
||||
} else if (Offset > Length) {
|
||||
return Length;
|
||||
}
|
||||
return Offset;
|
||||
}
|
||||
|
||||
STDMETHODIMP cEdit::Reformat()
|
||||
{
|
||||
// Just a typical post-resize type of behavior, make sure everythign is still visible as
|
||||
// the user likes.
|
||||
if( m_nCaretChar > m_strText.length() )
|
||||
put_Caret( m_strText.length() );
|
||||
else
|
||||
// Force a recalculation for scrolling
|
||||
put_Caret( m_nCaretChar );
|
||||
|
||||
//put_Caret( m_nCaretChar );
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP cEdit::Render( ICanvas *pCanvas )
|
||||
{
|
||||
HDC RenderDC;
|
||||
HRESULT hr;
|
||||
|
||||
checkFont();
|
||||
|
||||
// Draw the background
|
||||
RECT rcPos;
|
||||
m_pSite->get_Position( &rcPos );
|
||||
|
||||
RECT rcClient = { 0, 0, rcPos.right - rcPos.left, rcPos.bottom - rcPos.top };
|
||||
|
||||
if( m_pBackground.p != NULL )
|
||||
{
|
||||
static POINT ptOff = { 0, 0 };
|
||||
m_pBackground->PatBlt( pCanvas, &rcClient, &ptOff );
|
||||
}
|
||||
|
||||
RECT rcText = { m_szMargin.cx, m_szMargin.cy, rcClient.right - m_szMargin.cx, rcClient.bottom - m_szMargin.cy };
|
||||
VARIANT_BOOL bVisible;
|
||||
pCanvas->SetClipRect( &rcText, &bVisible );
|
||||
|
||||
if( !bVisible )
|
||||
// Nothing to draw huzzah!
|
||||
return S_OK;
|
||||
|
||||
long lFlags = 0;
|
||||
|
||||
if( m_bAA )
|
||||
lFlags |= eAA;
|
||||
|
||||
if( m_bOutline )
|
||||
lFlags |= eOutlined;
|
||||
|
||||
// Draw the text
|
||||
POINT ptText = { -m_nOffset, 0 };
|
||||
if( m_strText.length() > 0 )
|
||||
if (m_bPassword) {
|
||||
m_pFont->DrawTextEx( &ptText, _bstr_t( m_strPass.c_str() ), m_nTextColor, m_nOutlineColor, lFlags, pCanvas );
|
||||
} else {
|
||||
m_pFont->DrawTextEx( &ptText, _bstr_t( m_strText.c_str() ), m_nTextColor, m_nOutlineColor, lFlags, pCanvas );
|
||||
}
|
||||
|
||||
if( m_bCapture && m_bDrawCaret )
|
||||
{
|
||||
// Draw the caret
|
||||
RECT rcCaret = { m_nCaret - m_nOffset, m_szMargin.cy, m_nCaret - m_nOffset + 1, m_szMargin.cy + m_nCaretHeight };
|
||||
pCanvas->Fill( &rcCaret, m_nTextColor );
|
||||
}
|
||||
|
||||
if( m_bCapture ) // - Haz, fix for the annoying multiple edit selection ghosts
|
||||
{
|
||||
if (m_nCaretChar != m_nSelStartChar) {
|
||||
hr = pCanvas->GetDC(&RenderDC);
|
||||
if (SUCCEEDED(hr)) {
|
||||
RECT rcSelect;
|
||||
rcSelect.top = m_szMargin.cy;
|
||||
rcSelect.bottom = m_szMargin.cy + m_nCaretHeight;
|
||||
rcSelect.left = m_nSelStart - m_nOffset;
|
||||
rcSelect.right = m_nCaret - m_nOffset;
|
||||
if (rcSelect.right < rcSelect.left) {
|
||||
int t;
|
||||
t = rcSelect.left;
|
||||
rcSelect.left = rcSelect.right;
|
||||
rcSelect.right = t;
|
||||
}
|
||||
|
||||
|
||||
InvertRect(RenderDC, &rcSelect);
|
||||
pCanvas->ReleaseDC();
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP cEdit::MouseDown( MouseState *pMS )
|
||||
{
|
||||
if( !m_bCapture )
|
||||
Capture();
|
||||
else
|
||||
{
|
||||
_ASSERTE(!m_bSelecting);
|
||||
checkFont();
|
||||
|
||||
// Hit test the character and move to that position
|
||||
long nHitChar;
|
||||
if(m_bPassword)
|
||||
m_pFont->HitTest( _bstr_t( m_strPass.c_str() ), pMS->client.x + m_nOffset - m_szMargin.cx, &nHitChar );
|
||||
else
|
||||
m_pFont->HitTest( _bstr_t( m_strText.c_str() ), pMS->client.x + m_nOffset - m_szMargin.cx, &nHitChar );
|
||||
|
||||
// Reset the timer
|
||||
put_Caret( nHitChar );
|
||||
|
||||
m_bSelecting = true;
|
||||
}
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP cEdit::MouseUp(MouseState *pMS) {
|
||||
/* I assume it's possible to trigger a mouse up without a mousedown */
|
||||
m_bSelecting = false;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP cEdit::MouseMove(MouseState *pMS) {
|
||||
long nHitChar;
|
||||
|
||||
if (!m_bCapture) {
|
||||
_ASSERTE(!m_bSelecting);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
if (!m_bSelecting) {
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
checkFont();
|
||||
if (m_bPassword) {
|
||||
m_pFont->HitTest( _bstr_t( m_strPass.c_str() ), pMS->client.x + m_nOffset - m_szMargin.cx, &nHitChar );
|
||||
} else {
|
||||
m_pFont->HitTest( _bstr_t( m_strText.c_str() ), pMS->client.x + m_nOffset - m_szMargin.cx, &nHitChar );
|
||||
}
|
||||
|
||||
put_Caret(nHitChar);
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
|
||||
STDMETHODIMP cEdit::KeyboardChar( KeyState *pKS )
|
||||
{
|
||||
if (pKS->ctrl && pKS->vkey == 22) {
|
||||
Paste();
|
||||
} else if (pKS->ctrl && pKS->vkey == 3) {
|
||||
Copy();
|
||||
} else if (pKS->ctrl && pKS->vkey == 24) {
|
||||
Cut();
|
||||
} else {
|
||||
// Look for special characters
|
||||
switch( pKS->vkey )
|
||||
{
|
||||
case VK_BACK:
|
||||
if (m_nCaretChar != m_nSelStartChar) {
|
||||
Delete();
|
||||
} else {
|
||||
if( m_nCaretChar > 0 )
|
||||
{
|
||||
// Decrease the caret position
|
||||
put_Caret( m_nCaretChar - 1 );
|
||||
|
||||
// Remove the character
|
||||
m_strText.erase( m_strText.begin() + m_nCaretChar, m_strText.begin() + m_nCaretChar + 1 );
|
||||
|
||||
if(m_bPassword)
|
||||
m_strPass.erase( m_strPass.begin() + m_nCaretChar, m_strPass.begin() + m_nCaretChar + 1 );
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
// Assume every other character is being added
|
||||
if (m_nCaretChar != m_nSelStartChar) {
|
||||
Delete();
|
||||
}
|
||||
char wc[ 2 ] = { pKS->vkey, L'\0' };
|
||||
m_strText.insert( m_strText.begin() + m_nCaretChar, wc, wc + 1 );
|
||||
if(m_bPassword)
|
||||
{
|
||||
wc[0] = L'*';
|
||||
m_strPass.insert( m_strPass.begin() + m_nCaretChar, wc, wc + 1 );
|
||||
}
|
||||
put_Caret( m_nCaretChar + 1 );
|
||||
}
|
||||
}
|
||||
|
||||
m_pSite->Invalidate();
|
||||
sendTextChange();
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP cEdit::KeyboardEndCapture( VARIANT_BOOL bCancel )
|
||||
{
|
||||
if (bCancel) { // cyn, 15/10/2002
|
||||
m_bAllowCapture = false;
|
||||
}
|
||||
m_bCapture = false;
|
||||
m_pSite->EndTimer( TIMER_CARET );
|
||||
m_pSite->Invalidate();
|
||||
|
||||
long nID;
|
||||
m_pSite->get_ID( &nID );
|
||||
Fire_End( nID, ( bCancel ) ? VARIANT_FALSE : VARIANT_TRUE );
|
||||
m_bAllowCapture = true; // cyn, 15/10/2002
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP cEdit::KeyboardEvent( long nMsg, long wParam, long lParam )
|
||||
{
|
||||
const char *Start;
|
||||
int Search;
|
||||
bool Shift, OldSelecting;
|
||||
int Length;
|
||||
|
||||
if( nMsg != WM_KEYDOWN )
|
||||
// Only looking for keydown messages
|
||||
return S_OK;
|
||||
|
||||
Shift = (GetAsyncKeyState(VK_SHIFT) < 0);
|
||||
OldSelecting = m_bSelecting;
|
||||
m_bSelecting |= Shift; /* Hrrmm.. */
|
||||
|
||||
// Look for special characters
|
||||
switch( wParam )
|
||||
{
|
||||
case VK_DELETE:
|
||||
if (GetAsyncKeyState( VK_SHIFT ) < 0) {
|
||||
Cut();
|
||||
} else {
|
||||
if (m_nCaretChar != m_nSelStartChar) {
|
||||
Delete();
|
||||
} else {
|
||||
if( m_nCaretChar < m_strText.length() ) {
|
||||
// Remove the character
|
||||
m_strText.erase( m_strText.begin() + m_nCaretChar, m_strText.begin() + m_nCaretChar + 1 );
|
||||
if(m_bPassword)
|
||||
m_strPass.erase( m_strPass.begin() + m_nCaretChar, m_strPass.begin() + m_nCaretChar + 1 );
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case VK_HOME:
|
||||
put_Caret( 0 );
|
||||
break;
|
||||
|
||||
case VK_END:
|
||||
put_Caret( END );
|
||||
break;
|
||||
|
||||
case VK_INSERT: // cyn, 22/10/2002
|
||||
if (Shift) {
|
||||
m_bSelecting = false;
|
||||
Paste();
|
||||
} else if (GetAsyncKeyState( VK_CONTROL) < 0 ) {
|
||||
Copy();
|
||||
}
|
||||
break;
|
||||
|
||||
case VK_LEFT:
|
||||
if( m_nCaretChar > 0 ) {
|
||||
if (GetAsyncKeyState( VK_CONTROL ) < 0) {
|
||||
if (m_bPassword) {
|
||||
Start = m_strPass.c_str();
|
||||
} else {
|
||||
Start = m_strText.c_str();
|
||||
}
|
||||
|
||||
/* Loop until we find a non-space */
|
||||
for (Search=m_nCaretChar-1;Search>0;Search--) {
|
||||
if (Start[Search] != ' ') {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* Loop until we find a space */
|
||||
for (;Search>0;Search--) {
|
||||
if (Start[Search] == ' ') {
|
||||
Search++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (Search < 0) {
|
||||
_ASSERTE( false );
|
||||
Search = 0;
|
||||
}
|
||||
|
||||
put_Caret( Search );
|
||||
} else {
|
||||
put_Caret( m_nCaretChar - 1 );
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case VK_RIGHT:
|
||||
Length = m_strText.length();
|
||||
if( m_nCaretChar < Length ) {
|
||||
if (GetAsyncKeyState( VK_CONTROL ) < 0) {
|
||||
/* Possible change this, AC edit box is slightly different */
|
||||
if (m_bPassword) {
|
||||
Start = m_strPass.c_str();
|
||||
} else {
|
||||
Start = m_strText.c_str();
|
||||
}
|
||||
|
||||
/* Loop until we find a non-space */
|
||||
for (Search=m_nCaretChar+1;Search<Length;Search++) {
|
||||
if (Start[Search] != ' ') {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* Loop until we find a space */
|
||||
for (;Search<Length;Search++) {
|
||||
if (Start[Search] == ' ') {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* Loop until we find a non-space again, test it in notepad if you don't believe me */
|
||||
for (;Search<Length;Search++) {
|
||||
if (Start[Search] != ' ') {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* It's acceptable to go one character over the end (Search == Length) */
|
||||
if (Search > Length) {
|
||||
_ASSERTE( false );
|
||||
Search = END;
|
||||
}
|
||||
|
||||
put_Caret( Search );
|
||||
} else {
|
||||
put_Caret( m_nCaretChar + 1 );
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
// No processing
|
||||
m_bSelecting = OldSelecting;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
m_bSelecting = OldSelecting;
|
||||
m_pSite->Invalidate();
|
||||
sendTextChange();
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP cEdit::get_Text(BSTR *pVal)
|
||||
{
|
||||
_ASSERTE( pVal != NULL );
|
||||
|
||||
*pVal = T2BSTR( m_strText.c_str() );
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP cEdit::put_Text(BSTR newVal)
|
||||
{
|
||||
USES_CONVERSION;
|
||||
|
||||
m_strText = OLE2T( newVal );
|
||||
|
||||
m_strPass.assign("");
|
||||
|
||||
if(m_bPassword) {
|
||||
m_strPass.append(m_strText.length(), '*');
|
||||
}
|
||||
|
||||
m_nSelStartChar = m_nCaretChar = 0;
|
||||
|
||||
m_pSite->Invalidate();
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP cEdit::get_Caret(long *pVal)
|
||||
{
|
||||
_ASSERTE( pVal != NULL );
|
||||
|
||||
*pVal = m_nCaretChar;
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
// Only scroll within 10 pixels of the edge
|
||||
#define EDIT_HYSTERESIS 18
|
||||
|
||||
STDMETHODIMP cEdit::put_Caret(long newVal)
|
||||
{
|
||||
std::string strSample;
|
||||
|
||||
checkFont();
|
||||
|
||||
m_nCaretChar = Normalize(newVal);
|
||||
|
||||
if(m_bPassword) {
|
||||
_ASSERTE( m_strPass.length() == m_strText.length() );
|
||||
strSample.assign(m_strPass.begin(), m_strPass.begin() + m_nCaretChar);
|
||||
} else {
|
||||
strSample.assign(m_strText.begin(), m_strText.begin() + m_nCaretChar);
|
||||
}
|
||||
|
||||
|
||||
// Calculate the actual character position
|
||||
SIZE szText;
|
||||
|
||||
if (!SUCCEEDED (m_pFont->MeasureText( _bstr_t( strSample.c_str() ), &szText )))
|
||||
{
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
m_nCaretHeight = szText.cy;
|
||||
m_nCaret = szText.cx;
|
||||
|
||||
|
||||
RECT rcPosition;
|
||||
m_pSite->get_Position( &rcPosition );
|
||||
long nWidth = ( rcPosition.right - rcPosition.left ) - m_szMargin.cx * 2 - 2;
|
||||
|
||||
// Check for offset updates
|
||||
if( m_nCaret < ( m_nOffset + EDIT_HYSTERESIS ) )
|
||||
{
|
||||
// The caret has moved in front of the scroll region
|
||||
m_nOffset = m_nCaret - EDIT_HYSTERESIS;
|
||||
if( m_nOffset < 0 )
|
||||
// The offset is less thant the beginning, correct it
|
||||
m_nOffset = 0;
|
||||
}
|
||||
else if( m_nCaret > nWidth + m_nOffset )
|
||||
// The caret has moved off the end of the visible region
|
||||
// NOTE: the +1 is to account for the 1 pixel width of the caret
|
||||
m_nOffset = m_nCaret - nWidth;
|
||||
|
||||
if( m_bCapture )
|
||||
{
|
||||
// Force the caret on for a half second to make sure the user sees the new position
|
||||
m_pSite->EndTimer( TIMER_CARET );
|
||||
m_pSite->StartTimer( TIMER_CARET, 500 );
|
||||
m_bDrawCaret = true;
|
||||
}
|
||||
|
||||
if (m_bSelecting) {
|
||||
if(m_bPassword) {
|
||||
strSample.assign(m_strPass.begin(), m_strPass.begin() + m_nSelStartChar);
|
||||
} else {
|
||||
strSample.assign(m_strText.begin(), m_strText.begin() + m_nSelStartChar);
|
||||
}
|
||||
|
||||
|
||||
if (!SUCCEEDED (m_pFont->MeasureText( _bstr_t( strSample.c_str() ), &szText))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
m_nSelStart = szText.cx;
|
||||
|
||||
|
||||
} else {
|
||||
m_nSelStartChar = m_nCaretChar;
|
||||
m_nSelStart = m_nCaret;
|
||||
}
|
||||
|
||||
m_pSite->Invalidate();
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
/*
|
||||
nEnd < nStart is a valid condition
|
||||
*/
|
||||
STDMETHODIMP cEdit::Select(long nStart, long nEnd)
|
||||
{
|
||||
bool OldSelection;
|
||||
OldSelection = m_bSelecting;
|
||||
m_bSelecting = false;
|
||||
put_Caret(Normalize(nStart));
|
||||
m_bSelecting = true;
|
||||
put_Caret(Normalize(nEnd));
|
||||
m_bSelecting = OldSelection;
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
/* I think this is done */
|
||||
STDMETHODIMP cEdit::get_SelectedText(BSTR *pVal) {
|
||||
int Start, Len;
|
||||
|
||||
_ASSERTE(pVal);
|
||||
|
||||
if (m_bPassword) {
|
||||
return S_FALSE;
|
||||
}
|
||||
|
||||
if (m_nCaretChar < m_nSelStartChar) {
|
||||
Start = m_nCaretChar;
|
||||
Len = m_nSelStartChar - Start;
|
||||
} else {
|
||||
Start = m_nSelStartChar;
|
||||
Len = m_nCaretChar - Start;
|
||||
}
|
||||
*pVal = T2BSTR( m_strText.substr(Start, Len).c_str() );
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP cEdit::put_SelectedText(BSTR newVal) {
|
||||
USES_CONVERSION;
|
||||
std::string strInsert;
|
||||
int Length;
|
||||
|
||||
if (m_nCaretChar != m_nSelStartChar) {
|
||||
Delete();
|
||||
}
|
||||
|
||||
strInsert = OLE2T(newVal);
|
||||
Length = strInsert.length();
|
||||
|
||||
m_strText.insert(m_strText.begin() + m_nCaretChar, strInsert.begin(), strInsert.begin() + Length);
|
||||
if (m_bPassword) {
|
||||
m_strPass.insert(m_strPass.begin(), Length, '*');
|
||||
}
|
||||
|
||||
put_Caret( m_nCaretChar + Length );
|
||||
|
||||
m_pSite->Invalidate();
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP cEdit::TimerTimeout(long nID, long, long, VARIANT_BOOL *pbContinue)
|
||||
{
|
||||
if( nID == TIMER_CARET )
|
||||
{
|
||||
m_bDrawCaret = !m_bDrawCaret;
|
||||
m_pSite->Invalidate();
|
||||
|
||||
*pbContinue = VARIANT_TRUE;
|
||||
}
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP cEdit::SchemaLoad(IView *pView, IUnknown *pSchema)
|
||||
{
|
||||
USES_CONVERSION;
|
||||
|
||||
// Load the font and background image
|
||||
CComPtr< IPluginSite > pPlugin;
|
||||
m_pSite->get_PluginSite( &pPlugin );
|
||||
|
||||
pPlugin->CreateFontSchema( 14, 0, pSchema, &m_pFont );
|
||||
pPlugin->LoadImageSchema( pSchema, &m_pBackground );
|
||||
|
||||
MSXML::IXMLDOMElementPtr pElement = pSchema;
|
||||
|
||||
_variant_t vText = pElement->getAttribute( _T( "text" ) ),
|
||||
vTextColor = pElement->getAttribute( _T( "textcolor" ) ),
|
||||
vMarginX = pElement->getAttribute( _T( "marginx" ) ),
|
||||
vMarginY = pElement->getAttribute( _T( "marginy" ) ),
|
||||
vPassword = pElement->getAttribute( _T( "password" ) ),
|
||||
vOutline = pElement->getAttribute( _T( "outlinecolor" ) ),
|
||||
vAntialias = pElement->getAttribute( _T( "aa" ) );
|
||||
|
||||
if( vText.vt != VT_NULL )
|
||||
{
|
||||
_ASSERTE( vText.vt == VT_BSTR );
|
||||
m_strText = OLE2T( vText.bstrVal );
|
||||
}
|
||||
|
||||
if( vTextColor.vt != VT_NULL )
|
||||
{
|
||||
try
|
||||
{
|
||||
m_nTextColor = static_cast< long >( vTextColor );
|
||||
}
|
||||
catch( ... )
|
||||
{
|
||||
// Type conversion error
|
||||
_ASSERTE( FALSE );
|
||||
}
|
||||
}
|
||||
|
||||
if( vMarginX.vt != VT_NULL )
|
||||
{
|
||||
try
|
||||
{
|
||||
m_szMargin.cx = static_cast< long >( vMarginX );
|
||||
}
|
||||
catch( ... )
|
||||
{
|
||||
// Type conversion error
|
||||
_ASSERTE( FALSE );
|
||||
}
|
||||
}
|
||||
|
||||
if( vMarginY.vt != VT_NULL )
|
||||
{
|
||||
try
|
||||
{
|
||||
m_szMargin.cy = static_cast< long >( vMarginY );
|
||||
}
|
||||
catch( ... )
|
||||
{
|
||||
// Type conversion error
|
||||
_ASSERTE( FALSE );
|
||||
}
|
||||
}
|
||||
|
||||
if( vPassword.vt != VT_NULL)
|
||||
{
|
||||
try
|
||||
{
|
||||
m_bPassword = static_cast< bool >( vPassword );
|
||||
}
|
||||
catch( ... )
|
||||
{
|
||||
_ASSERTE( FALSE );
|
||||
}
|
||||
}
|
||||
else
|
||||
m_bPassword = false;
|
||||
|
||||
if( vText.vt != VT_NULL )
|
||||
{
|
||||
_ASSERTE( vText.vt == VT_BSTR );
|
||||
m_strText = OLE2T( vText.bstrVal );
|
||||
|
||||
if(m_bPassword)
|
||||
for(int i=0; i<m_strText.length(); i++)
|
||||
m_strPass.append("*");
|
||||
}
|
||||
|
||||
m_nOutlineColor = 0;
|
||||
m_bOutline = false;
|
||||
if( vOutline.vt != VT_NULL )
|
||||
{
|
||||
try
|
||||
{
|
||||
m_bOutline = true;
|
||||
m_nOutlineColor = static_cast< long >( vOutline );
|
||||
}
|
||||
catch( ... )
|
||||
{
|
||||
// Type conversion error
|
||||
_ASSERTE( FALSE );
|
||||
}
|
||||
}
|
||||
|
||||
m_bAA = true;
|
||||
if( vAntialias.vt != VT_NULL )
|
||||
{
|
||||
try
|
||||
{
|
||||
m_bAA = static_cast< bool >( vAntialias );
|
||||
}
|
||||
catch( ... )
|
||||
{
|
||||
// Type conversion error
|
||||
_ASSERTE( FALSE );
|
||||
}
|
||||
}
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP cEdit::get_Background(IImageCacheDisp **pVal)
|
||||
{
|
||||
_ASSERTE( pVal != NULL );
|
||||
|
||||
if( m_pBackground.p == NULL )
|
||||
*pVal = NULL;
|
||||
else
|
||||
m_pBackground->QueryInterface( pVal );
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP cEdit::putref_Background(IImageCacheDisp *newVal)
|
||||
{
|
||||
if( m_pBackground.p )
|
||||
m_pBackground.Release();
|
||||
|
||||
if( newVal != NULL )
|
||||
{
|
||||
HRESULT hRes = newVal->QueryInterface( &m_pBackground );
|
||||
_ASSERTE( SUCCEEDED( hRes ) );
|
||||
}
|
||||
|
||||
m_pSite->Invalidate();
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP cEdit::get_Font(IFontCacheDisp **pVal)
|
||||
{
|
||||
_ASSERTE( pVal != NULL );
|
||||
|
||||
if( m_pFont.p == NULL )
|
||||
*pVal = NULL;
|
||||
else
|
||||
m_pFont->QueryInterface( pVal );
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP cEdit::putref_Font(IFontCacheDisp *newVal)
|
||||
{
|
||||
_ASSERTE( newVal != NULL );
|
||||
|
||||
if( m_pFont.p )
|
||||
m_pFont.Release();
|
||||
|
||||
HRESULT hRes = newVal->QueryInterface( &m_pFont );
|
||||
|
||||
_ASSERTE( SUCCEEDED( hRes ) );
|
||||
|
||||
// Reformat
|
||||
put_Caret( m_nCaretChar );
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP cEdit::get_TextColor(long *pVal)
|
||||
{
|
||||
_ASSERTE( pVal != NULL );
|
||||
|
||||
*pVal = m_nTextColor;
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP cEdit::put_TextColor(long newVal)
|
||||
{
|
||||
_ASSERTE( ( newVal & 0xFF000000 ) == 0 );
|
||||
|
||||
m_nTextColor = newVal;
|
||||
m_pSite->Invalidate();
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP cEdit::SetMargins(long nX, long nY)
|
||||
{
|
||||
_ASSERTE( nX >= 0 && nY >= 0 );
|
||||
|
||||
m_szMargin.cx = nX;
|
||||
m_szMargin.cy = nY;
|
||||
put_Caret( m_nCaretChar );
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP cEdit::Capture()
|
||||
{
|
||||
_ASSERTE( !m_bCapture );
|
||||
|
||||
if ( m_bAllowCapture ) {
|
||||
m_pSite->CaptureKeyboard();
|
||||
|
||||
/* Until we actually capture the keyboard, other code can still execute */
|
||||
/* If that other code calls put_Caret (eg, put_SelectedText), the timer is set */
|
||||
/* If that timer is set, and we then try to set it again, it has an error */
|
||||
m_bCapture = true;
|
||||
m_bDrawCaret = true;
|
||||
|
||||
m_pSite->Invalidate();
|
||||
m_pSite->StartTimer( TIMER_CARET, 500 );
|
||||
|
||||
if (m_nCaretChar == m_nSelStartChar) {
|
||||
Select(0, END);
|
||||
}
|
||||
|
||||
long nID;
|
||||
m_pSite->get_ID( &nID );
|
||||
Fire_Begin( nID );
|
||||
|
||||
return S_OK;
|
||||
} else {
|
||||
return S_FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
122
Native/DecalControls/Edit.h
Normal file
122
Native/DecalControls/Edit.h
Normal file
|
|
@ -0,0 +1,122 @@
|
|||
// Edit.h : Declaration of the cEdit
|
||||
|
||||
#ifndef __EDIT_H_
|
||||
#define __EDIT_H_
|
||||
|
||||
#include "resource.h" // main symbols
|
||||
|
||||
#include "SinkImpl.h"
|
||||
#include "DecalControlsCP.h"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// cEdit
|
||||
class ATL_NO_VTABLE cEdit :
|
||||
public CComObjectRootEx<CComMultiThreadModel>,
|
||||
public CComCoClass<cEdit, &CLSID_Edit>,
|
||||
public IConnectionPointContainerImpl<cEdit>,
|
||||
public ILayerImpl< cEdit >,
|
||||
public ILayerRenderImpl,
|
||||
public ILayerMouseImpl,
|
||||
public ILayerKeyboard,
|
||||
public ILayerTimer,
|
||||
public ILayerSchema,
|
||||
public IControlImpl< cEdit, IEdit, &IID_IEdit, &LIBID_DecalControls >,
|
||||
public IProvideClassInfo2Impl< &CLSID_Edit, &DIID_IEditEvents, &LIBID_DecalControls >,
|
||||
public CProxyIEditEvents< cEdit >
|
||||
{
|
||||
public:
|
||||
cEdit();
|
||||
|
||||
CComPtr< IImageCache > m_pBackground;
|
||||
CComPtr< IFontCache > m_pFont;
|
||||
SIZE m_szMargin;
|
||||
|
||||
bool m_bAllowCapture; // cyn, 15/10/2002
|
||||
bool m_bCapture;
|
||||
bool m_bDrawCaret;
|
||||
bool m_bPassword;
|
||||
bool m_bSelecting;
|
||||
bool m_bOutline;
|
||||
bool m_bAA;
|
||||
|
||||
long m_nCaretChar, m_nCaret, m_nOffset,
|
||||
m_nCaretHeight,
|
||||
m_nSelStart, m_nSelStartChar,
|
||||
m_nTextColor, m_nOutlineColor;
|
||||
|
||||
|
||||
|
||||
std::string m_strText;
|
||||
std::string m_strPass;
|
||||
|
||||
void checkFont();
|
||||
void sendTextChange();
|
||||
void Delete();
|
||||
void Copy();
|
||||
void Cut();
|
||||
void Paste();
|
||||
int Normalize(int Offset);
|
||||
|
||||
DECLARE_REGISTRY_RESOURCEID(IDR_EDIT)
|
||||
|
||||
DECLARE_PROTECT_FINAL_CONSTRUCT()
|
||||
|
||||
BEGIN_COM_MAP(cEdit)
|
||||
COM_INTERFACE_ENTRY(ILayerRender)
|
||||
COM_INTERFACE_ENTRY(ILayerMouse)
|
||||
COM_INTERFACE_ENTRY(ILayerKeyboard)
|
||||
COM_INTERFACE_ENTRY(ILayerTimer)
|
||||
COM_INTERFACE_ENTRY(ILayerSchema)
|
||||
COM_INTERFACE_ENTRY(ILayer)
|
||||
COM_INTERFACE_ENTRY(IEdit)
|
||||
COM_INTERFACE_ENTRY(IControl)
|
||||
COM_INTERFACE_ENTRY(IDispatch)
|
||||
COM_INTERFACE_ENTRY(IProvideClassInfo)
|
||||
COM_INTERFACE_ENTRY(IProvideClassInfo2)
|
||||
COM_INTERFACE_ENTRY_IMPL(IConnectionPointContainer)
|
||||
END_COM_MAP()
|
||||
|
||||
BEGIN_CONNECTION_POINT_MAP(cEdit)
|
||||
CONNECTION_POINT_ENTRY(DIID_IEditEvents)
|
||||
END_CONNECTION_POINT_MAP()
|
||||
|
||||
public:
|
||||
// IEdit Methods
|
||||
STDMETHOD(get_SelectedText)(/*[out, retval]*/ BSTR *pVal);
|
||||
STDMETHOD(put_SelectedText)(/*[in]*/ BSTR newVal);
|
||||
STDMETHOD(Select)(long nStart, long nEnd);
|
||||
STDMETHOD(get_Caret)(/*[out, retval]*/ long *pVal);
|
||||
STDMETHOD(put_Caret)(/*[in]*/ long newVal);
|
||||
STDMETHOD(get_Text)(/*[out, retval]*/ BSTR *pVal);
|
||||
STDMETHOD(put_Text)(/*[in]*/ BSTR newVal);
|
||||
STDMETHOD(SetMargins)(long nX, long nY);
|
||||
STDMETHOD(get_TextColor)(/*[out, retval]*/ long *pVal);
|
||||
STDMETHOD(put_TextColor)(/*[in]*/ long newVal);
|
||||
STDMETHOD(get_Font)(/*[out, retval]*/ IFontCacheDisp * *pVal);
|
||||
STDMETHOD(putref_Font)(/*[in]*/ IFontCacheDisp * newVal);
|
||||
STDMETHOD(get_Background)(/*[out, retval]*/ IImageCacheDisp * *pVal);
|
||||
STDMETHOD(putref_Background)(/*[in]*/ IImageCacheDisp * newVal);
|
||||
STDMETHOD(Capture)();
|
||||
|
||||
// ILayerRender Methods
|
||||
STDMETHOD(Reformat)();
|
||||
STDMETHOD(Render)(ICanvas *pCanvas);
|
||||
|
||||
// ILayerMouse Methods
|
||||
STDMETHOD(MouseDown)(MouseState *pMS);
|
||||
STDMETHOD(MouseUp)(MouseState *pMS);
|
||||
STDMETHOD(MouseMove)(MouseState *pMS);
|
||||
|
||||
// ILayerKeyboard Methods
|
||||
STDMETHOD(KeyboardChar)(KeyState *pKS);
|
||||
STDMETHOD(KeyboardEndCapture)(VARIANT_BOOL bCancel);
|
||||
STDMETHOD(KeyboardEvent)( long uMsg, long wParam, long lParam );
|
||||
|
||||
// ILayerTimer Methods
|
||||
STDMETHOD(TimerTimeout)(long nID, long nInterval, long nReps, VARIANT_BOOL *pbContinue);
|
||||
|
||||
// ILayerSchema Methods
|
||||
STDMETHOD(SchemaLoad)(IView *pView, IUnknown *pSchema);
|
||||
};
|
||||
|
||||
#endif //__EDIT_H_
|
||||
25
Native/DecalControls/Edit.rgs
Normal file
25
Native/DecalControls/Edit.rgs
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
HKCR
|
||||
{
|
||||
DecalControls.Edit.1 = s 'DecalControls Edit'
|
||||
{
|
||||
CLSID = s '{8E8F88D2-AA47-474E-9DB7-912D49C8BE9D}'
|
||||
}
|
||||
DecalControls.Edit = s 'DecalControls Edit'
|
||||
{
|
||||
CLSID = s '{8E8F88D2-AA47-474E-9DB7-912D49C8BE9D}'
|
||||
CurVer = s 'DecalControls.Edit.1'
|
||||
}
|
||||
NoRemove CLSID
|
||||
{
|
||||
ForceRemove {8E8F88D2-AA47-474E-9DB7-912D49C8BE9D} = s 'DecalControls Edit'
|
||||
{
|
||||
ProgID = s 'DecalControls.Edit.1'
|
||||
VersionIndependentProgID = s 'DecalControls.Edit'
|
||||
InprocServer32 = s '%MODULE%'
|
||||
{
|
||||
val ThreadingModel = s 'Both'
|
||||
}
|
||||
'TypeLib' = s '{1C4B007A-04DD-4DF8-BA29-2CFBD0220B89}'
|
||||
}
|
||||
}
|
||||
}
|
||||
36
Native/DecalControls/FixedLayout.cpp
Normal file
36
Native/DecalControls/FixedLayout.cpp
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
// Client.cpp : Implementation of cClient
|
||||
#include "stdafx.h"
|
||||
#include "DecalControls.h"
|
||||
#include "FixedLayout.h"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// cClient
|
||||
|
||||
void cFixedLayout::onSchemaLoad( IView *pView, MSXML::IXMLDOMElementPtr &pElement )
|
||||
{
|
||||
// Create all child controls from schema and let them be
|
||||
// placed wherever they like
|
||||
MSXML::IXMLDOMElementPtr pChild;
|
||||
for( MSXML::IXMLDOMNodeListPtr pChildren = pElement->selectNodes( _T( "control" ) );
|
||||
( pChild = pChildren->nextNode() ).GetInterfacePtr() != NULL; )
|
||||
loadChildControl( pView, pChild );
|
||||
}
|
||||
|
||||
STDMETHODIMP cFixedLayout::CreateChild(LayerParams *params, ILayer *pSink)
|
||||
{
|
||||
m_pSite->CreateChild( params, pSink );
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP cFixedLayout::PositionChild(long nID, LPRECT prcNew)
|
||||
{
|
||||
CComPtr< ILayerSite > pChildSite;
|
||||
HRESULT hRes = m_pSite->get_Child( nID, ePositionByID, &pChildSite );
|
||||
|
||||
_ASSERTE( SUCCEEDED( hRes ) );
|
||||
|
||||
pChildSite->put_Position( prcNew );
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
57
Native/DecalControls/FixedLayout.h
Normal file
57
Native/DecalControls/FixedLayout.h
Normal file
|
|
@ -0,0 +1,57 @@
|
|||
// Client.h : Declaration of the cClient
|
||||
|
||||
#ifndef __FIXEDLAYOUT_H_
|
||||
#define __FIXEDLAYOUT_H_
|
||||
|
||||
#include "resource.h" // main symbols
|
||||
|
||||
#include "SinkImpl.h"
|
||||
#include "ControlImpl.h"
|
||||
#include "DecalControlsCP.h"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// cClient
|
||||
class ATL_NO_VTABLE cFixedLayout :
|
||||
public CComObjectRootEx<CComMultiThreadModel>,
|
||||
public CComCoClass<cFixedLayout, &CLSID_FixedLayout>,
|
||||
public ILayerImpl< cFixedLayout >,
|
||||
public ILayoutImpl< cFixedLayout, IFixedLayout, &IID_ILayout, &LIBID_DecalControls >,
|
||||
public IProvideClassInfo2Impl< &CLSID_FixedLayout, &DIID_IControlEvents, &LIBID_DecalControls >,
|
||||
public IConnectionPointContainerImpl<cFixedLayout>,
|
||||
public CProxyIControlEvents< cFixedLayout >
|
||||
{
|
||||
public:
|
||||
cFixedLayout()
|
||||
{
|
||||
}
|
||||
|
||||
void onSchemaLoad( IView *pView, MSXML::IXMLDOMElementPtr &pElement );
|
||||
|
||||
DECLARE_REGISTRY_RESOURCEID(IDR_FIXEDLAYOUT)
|
||||
|
||||
DECLARE_PROTECT_FINAL_CONSTRUCT()
|
||||
|
||||
BEGIN_COM_MAP(cFixedLayout)
|
||||
COM_INTERFACE_ENTRY(ILayerRender)
|
||||
COM_INTERFACE_ENTRY(ILayerSchema)
|
||||
COM_INTERFACE_ENTRY(ILayer)
|
||||
COM_INTERFACE_ENTRY(IDispatch)
|
||||
COM_INTERFACE_ENTRY(IControl)
|
||||
COM_INTERFACE_ENTRY(ILayout)
|
||||
COM_INTERFACE_ENTRY(IFixedLayout)
|
||||
COM_INTERFACE_ENTRY(IProvideClassInfo)
|
||||
COM_INTERFACE_ENTRY(IProvideClassInfo2)
|
||||
COM_INTERFACE_ENTRY_IMPL(IConnectionPointContainer)
|
||||
END_COM_MAP()
|
||||
|
||||
BEGIN_CONNECTION_POINT_MAP(cFixedLayout)
|
||||
CONNECTION_POINT_ENTRY(DIID_IControlEvents)
|
||||
END_CONNECTION_POINT_MAP()
|
||||
|
||||
public:
|
||||
// IFixedLayout Methods
|
||||
STDMETHOD(CreateChild)(struct LayerParams *params, ILayer *pSink);
|
||||
STDMETHOD(PositionChild)(long nID, LPRECT prcNew);
|
||||
};
|
||||
|
||||
#endif //__CLIENT_H_
|
||||
25
Native/DecalControls/FixedLayout.rgs
Normal file
25
Native/DecalControls/FixedLayout.rgs
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
HKCR
|
||||
{
|
||||
DecalControls.FixedLayout.1 = s 'DecalControls FixedLayout'
|
||||
{
|
||||
CLSID = s '{CD6556CD-F8D9-4CB0-AB7C-7C33058294E4}'
|
||||
}
|
||||
DecalControls.FixedLayout = s 'DecalControls FixedLayout'
|
||||
{
|
||||
CLSID = s '{CD6556CD-F8D9-4CB0-AB7C-7C33058294E4}'
|
||||
CurVer = s 'DecalControls.FixedLayout.1'
|
||||
}
|
||||
NoRemove CLSID
|
||||
{
|
||||
ForceRemove {CD6556CD-F8D9-4CB0-AB7C-7C33058294E4} = s 'DecalControls FixedLayout'
|
||||
{
|
||||
ProgID = s 'DecalControls.FixedLayout.1'
|
||||
VersionIndependentProgID = s 'DecalControls.FixedLayout'
|
||||
InprocServer32 = s '%MODULE%'
|
||||
{
|
||||
val ThreadingModel = s 'Both'
|
||||
}
|
||||
'TypeLib' = s '{1C4B007A-04DD-4DF8-BA29-2CFBD0220B89}'
|
||||
}
|
||||
}
|
||||
}
|
||||
95
Native/DecalControls/IconColumn.cpp
Normal file
95
Native/DecalControls/IconColumn.cpp
Normal file
|
|
@ -0,0 +1,95 @@
|
|||
// IconColumn.cpp : Implementation of cIconColumn
|
||||
#include "stdafx.h"
|
||||
#include "DecalControls.h"
|
||||
#include "IconColumn.h"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// cIconColumn
|
||||
|
||||
|
||||
STDMETHODIMP cIconColumn::get_FixedWidth(VARIANT_BOOL *pVal)
|
||||
{
|
||||
*pVal = VARIANT_TRUE;
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP cIconColumn::get_Width(long *pVal)
|
||||
{
|
||||
*pVal = 20;
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
|
||||
STDMETHODIMP cIconColumn::put_Width(long newVal)
|
||||
{
|
||||
//m_Width = newVal;
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP cIconColumn::Render(ICanvas *pCanvas, LPPOINT ptCell, long nColor)
|
||||
{
|
||||
_variant_t vIconLib, vIcon;
|
||||
|
||||
m_pList->get_Data( ptCell->x, ptCell->y, 0, &vIconLib );
|
||||
m_pList->get_Data( ptCell->x, ptCell->y, 1, &vIcon );
|
||||
|
||||
// Converted nicely now ...
|
||||
// Find our checked and unchecked images
|
||||
CComPtr< IIconCache > pIcons;
|
||||
|
||||
SIZE sz = { 16, 16 };
|
||||
m_pSite->GetIconCache( &sz, &pIcons );
|
||||
|
||||
POINT pt = { 2, 2 };
|
||||
pIcons->DrawIcon( &pt, static_cast< long >( vIcon ), static_cast< long >( vIconLib ), pCanvas );
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP cIconColumn::get_DataColumns(long *pVal)
|
||||
{
|
||||
*pVal = 2;
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP cIconColumn::Initialize(IList *newVal, IPluginSite *pSite)
|
||||
{
|
||||
m_pList = newVal;
|
||||
m_pSite = pSite;
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP cIconColumn::SchemaLoad(IUnknown *pSchema)
|
||||
{
|
||||
// TODO: Add your implementation code here
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP cIconColumn::get_Height(long *pVal)
|
||||
{
|
||||
*pVal = 20;
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP cIconColumn::Activate(LPPOINT ptCell)
|
||||
{
|
||||
// TODO: Add your implementation code here
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP cIconColumn::get_Color(long nRow, long *pVal)
|
||||
{
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP cIconColumn::put_Color(long nRow, long newVal)
|
||||
{
|
||||
return S_OK;
|
||||
}
|
||||
46
Native/DecalControls/IconColumn.h
Normal file
46
Native/DecalControls/IconColumn.h
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
// IconColumn.h : Declaration of the cIconColumn
|
||||
|
||||
#ifndef __ICONCOLUMN_H_
|
||||
#define __ICONCOLUMN_H_
|
||||
|
||||
#include "resource.h" // main symbols
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// cIconColumn
|
||||
class ATL_NO_VTABLE cIconColumn :
|
||||
public CComObjectRootEx<CComMultiThreadModel>,
|
||||
public CComCoClass<cIconColumn, &CLSID_IconColumn>,
|
||||
public IListColumn
|
||||
{
|
||||
public:
|
||||
cIconColumn()
|
||||
{
|
||||
}
|
||||
|
||||
CComPtr< IList > m_pList;
|
||||
CComPtr< IPluginSite > m_pSite;
|
||||
|
||||
DECLARE_REGISTRY_RESOURCEID(IDR_ICONCOLUMN)
|
||||
|
||||
DECLARE_PROTECT_FINAL_CONSTRUCT()
|
||||
|
||||
BEGIN_COM_MAP(cIconColumn)
|
||||
COM_INTERFACE_ENTRY(IListColumn)
|
||||
END_COM_MAP()
|
||||
|
||||
// IListColumn
|
||||
public:
|
||||
STDMETHOD(get_Color)(long nRow, /*[out, retval]*/ long *pVal);
|
||||
STDMETHOD(put_Color)(long nRow, /*[in]*/ long newVal);
|
||||
STDMETHOD(Activate)(LPPOINT ptCell);
|
||||
STDMETHOD(get_Height)(/*[out, retval]*/ long *pVal);
|
||||
STDMETHOD(SchemaLoad)(IUnknown *pSchema);
|
||||
STDMETHOD(Initialize)(/*[in]*/ IList * newVal, IPluginSite *pSite);
|
||||
STDMETHOD(get_DataColumns)(/*[out, retval]*/ long *pVal);
|
||||
STDMETHOD(Render)(ICanvas *, LPPOINT ptCell, long nColor);
|
||||
STDMETHOD(get_Width)(/*[out, retval]*/ long *pVal);
|
||||
STDMETHOD(get_FixedWidth)(/*[out, retval]*/ VARIANT_BOOL *pVal);
|
||||
STDMETHOD(put_Width)(/*[in]*/ long newVal);
|
||||
};
|
||||
|
||||
#endif //__ICONCOLUMN_H_
|
||||
25
Native/DecalControls/IconColumn.rgs
Normal file
25
Native/DecalControls/IconColumn.rgs
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
HKCR
|
||||
{
|
||||
DecalControls.IconColumn.1 = s 'DecalControls IconColumn'
|
||||
{
|
||||
CLSID = s '{F12A2C4C-3B78-46EB-8722-68B27A75AE55}'
|
||||
}
|
||||
DecalControls.IconColumn = s 'DecalControls IconColumn'
|
||||
{
|
||||
CLSID = s '{F12A2C4C-3B78-46EB-8722-68B27A75AE55}'
|
||||
CurVer = s 'DecalControls.IconColumn.1'
|
||||
}
|
||||
NoRemove CLSID
|
||||
{
|
||||
ForceRemove {F12A2C4C-3B78-46EB-8722-68B27A75AE55} = s 'DecalControls IconColumn'
|
||||
{
|
||||
ProgID = s 'DecalControls.IconColumn.1'
|
||||
VersionIndependentProgID = s 'DecalControls.IconColumn'
|
||||
InprocServer32 = s '%MODULE%'
|
||||
{
|
||||
val ThreadingModel = s 'Both'
|
||||
}
|
||||
'TypeLib' = s '{3559E08B-827E-4DFE-9D33-3567246849CC}'
|
||||
}
|
||||
}
|
||||
}
|
||||
656
Native/DecalControls/List.cpp
Normal file
656
Native/DecalControls/List.cpp
Normal file
|
|
@ -0,0 +1,656 @@
|
|||
// List.cpp : Implementation of cList
|
||||
#include "stdafx.h"
|
||||
#include "DecalControls.h"
|
||||
#include "List.h"
|
||||
|
||||
#include "ListView.h"
|
||||
|
||||
enum eListChild
|
||||
{
|
||||
eListScroller = 1,
|
||||
eListView = 1000
|
||||
};
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// cList
|
||||
|
||||
cList::cRow::cRow( long nDataWidth )
|
||||
: m_pData( new VARIANT[ nDataWidth ] ),
|
||||
m_pEndData( m_pData + nDataWidth ),
|
||||
m_bInvalid( true ),
|
||||
m_colors( NULL ) /* cyn - 07/08/2002 */
|
||||
{
|
||||
for( VARIANT *i_var = m_pData; i_var != m_pEndData; ++ i_var )
|
||||
::VariantInit( i_var );
|
||||
|
||||
}
|
||||
|
||||
cList::cRow::cRow( const cRow &row )
|
||||
: m_pData( row.m_pData ),
|
||||
m_pEndData( row.m_pEndData ),
|
||||
m_bInvalid( row.m_bInvalid ),
|
||||
m_colors( row.m_colors ) /* cyn - 07/08/2002 -- This is the real fix, the rest of */
|
||||
/* the changes just make it faster */
|
||||
{
|
||||
_ASSERTE( _CrtIsValidHeapPointer( m_pData ) );
|
||||
row.m_pData = NULL;
|
||||
row.m_colors = NULL;
|
||||
}
|
||||
|
||||
cList::cRow::~cRow()
|
||||
{
|
||||
if( m_pData != NULL )
|
||||
{
|
||||
_ASSERTE( _CrtIsValidHeapPointer( m_pData ) );
|
||||
for( VARIANT *i_var = m_pData; i_var != m_pEndData; ++ i_var )
|
||||
{
|
||||
HRESULT hRes = ::VariantClear( i_var );
|
||||
_ASSERTE( SUCCEEDED( hRes ) );
|
||||
}
|
||||
|
||||
delete[] m_pData;
|
||||
}
|
||||
|
||||
if (m_colors) { /* cyn - 07/08/2002 */
|
||||
delete[] m_colors;
|
||||
}
|
||||
}
|
||||
|
||||
cList::cRow &cList::cRow::operator =( const cRow &row )
|
||||
{
|
||||
|
||||
|
||||
// Clear out our current data - if any
|
||||
if( m_pData != NULL )
|
||||
{
|
||||
_ASSERTE( _CrtIsValidHeapPointer( m_pData ) );
|
||||
for( VARIANT *i_var = m_pData; i_var != m_pEndData; ++ i_var )
|
||||
{
|
||||
HRESULT hRes = ::VariantClear( i_var );
|
||||
_ASSERTE( SUCCEEDED( hRes ) );
|
||||
}
|
||||
|
||||
delete[] m_pData;
|
||||
m_pData = NULL;
|
||||
}
|
||||
|
||||
_ASSERTE( _CrtIsValidHeapPointer( row.m_pData ) );
|
||||
|
||||
m_pData = row.m_pData;
|
||||
m_pEndData = row.m_pEndData;
|
||||
m_bInvalid = row.m_bInvalid;
|
||||
|
||||
if (m_colors) { /* cyn - 07/08/2002 */
|
||||
delete[] m_colors;
|
||||
}
|
||||
m_colors = row.m_colors;
|
||||
row.m_colors = NULL;
|
||||
|
||||
row.m_pData = NULL;
|
||||
|
||||
_ASSERTMEM( _CrtCheckMemory() );
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
STDMETHODIMP cList::AddColumn(IListColumn *pNewColumn, long *nIndex)
|
||||
{
|
||||
_ASSERTE( pNewColumn != NULL );
|
||||
_ASSERTE( nIndex != NULL );
|
||||
|
||||
// We can only add columns before there are data rows
|
||||
_ASSERTE( m_rows.size() == 0 );
|
||||
|
||||
// Looking good, make up the record
|
||||
cColumn c;
|
||||
c.m_pColumn = pNewColumn;
|
||||
c.m_nDataLeft = ( m_cols.size() == 0 ) ? 0 : m_cols.back().m_nDataRight;
|
||||
|
||||
CComPtr< IPluginSite > pPluginSite;
|
||||
m_pSite->get_PluginSite( &pPluginSite );
|
||||
|
||||
long nDataSize;
|
||||
pNewColumn->get_DataColumns( &nDataSize );
|
||||
c.m_nDataRight = c.m_nDataLeft + nDataSize;
|
||||
|
||||
pNewColumn->Initialize( this, pPluginSite );
|
||||
|
||||
CComPtr< ILayerMouse > pMouse;
|
||||
c.m_bSupportsMouse = !!SUCCEEDED( pNewColumn->QueryInterface( &pMouse ) );
|
||||
|
||||
m_cols.push_back( c );
|
||||
|
||||
// Reformat will fill in column lefts and rights
|
||||
m_pSite->Reformat();
|
||||
|
||||
*nIndex = ( m_cols.size() - 1 );
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP cList::AddRow(long *pnNewIndex)
|
||||
{
|
||||
_ASSERTE( pnNewIndex != NULL );
|
||||
|
||||
// There must be at least one column defined
|
||||
_ASSERTE( m_cols.size() > 0 );
|
||||
|
||||
m_rows.push_back( cRow( m_cols.back().m_nDataRight ) );
|
||||
long nSize = m_rows.size();
|
||||
|
||||
Reformat();
|
||||
m_pSite->Reformat();
|
||||
|
||||
if( m_bAutoScroll == true )
|
||||
{
|
||||
POINT ptCurrent;
|
||||
m_pScroller->get_Offset( &ptCurrent );
|
||||
|
||||
ptCurrent.y = m_rows.size();
|
||||
|
||||
m_pScroller->ScrollTo( &ptCurrent );
|
||||
|
||||
Reformat();
|
||||
m_pSite->Reformat();
|
||||
}
|
||||
|
||||
*pnNewIndex = ( nSize - 1 );
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP cList::DeleteRow(long nIndex)
|
||||
{
|
||||
_ASSERTE( nIndex >= 0 );
|
||||
_ASSERTE( nIndex < m_rows.size() );
|
||||
|
||||
m_rows.erase( m_rows.begin() + nIndex );
|
||||
|
||||
// Start at that index and invalidate all rows below that point
|
||||
m_pView->InvalidateFrom( nIndex );
|
||||
for( cRowList::iterator i_row = m_rows.begin() + nIndex; i_row != m_rows.end(); ++ i_row )
|
||||
i_row->m_bInvalid = true;
|
||||
|
||||
m_pSite->Invalidate();
|
||||
m_pSite->Reformat();
|
||||
|
||||
POINT offset;
|
||||
::memset (&offset, 0, sizeof (offset));
|
||||
|
||||
m_pScroller->get_Offset (&offset);
|
||||
|
||||
if (offset.y > nIndex )
|
||||
{
|
||||
// TODO: This isn't perfect, if items are removed from the bottom of the list when
|
||||
// you're scrolled to the middle, this will cause it to scroll up a line. It does
|
||||
// solve the problem of lists 'losing' items when the thumb goes away though.
|
||||
|
||||
// Note by Haz - I changed the above from if( offset.y > 0 ) - seems to fix problem :)
|
||||
offset.y--;
|
||||
m_pScroller->ScrollTo (&offset);
|
||||
}
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP cList::get_Data(long nX, long nY, long nSubValue, VARIANT *pVal)
|
||||
{
|
||||
_ASSERTE( m_cols.size() > 0 );
|
||||
_ASSERTE( nX >= 0 );
|
||||
_ASSERTE( nX < m_cols.back().m_nDataRight );
|
||||
_ASSERTE( nSubValue >= 0 );
|
||||
_ASSERTE( nSubValue < ( m_cols[ nX ].m_nDataRight - m_cols[ nX ].m_nDataLeft ) );
|
||||
_ASSERTE( nY >= 0 );
|
||||
_ASSERTE( nY < m_rows.size() );
|
||||
_ASSERTE( pVal != NULL );
|
||||
|
||||
cRow &rowData = m_rows[ nY ];
|
||||
HRESULT hRes = ::VariantCopy( pVal, rowData.m_pData + ( m_cols[ nX ].m_nDataLeft + nSubValue ) );
|
||||
_ASSERTE( SUCCEEDED( hRes ) );
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP cList::put_Data(long nX, long nY, long nSubValue, VARIANT *newVal)
|
||||
{
|
||||
_ASSERTE( m_cols.size() > 0 );
|
||||
_ASSERTE( nX >= 0 );
|
||||
_ASSERTE( nX < m_cols.back().m_nDataRight );
|
||||
_ASSERTE( nSubValue >= 0 );
|
||||
_ASSERTE( nSubValue < ( m_cols[ nX ].m_nDataRight - m_cols[ nX ].m_nDataLeft ) );
|
||||
_ASSERTE( nY >= 0 );
|
||||
_ASSERTE( nY < m_rows.size() );
|
||||
_ASSERTE( newVal != NULL );
|
||||
|
||||
if( nY >= m_rows.size() )
|
||||
return E_FAIL;
|
||||
|
||||
cRow &rowData = m_rows[ nY ];
|
||||
|
||||
long lDataColumns = 0;
|
||||
m_cols[ nX ].m_pColumn->get_DataColumns( &lDataColumns );
|
||||
|
||||
if( nSubValue > lDataColumns )
|
||||
return E_FAIL;
|
||||
|
||||
HRESULT hRes = ::VariantCopy( rowData.m_pData + ( m_cols[ nX ].m_nDataLeft + nSubValue ), newVal );
|
||||
_ASSERTE( SUCCEEDED( hRes ) );
|
||||
rowData.m_bInvalid = true;
|
||||
|
||||
m_pSite->Invalidate();
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP cList::get_CellRect(LPPOINT pt, LPRECT pVal)
|
||||
{
|
||||
_ASSERTE( pt != NULL );
|
||||
_ASSERTE( m_cols.size() > 0 );
|
||||
_ASSERTE( pt->x >= 0 );
|
||||
_ASSERTE( pt->x < m_cols.back().m_nDataRight );
|
||||
_ASSERTE( pt->y >= 0 );
|
||||
_ASSERTE( pt->y < m_rows.size() );
|
||||
_ASSERTE( pVal != NULL );
|
||||
|
||||
pVal->top = pt->y * m_nRowHeight;
|
||||
pVal->bottom = ( pt->y + 1 ) * m_nRowHeight;
|
||||
pVal->left = m_cols[ pt->x ].m_nLeft;
|
||||
pVal->right = m_cols[ pt->y ].m_nRight;
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
void cList::onCreate()
|
||||
{
|
||||
// Create the scoller and the scroller client object
|
||||
CComPtr< ILayer > pScrollerLayer;
|
||||
|
||||
HRESULT hRes = ::CoCreateInstance( CLSID_Scroller, NULL, CLSCTX_INPROC_SERVER,
|
||||
__uuidof( ILayer ), reinterpret_cast< void ** >( &pScrollerLayer ) );
|
||||
|
||||
_ASSERTE( SUCCEEDED( hRes ) );
|
||||
|
||||
// Will reposition on reformat
|
||||
LayerParams p = { eListScroller, { 0, 0, 0, 0 }, eRenderClipped };
|
||||
|
||||
m_pSite->CreateChild( &p, pScrollerLayer );
|
||||
pScrollerLayer->QueryInterface( &m_pScroller );
|
||||
|
||||
CComObject< cListView > *pView;
|
||||
CComObject< cListView >::CreateInstance( &pView );
|
||||
|
||||
m_pScroller->CreateClient( pView );
|
||||
m_pView = pView;
|
||||
|
||||
// Configure the scroller
|
||||
|
||||
SIZE szIncrement = { 100, 20 };
|
||||
m_pScroller->put_Increments( &szIncrement );
|
||||
m_pScroller->put_HorizontalEnabled( VARIANT_FALSE );
|
||||
m_pScroller->put_VerticalEnabled( VARIANT_TRUE );
|
||||
|
||||
pView->m_pList = this;
|
||||
|
||||
m_pSite->put_Transparent( VARIANT_FALSE );
|
||||
}
|
||||
|
||||
void cList::onDestroy()
|
||||
{
|
||||
// Release all of our references
|
||||
m_pView.Release();
|
||||
m_pScroller.Release();
|
||||
|
||||
// Kill the data
|
||||
m_cols.clear();
|
||||
m_rows.clear();
|
||||
}
|
||||
|
||||
STDMETHODIMP cList::Reformat()
|
||||
{
|
||||
// Recalculate the column widths and reposition the child control
|
||||
RECT rc;
|
||||
m_pSite->get_Position( &rc );
|
||||
|
||||
RECT rcScroller = { 0, 0, rc.right - rc.left, rc.bottom - rc.top };
|
||||
CComPtr< ILayerSite > pScrollerSite;
|
||||
HRESULT hRes = m_pSite->get_Child( eListScroller, ePositionByID, &pScrollerSite );
|
||||
_ASSERTE( SUCCEEDED( hRes ) );
|
||||
|
||||
pScrollerSite->put_Position( &rcScroller );
|
||||
|
||||
SIZE szClient;
|
||||
m_pScroller->get_Viewport( &szClient );
|
||||
|
||||
// Ok, setup the list view objects (note there is cache for a partial row at the top and bottom)
|
||||
m_pView->SetCacheInfo( m_nRowHeight, ( szClient.cy / m_nRowHeight ) + 2 );
|
||||
|
||||
szClient.cy = m_nRowHeight * m_rows.size();
|
||||
|
||||
m_pScroller->put_Area( &szClient );
|
||||
|
||||
// Last, calculate the column widths
|
||||
long nFixedWidthsTotal = 0,
|
||||
nVariableCount = 0;
|
||||
|
||||
// First pass adds up the fixed widths
|
||||
{
|
||||
for( cColumnList::iterator i = m_cols.begin(); i != m_cols.end(); ++ i )
|
||||
{
|
||||
VARIANT_BOOL bFixed;
|
||||
i->m_pColumn->get_FixedWidth( &bFixed );
|
||||
|
||||
if( bFixed )
|
||||
{
|
||||
long nWidth;
|
||||
i->m_pColumn->get_Width( &nWidth );
|
||||
|
||||
nFixedWidthsTotal += nWidth;
|
||||
}
|
||||
else
|
||||
++ nVariableCount;
|
||||
}
|
||||
}
|
||||
|
||||
// Next pass sets the widths
|
||||
//_ASSERTE( nFixedWidthsTotal < szClient.cx );
|
||||
|
||||
long nPosition = 0;
|
||||
|
||||
for( cColumnList::iterator i = m_cols.begin(); i != m_cols.end(); ++ i )
|
||||
{
|
||||
VARIANT_BOOL bFixed;
|
||||
i->m_pColumn->get_FixedWidth( &bFixed );
|
||||
|
||||
i->m_nLeft = nPosition;
|
||||
|
||||
if( bFixed )
|
||||
{
|
||||
long nWidth;
|
||||
i->m_pColumn->get_Width( &nWidth );
|
||||
i->m_nRight = i->m_nLeft + nWidth;
|
||||
}
|
||||
else
|
||||
i->m_nRight = i->m_nLeft + ( szClient.cx - nFixedWidthsTotal ) / nVariableCount;
|
||||
|
||||
nPosition = i->m_nRight;
|
||||
}
|
||||
|
||||
_ASSERTMEM( _CrtCheckMemory( ) );
|
||||
|
||||
_ASSERT(0==0);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP cList::put_RowEstimate(long newVal)
|
||||
{
|
||||
m_rows.reserve( newVal );
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP cList::SchemaLoad(IView *, IUnknown *pSchema)
|
||||
{
|
||||
MSXML::IXMLDOMElementPtr pElement = pSchema;
|
||||
|
||||
_variant_t vRowHeight = pElement->getAttribute( _T( "rowheight" ) );
|
||||
|
||||
if( vRowHeight.vt != VT_NULL )
|
||||
{
|
||||
try
|
||||
{
|
||||
m_nRowHeight = static_cast< long >( vRowHeight );
|
||||
}
|
||||
catch( ... )
|
||||
{
|
||||
// Type conversion error
|
||||
_ASSERTE( FALSE );
|
||||
}
|
||||
}
|
||||
else
|
||||
m_nRowHeight = 20;
|
||||
|
||||
_variant_t vAutoScroll = pElement->getAttribute( _T( "autoscroll" ) );
|
||||
if( vAutoScroll.vt != VT_NULL )
|
||||
{
|
||||
try
|
||||
{
|
||||
m_bAutoScroll = static_cast< bool >( vAutoScroll );
|
||||
}
|
||||
catch( ... )
|
||||
{
|
||||
// Type conversion error
|
||||
_ASSERTE( FALSE );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Walk the list of columns under this element
|
||||
MSXML::IXMLDOMElementPtr pColumn;
|
||||
for( MSXML::IXMLDOMNodeListPtr pColumns = pElement->selectNodes( _T( "column" ) ); ( pColumn = pColumns->nextNode() ).GetInterfacePtr() != NULL; )
|
||||
{
|
||||
_variant_t vProgID = pColumn->getAttribute( _T( "progid" ) );
|
||||
|
||||
_ASSERTE( vProgID.vt == VT_BSTR );
|
||||
|
||||
CLSID clsid;
|
||||
HRESULT hRes = ::CLSIDFromProgID( vProgID.bstrVal, &clsid );
|
||||
|
||||
_ASSERTE( SUCCEEDED( hRes ) );
|
||||
|
||||
// Looking good, create the column object
|
||||
CComPtr< IListColumn > pColumnInst;
|
||||
|
||||
hRes = ::CoCreateInstance( clsid, NULL, CLSCTX_INPROC_SERVER, IID_IListColumn,
|
||||
reinterpret_cast< void ** >( &pColumnInst ) );
|
||||
|
||||
_ASSERTE( SUCCEEDED( hRes ) );
|
||||
|
||||
// Have the column load any special internal values
|
||||
pColumnInst->SchemaLoad( pColumn );
|
||||
|
||||
long nIndex;
|
||||
AddColumn( pColumnInst, &nIndex );
|
||||
}
|
||||
|
||||
SIZE szIncrement = { 100, m_nRowHeight };
|
||||
m_pScroller->put_Increments( &szIncrement );
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP cList::get_Count( long *pnCount )
|
||||
{
|
||||
_ASSERTE( pnCount != NULL );
|
||||
|
||||
*pnCount = m_rows.size();
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP cList::get_CountCols( long *pnCount )
|
||||
{
|
||||
_ASSERTE( pnCount != NULL );
|
||||
|
||||
*pnCount = m_cols.size();
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP cList::Clear()
|
||||
{
|
||||
m_rows.clear();
|
||||
m_pView->InvalidateFrom( 0 );
|
||||
|
||||
m_pScroller->ResetScroller();
|
||||
|
||||
m_pSite->Reformat();
|
||||
m_pSite->Invalidate();
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP cList::InsertRow(long lIndex)
|
||||
{
|
||||
_ASSERTE (lIndex >= 0);
|
||||
// There must be at least one column defined
|
||||
_ASSERTE( m_cols.size() > 0 );
|
||||
|
||||
cRowList::iterator it = m_rows.begin ();
|
||||
|
||||
if (lIndex > 0)
|
||||
{
|
||||
it += lIndex;
|
||||
}
|
||||
|
||||
m_rows.insert( it, cRow( m_cols.back().m_nDataRight ) );
|
||||
|
||||
// Start at that index and invalidate all rows below that point
|
||||
m_pView->InvalidateFrom( lIndex );
|
||||
for( cRowList::iterator i_row = m_rows.begin() + lIndex; i_row != m_rows.end(); ++ i_row )
|
||||
{
|
||||
i_row->m_bInvalid = true;
|
||||
}
|
||||
|
||||
m_pSite->Invalidate();
|
||||
m_pSite->Reformat();
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP cList::put_ColumnWidth(long nColumn, long nWidth)
|
||||
{
|
||||
m_cols[ nColumn ].m_pColumn->put_Width(nWidth);
|
||||
m_pSite->Invalidate();
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP cList::get_ColumnWidth(long nColumn, long *nWidth)
|
||||
{
|
||||
m_cols[ nColumn ].m_pColumn->get_Width(nWidth);
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP cList::get_Color(long nX, long nY, long *pVal)
|
||||
{
|
||||
|
||||
if (!pVal) { /* cyn - 07/08/2002 */
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
*pVal = 0x00FFFFFF;
|
||||
cRow &rowData = m_rows[nY];
|
||||
|
||||
if (nX >= m_cols.size()) {
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
if (rowData.m_colors) {
|
||||
if (rowData.m_colors[nX]) {
|
||||
*pVal = rowData.m_colors[nX];
|
||||
}
|
||||
}
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP cList::put_Color(long nX, long nY, long newVal)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (nX >= m_cols.size()) { /* cyn - 07/08/2002 */
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
cRow &rowData = m_rows[nY];
|
||||
|
||||
if (!rowData.m_colors) {
|
||||
i = m_cols.size();
|
||||
rowData.m_colors = new long[ i ];
|
||||
if (!rowData.m_colors) {
|
||||
return E_OUTOFMEMORY;
|
||||
}
|
||||
|
||||
// Madar 9/8/2002: Initialize colors to white.
|
||||
for (long loop = 0; loop < m_cols.size(); ++loop) {
|
||||
rowData.m_colors[loop] = 0x00ffffff;
|
||||
}
|
||||
}
|
||||
|
||||
rowData.m_colors[nX] = newVal;
|
||||
|
||||
m_pSite->Invalidate();
|
||||
rowData.m_bInvalid = true;
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP cList::get_AutoScroll(VARIANT_BOOL *pVal)
|
||||
{
|
||||
if( m_bAutoScroll == true )
|
||||
*pVal = VARIANT_TRUE;
|
||||
|
||||
else if( m_bAutoScroll == false )
|
||||
*pVal = VARIANT_FALSE;
|
||||
|
||||
else
|
||||
return E_FAIL;
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP cList::put_AutoScroll(VARIANT_BOOL newVal)
|
||||
{
|
||||
if( newVal == VARIANT_TRUE )
|
||||
m_bAutoScroll = true;
|
||||
|
||||
else if( newVal == VARIANT_FALSE )
|
||||
m_bAutoScroll = false;
|
||||
|
||||
else
|
||||
return E_FAIL;
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP cList::get_ScrollPosition(long *pVal)
|
||||
{
|
||||
tagPOINT tpOffset;
|
||||
tagSIZE tsSize;
|
||||
m_pScroller->get_Offset( &tpOffset );
|
||||
m_pScroller->get_Increments( &tsSize );
|
||||
|
||||
*pVal = tpOffset.y;
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP cList::put_ScrollPosition(long newVal)
|
||||
{
|
||||
tagPOINT tpOffset;
|
||||
tagSIZE tsSize;
|
||||
m_pScroller->get_Offset( &tpOffset );
|
||||
m_pScroller->get_Increments( &tsSize );
|
||||
|
||||
tpOffset.y = newVal;
|
||||
|
||||
m_pScroller->ScrollTo( &tpOffset );
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP cList::JumpToPosition(long newVal)
|
||||
{
|
||||
_ASSERTE( newVal >= 0 );
|
||||
_ASSERTE( newVal < m_rows.size() );
|
||||
|
||||
tagPOINT tpOffset;
|
||||
m_pScroller->get_Offset( &tpOffset );
|
||||
|
||||
tpOffset.y = newVal;
|
||||
|
||||
m_pScroller->put_Offset( &tpOffset );
|
||||
m_pScroller->ScrollTo( &tpOffset ); // ensures the thumb gets updated
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
122
Native/DecalControls/List.h
Normal file
122
Native/DecalControls/List.h
Normal file
|
|
@ -0,0 +1,122 @@
|
|||
// List.h : Declaration of the cList
|
||||
|
||||
#ifndef __LIST_H_
|
||||
#define __LIST_H_
|
||||
|
||||
#include "resource.h" // main symbols
|
||||
|
||||
#include "SinkImpl.h"
|
||||
#include "DecalControlsCP.h"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// cList
|
||||
class ATL_NO_VTABLE cList :
|
||||
public CComObjectRootEx<CComMultiThreadModel>,
|
||||
public CComCoClass<cList, &CLSID_List>,
|
||||
public IControlImpl< cList, IList, &IID_IListDisp, &LIBID_DecalControls >,
|
||||
public ILayerImpl< cList >,
|
||||
public ILayerRenderImpl,
|
||||
public ILayerSchema,
|
||||
public IProvideClassInfo2Impl< &CLSID_List, &DIID_IListEvents, &LIBID_DecalControls >,
|
||||
public IConnectionPointContainerImpl<cList>,
|
||||
public CProxyIListEvents< cList >
|
||||
{
|
||||
public:
|
||||
cList()
|
||||
{
|
||||
m_bAutoScroll = false;
|
||||
}
|
||||
|
||||
class cColumn
|
||||
{
|
||||
public:
|
||||
CComPtr< IListColumn > m_pColumn;
|
||||
long m_nLeft, m_nRight;
|
||||
long m_nDataLeft, m_nDataRight;
|
||||
|
||||
bool m_bSupportsMouse;
|
||||
};
|
||||
|
||||
typedef std::deque< cColumn > cColumnList;
|
||||
|
||||
class cRow
|
||||
{
|
||||
public:
|
||||
mutable VARIANT *m_pData,
|
||||
*m_pEndData;
|
||||
bool m_bInvalid;
|
||||
mutable long *m_colors; /* cyn - 07/08/2002 */
|
||||
|
||||
explicit cRow( long nDataWidth );
|
||||
cRow( const cRow &row );
|
||||
~cRow();
|
||||
|
||||
cRow &operator=( const cRow & );
|
||||
};
|
||||
|
||||
typedef std::vector< cRow > cRowList;
|
||||
|
||||
CComPtr< IScroller > m_pScroller;
|
||||
CComPtr< IListView > m_pView;
|
||||
|
||||
cColumnList m_cols;
|
||||
cRowList m_rows;
|
||||
|
||||
long m_nRowHeight;
|
||||
bool m_bAutoScroll;
|
||||
|
||||
void onCreate();
|
||||
void onDestroy();
|
||||
|
||||
DECLARE_REGISTRY_RESOURCEID(IDR_LIST)
|
||||
|
||||
DECLARE_PROTECT_FINAL_CONSTRUCT()
|
||||
|
||||
BEGIN_COM_MAP(cList)
|
||||
COM_INTERFACE_ENTRY(ILayerRender)
|
||||
COM_INTERFACE_ENTRY(ILayer)
|
||||
COM_INTERFACE_ENTRY(ILayerSchema)
|
||||
COM_INTERFACE_ENTRY(IList)
|
||||
COM_INTERFACE_ENTRY(IListDisp)
|
||||
COM_INTERFACE_ENTRY(IControl)
|
||||
COM_INTERFACE_ENTRY(IDispatch)
|
||||
COM_INTERFACE_ENTRY(IProvideClassInfo)
|
||||
COM_INTERFACE_ENTRY(IProvideClassInfo2)
|
||||
COM_INTERFACE_ENTRY_IMPL(IConnectionPointContainer)
|
||||
END_COM_MAP()
|
||||
|
||||
BEGIN_CONNECTION_POINT_MAP(cList)
|
||||
CONNECTION_POINT_ENTRY(DIID_IListEvents)
|
||||
END_CONNECTION_POINT_MAP()
|
||||
|
||||
public:
|
||||
STDMETHOD(JumpToPosition)(long newVal);
|
||||
STDMETHOD(get_ScrollPosition)(/*[out, retval]*/ long *pVal);
|
||||
STDMETHOD(put_ScrollPosition)(/*[in]*/ long newVal);
|
||||
STDMETHOD(get_AutoScroll)(/*[out, retval]*/ VARIANT_BOOL *pVal);
|
||||
STDMETHOD(put_AutoScroll)(/*[in]*/ VARIANT_BOOL newVal);
|
||||
STDMETHOD(get_Color)(long nX, long nY, /*[out, retval]*/ long *pVal);
|
||||
STDMETHOD(put_Color)(long nX, long nY, /*[in]*/ long newVal);
|
||||
STDMETHOD(InsertRow)(long lIndex);
|
||||
// IList Methods
|
||||
STDMETHOD(get_CellRect)(LPPOINT pt, /*[out, retval]*/ LPRECT pVal);
|
||||
STDMETHOD(get_Data)(long nX, long nY, /*[optional, defaultvalue(0)]*/ long nSubValue, /*[out, retval]*/ VARIANT* pVal);
|
||||
STDMETHOD(put_Data)(long nX, long nY, /*[optional, defaultvalue(0)]*/ long nSubValue, /*[in]*/ VARIANT* newVal);
|
||||
STDMETHOD(DeleteRow)(long nIndex);
|
||||
STDMETHOD(AddRow)(/*[out, retval]*/ long *pnNewIndex);
|
||||
STDMETHOD(AddColumn)(IListColumn *pNewColumn, /*[out, retval]*/ long *nIndex);
|
||||
STDMETHOD(put_RowEstimate)(/*[in]*/ long newVal);
|
||||
STDMETHOD(get_Count)(long *pnCount);
|
||||
STDMETHOD(get_CountCols)(long *pnCount);
|
||||
STDMETHOD(Clear)();
|
||||
STDMETHOD(put_ColumnWidth)(long nColumn, long nWidth);
|
||||
STDMETHOD(get_ColumnWidth)(long nColumn, long *nWidth);
|
||||
|
||||
// ILayerRender Methods
|
||||
STDMETHOD(Reformat)();
|
||||
|
||||
// ILayerSchema Methods
|
||||
STDMETHOD(SchemaLoad)(IView *, IUnknown *pSchema);
|
||||
};
|
||||
|
||||
#endif //__LIST_H_
|
||||
25
Native/DecalControls/List.rgs
Normal file
25
Native/DecalControls/List.rgs
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
HKCR
|
||||
{
|
||||
DecalControls.List.1 = s 'DecalControls List'
|
||||
{
|
||||
CLSID = s '{3839008F-AF5B-43FC-9F6A-3376B99E3DAF}'
|
||||
}
|
||||
DecalControls.List = s 'DecalControls List'
|
||||
{
|
||||
CLSID = s '{3839008F-AF5B-43FC-9F6A-3376B99E3DAF}'
|
||||
CurVer = s 'DecalControls.List.1'
|
||||
}
|
||||
NoRemove CLSID
|
||||
{
|
||||
ForceRemove {3839008F-AF5B-43FC-9F6A-3376B99E3DAF} = s 'DecalControls List'
|
||||
{
|
||||
ProgID = s 'DecalControls.List.1'
|
||||
VersionIndependentProgID = s 'DecalControls.List'
|
||||
InprocServer32 = s '%MODULE%'
|
||||
{
|
||||
val ThreadingModel = s 'Both'
|
||||
}
|
||||
'TypeLib' = s '{3559E08B-827E-4DFE-9D33-3567246849CC}'
|
||||
}
|
||||
}
|
||||
}
|
||||
220
Native/DecalControls/ListView.cpp
Normal file
220
Native/DecalControls/ListView.cpp
Normal file
|
|
@ -0,0 +1,220 @@
|
|||
// ListView.cpp : Implementation of cListView
|
||||
#include "stdafx.h"
|
||||
#include "DecalControls.h"
|
||||
#include "ListView.h"
|
||||
|
||||
#include "List.h"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// cListView
|
||||
|
||||
cListView::cListView()
|
||||
: m_nRowHeight( 20 ),
|
||||
m_nRowCache( 0 ),
|
||||
m_nValidFrom( 0 ),
|
||||
m_nValidTo( 0 )
|
||||
{
|
||||
}
|
||||
|
||||
STDMETHODIMP cListView::put_Area(LPSIZE newVal)
|
||||
{
|
||||
RECT rc = { 0, 0, newVal->cx, newVal->cy };
|
||||
m_pSite->put_Position( &rc );
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP cListView::SetCacheInfo(long nRowHeight, long nRowsToCache)
|
||||
{
|
||||
m_nRowHeight = nRowHeight;
|
||||
m_nRowCache = nRowsToCache;
|
||||
|
||||
m_pSite->Reformat();
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
void cListView::onCreate()
|
||||
{
|
||||
CComPtr< IPluginSite > pPlugin;
|
||||
m_pSite->get_PluginSite( &pPlugin );
|
||||
|
||||
pPlugin->LoadBitmapPortal( 0x0600128A, &m_pBackground );
|
||||
|
||||
m_pSite->put_Transparent( VARIANT_FALSE );
|
||||
}
|
||||
|
||||
void cListView::onDestroy()
|
||||
{
|
||||
m_pBackground.Release();
|
||||
|
||||
if( m_pCache.p != NULL )
|
||||
m_pCache.Release();
|
||||
}
|
||||
|
||||
STDMETHODIMP cListView::Reformat()
|
||||
{
|
||||
RECT rcPos;
|
||||
m_pSite->get_Position( &rcPos );
|
||||
|
||||
SIZE szCache = { rcPos.right - rcPos.left, m_nRowHeight * m_nRowCache };
|
||||
|
||||
if( m_pCache.p != NULL )
|
||||
m_pCache->put_Size( &szCache );
|
||||
else
|
||||
{
|
||||
CComPtr< IPluginSite > pPlugin;
|
||||
m_pSite->get_PluginSite( &pPlugin );
|
||||
|
||||
pPlugin->CreateCanvas( &szCache, &m_pCache );
|
||||
}
|
||||
|
||||
_ASSERTMEM( _CrtCheckMemory( ) );
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP cListView::Render(ICanvas *pCanvas)
|
||||
{
|
||||
_ASSERTMEM( _CrtCheckMemory( ) );
|
||||
|
||||
// First, draw the Background pattern
|
||||
VARIANT_BOOL bLost;
|
||||
m_pCache->get_WasLost( &bLost );
|
||||
|
||||
if( bLost )
|
||||
// There is no valid range - we must redraw
|
||||
// the entire rowset
|
||||
m_nValidFrom = m_nValidTo;
|
||||
|
||||
ClipParams cp;
|
||||
pCanvas->GetClipParams( &cp );
|
||||
|
||||
SIZE szCache;
|
||||
m_pCache->get_Size( &szCache );
|
||||
|
||||
// We have the clipping rectangle now - calculate the range
|
||||
// of rows we want to draw
|
||||
long nDrawFrom = cp.org.y / m_nRowHeight,
|
||||
nDrawTo = nDrawFrom + m_nRowCache,
|
||||
nRowCount = m_pList->m_rows.size();
|
||||
|
||||
// Ok, now draw all of the rows either out of range
|
||||
// or invalid
|
||||
for( long nDraw = nDrawFrom; nDraw < nDrawTo; ++ nDraw )
|
||||
{
|
||||
// Determine how much we need to draw
|
||||
bool bHasData = ( nDraw >= 0 && nDraw < nRowCount );
|
||||
|
||||
if( nDraw < m_nValidFrom || nDraw >= m_nValidTo || ( bHasData && m_pList->m_rows[ nDraw ].m_bInvalid ) )
|
||||
{
|
||||
// Redraw this row
|
||||
long nRowPos = nDraw % m_nRowCache;
|
||||
RECT rcRow = { 0, nRowPos * m_nRowHeight, szCache.cx, ( nRowPos + 1 ) * m_nRowHeight };
|
||||
|
||||
// Fill the background with the background image
|
||||
POINT ptBackgroundOrg = { 0, nDraw * m_nRowHeight };
|
||||
m_pBackground->PatBlt( m_pCache, &rcRow, &ptBackgroundOrg );
|
||||
|
||||
if( bHasData )
|
||||
{
|
||||
// This row is visible and there's data - so use the
|
||||
// column objects to render the data
|
||||
for( cList::cColumnList::iterator i_col = m_pList->m_cols.begin(); i_col != m_pList->m_cols.end(); ++ i_col )
|
||||
{
|
||||
RECT rcCell = { i_col->m_nLeft, rcRow.top, i_col->m_nRight, rcRow.bottom };
|
||||
VARIANT_BOOL bVisible;
|
||||
m_pCache->PushClipRect( &rcCell, &bVisible );
|
||||
|
||||
// All our clippings should be completely visible
|
||||
_ASSERTE( bVisible );
|
||||
|
||||
long nColor;
|
||||
POINT ptCell = { i_col - m_pList->m_cols.begin(), nDraw };
|
||||
|
||||
get_Color(ptCell.x, ptCell.y, &nColor);
|
||||
i_col->m_pColumn->Render( m_pCache, &ptCell, nColor);
|
||||
m_pCache->PopClipRect();
|
||||
|
||||
_ASSERTMEM( _CrtCheckMemory( ) );
|
||||
}
|
||||
|
||||
m_pList->m_rows[ nDraw ].m_bInvalid = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Now that our cache is updated, we can tranfer it to the surface
|
||||
m_nValidFrom = nDrawFrom;
|
||||
m_nValidTo = nDrawTo;
|
||||
|
||||
long nBltFrom = nDrawFrom % m_nRowCache;
|
||||
|
||||
RECT rcTop = { 0, nBltFrom * m_nRowHeight, szCache.cx, m_nRowHeight * m_nRowCache };
|
||||
POINT ptDest = { 0, nDrawFrom * m_nRowHeight };
|
||||
pCanvas->Blt( &rcTop, m_pCache, &ptDest );
|
||||
|
||||
if( nBltFrom != 0 )
|
||||
{
|
||||
// Transfer the bottom part
|
||||
RECT rcBottom = { 0, 0, szCache.cx, nBltFrom * m_nRowHeight };
|
||||
POINT ptDestBottom = { 0, ( nDrawFrom + m_nRowCache - nBltFrom ) * m_nRowHeight };
|
||||
|
||||
pCanvas->Blt( &rcBottom, m_pCache, &ptDestBottom );
|
||||
}
|
||||
|
||||
_ASSERTMEM( _CrtCheckMemory( ) );
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP cListView::MouseDown( MouseState *pMS )
|
||||
{
|
||||
// Hit test to find what cell
|
||||
POINT ptHit = { 0, pMS->client.y / m_nRowHeight };
|
||||
if( ptHit.y >= m_pList->m_rows.size() )
|
||||
// We did not hit any rows
|
||||
return S_OK;
|
||||
|
||||
for( cList::cColumnList::iterator i_col = m_pList->m_cols.begin(); i_col != m_pList->m_cols.end(); ++ i_col )
|
||||
{
|
||||
if( pMS->client.x >= i_col->m_nLeft && pMS->client.x < i_col->m_nRight )
|
||||
{
|
||||
ptHit.x = ( i_col - m_pList->m_cols.begin() );
|
||||
|
||||
i_col->m_pColumn->Activate( &ptHit );
|
||||
|
||||
long nID;
|
||||
m_pList->m_pSite->get_ID( &nID );
|
||||
|
||||
m_pList->Fire_Change( nID, ptHit.x, ptHit.y );
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP cListView::InvalidateFrom(long nRow)
|
||||
{
|
||||
if( nRow < m_nValidTo )
|
||||
m_nValidTo = nRow;
|
||||
|
||||
if( nRow < m_nValidFrom )
|
||||
m_nValidFrom = nRow;
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP cListView::get_Color(long nCol, long nRow, long *pVal)
|
||||
{
|
||||
m_pList->get_Color(nCol, nRow, pVal);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP cListView::put_Color(long nCol, long nRow, long newVal)
|
||||
{
|
||||
m_pList->put_Color(nCol, nRow, newVal);
|
||||
return S_OK;
|
||||
}
|
||||
65
Native/DecalControls/ListView.h
Normal file
65
Native/DecalControls/ListView.h
Normal file
|
|
@ -0,0 +1,65 @@
|
|||
// ListView.h : Declaration of the cListView
|
||||
|
||||
#ifndef __LISTVIEW_H_
|
||||
#define __LISTVIEW_H_
|
||||
|
||||
#include "resource.h" // main symbols
|
||||
|
||||
#include "SinkImpl.h"
|
||||
|
||||
class cList;
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// cListView
|
||||
class ATL_NO_VTABLE cListView :
|
||||
public CComObjectRootEx<CComMultiThreadModel>,
|
||||
public ILayerImpl< cListView >,
|
||||
public ILayerRenderImpl,
|
||||
public ILayerMouseImpl,
|
||||
public cNoEventsImpl,
|
||||
public IListView
|
||||
{
|
||||
public:
|
||||
cListView();
|
||||
|
||||
CComPtr< ICanvas > m_pCache;
|
||||
|
||||
CComPtr< IImageCache > m_pBackground;
|
||||
|
||||
typedef std::map< std::pair< long, long >, long > cCellMap;
|
||||
cCellMap m_cells;
|
||||
|
||||
long m_nRowHeight,
|
||||
m_nRowCache,
|
||||
m_nValidFrom,
|
||||
m_nValidTo;
|
||||
|
||||
cList *m_pList;
|
||||
|
||||
void onCreate();
|
||||
void onDestroy();
|
||||
|
||||
BEGIN_COM_MAP(cListView)
|
||||
COM_INTERFACE_ENTRY(ILayerRender)
|
||||
COM_INTERFACE_ENTRY(ILayerMouse)
|
||||
COM_INTERFACE_ENTRY(ILayer)
|
||||
COM_INTERFACE_ENTRY(IListView)
|
||||
END_COM_MAP()
|
||||
|
||||
public:
|
||||
STDMETHOD(get_Color)(long nCol, long nRow, /*[out, retval]*/ long *pVal);
|
||||
STDMETHOD(put_Color)(long nCol, long nRow, /*[in]*/ long newVal);
|
||||
// IListView Methods
|
||||
STDMETHOD(put_Area)(/*[in]*/ LPSIZE newVal);
|
||||
STDMETHOD(SetCacheInfo)(long nRowHeight, long nRowsToCache);
|
||||
STDMETHOD(InvalidateFrom)(long nRow);
|
||||
|
||||
// ILayerRender Methods
|
||||
STDMETHOD(Reformat)();
|
||||
STDMETHOD(Render)(ICanvas *pCanvas);
|
||||
|
||||
// ILayerMouse Methods
|
||||
STDMETHOD(MouseDown)(MouseState *pMS);
|
||||
};
|
||||
|
||||
#endif //__LISTVIEW_H_
|
||||
281
Native/DecalControls/Notebook.cpp
Normal file
281
Native/DecalControls/Notebook.cpp
Normal file
|
|
@ -0,0 +1,281 @@
|
|||
// Notebook.cpp : Implementation of cNotebook
|
||||
#include "stdafx.h"
|
||||
#include "DecalControls.h"
|
||||
#include "Notebook.h"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// cNotebook
|
||||
|
||||
cNotebook::cNotebook():
|
||||
m_nNextPageID( 1001 ),
|
||||
m_nActiveTab( -1 ),
|
||||
m_nCaptureTab( -1 ),
|
||||
m_bHitCapture( false )
|
||||
{
|
||||
}
|
||||
|
||||
long cNotebook::hitTest( MouseState *pMS )
|
||||
{
|
||||
if( pMS->over != this )
|
||||
// Not hitting us, therefore not hitting a tab
|
||||
return -1;
|
||||
|
||||
// Yes for y boundaries
|
||||
if( pMS->client.y < 0 || pMS->client.y >= 16 )
|
||||
return -1;
|
||||
|
||||
// Walk through the list of tabs
|
||||
for( cPageList::iterator i = m_pages.begin(); i != m_pages.end(); ++ i )
|
||||
{
|
||||
if( pMS->client.x >= i->m_nLeft && pMS->client.x < i->m_nRight )
|
||||
// Hit a tab!
|
||||
return ( i - m_pages.begin() );
|
||||
}
|
||||
|
||||
// No tabs hit
|
||||
return -1;
|
||||
}
|
||||
|
||||
void cNotebook::positionActiveTab()
|
||||
{
|
||||
if( m_nActiveTab == -1 )
|
||||
return;
|
||||
|
||||
RECT rcClient;
|
||||
m_pSite->get_Position( &rcClient );
|
||||
|
||||
CComPtr< ILayerSite > pChild;
|
||||
m_pSite->get_Child( m_pages[ m_nActiveTab ].m_nPageID, ePositionByID, &pChild );
|
||||
|
||||
RECT rcChild = { 0, 16, rcClient.right - rcClient.left, rcClient.bottom - rcClient.top };
|
||||
pChild->put_Position( &rcChild );
|
||||
}
|
||||
|
||||
STDMETHODIMP cNotebook::AddPage(BSTR strText, IControl *pClient)
|
||||
{
|
||||
cPage p;
|
||||
p.m_strName = strText;
|
||||
p.m_nPageID = m_nNextPageID ++;
|
||||
|
||||
CComPtr< ILayer > pClientLayer;
|
||||
pClient->QueryInterface( &pClientLayer );
|
||||
|
||||
LayerParams lp = { p.m_nPageID, { 0, 0, 0, 0 }, eRenderClipped };
|
||||
m_pSite->CreateChild( &lp, pClientLayer );
|
||||
|
||||
m_pages.push_back( p );
|
||||
|
||||
if( m_nActiveTab == -1 )
|
||||
// Activate the page if it's the first one
|
||||
m_nActiveTab = 0;
|
||||
|
||||
m_pSite->Reformat();
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
void cNotebook::onCreate()
|
||||
{
|
||||
// Load the images
|
||||
CComPtr< IPluginSite > pPlugin;
|
||||
m_pSite->get_PluginSite( &pPlugin );
|
||||
|
||||
pPlugin->LoadBitmapFile( _bstr_t( _T( "Tab-Active.bmp" ) ), &m_pActive );
|
||||
pPlugin->LoadBitmapFile( _bstr_t( _T( "Tab-Inactive.bmp" ) ), &m_pInactive );
|
||||
BSTR bstrFontName;
|
||||
pPlugin->get_FontName(&bstrFontName);
|
||||
pPlugin->CreateFont( bstrFontName /*_bstr_t( _T( "Times New Roman" ) )*/, 14, 0, &m_pFont );
|
||||
}
|
||||
|
||||
void cNotebook::onDestroy()
|
||||
{
|
||||
m_pActive.Release();
|
||||
m_pInactive.Release();
|
||||
}
|
||||
|
||||
#define TEXT_LR_MARGIN 5
|
||||
|
||||
STDMETHODIMP cNotebook::Reformat()
|
||||
{
|
||||
// Walk through the tabs and position the graphics
|
||||
long nTabPos = 0;
|
||||
for( cPageList::iterator i = m_pages.begin(); i != m_pages.end(); ++ i )
|
||||
{
|
||||
// Calculate the text length
|
||||
SIZE sz;
|
||||
m_pFont->MeasureText( i->m_strName, &sz );
|
||||
|
||||
long nWidth = sz.cx + TEXT_LR_MARGIN * 2;
|
||||
|
||||
i->m_nLeft = nTabPos;
|
||||
i->m_nRight = nTabPos + nWidth;
|
||||
nTabPos += nWidth;
|
||||
}
|
||||
|
||||
if( m_nActiveTab != -1 )
|
||||
positionActiveTab();
|
||||
|
||||
_ASSERTMEM( _CrtCheckMemory( ) );
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP cNotebook::Render( ICanvas *pCanvas )
|
||||
{
|
||||
for( cPageList::iterator i = m_pages.begin(); i != m_pages.end(); ++ i )
|
||||
{
|
||||
POINT ptTab = { i->m_nLeft, 0 };
|
||||
long nWidth = i->m_nRight - i->m_nLeft;
|
||||
long nIndex = i - m_pages.begin();
|
||||
|
||||
bool bActive = ( ( nIndex == m_nActiveTab ) || ( m_nCaptureTab != -1 && m_bHitCapture && nIndex == m_nCaptureTab ) );
|
||||
if( bActive )
|
||||
m_pActive->StretchBlt( pCanvas, &ptTab, nWidth, 7, 90 );
|
||||
else
|
||||
m_pInactive->StretchBlt( pCanvas, &ptTab, nWidth, 7, 90 );
|
||||
|
||||
// Draw the text
|
||||
POINT ptText = { i->m_nLeft + TEXT_LR_MARGIN, 2 };
|
||||
m_pFont->DrawText( &ptText, i->m_strName, ( bActive ) ? RGB( 0, 0, 0 ) : RGB( 192, 192, 192 ), pCanvas );
|
||||
}
|
||||
|
||||
_ASSERTMEM( _CrtCheckMemory( ) );
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP cNotebook::MouseDown( MouseState *pMS )
|
||||
{
|
||||
m_nCaptureTab = hitTest( pMS );
|
||||
|
||||
if( m_nCaptureTab != -1 )
|
||||
{
|
||||
m_bHitCapture = true;
|
||||
m_pSite->Invalidate();
|
||||
}
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP cNotebook::MouseUp( MouseState *pMS )
|
||||
{
|
||||
_ASSERTMEM( _CrtCheckMemory( ) );
|
||||
|
||||
if( m_nCaptureTab == -1 )
|
||||
return S_OK;
|
||||
|
||||
if( hitTest( pMS ) == m_nCaptureTab )
|
||||
put_ActiveTab( m_nCaptureTab );
|
||||
|
||||
_ASSERTMEM( _CrtCheckMemory( ) );
|
||||
|
||||
m_nCaptureTab = -1;
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP cNotebook::MouseMove( MouseState *pMS )
|
||||
{
|
||||
if( m_nCaptureTab == -1 )
|
||||
// We are hitting in progress
|
||||
return S_OK;
|
||||
|
||||
// Check for a hit
|
||||
bool bHitCapture = ( hitTest( pMS ) == m_nCaptureTab );
|
||||
if( bHitCapture != m_bHitCapture )
|
||||
{
|
||||
m_bHitCapture = bHitCapture;
|
||||
m_pSite->Invalidate();
|
||||
}
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP cNotebook::get_ActiveTab(long *pVal)
|
||||
{
|
||||
*pVal = m_nActiveTab;
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP cNotebook::put_ActiveTab(long newVal)
|
||||
{
|
||||
if( m_nActiveTab != -1 )
|
||||
{
|
||||
// Hide the current active view
|
||||
static RECT rcHide = { 0, 0, 0, 0 };
|
||||
CComPtr< ILayerSite > pChild;
|
||||
m_pSite->get_Child( m_pages[ m_nActiveTab ].m_nPageID, ePositionByID, &pChild );
|
||||
|
||||
pChild->put_Position( &rcHide );
|
||||
}
|
||||
|
||||
m_nActiveTab = newVal;
|
||||
|
||||
if( m_nActiveTab != -1 )
|
||||
positionActiveTab();
|
||||
|
||||
long nID;
|
||||
m_pSite->get_ID( &nID );
|
||||
Fire_Change( nID, m_nActiveTab );
|
||||
|
||||
m_pSite->Invalidate();
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP cNotebook::SchemaLoad(IView *pView, IUnknown *pSchema)
|
||||
{
|
||||
MSXML::IXMLDOMElementPtr pElement = pSchema;
|
||||
|
||||
MSXML::IXMLDOMElementPtr pPage;
|
||||
for( MSXML::IXMLDOMNodeListPtr pPages = pElement->selectNodes( _T( "page" ) ); ( pPage = pPages->nextNode() ).GetInterfacePtr() != NULL; )
|
||||
{
|
||||
// We have the page, get the text, then recurse and generate the control
|
||||
_variant_t vText = pPage->getAttribute( _T( "label" ) );
|
||||
|
||||
_ASSERTE( vText.vt == VT_BSTR );
|
||||
|
||||
cPage p;
|
||||
p.m_strName = vText.bstrVal;
|
||||
p.m_nPageID = m_nNextPageID ++;
|
||||
|
||||
m_pages.push_back( p );
|
||||
|
||||
MSXML::IXMLDOMElementPtr pControl = pPage->selectSingleNode( _T( "control" ) );
|
||||
|
||||
_ASSERTE( pControl.GetInterfacePtr() != NULL );
|
||||
|
||||
long nAssigned;
|
||||
pView->LoadControl( m_pSite, p.m_nPageID, pControl, &nAssigned );
|
||||
}
|
||||
|
||||
if( m_nActiveTab == -1 && m_pages.size() > 0 )
|
||||
// Activate the page if it's the first one
|
||||
m_nActiveTab = 0;
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP cNotebook::get_PageText(long nIndex, BSTR *pVal)
|
||||
{
|
||||
_ASSERTE( pVal != NULL );
|
||||
_ASSERTE( nIndex >= 0 );
|
||||
_ASSERTE( nIndex < m_pages.size() );
|
||||
|
||||
*pVal = OLE2BSTR( m_pages[ nIndex ].m_strName );
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP cNotebook::put_PageText(long nIndex, BSTR newVal)
|
||||
{
|
||||
_ASSERTE( newVal != NULL );
|
||||
_ASSERTE( nIndex >= 0 );
|
||||
_ASSERTE( nIndex < m_pages.size() );
|
||||
|
||||
m_pages[ nIndex ].m_strName = newVal;
|
||||
m_pSite->Reformat();
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
97
Native/DecalControls/Notebook.h
Normal file
97
Native/DecalControls/Notebook.h
Normal file
|
|
@ -0,0 +1,97 @@
|
|||
// Notebook.h : Declaration of the cNotebook
|
||||
|
||||
#ifndef __NOTEBOOK_H_
|
||||
#define __NOTEBOOK_H_
|
||||
|
||||
#include "resource.h" // main symbols
|
||||
|
||||
#include "SinkImpl.h"
|
||||
#include "DecalControlsCP.h"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// cNotebook
|
||||
class ATL_NO_VTABLE cNotebook :
|
||||
public CComObjectRootEx<CComMultiThreadModel>,
|
||||
public CComCoClass<cNotebook, &CLSID_Notebook>,
|
||||
public IConnectionPointContainerImpl<cNotebook>,
|
||||
public ILayerImpl< cNotebook >,
|
||||
public ILayerRenderImpl,
|
||||
public ILayerMouseImpl,
|
||||
public ILayerSchema,
|
||||
public IProvideClassInfo2Impl< &CLSID_Notebook, &DIID_INotebookEvents, &LIBID_DecalControls >,
|
||||
public IControlImpl< cNotebook, INotebook, &IID_INotebook, &LIBID_DecalControls >,
|
||||
public CProxyINotebookEvents< cNotebook >
|
||||
{
|
||||
public:
|
||||
cNotebook();
|
||||
|
||||
class cPage
|
||||
{
|
||||
public:
|
||||
_bstr_t m_strName;
|
||||
long m_nPageID;
|
||||
|
||||
long m_nLeft, m_nRight;
|
||||
};
|
||||
|
||||
typedef std::vector< cPage > cPageList;
|
||||
cPageList m_pages;
|
||||
|
||||
CComPtr< IImageCache > m_pActive;
|
||||
CComPtr< IImageCache > m_pInactive;
|
||||
CComPtr< IFontCache > m_pFont;
|
||||
|
||||
long m_nNextPageID,
|
||||
m_nActiveTab,
|
||||
m_nCaptureTab;
|
||||
bool m_bHitCapture;
|
||||
|
||||
long hitTest( MouseState *pMS );
|
||||
void positionActiveTab();
|
||||
|
||||
void onCreate();
|
||||
void onDestroy();
|
||||
|
||||
DECLARE_REGISTRY_RESOURCEID(IDR_NOTEBOOK)
|
||||
|
||||
DECLARE_PROTECT_FINAL_CONSTRUCT()
|
||||
|
||||
BEGIN_COM_MAP(cNotebook)
|
||||
COM_INTERFACE_ENTRY(ILayerRender)
|
||||
COM_INTERFACE_ENTRY(ILayerMouse)
|
||||
COM_INTERFACE_ENTRY(INotebook)
|
||||
COM_INTERFACE_ENTRY(IControl)
|
||||
COM_INTERFACE_ENTRY(IDispatch)
|
||||
COM_INTERFACE_ENTRY(ILayer)
|
||||
COM_INTERFACE_ENTRY(ILayerSchema)
|
||||
COM_INTERFACE_ENTRY(IProvideClassInfo)
|
||||
COM_INTERFACE_ENTRY(IProvideClassInfo2)
|
||||
COM_INTERFACE_ENTRY_IMPL(IConnectionPointContainer)
|
||||
END_COM_MAP()
|
||||
|
||||
BEGIN_CONNECTION_POINT_MAP(cNotebook)
|
||||
CONNECTION_POINT_ENTRY(DIID_INotebookEvents)
|
||||
END_CONNECTION_POINT_MAP()
|
||||
|
||||
public:
|
||||
// INotebook Methods
|
||||
STDMETHOD(AddPage)(BSTR strText, IControl *pClient);
|
||||
STDMETHOD(get_ActiveTab)(/*[out, retval]*/ long *pVal);
|
||||
STDMETHOD(put_ActiveTab)(/*[in]*/ long newVal);
|
||||
STDMETHOD(get_PageText)(long nIndex, /*[out, retval]*/ BSTR *pVal);
|
||||
STDMETHOD(put_PageText)(long nIndex, /*[in]*/ BSTR newVal);
|
||||
|
||||
// ILayerRender Methods
|
||||
STDMETHOD(Reformat)();
|
||||
STDMETHOD(Render)( ICanvas *pCanvas );
|
||||
|
||||
// ILayerMouse Methods
|
||||
STDMETHOD(MouseDown)( MouseState *pMS );
|
||||
STDMETHOD(MouseUp)( MouseState *pMS );
|
||||
STDMETHOD(MouseMove)( MouseState *pMS );
|
||||
|
||||
// ILayerSchema Methods
|
||||
STDMETHOD(SchemaLoad)(IView *, IUnknown *pSchema);
|
||||
};
|
||||
|
||||
#endif //__NOTEBOOK_H_
|
||||
25
Native/DecalControls/Notebook.rgs
Normal file
25
Native/DecalControls/Notebook.rgs
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
HKCR
|
||||
{
|
||||
DecalControls.Notebook.1 = s 'DecalControls Notebook'
|
||||
{
|
||||
CLSID = s '{ED14E7C5-11BE-4DFD-9829-873AB6BE3CFC}'
|
||||
}
|
||||
DecalControls.Notebook = s 'DecalControls Notebook'
|
||||
{
|
||||
CLSID = s '{ED14E7C5-11BE-4DFD-9829-873AB6BE3CFC}'
|
||||
CurVer = s 'DecalControls.Notebook.1'
|
||||
}
|
||||
NoRemove CLSID
|
||||
{
|
||||
ForceRemove {ED14E7C5-11BE-4DFD-9829-873AB6BE3CFC} = s 'DecalControls Notebook'
|
||||
{
|
||||
ProgID = s 'DecalControls.Notebook.1'
|
||||
VersionIndependentProgID = s 'DecalControls.Notebook'
|
||||
InprocServer32 = s '%MODULE%'
|
||||
{
|
||||
val ThreadingModel = s 'Both'
|
||||
}
|
||||
'TypeLib' = s '{3559E08B-827E-4DFE-9D33-3567246849CC}'
|
||||
}
|
||||
}
|
||||
}
|
||||
110
Native/DecalControls/PageLayout.cpp
Normal file
110
Native/DecalControls/PageLayout.cpp
Normal file
|
|
@ -0,0 +1,110 @@
|
|||
// PageLayout.cpp : Implementation of cPageLayout
|
||||
#include "stdafx.h"
|
||||
#include "DecalControls.h"
|
||||
#include "PageLayout.h"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// cPageLayout
|
||||
|
||||
void cPageLayout::onChildDestroy( long nID )
|
||||
{
|
||||
if( m_nActive != -1 )
|
||||
{
|
||||
if( nID == m_pages[ m_nActive ] )
|
||||
// The active page is being deleted, now we show no pages
|
||||
m_nActive = -1;
|
||||
}
|
||||
|
||||
// Walk through the list of pages and remove he who does
|
||||
// not exist
|
||||
for( cChildIDList::iterator i = m_pages.begin(); i != m_pages.end(); ++ i )
|
||||
{
|
||||
if( *i == nID )
|
||||
{
|
||||
m_pages.erase( i );
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void cPageLayout::onSchemaLoad( IView *pView, MSXML::IXMLDOMElementPtr &pElement )
|
||||
{
|
||||
// Each control child is a page
|
||||
MSXML::IXMLDOMElementPtr pChild;
|
||||
for( MSXML::IXMLDOMNodeListPtr pChildren = pElement->selectNodes( _T( "control" ) );
|
||||
( pChild = pChildren->nextNode() ).GetInterfacePtr() != NULL; )
|
||||
m_pages.push_back( loadChildControl( pView, pChild ) );
|
||||
}
|
||||
|
||||
STDMETHODIMP cPageLayout::get_Active(long *pVal)
|
||||
{
|
||||
_ASSERTE( pVal != NULL );
|
||||
|
||||
*pVal = m_nActive;
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP cPageLayout::put_Active(long newVal)
|
||||
{
|
||||
_ASSERTE( newVal >= 0 );
|
||||
_ASSERTE( newVal < m_pages.size() );
|
||||
|
||||
if( m_nActive != -1 )
|
||||
{
|
||||
// Hide the active page
|
||||
CComPtr< ILayerSite > pChildSite;
|
||||
HRESULT hRes = m_pSite->get_Child( m_pages[ m_nActive ], ePositionByID, &pChildSite );
|
||||
_ASSERTE( SUCCEEDED( hRes ) );
|
||||
|
||||
static RECT rcHide = { 0, 0, 0, 0 };
|
||||
pChildSite->put_Position( &rcHide );
|
||||
}
|
||||
|
||||
m_nActive = newVal;
|
||||
|
||||
// The reformat next cycle will reposition the child
|
||||
m_pSite->Reformat();
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP cPageLayout::CreatePage(ILayer *pChild)
|
||||
{
|
||||
_ASSERTE( pChild != NULL );
|
||||
|
||||
LayerParams lp = { dispenseID(), { 0, 0, 0, 0 }, eRenderClipped };
|
||||
m_pSite->CreateChild( &lp, pChild );
|
||||
|
||||
m_pages.push_back( lp.ID );
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP cPageLayout::get_Count(long *pVal)
|
||||
{
|
||||
_ASSERTE( pVal != NULL );
|
||||
*pVal = m_pages.size();
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP cPageLayout::Reformat()
|
||||
{
|
||||
if( m_nActive == -1 )
|
||||
return S_OK;
|
||||
|
||||
// Get the active page and set it to fill our entire client area
|
||||
RECT rcThis;
|
||||
m_pSite->get_Position( &rcThis );
|
||||
|
||||
RECT rcClient = { 0, 0, rcThis.right - rcThis.left, rcThis.bottom - rcThis.top };
|
||||
|
||||
CComPtr< ILayerSite > pChild;
|
||||
HRESULT hRes = m_pSite->get_Child( m_pages[ m_nActive ], ePositionByID, &pChild );
|
||||
_ASSERTE( SUCCEEDED( hRes ) );
|
||||
|
||||
pChild->put_Position( &rcClient );
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
70
Native/DecalControls/PageLayout.h
Normal file
70
Native/DecalControls/PageLayout.h
Normal file
|
|
@ -0,0 +1,70 @@
|
|||
// PageLayout.h : Declaration of the cPageLayout
|
||||
|
||||
#ifndef __PAGELAYOUT_H_
|
||||
#define __PAGELAYOUT_H_
|
||||
|
||||
#include "resource.h" // main symbols
|
||||
|
||||
#include "ControlImpl.h"
|
||||
#include "DecalControlsCP.h"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// cPageLayout
|
||||
class ATL_NO_VTABLE cPageLayout :
|
||||
public CComObjectRootEx<CComMultiThreadModel>,
|
||||
public CComCoClass<cPageLayout, &CLSID_PageLayout>,
|
||||
public ILayoutImpl< cPageLayout, IPageLayout, &IID_IPageLayoutDisp, &LIBID_DecalControls >,
|
||||
public ILayerImpl< cPageLayout >,
|
||||
public IProvideClassInfo2Impl< &CLSID_PageLayout, &DIID_IControlEvents, &LIBID_DecalControls >,
|
||||
public IConnectionPointContainerImpl<cPageLayout>,
|
||||
public CProxyIControlEvents< cPageLayout >
|
||||
{
|
||||
public:
|
||||
cPageLayout()
|
||||
: m_nActive( -1 )
|
||||
{
|
||||
}
|
||||
|
||||
// Override functions
|
||||
void onChildDestroy( long nID );
|
||||
void onSchemaLoad( IView *pView, MSXML::IXMLDOMElementPtr &pElement );
|
||||
|
||||
typedef std::deque< long > cChildIDList;
|
||||
cChildIDList m_pages;
|
||||
|
||||
long m_nActive;
|
||||
|
||||
DECLARE_REGISTRY_RESOURCEID(IDR_PAGELAYOUT)
|
||||
|
||||
DECLARE_PROTECT_FINAL_CONSTRUCT()
|
||||
|
||||
BEGIN_COM_MAP(cPageLayout)
|
||||
COM_INTERFACE_ENTRY(ILayerRender)
|
||||
COM_INTERFACE_ENTRY(ILayerSchema)
|
||||
COM_INTERFACE_ENTRY(ILayer)
|
||||
COM_INTERFACE_ENTRY(IPageLayout)
|
||||
COM_INTERFACE_ENTRY(IPageLayoutDisp)
|
||||
COM_INTERFACE_ENTRY(ILayout)
|
||||
COM_INTERFACE_ENTRY(IControl)
|
||||
COM_INTERFACE_ENTRY(IDispatch)
|
||||
COM_INTERFACE_ENTRY(IProvideClassInfo)
|
||||
COM_INTERFACE_ENTRY(IProvideClassInfo2)
|
||||
COM_INTERFACE_ENTRY_IMPL(IConnectionPointContainer)
|
||||
END_COM_MAP()
|
||||
|
||||
BEGIN_CONNECTION_POINT_MAP(cPageLayout)
|
||||
CONNECTION_POINT_ENTRY(DIID_IControlEvents)
|
||||
END_CONNECTION_POINT_MAP()
|
||||
|
||||
public:
|
||||
// IPageLayout Methods
|
||||
STDMETHOD(get_Count)(/*[out, retval]*/ long *pVal);
|
||||
STDMETHOD(CreatePage)(ILayer *pChild);
|
||||
STDMETHOD(get_Active)(/*[out, retval]*/ long *pVal);
|
||||
STDMETHOD(put_Active)(/*[in]*/ long newVal);
|
||||
|
||||
// ILayerRender Methods
|
||||
STDMETHOD(Reformat)();
|
||||
};
|
||||
|
||||
#endif //__PAGELAYOUT_H_
|
||||
25
Native/DecalControls/PageLayout.rgs
Normal file
25
Native/DecalControls/PageLayout.rgs
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
HKCR
|
||||
{
|
||||
DecalControls.PageLayout.1 = s 'PageLayout Class'
|
||||
{
|
||||
CLSID = s '{5AD04D45-D4BF-4729-8A2E-5D37CF726CAA}'
|
||||
}
|
||||
DecalControls.PageLayout = s 'PageLayout Class'
|
||||
{
|
||||
CLSID = s '{5AD04D45-D4BF-4729-8A2E-5D37CF726CAA}'
|
||||
CurVer = s 'DecalControls.PageLayout.1'
|
||||
}
|
||||
NoRemove CLSID
|
||||
{
|
||||
ForceRemove {5AD04D45-D4BF-4729-8A2E-5D37CF726CAA} = s 'PageLayout Class'
|
||||
{
|
||||
ProgID = s 'DecalControls.PageLayout.1'
|
||||
VersionIndependentProgID = s 'DecalControls.PageLayout'
|
||||
InprocServer32 = s '%MODULE%'
|
||||
{
|
||||
val ThreadingModel = s 'Both'
|
||||
}
|
||||
'TypeLib' = s '{1C4B007A-04DD-4DF8-BA29-2CFBD0220B89}'
|
||||
}
|
||||
}
|
||||
}
|
||||
323
Native/DecalControls/Progress.cpp
Normal file
323
Native/DecalControls/Progress.cpp
Normal file
|
|
@ -0,0 +1,323 @@
|
|||
// Progress.cpp : Implementation of cProgress
|
||||
#include "stdafx.h"
|
||||
#include "DecalControls.h"
|
||||
#include "Progress.h"
|
||||
#include <sstream>
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// cProgress
|
||||
|
||||
|
||||
STDMETHODIMP cProgress::get_Value(long *pVal)
|
||||
{
|
||||
_ASSERTE( pVal );
|
||||
*pVal = m_nProgress;
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP cProgress::put_Value(long newVal)
|
||||
{
|
||||
_ASSERTE( newVal <= m_nMaxProgress );
|
||||
m_nProgress = newVal;
|
||||
m_pSite->Invalidate();
|
||||
m_pSite->Reformat();
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP cProgress::SchemaLoad(IView *pView, IUnknown *pSchema)
|
||||
{
|
||||
CComPtr< IPluginSite > pPlugin;
|
||||
m_pSite->get_PluginSite(&pPlugin);
|
||||
|
||||
pPlugin->CreateFontSchema(14, 0, pSchema, &m_pFont);
|
||||
|
||||
MSXML::IXMLDOMElementPtr pElement = pSchema;
|
||||
|
||||
_variant_t vValue = pElement->getAttribute(_T("value"));
|
||||
_variant_t vMaxValue = pElement->getAttribute(_T("max"));
|
||||
_variant_t vFaceColor = pElement->getAttribute(_T("facecolor"));
|
||||
_variant_t vFillColor = pElement->getAttribute(_T("fillcolor"));
|
||||
_variant_t vTextColor = pElement->getAttribute(_T("textcolor"));
|
||||
_variant_t vBorderColor = pElement->getAttribute(_T("bordercolor"));
|
||||
_variant_t vPreText = pElement->getAttribute(_T("pretext"));
|
||||
_variant_t vPostText = pElement->getAttribute(_T("posttext"));
|
||||
_variant_t vAlignment = pElement->getAttribute(_T("align"));
|
||||
_variant_t vDrawText = pElement->getAttribute(_T("drawtext"));
|
||||
_variant_t vBorderWidth = pElement->getAttribute(_T("border"));
|
||||
|
||||
// This is a required element
|
||||
_ASSERTE( vValue.vt == VT_I4 || vValue.vt == VT_I2 );
|
||||
m_nProgress = vValue;
|
||||
|
||||
if( vMaxValue.vt != VT_NULL )
|
||||
{
|
||||
try
|
||||
{
|
||||
m_nMaxProgress = static_cast< long >(vMaxValue);
|
||||
}
|
||||
catch( ... )
|
||||
{
|
||||
// Type conversion error
|
||||
_ASSERTE( FALSE );
|
||||
}
|
||||
}
|
||||
|
||||
if( vFaceColor.vt != VT_NULL )
|
||||
{
|
||||
try
|
||||
{
|
||||
m_nFaceColor = static_cast< long >(vFaceColor);
|
||||
}
|
||||
catch( ... )
|
||||
{
|
||||
// Type conversion error
|
||||
_ASSERTE( FALSE );
|
||||
}
|
||||
}
|
||||
|
||||
if( vFillColor.vt != VT_NULL )
|
||||
{
|
||||
try
|
||||
{
|
||||
m_nFillColor = static_cast< long >(vFillColor);
|
||||
}
|
||||
catch( ... )
|
||||
{
|
||||
// Type conversion error
|
||||
_ASSERTE( FALSE );
|
||||
}
|
||||
}
|
||||
|
||||
if( vTextColor.vt != VT_NULL )
|
||||
{
|
||||
try
|
||||
{
|
||||
m_nTextColor = static_cast< long >(vTextColor);
|
||||
}
|
||||
catch( ... )
|
||||
{
|
||||
// Type conversion error
|
||||
_ASSERTE( FALSE );
|
||||
}
|
||||
}
|
||||
|
||||
if( vBorderColor.vt != VT_NULL )
|
||||
{
|
||||
try
|
||||
{
|
||||
m_nBorderColor = static_cast< long >(vBorderColor);
|
||||
}
|
||||
catch( ... )
|
||||
{
|
||||
// Type conversion error
|
||||
_ASSERTE( FALSE );
|
||||
}
|
||||
}
|
||||
|
||||
if (vPreText.vt == VT_BSTR)
|
||||
put_PreText(vPreText.bstrVal);
|
||||
|
||||
if (vPostText.vt == VT_BSTR)
|
||||
put_PostText(vPostText.bstrVal);
|
||||
|
||||
if (vAlignment.vt == VT_BSTR)
|
||||
put_Alignment(vAlignment.bstrVal);
|
||||
|
||||
if( vDrawText.vt != VT_NULL )
|
||||
{
|
||||
try
|
||||
{
|
||||
m_nDrawText = static_cast< long >(vDrawText);
|
||||
}
|
||||
catch( ... )
|
||||
{
|
||||
// Type conversion error
|
||||
_ASSERTE( FALSE );
|
||||
}
|
||||
}
|
||||
|
||||
if( vBorderWidth.vt != VT_NULL )
|
||||
{
|
||||
try
|
||||
{
|
||||
m_nBorderWidth = static_cast< long >(vBorderWidth);
|
||||
}
|
||||
catch( ... )
|
||||
{
|
||||
// Type conversion error
|
||||
_ASSERTE( FALSE );
|
||||
}
|
||||
}
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP cProgress::Reformat()
|
||||
{
|
||||
if (!m_pFont.p)
|
||||
{
|
||||
// No font was specified, create the default font
|
||||
CComPtr< IPluginSite > pPlugin;
|
||||
m_pSite->get_PluginSite(&pPlugin);
|
||||
BSTR bstrFontName;
|
||||
pPlugin->get_FontName(&bstrFontName);
|
||||
pPlugin->CreateFont(bstrFontName /*_bstr_t(_T( "Times New Roman" ))*/, 14, 0, &m_pFont);
|
||||
}
|
||||
|
||||
// build string
|
||||
std::stringstream strText;
|
||||
strText << m_strPre << m_nProgress << m_strPost;
|
||||
m_bstrText = strText.str().c_str();
|
||||
|
||||
RECT rc;
|
||||
m_pSite->get_Position(&rc);
|
||||
|
||||
SIZE szText;
|
||||
m_pFont->MeasureText(m_bstrText, &szText);
|
||||
|
||||
// align vertically center
|
||||
m_ptText.y = ((rc.bottom - rc.top) - szText.cy) / 2;
|
||||
|
||||
// align left
|
||||
if (m_nAlignment == 0)
|
||||
m_ptText.x = m_nBorderWidth + 1;
|
||||
|
||||
// align center
|
||||
if (m_nAlignment == 1)
|
||||
m_ptText.x = ((rc.right - rc.left) - szText.cx) / 2;
|
||||
|
||||
// align right
|
||||
if (m_nAlignment == 2)
|
||||
m_ptText.x = ((rc.right - szText.cx) - m_nBorderWidth) - 6;
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP cProgress::Render(ICanvas *pCanvas)
|
||||
{
|
||||
_ASSERTE( pCanvas != NULL );
|
||||
_ASSERTE( m_pSite.p != NULL );
|
||||
|
||||
RECT rcPos;
|
||||
m_pSite->get_Position(&rcPos);
|
||||
|
||||
RECT rcClient = { 0, 0, rcPos.right - rcPos.left, rcPos.bottom - rcPos.top };
|
||||
RECT rcCenter = { m_nBorderWidth, m_nBorderWidth,
|
||||
(rcPos.right - rcPos.left) - m_nBorderWidth,
|
||||
(rcPos.bottom - rcPos.top) - m_nBorderWidth };
|
||||
|
||||
pCanvas->Fill(&rcClient, m_nBorderColor); // draw border
|
||||
pCanvas->Fill(&rcCenter, m_nFaceColor); // fill background
|
||||
|
||||
// calculate fill width
|
||||
long nPixelWidth = ((float)rcCenter.right / (float)m_nMaxProgress) * (float)m_nProgress;
|
||||
|
||||
RECT rcProgress = { m_nBorderWidth, m_nBorderWidth,
|
||||
nPixelWidth - m_nBorderWidth,
|
||||
rcCenter.bottom };
|
||||
|
||||
pCanvas->Fill(&rcProgress, m_nFillColor); // fill progress
|
||||
|
||||
// draw text
|
||||
if (m_nDrawText)
|
||||
m_pFont->DrawText(&m_ptText, m_bstrText, m_nTextColor, pCanvas);
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP cProgress::put_FaceColor(long newVal)
|
||||
{
|
||||
m_nFaceColor = newVal;
|
||||
m_pSite->Invalidate();
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP cProgress::put_FillColor(long newVal)
|
||||
{
|
||||
m_nFillColor = newVal;
|
||||
m_pSite->Invalidate();
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP cProgress::put_TextColor(long newVal)
|
||||
{
|
||||
m_nTextColor = newVal;
|
||||
m_pSite->Invalidate();
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP cProgress::put_MaxValue(long newVal)
|
||||
{
|
||||
m_nMaxProgress = newVal;
|
||||
m_pSite->Invalidate();
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
|
||||
STDMETHODIMP cProgress::put_PreText(BSTR newVal)
|
||||
{
|
||||
USES_CONVERSION;
|
||||
m_strPre = OLE2A(newVal);
|
||||
m_pSite->Invalidate();
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP cProgress::put_PostText(BSTR newVal)
|
||||
{
|
||||
USES_CONVERSION;
|
||||
m_strPost = OLE2A(newVal);
|
||||
m_pSite->Invalidate();
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP cProgress::put_Alignment(BSTR newVal)
|
||||
{
|
||||
USES_CONVERSION;
|
||||
std::string val = OLE2A(newVal);
|
||||
|
||||
if (!val.compare("left"))
|
||||
m_nAlignment = 0;
|
||||
if (!val.compare("center"))
|
||||
m_nAlignment = 1;
|
||||
if (!val.compare("right"))
|
||||
m_nAlignment = 2;
|
||||
|
||||
m_pSite->Invalidate();
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP cProgress::put_DrawText(VARIANT_BOOL newVal)
|
||||
{
|
||||
if (newVal == VARIANT_TRUE)
|
||||
m_nDrawText = true;
|
||||
else
|
||||
m_nDrawText = false;
|
||||
|
||||
m_pSite->Invalidate();
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
|
||||
STDMETHODIMP cProgress::put_BorderWidth(long newVal)
|
||||
{
|
||||
m_nBorderWidth = newVal;
|
||||
m_pSite->Invalidate();
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP cProgress::put_BorderColor(long newVal)
|
||||
{
|
||||
m_nBorderColor = newVal;
|
||||
m_pSite->Invalidate();
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
88
Native/DecalControls/Progress.h
Normal file
88
Native/DecalControls/Progress.h
Normal file
|
|
@ -0,0 +1,88 @@
|
|||
// Progress.h : Declaration of the cProgress
|
||||
|
||||
#ifndef __PROGRESS_H_
|
||||
#define __PROGRESS_H_
|
||||
|
||||
#include "resource.h" // main symbols
|
||||
|
||||
#include "SinkImpl.h"
|
||||
#include "DecalControlsCP.h"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// cProgress
|
||||
class ATL_NO_VTABLE cProgress :
|
||||
public CComObjectRootEx< CComSingleThreadModel >,
|
||||
public CComCoClass< cProgress, &CLSID_Progress >,
|
||||
public IConnectionPointContainerImpl< cProgress >,
|
||||
public IControlImpl< cProgress, IProgress, &IID_IProgress, &LIBID_DecalControls >,
|
||||
public ILayerImpl< cProgress >,
|
||||
public ILayerRenderImpl,
|
||||
public ILayerSchema,
|
||||
public IProvideClassInfo2Impl< &CLSID_Progress, &DIID_IControlEvents, &LIBID_DecalControls >,
|
||||
public CProxyIControlEvents< cProgress >
|
||||
{
|
||||
public:
|
||||
cProgress()
|
||||
{
|
||||
m_nFaceColor = RGB(140, 80, 30);
|
||||
m_nFillColor = RGB(220, 140, 60);
|
||||
m_nProgress = 50;
|
||||
m_nTextColor = RGB(240, 240, 120);
|
||||
m_nBorderColor = RGB(240, 240, 120);
|
||||
m_nBorderWidth = 1;
|
||||
m_nMaxProgress = 100;
|
||||
m_strPost = "%";
|
||||
m_nDrawText = true;
|
||||
m_nAlignment = 1; // center
|
||||
}
|
||||
|
||||
DECLARE_REGISTRY_RESOURCEID(IDR_PROGRESS)
|
||||
DECLARE_PROTECT_FINAL_CONSTRUCT()
|
||||
|
||||
BEGIN_COM_MAP(cProgress)
|
||||
COM_INTERFACE_ENTRY(ILayerRender)
|
||||
COM_INTERFACE_ENTRY(ILayerSchema)
|
||||
COM_INTERFACE_ENTRY(ILayer)
|
||||
COM_INTERFACE_ENTRY(IControl)
|
||||
COM_INTERFACE_ENTRY(IDispatch)
|
||||
COM_INTERFACE_ENTRY(IProgress)
|
||||
COM_INTERFACE_ENTRY(IProvideClassInfo)
|
||||
COM_INTERFACE_ENTRY(IProvideClassInfo2)
|
||||
COM_INTERFACE_ENTRY_IMPL(IConnectionPointContainer)
|
||||
END_COM_MAP()
|
||||
|
||||
BEGIN_CONNECTION_POINT_MAP(cProgress)
|
||||
CONNECTION_POINT_ENTRY(DIID_IControlEvents)
|
||||
END_CONNECTION_POINT_MAP()
|
||||
|
||||
public:
|
||||
STDMETHOD(put_BorderColor)(/*[in]*/ long newVal);
|
||||
STDMETHOD(put_BorderWidth)(/*[in]*/ long newVal);
|
||||
STDMETHOD(put_PreText)(/*[in]*/ BSTR newVal);
|
||||
STDMETHOD(put_DrawText)(/*[in]*/ VARIANT_BOOL newVal);
|
||||
STDMETHOD(put_Alignment)(/*[in]*/ BSTR newVal);
|
||||
STDMETHOD(put_PostText)(/*[in]*/ BSTR newVal);
|
||||
STDMETHOD(put_MaxValue)(/*[in]*/ long newVal);
|
||||
STDMETHOD(put_TextColor)(/*[in]*/ long newVal);
|
||||
STDMETHOD(put_FillColor)(/*[in]*/ long newVal);
|
||||
STDMETHOD(put_FaceColor)(/*[in]*/ long newVal);
|
||||
STDMETHOD(get_Value)(/*[out, retval]*/ long *pVal);
|
||||
STDMETHOD(put_Value)(/*[in]*/ long newVal);
|
||||
|
||||
// ILayerSchema Methods
|
||||
STDMETHOD(SchemaLoad)(IView *pView, IUnknown *pSchema);
|
||||
|
||||
// ILayerRender Methods
|
||||
STDMETHOD(Reformat)();
|
||||
STDMETHOD(Render)(ICanvas *pCanvas);
|
||||
|
||||
long m_nProgress, m_nFaceColor, m_nTextColor, m_nFillColor,
|
||||
m_nMaxProgress, m_nBorderColor, m_nBorderWidth, m_nDrawText;
|
||||
std::string m_strPost, m_strPre;
|
||||
POINT m_ptText;
|
||||
_bstr_t m_bstrText;
|
||||
int m_nAlignment; // 0 = left, 1 = center, 2 = right
|
||||
CComPtr< IFontCache > m_pFont;
|
||||
};
|
||||
|
||||
#endif //__PROGRESS_H_
|
||||
382
Native/DecalControls/PushButton.cpp
Normal file
382
Native/DecalControls/PushButton.cpp
Normal file
|
|
@ -0,0 +1,382 @@
|
|||
// PushButton.cpp : Implementation of cPushButton
|
||||
#include "stdafx.h"
|
||||
#include "DecalControls.h"
|
||||
#include "PushButton.h"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// cPushButton
|
||||
|
||||
cPushButton::cPushButton()
|
||||
: m_bPressed( VARIANT_FALSE ),
|
||||
m_bMouseIn( VARIANT_FALSE ),
|
||||
m_nFaceColor( RGB( 140, 80, 30 ) ),
|
||||
m_nTextColor( RGB( 240, 240, 120 ) ),
|
||||
m_UseFaceColor(false) // GKusnick: Render 3D outline.
|
||||
{
|
||||
}
|
||||
|
||||
void cPushButton::onCreate()
|
||||
{
|
||||
// This control draws over it's entire area
|
||||
m_pSite->put_Transparent( VARIANT_FALSE );
|
||||
}
|
||||
|
||||
STDMETHODIMP cPushButton::get_Image(IImageCacheDisp **pVal)
|
||||
{
|
||||
_ASSERTE( pVal != NULL );
|
||||
|
||||
if( m_pBackground.p == NULL )
|
||||
*pVal = NULL;
|
||||
else
|
||||
m_pBackground->QueryInterface( pVal );
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP cPushButton::putref_Image(IImageCacheDisp *newVal)
|
||||
{
|
||||
if( m_pBackground.p )
|
||||
m_pBackground.Release();
|
||||
|
||||
if( newVal != NULL )
|
||||
{
|
||||
HRESULT hRes = newVal->QueryInterface( &m_pBackground );
|
||||
_ASSERTE( SUCCEEDED( hRes ) );
|
||||
}
|
||||
|
||||
m_pSite->Invalidate();
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP cPushButton::get_Font(IFontCacheDisp **pVal)
|
||||
{
|
||||
_ASSERTE( pVal != NULL );
|
||||
|
||||
if( m_pFont.p == NULL )
|
||||
*pVal = NULL;
|
||||
else
|
||||
m_pFont->QueryInterface( pVal );
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP cPushButton::putref_Font(IFontCacheDisp *newVal)
|
||||
{
|
||||
_ASSERTE( newVal != NULL );
|
||||
|
||||
if( m_pFont.p )
|
||||
m_pFont.Release();
|
||||
|
||||
HRESULT hRes = newVal->QueryInterface( &m_pFont );
|
||||
|
||||
_ASSERTE( SUCCEEDED( hRes ) );
|
||||
|
||||
m_pSite->Reformat();
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP cPushButton::get_Text(BSTR *pVal)
|
||||
{
|
||||
_ASSERTE( pVal != NULL );
|
||||
|
||||
*pVal = OLE2BSTR( m_strText );
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP cPushButton::put_Text(BSTR newVal)
|
||||
{
|
||||
_ASSERTE( newVal != NULL );
|
||||
|
||||
m_strText = newVal;
|
||||
m_pSite->Reformat();
|
||||
m_pSite->Invalidate();
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP cPushButton::get_FaceColor(long *pVal)
|
||||
{
|
||||
_ASSERTE( pVal != NULL );
|
||||
|
||||
*pVal = m_nFaceColor;
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP cPushButton::put_FaceColor(long newVal)
|
||||
{
|
||||
_ASSERTE( ( newVal & 0xFF000000L ) == 0 );
|
||||
|
||||
m_nFaceColor = newVal;
|
||||
m_UseFaceColor = true; // GKusnick: Render 3D outline.
|
||||
m_pSite->Invalidate();
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP cPushButton::get_TextColor(long *pVal)
|
||||
{
|
||||
_ASSERTE( pVal != NULL );
|
||||
|
||||
*pVal = m_nTextColor;
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP cPushButton::put_TextColor(long newVal)
|
||||
{
|
||||
_ASSERTE( ( newVal & 0xFF000000L ) == 0 );
|
||||
|
||||
m_nTextColor = newVal;
|
||||
m_pSite->Invalidate();
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP cPushButton::SchemaLoad( IView *pView, IUnknown *pSchema )
|
||||
{
|
||||
CComPtr< IPluginSite > pPlugin;
|
||||
m_pSite->get_PluginSite( &pPlugin );
|
||||
|
||||
// Load some defaults
|
||||
pPlugin->CreateFontSchema( 14, 0, pSchema, &m_pFont );
|
||||
pPlugin->LoadImageSchema( pSchema, &m_pBackground );
|
||||
|
||||
MSXML::IXMLDOMElementPtr pElement = pSchema;
|
||||
|
||||
_variant_t vFaceColor = pElement->getAttribute( _T( "facecolor" ) ),
|
||||
vTextColor = pElement->getAttribute( _T( "textcolor" ) ),
|
||||
vText = pElement->getAttribute( _T( "text" ) ),
|
||||
vAntialias = pElement->getAttribute( _T( "aa" ) );
|
||||
|
||||
if( vFaceColor.vt != VT_NULL )
|
||||
{
|
||||
try
|
||||
{
|
||||
m_nFaceColor = static_cast< long >( vFaceColor );
|
||||
m_UseFaceColor = true; // GKusnick: Render 3D outline.
|
||||
}
|
||||
catch( ... )
|
||||
{
|
||||
// Type conversion error
|
||||
_ASSERTE( FALSE );
|
||||
}
|
||||
}
|
||||
|
||||
if( vTextColor.vt != VT_NULL )
|
||||
{
|
||||
try
|
||||
{
|
||||
m_nTextColor = static_cast< long >( vTextColor );
|
||||
}
|
||||
catch( ... )
|
||||
{
|
||||
// Type conversion error
|
||||
_ASSERTE( FALSE );
|
||||
}
|
||||
}
|
||||
|
||||
if( vText.vt != VT_NULL )
|
||||
{
|
||||
_ASSERTE( vText.vt == VT_BSTR );
|
||||
m_strText = vText.bstrVal;
|
||||
}
|
||||
|
||||
m_bAA = true;
|
||||
if( vAntialias.vt != VT_NULL )
|
||||
{
|
||||
try
|
||||
{
|
||||
m_bAA = static_cast< bool >( vAntialias );
|
||||
}
|
||||
catch( ... )
|
||||
{
|
||||
// Type conversion error
|
||||
_ASSERTE( FALSE );
|
||||
}
|
||||
}
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP cPushButton::MouseEnter(struct MouseState *)
|
||||
{
|
||||
_ASSERTE( !m_bMouseIn );
|
||||
|
||||
m_bMouseIn = VARIANT_TRUE;
|
||||
|
||||
if( m_bPressed )
|
||||
{
|
||||
long nID;
|
||||
m_pSite->get_ID( &nID );
|
||||
Fire_Hit( nID );
|
||||
|
||||
_ASSERTE( m_pSite.p != NULL );
|
||||
|
||||
m_pSite->Invalidate();
|
||||
}
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP cPushButton::MouseExit(struct MouseState *)
|
||||
{
|
||||
_ASSERTE( m_bMouseIn );
|
||||
|
||||
m_bMouseIn = VARIANT_FALSE;
|
||||
|
||||
if( m_bPressed )
|
||||
{
|
||||
long nID;
|
||||
m_pSite->get_ID( &nID );
|
||||
Fire_Unhit( nID );
|
||||
|
||||
_ASSERTE( m_pSite.p != NULL );
|
||||
|
||||
m_pSite->Invalidate();
|
||||
}
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP cPushButton::MouseDown(struct MouseState *)
|
||||
{
|
||||
_ASSERTE( m_pSite != NULL );
|
||||
|
||||
long nID;
|
||||
m_pSite->get_ID( &nID );
|
||||
Fire_Hit( nID );
|
||||
|
||||
m_bPressed = VARIANT_TRUE;
|
||||
m_pSite->Invalidate();
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP cPushButton::MouseUp(struct MouseState *)
|
||||
{
|
||||
m_bPressed = VARIANT_FALSE;
|
||||
|
||||
long nID;
|
||||
m_pSite->get_ID( &nID );
|
||||
|
||||
if( m_bMouseIn )
|
||||
{
|
||||
_ASSERTE( m_pSite.p != NULL );
|
||||
|
||||
m_pSite->Invalidate();
|
||||
|
||||
// NOTE: The command may destroy the control synchronously
|
||||
// so we make a stack copy of the target in case our instance is destroyed
|
||||
// for the purpose of completing the command
|
||||
Fire_Accepted( nID );
|
||||
Fire_Unhit( nID );
|
||||
}
|
||||
else
|
||||
Fire_Canceled( nID );
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP cPushButton::Reformat()
|
||||
{
|
||||
// Everything looks good, calculate the offset of the text
|
||||
if( m_pFont.p == NULL )
|
||||
{
|
||||
// No font was specified, create the default font
|
||||
CComPtr< IPluginSite > pPlugin;
|
||||
m_pSite->get_PluginSite( &pPlugin );
|
||||
|
||||
BSTR bstrFontName;
|
||||
pPlugin->get_FontName(&bstrFontName);
|
||||
pPlugin->CreateFont( bstrFontName /*_bstr_t( _T( "Times New Roman" ) )*/, 14, 0, &m_pFont );
|
||||
}
|
||||
|
||||
RECT rc;
|
||||
m_pSite->get_Position( &rc );
|
||||
|
||||
SIZE szText;
|
||||
m_pFont->MeasureText( m_strText, &szText );
|
||||
|
||||
m_ptText.x = ( ( rc.right - rc.left ) - szText.cx ) / 2;
|
||||
m_ptText.y = ( ( rc.bottom - rc.top ) - szText.cy ) / 2;
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP cPushButton::Render( ICanvas *pCanvas )
|
||||
{
|
||||
_ASSERTE( pCanvas != NULL );
|
||||
_ASSERTE( m_pSite.p != NULL );
|
||||
|
||||
RECT rcPos;
|
||||
m_pSite->get_Position( &rcPos );
|
||||
|
||||
RECT rcClient = { 0, 0, rcPos.right - rcPos.left, rcPos.bottom - rcPos.top };
|
||||
bool bPressed = ( m_bPressed && m_bMouseIn );
|
||||
|
||||
// First draw the background
|
||||
if( m_pBackground.p == NULL )
|
||||
pCanvas->Fill( &rcClient, m_nFaceColor );
|
||||
else
|
||||
{
|
||||
POINT ptOrg = { ( bPressed ) ? 1 : 0, ( bPressed ) ? 1 : 0 };
|
||||
m_pBackground->PatBlt( pCanvas, &rcClient, &ptOrg );
|
||||
}
|
||||
|
||||
// Next, draw the text
|
||||
POINT ptText = { ( !bPressed ) ? m_ptText.x : m_ptText.x + 1, ( !bPressed ) ? m_ptText.y : m_ptText.y + 1 };
|
||||
m_pFont->DrawTextEx( &ptText, m_strText, m_nTextColor, 0, m_bAA ? eAA : 0, pCanvas );
|
||||
|
||||
// Nerfgolem 2001.10.11
|
||||
// Do not render the 3D outline if there's a background image.
|
||||
// GKusnick: Do render it if there's an explicit face color.
|
||||
if( m_pBackground.p == NULL || m_UseFaceColor )
|
||||
{
|
||||
// Last, draw the '3D' border - colors are generated relative to the face color
|
||||
// and the design is taken from the windows button
|
||||
long nBrightest = RGB( ( 255 - GetRValue( m_nFaceColor ) ) / 2 + GetRValue( m_nFaceColor ),
|
||||
( 255 - GetGValue( m_nFaceColor ) ) / 2 + GetGValue( m_nFaceColor ),
|
||||
( 255 - GetBValue( m_nFaceColor ) ) / 2 + GetBValue( m_nFaceColor ) ),
|
||||
nDarkShadow = RGB( GetRValue( m_nFaceColor ) / 4, GetGValue( m_nFaceColor ) / 4, GetBValue( m_nFaceColor ) / 4 ),
|
||||
nShadow = RGB( GetRValue( m_nFaceColor ) / 2, GetGValue( m_nFaceColor ) / 2, GetBValue( m_nFaceColor ) / 2 );
|
||||
|
||||
RECT rcOuterLeft = { 0, 0, 1, rcClient.bottom - 1 },
|
||||
rcInnerLeft = { 1, 1, 2, rcClient.bottom - 2 },
|
||||
rcOuterTop = { 0, 0, rcClient.right - 1, 1 },
|
||||
rcInnerTop = { 1, 1, rcClient.right - 2, 2 },
|
||||
rcOuterRight = { rcClient.right - 1, 0, rcClient.right, rcClient.bottom },
|
||||
rcInnerRight = { rcClient.right - 2, 1, rcClient.right - 1, rcClient.bottom - 1 },
|
||||
rcOuterBottom = { 0, rcClient.bottom - 1, rcClient.right, rcClient.bottom },
|
||||
rcInnerBottom = { 1, rcClient.bottom - 2, rcClient.right - 1, rcClient.bottom - 1 };
|
||||
|
||||
if( bPressed )
|
||||
{
|
||||
pCanvas->Fill( &rcOuterLeft, nDarkShadow );
|
||||
pCanvas->Fill( &rcOuterTop, nDarkShadow );
|
||||
pCanvas->Fill( &rcOuterRight, nBrightest );
|
||||
pCanvas->Fill( &rcOuterBottom, nBrightest );
|
||||
|
||||
pCanvas->Fill( &rcInnerLeft, nShadow );
|
||||
pCanvas->Fill( &rcInnerTop, nShadow );
|
||||
pCanvas->Fill( &rcInnerRight, m_nFaceColor );
|
||||
pCanvas->Fill( &rcInnerBottom, m_nFaceColor );
|
||||
}
|
||||
else
|
||||
{
|
||||
pCanvas->Fill( &rcOuterLeft, nBrightest );
|
||||
pCanvas->Fill( &rcOuterTop, nBrightest );
|
||||
pCanvas->Fill( &rcOuterRight, nDarkShadow );
|
||||
pCanvas->Fill( &rcOuterBottom, nDarkShadow );
|
||||
|
||||
pCanvas->Fill( &rcInnerLeft, m_nFaceColor );
|
||||
pCanvas->Fill( &rcInnerTop, m_nFaceColor );
|
||||
pCanvas->Fill( &rcInnerRight, nShadow );
|
||||
pCanvas->Fill( &rcInnerBottom, nShadow );
|
||||
}
|
||||
}
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
91
Native/DecalControls/PushButton.h
Normal file
91
Native/DecalControls/PushButton.h
Normal file
|
|
@ -0,0 +1,91 @@
|
|||
// PushButton.h : Declaration of the cPushButton
|
||||
|
||||
#ifndef __PUSHBUTTON_H_
|
||||
#define __PUSHBUTTON_H_
|
||||
|
||||
#include "resource.h" // main symbols
|
||||
|
||||
#include "SinkImpl.h"
|
||||
#include "DecalControlsCP.h"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// cPushButton
|
||||
class ATL_NO_VTABLE cPushButton :
|
||||
public CComObjectRootEx<CComMultiThreadModel>,
|
||||
public CComCoClass<cPushButton, &CLSID_PushButton>,
|
||||
public IControlImpl< cPushButton, IPushButton, &IID_IPushButton, &LIBID_DecalControls >,
|
||||
public ILayerImpl< cPushButton >,
|
||||
public ILayerRenderImpl,
|
||||
public ILayerSchema,
|
||||
public ILayerMouseImpl,
|
||||
public IProvideClassInfo2Impl< &CLSID_PushButton, &DIID_ICommandEvents, &LIBID_DecalControls >,
|
||||
public IConnectionPointContainerImpl<cPushButton>,
|
||||
public CProxyICommandEvents< cPushButton >
|
||||
{
|
||||
public:
|
||||
cPushButton();
|
||||
|
||||
VARIANT_BOOL m_bPressed,
|
||||
m_bMouseIn;
|
||||
|
||||
_bstr_t m_strText;
|
||||
CComPtr< IFontCache > m_pFont;
|
||||
CComPtr< IImageCache > m_pBackground;
|
||||
POINT m_ptText;
|
||||
|
||||
long m_nFaceColor,
|
||||
m_nTextColor;
|
||||
BOOL m_UseFaceColor; // GKusnick: Render 3D outline.
|
||||
bool m_bAA;
|
||||
|
||||
void onCreate();
|
||||
|
||||
DECLARE_REGISTRY_RESOURCEID(IDR_PUSHBUTTON)
|
||||
|
||||
DECLARE_PROTECT_FINAL_CONSTRUCT()
|
||||
|
||||
BEGIN_COM_MAP(cPushButton)
|
||||
COM_INTERFACE_ENTRY(ILayerRender)
|
||||
COM_INTERFACE_ENTRY(ILayerMouse)
|
||||
COM_INTERFACE_ENTRY(ILayerSchema)
|
||||
COM_INTERFACE_ENTRY(ILayer)
|
||||
COM_INTERFACE_ENTRY(IControl)
|
||||
COM_INTERFACE_ENTRY(IDispatch)
|
||||
COM_INTERFACE_ENTRY(IPushButton)
|
||||
COM_INTERFACE_ENTRY(IProvideClassInfo)
|
||||
COM_INTERFACE_ENTRY(IProvideClassInfo2)
|
||||
COM_INTERFACE_ENTRY_IMPL(IConnectionPointContainer)
|
||||
END_COM_MAP()
|
||||
|
||||
BEGIN_CONNECTION_POINT_MAP(cPushButton)
|
||||
CONNECTION_POINT_ENTRY(DIID_ICommandEvents)
|
||||
END_CONNECTION_POINT_MAP()
|
||||
|
||||
public:
|
||||
// IPushButton Methods
|
||||
STDMETHOD(get_TextColor)(/*[out, retval]*/ long *pVal);
|
||||
STDMETHOD(put_TextColor)(/*[in]*/ long newVal);
|
||||
STDMETHOD(get_FaceColor)(/*[out, retval]*/ long *pVal);
|
||||
STDMETHOD(put_FaceColor)(/*[in]*/ long newVal);
|
||||
STDMETHOD(get_Text)(/*[out, retval]*/ BSTR *pVal);
|
||||
STDMETHOD(put_Text)(/*[in]*/ BSTR newVal);
|
||||
STDMETHOD(get_Font)(/*[out, retval]*/ IFontCacheDisp * *pVal);
|
||||
STDMETHOD(putref_Font)(/*[in]*/ IFontCacheDisp * newVal);
|
||||
STDMETHOD(get_Image)(/*[out, retval]*/ IImageCacheDisp * *pVal);
|
||||
STDMETHOD(putref_Image)(/*[in]*/ IImageCacheDisp * newVal);
|
||||
|
||||
// ILayerMouse Methods
|
||||
STDMETHOD(MouseEnter)(struct MouseState *);
|
||||
STDMETHOD(MouseExit)(struct MouseState *);
|
||||
STDMETHOD(MouseDown)(struct MouseState *);
|
||||
STDMETHOD(MouseUp)(struct MouseState *);
|
||||
|
||||
// ILayerRender Methods
|
||||
STDMETHOD(Reformat)();
|
||||
STDMETHOD(Render)(ICanvas *pCanvas);
|
||||
|
||||
// ILayerSchema Methods
|
||||
STDMETHOD(SchemaLoad)( IView *pView, IUnknown *pSchema );
|
||||
};
|
||||
|
||||
#endif //__PUSHBUTTON_H_
|
||||
25
Native/DecalControls/PushButton.rgs
Normal file
25
Native/DecalControls/PushButton.rgs
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
HKCR
|
||||
{
|
||||
DecalControls.PushButton.1 = s 'PushButton Class'
|
||||
{
|
||||
CLSID = s '{AE4525BE-81D1-40FB-9170-77172077EB49}'
|
||||
}
|
||||
DecalControls.PushButton = s 'PushButton Class'
|
||||
{
|
||||
CLSID = s '{AE4525BE-81D1-40FB-9170-77172077EB49}'
|
||||
CurVer = s 'DecalControls.PushButton.1'
|
||||
}
|
||||
NoRemove CLSID
|
||||
{
|
||||
ForceRemove {AE4525BE-81D1-40FB-9170-77172077EB49} = s 'PushButton Class'
|
||||
{
|
||||
ProgID = s 'DecalControls.PushButton.1'
|
||||
VersionIndependentProgID = s 'DecalControls.PushButton'
|
||||
InprocServer32 = s '%MODULE%'
|
||||
{
|
||||
val ThreadingModel = s 'Both'
|
||||
}
|
||||
'TypeLib' = s '{1C4B007A-04DD-4DF8-BA29-2CFBD0220B89}'
|
||||
}
|
||||
}
|
||||
}
|
||||
863
Native/DecalControls/Scroller.cpp
Normal file
863
Native/DecalControls/Scroller.cpp
Normal file
|
|
@ -0,0 +1,863 @@
|
|||
// Scroller.cpp : Implementation of cScroller
|
||||
#include "stdafx.h"
|
||||
#include "DecalControls.h"
|
||||
#include "Scroller.h"
|
||||
|
||||
enum eScrollChildren
|
||||
{
|
||||
eScrollerUp = 1,
|
||||
eScrollerDown = 2,
|
||||
eScrollerRight = 3,
|
||||
eScrollerLeft = 4,
|
||||
eScrollerPager = 5,
|
||||
eScrollerPageUp = 6,
|
||||
eScrollerPageDown = 7,
|
||||
eScrollerPageLeft = 8,
|
||||
eScrollerPageRight = 9,
|
||||
eScrollerClient = 10,
|
||||
eScrollerHThumb = 11,
|
||||
eScrollerVThumb = 12
|
||||
};
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// cScroller
|
||||
|
||||
void cScroller::onCreate()
|
||||
{
|
||||
// Initialize our layout options
|
||||
m_szArea.cx = 0;
|
||||
m_szArea.cy = 0;
|
||||
|
||||
m_szIncrement.cx = 100;
|
||||
m_szIncrement.cy = 20;
|
||||
|
||||
m_ptThumb.x = 0;
|
||||
m_ptThumb.y = 0;
|
||||
|
||||
m_bHScroll = VARIANT_FALSE;
|
||||
m_bVScroll = VARIANT_FALSE;
|
||||
|
||||
CComPtr< ILayer > pLayerPager;
|
||||
HRESULT hRes = ::CoCreateInstance( __uuidof( Pager ), NULL, CLSCTX_INPROC_SERVER, __uuidof( ILayer ),
|
||||
reinterpret_cast< void ** >( &pLayerPager ) );
|
||||
_ASSERTE( SUCCEEDED( hRes ) );
|
||||
|
||||
LayerParams p = { eScrollerPager, { 0, 0, 0, 0 }, eRenderClipped };
|
||||
|
||||
m_pSite->CreateChild( &p, pLayerPager );
|
||||
pLayerPager->QueryInterface( &m_pPager );
|
||||
IPagerEventsImpl< PAGER_CLIENT, cScroller >::advise( m_pPager );
|
||||
|
||||
CComPtr< ILayer > pLayerUp;
|
||||
hRes = ::CoCreateInstance( __uuidof( Button ), NULL, CLSCTX_INPROC_SERVER, __uuidof( ILayer ),
|
||||
reinterpret_cast< void ** >( &pLayerUp ) );
|
||||
_ASSERTE( SUCCEEDED( hRes ) );
|
||||
|
||||
p.ID = eScrollerUp;
|
||||
|
||||
CComPtr< IButton > pUp;
|
||||
m_pSite->CreateChild( &p, pLayerUp );
|
||||
pLayerUp->QueryInterface( &pUp);
|
||||
ICommandEventsImpl< BUTTON_UP, cScroller >::advise( pUp );
|
||||
pUp->SetImages( 0, 0x06001261, 0x06001262 );
|
||||
pUp->put_Matte( RGB( 0, 0, 0 ) );
|
||||
|
||||
CComPtr< ILayer > pLayerDown;
|
||||
hRes = ::CoCreateInstance( __uuidof( Button ), NULL, CLSCTX_INPROC_SERVER, __uuidof( ILayer ),
|
||||
reinterpret_cast< void ** >( &pLayerDown ) );
|
||||
_ASSERTE( SUCCEEDED( hRes ) );
|
||||
|
||||
p.ID = eScrollerDown;
|
||||
|
||||
CComPtr< IButton > pDown;
|
||||
m_pSite->CreateChild( &p, pLayerDown );
|
||||
pLayerDown->QueryInterface( &pDown );
|
||||
ICommandEventsImpl< BUTTON_DOWN, cScroller >::advise( pDown );
|
||||
pDown->SetImages( 0, 0x0600125E, 0x0600125F );
|
||||
pDown->put_Matte( RGB( 0, 0, 0 ) );
|
||||
|
||||
CComPtr< ILayer > pLayerLeft;
|
||||
hRes = ::CoCreateInstance( __uuidof( Button ), NULL, CLSCTX_INPROC_SERVER, __uuidof( ILayer ),
|
||||
reinterpret_cast< void ** >( &pLayerLeft ) );
|
||||
_ASSERTE( SUCCEEDED( hRes ) );
|
||||
|
||||
p.ID = eScrollerLeft;
|
||||
|
||||
CComPtr< IButton > pLeft;
|
||||
m_pSite->CreateChild( &p, pLayerLeft );
|
||||
pLayerLeft->QueryInterface( &pLeft );
|
||||
ICommandEventsImpl< BUTTON_LEFT, cScroller >::advise( pLeft );
|
||||
pLeft->SetImages( 0, 0x06001295, 0x06001296 );
|
||||
pLeft->put_Matte( RGB( 0, 0, 0 ) );
|
||||
|
||||
CComPtr< ILayer > pLayerRight;
|
||||
hRes = ::CoCreateInstance( __uuidof( Button ), NULL, CLSCTX_INPROC_SERVER, __uuidof( ILayer ),
|
||||
reinterpret_cast< void ** >( &pLayerRight ) );
|
||||
_ASSERTE( SUCCEEDED( hRes ) );
|
||||
|
||||
p.ID = eScrollerRight;
|
||||
|
||||
CComPtr< IButton > pRight;
|
||||
m_pSite->CreateChild( &p, pLayerRight );
|
||||
pLayerRight->QueryInterface( &pRight );
|
||||
ICommandEventsImpl< BUTTON_RIGHT, cScroller >::advise( pRight );
|
||||
pRight->SetImages( 0, 0x06001298, 0x06001299 );
|
||||
pRight->put_Matte( RGB( 0, 0, 0 ) );
|
||||
|
||||
// Positioning will occur during Reformat
|
||||
|
||||
// Load the images
|
||||
CComPtr< IPluginSite > pPlugin;
|
||||
m_pSite->get_PluginSite( &pPlugin );
|
||||
|
||||
pPlugin->LoadBitmapPortal( 0x06001260, &m_pVScrollBack );
|
||||
pPlugin->LoadBitmapPortal( 0x06001297, &m_pHScrollBack );
|
||||
}
|
||||
|
||||
void cScroller::onDestroy()
|
||||
{
|
||||
m_pPager.Release();
|
||||
}
|
||||
|
||||
void cScroller::constrainOffset( LPPOINT ppt )
|
||||
{
|
||||
// First check for overflow, furthest scroll should be allowed is less a
|
||||
// page size
|
||||
POINT ptMax = { m_szArea.cx, m_szArea.cy };
|
||||
|
||||
SIZE szViewport;
|
||||
get_Viewport( &szViewport );
|
||||
|
||||
if((szViewport.cx % m_szIncrement.cx)==0)
|
||||
ptMax.x -= szViewport.cx;
|
||||
else
|
||||
ptMax.x -= ( szViewport.cx / m_szIncrement.cx + 1) * m_szIncrement.cx;
|
||||
|
||||
if((szViewport.cy % m_szIncrement.cy)==0)
|
||||
ptMax.y -= szViewport.cy;
|
||||
else
|
||||
ptMax.y -= ( szViewport.cy / m_szIncrement.cy + 1) * m_szIncrement.cy;
|
||||
|
||||
// substract the viewport (rounded up a notch) from the max scroll area
|
||||
// ptMax.x -= ( szViewport.cx / m_szIncrement.cx + 1) * m_szIncrement.cx;
|
||||
// ptMax.y -= ( szViewport.cy / m_szIncrement.cy + 1) * m_szIncrement.cy;
|
||||
|
||||
if( ppt->x > ptMax.x )
|
||||
ppt->x = ptMax.x;
|
||||
if( ppt->y > ptMax.y )
|
||||
ppt->y = ptMax.y;
|
||||
|
||||
// Check for underflow (either because it was assigned too low
|
||||
// or or max is too low)
|
||||
if( ppt->x < 0 )
|
||||
ppt->x = 0;
|
||||
if( ppt->y < 0 )
|
||||
ppt->y = 0;
|
||||
|
||||
}
|
||||
|
||||
#define BTN_SIZE 16
|
||||
|
||||
long cScroller::hitTest( MouseState *pMS )
|
||||
{
|
||||
if( pMS->over != this )
|
||||
return -1;
|
||||
|
||||
SIZE szViewport;
|
||||
|
||||
get_Viewport( &szViewport );
|
||||
|
||||
RECT rcScroll = { BTN_SIZE, BTN_SIZE, szViewport.cx - BTN_SIZE, szViewport.cy - BTN_SIZE };
|
||||
|
||||
// Check if it's on the horizontal bar
|
||||
if( m_bHScroll )
|
||||
{
|
||||
if( pMS->client.x > rcScroll.left && pMS->client.x < rcScroll.right && pMS->client.y > szViewport.cy )
|
||||
{
|
||||
if( m_szArea.cx == szViewport.cx )
|
||||
// Special case, no scrolling if the area is the minimum size
|
||||
return -1;
|
||||
|
||||
// We hit the horizontal bar
|
||||
if( pMS->client.x < ( m_ptThumb.x + BTN_SIZE ) )
|
||||
// Hit before the thumb
|
||||
return eScrollerPageLeft;
|
||||
else if( pMS->client.x > ( m_ptThumb.x + BTN_SIZE * 2 ) )
|
||||
// Hit after the thumb
|
||||
return eScrollerPageRight;
|
||||
|
||||
// Hit the thumb
|
||||
return eScrollerHThumb;
|
||||
}
|
||||
}
|
||||
|
||||
// Check if it's on the vertical bar
|
||||
if( m_bVScroll )
|
||||
{
|
||||
if( pMS->client.y > rcScroll.top && pMS->client.y < rcScroll.bottom && pMS->client.x > szViewport.cx )
|
||||
{
|
||||
if( m_szArea.cy == szViewport.cy )
|
||||
// Special case, no scrolling if the area is the minimum size
|
||||
return -1;
|
||||
|
||||
// We hit the vertical bar
|
||||
if( pMS->client.y < ( m_ptThumb.y + BTN_SIZE ) )
|
||||
// Hit above the thumb
|
||||
return eScrollerPageUp;
|
||||
else if( pMS->client.y > ( m_ptThumb.y + BTN_SIZE * 2 ) )
|
||||
// Hit below thumb
|
||||
return eScrollerPageDown;
|
||||
|
||||
// Hit the v thumb
|
||||
return eScrollerVThumb;
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
STDMETHODIMP cScroller::Render(ICanvas *pCanvas)
|
||||
{
|
||||
SIZE szViewport;
|
||||
get_Viewport( &szViewport );
|
||||
|
||||
// Fill in the scrollbars as neccessary
|
||||
static POINT ptOff = { 0, 0 };
|
||||
|
||||
CComPtr< IPluginSite > pPluginSite;
|
||||
m_pSite->get_PluginSite( &pPluginSite );
|
||||
|
||||
SIZE szIcon = { BTN_SIZE, BTN_SIZE };
|
||||
CComPtr< IIconCache > pIconCache;
|
||||
pPluginSite->GetIconCache( &szIcon, &pIconCache );
|
||||
|
||||
if( m_bHScroll )
|
||||
{
|
||||
RECT rcHScroll = { BTN_SIZE, szViewport.cy, szViewport.cx - BTN_SIZE, szViewport.cy + BTN_SIZE };
|
||||
m_pHScrollBack->PatBlt( pCanvas, &rcHScroll, &ptOff );
|
||||
|
||||
if( m_szArea.cx != szViewport.cx )
|
||||
{
|
||||
// Draw the H thumb
|
||||
POINT ptHThumb = { BTN_SIZE + m_ptThumb.x, szViewport.cy };
|
||||
RECT rcThumb = { ptHThumb.x, ptHThumb.y, ptHThumb.x + BTN_SIZE, ptHThumb.y + BTN_SIZE };
|
||||
pCanvas->Fill( &rcThumb, RGB( 0, 0, 0 ) );
|
||||
pIconCache->DrawIcon( &ptHThumb, ( m_nCurrentCommand == eScrollerHThumb ) ? 0x06001264 : 0x06001263, 0, pCanvas );
|
||||
}
|
||||
}
|
||||
|
||||
if( m_bVScroll )
|
||||
{
|
||||
RECT rcVScroll = { szViewport.cx, BTN_SIZE, szViewport.cx + BTN_SIZE, szViewport.cy - BTN_SIZE };
|
||||
m_pVScrollBack->PatBlt( pCanvas, &rcVScroll, &ptOff );
|
||||
|
||||
if( m_szArea.cy != szViewport.cy )
|
||||
{
|
||||
// Draw the V thumb
|
||||
POINT ptVThumb = { szViewport.cx, BTN_SIZE + m_ptThumb.y };
|
||||
RECT rcThumb = { ptVThumb.x, ptVThumb.y, ptVThumb.x + BTN_SIZE, ptVThumb.y + BTN_SIZE };
|
||||
pCanvas->Fill( &rcThumb, RGB( 0, 0, 0 ) );
|
||||
pIconCache->DrawIcon( &ptVThumb, ( m_nCurrentCommand == eScrollerVThumb ) ? 0x06001264 : 0x06001263, 0, pCanvas );
|
||||
}
|
||||
}
|
||||
|
||||
if( m_bHScroll && m_bVScroll )
|
||||
{
|
||||
// Draw the little corner piece
|
||||
RECT rcCorner = { szViewport.cx, szViewport.cy, szViewport.cx + BTN_SIZE, szViewport.cy + BTN_SIZE };
|
||||
pCanvas->Fill( &rcCorner, RGB( 130, 100, 80 ) );
|
||||
}
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP cScroller::Reformat()
|
||||
{
|
||||
SIZE szViewport;
|
||||
get_Viewport( &szViewport );
|
||||
|
||||
CComPtr< ILayerSite > pPagerSite;
|
||||
HRESULT hRes = m_pSite->get_Child( eScrollerPager, ePositionByID, &pPagerSite );
|
||||
|
||||
RECT rcPager = { 0, 0, szViewport.cx, szViewport.cy };
|
||||
pPagerSite->put_Position( &rcPager );
|
||||
|
||||
CComPtr< ILayerSite > pClientSite;
|
||||
pPagerSite->get_Child( eScrollerClient, ePositionByID, &pClientSite );
|
||||
|
||||
RECT rcClient = { 0, 0, m_szArea.cx, m_szArea.cy };
|
||||
pClientSite->put_Position( &rcClient );
|
||||
|
||||
CComPtr< ILayerSite > pUp, pDown, pLeft, pRight;
|
||||
|
||||
m_pSite->get_Child( eScrollerUp, ePositionByID, &pUp );
|
||||
m_pSite->get_Child( eScrollerDown, ePositionByID, &pDown );
|
||||
m_pSite->get_Child( eScrollerLeft, ePositionByID, &pLeft );
|
||||
m_pSite->get_Child( eScrollerRight, ePositionByID, &pRight );
|
||||
|
||||
static RECT rcHidden = { 0, 0, 0, 0 };
|
||||
|
||||
if( m_bHScroll )
|
||||
{
|
||||
RECT rcLeft = { 0, szViewport.cy, BTN_SIZE, szViewport.cy + BTN_SIZE },
|
||||
rcRight = { szViewport.cx - BTN_SIZE, szViewport.cy, szViewport.cx, szViewport.cy + BTN_SIZE };
|
||||
|
||||
pLeft->put_Position( &rcLeft );
|
||||
pRight->put_Position( &rcRight );
|
||||
}
|
||||
else
|
||||
{
|
||||
pLeft->put_Position( &rcHidden );
|
||||
pRight->put_Position( &rcHidden );
|
||||
}
|
||||
|
||||
if( m_bVScroll )
|
||||
{
|
||||
RECT rcUp = { szViewport.cx, 0, szViewport.cx + BTN_SIZE, BTN_SIZE },
|
||||
rcDown = { szViewport.cx, szViewport.cy - BTN_SIZE, szViewport.cx + BTN_SIZE, szViewport.cy };
|
||||
|
||||
pUp->put_Position( &rcUp );
|
||||
pDown->put_Position( &rcDown );
|
||||
}
|
||||
else
|
||||
{
|
||||
pUp->put_Position( &rcHidden );
|
||||
pDown->put_Position( &rcHidden );
|
||||
}
|
||||
|
||||
// Calculate the size of the page increments
|
||||
m_szPage.cx = ( szViewport.cx / m_szIncrement.cx ) * m_szIncrement.cx;
|
||||
m_szPage.cy = ( szViewport.cy / m_szIncrement.cy ) * m_szIncrement.cy;
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
void cScroller::onButtonHit(long nID)
|
||||
{
|
||||
m_pPager->put_Command( nID );
|
||||
}
|
||||
|
||||
void cScroller::onButtonUnhit(long)
|
||||
{
|
||||
m_pPager->FinishCommand();
|
||||
}
|
||||
|
||||
VARIANT_BOOL cScroller::onClientGetNextPosition(long nID, long nCommand, long *pnX, long *pnY)
|
||||
{
|
||||
POINT ptDest;
|
||||
m_pPager->get_Offset( &ptDest );
|
||||
|
||||
POINT ptOriginal = ptDest;
|
||||
|
||||
switch( nCommand )
|
||||
{
|
||||
case eScrollerUp:
|
||||
ptDest.y -= m_szIncrement.cy;
|
||||
break;
|
||||
|
||||
case eScrollerDown:
|
||||
ptDest.y += m_szIncrement.cy;
|
||||
break;
|
||||
|
||||
case eScrollerPageUp:
|
||||
ptDest.y -= m_szPage.cy;
|
||||
break;
|
||||
|
||||
case eScrollerPageDown:
|
||||
ptDest.y += m_szPage.cy;
|
||||
break;
|
||||
|
||||
case eScrollerLeft:
|
||||
ptDest.x -= m_szIncrement.cx;
|
||||
break;
|
||||
|
||||
case eScrollerRight:
|
||||
ptDest.x += m_szIncrement.cx;
|
||||
break;
|
||||
|
||||
case eScrollerPageLeft:
|
||||
ptDest.x -= m_szPage.cx;
|
||||
break;
|
||||
|
||||
case eScrollerPageRight:
|
||||
ptDest.x += m_szPage.cx;
|
||||
break;
|
||||
|
||||
default:
|
||||
// Unknown scrolling command
|
||||
_ASSERTE( FALSE );
|
||||
}
|
||||
|
||||
constrainOffset( &ptDest );
|
||||
|
||||
if( ptDest.x == ptOriginal.x && ptDest.y == ptOriginal.y )
|
||||
// We didn't move this cycle - do not continue
|
||||
return VARIANT_FALSE;
|
||||
|
||||
*pnX = ptDest.x;
|
||||
*pnY = ptDest.y;
|
||||
|
||||
return VARIANT_TRUE;
|
||||
}
|
||||
|
||||
void cScroller::onClientChange( long nID, long, long nX, long nY )
|
||||
{
|
||||
_ASSERTE( nID == eScrollerPager );
|
||||
|
||||
// Convert these values to a thumb-like position
|
||||
SIZE szViewport;
|
||||
get_Viewport( &szViewport );
|
||||
|
||||
SIZE szScroll = szViewport;
|
||||
szScroll.cx -= BTN_SIZE * 3;
|
||||
szScroll.cy -= BTN_SIZE * 3;
|
||||
|
||||
// The viewport is now the size of the thumb ranges
|
||||
m_ptThumb.x = static_cast< long >( ( ( m_szArea.cx - szViewport.cx ) != 0 ) ? static_cast< double >( nX * szScroll.cx ) / static_cast< double >( m_szArea.cx - szViewport.cx ) : 0.0 );
|
||||
m_ptThumb.y = static_cast< long >( ( ( m_szArea.cy - szViewport.cy ) != 0 ) ? static_cast< double >( nY * szScroll.cy ) / static_cast< double >( m_szArea.cy - szViewport.cy ) : 0.0 );
|
||||
|
||||
if( m_ptThumb.x > szScroll.cx || nX >= ( m_szArea.cx - szViewport.cx - m_szIncrement.cy ) )
|
||||
m_ptThumb.x = szScroll.cx;
|
||||
if( m_ptThumb.y > szScroll.cy || nY >= ( m_szArea.cy - szViewport.cy - m_szIncrement.cy ) )
|
||||
m_ptThumb.y = szScroll.cy;
|
||||
|
||||
if( m_ptThumb.x < 0 )
|
||||
m_ptThumb.x = 0;
|
||||
if( m_ptThumb.y < 0 )
|
||||
m_ptThumb.y = 0;
|
||||
|
||||
// Check if the thumb moving has canceled a mouse action
|
||||
switch( m_nCurrentCommand )
|
||||
{
|
||||
case eScrollerPageUp:
|
||||
case eScrollerPageDown:
|
||||
case eScrollerPageLeft:
|
||||
case eScrollerPageRight:
|
||||
{
|
||||
MouseState ms = { this, { 0, 0 }, { m_ptMouseLast.x, m_ptMouseLast.y }, VARIANT_FALSE, VARIANT_FALSE };
|
||||
if( hitTest( &ms ) != m_nCurrentCommand )
|
||||
m_pPager->FinishCommand();
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
// Draw next frame
|
||||
m_pSite->Invalidate();
|
||||
|
||||
long nIDThis;
|
||||
m_pSite->get_ID( &nIDThis );
|
||||
Fire_Change( nIDThis, nX, nY );
|
||||
}
|
||||
|
||||
STDMETHODIMP cScroller::get_Viewport(LPSIZE pVal)
|
||||
{
|
||||
_ASSERTE( pVal != NULL );
|
||||
|
||||
RECT rc;
|
||||
m_pSite->get_Position( &rc );
|
||||
|
||||
pVal->cx = ( rc.right - rc.left ) - ( ( m_bVScroll ) ? BTN_SIZE : 0 );
|
||||
pVal->cy = ( rc.bottom - rc.top ) - ( ( m_bHScroll ) ? BTN_SIZE : 0 );
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP cScroller::get_Area(LPSIZE pVal)
|
||||
{
|
||||
_ASSERTE( pVal != NULL );
|
||||
|
||||
*pVal = m_szArea;
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP cScroller::put_Area(LPSIZE newVal)
|
||||
{
|
||||
_ASSERTE( newVal != NULL );
|
||||
//_ASSERTE( newVal->cx >= 0 && newVal->cy >= 0 );
|
||||
|
||||
// Now this area will have to be rounded up to an increment or
|
||||
// a page size
|
||||
SIZE szViewport;
|
||||
get_Viewport( &szViewport );
|
||||
|
||||
if( newVal->cx < szViewport.cx )
|
||||
// This view is thinner than the viewport, set it to the minimum
|
||||
newVal->cx = szViewport.cx;
|
||||
else if( m_bHScroll )
|
||||
if((szViewport.cx % m_szIncrement.cx)!=0)
|
||||
newVal->cx += m_szIncrement.cx - ( newVal->cx % m_szIncrement.cx ); // Make sure there is an extra line so we don't scroll off the edge
|
||||
|
||||
// Repeat for y-scoord
|
||||
if( newVal->cy < szViewport.cy )
|
||||
newVal->cy = szViewport.cy;
|
||||
else if( m_bVScroll )
|
||||
if((szViewport.cy % m_szIncrement.cy)!=0)
|
||||
newVal->cy += m_szIncrement.cy - ( newVal->cy % m_szIncrement.cy );
|
||||
|
||||
m_szArea = *newVal;
|
||||
m_pSite->Reformat();
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP cScroller::get_HorizontalEnabled(VARIANT_BOOL *pVal)
|
||||
{
|
||||
_ASSERTE( pVal != NULL );
|
||||
|
||||
*pVal = m_bHScroll;
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP cScroller::put_HorizontalEnabled(VARIANT_BOOL newVal)
|
||||
{
|
||||
if( newVal != m_bHScroll )
|
||||
{
|
||||
m_bHScroll = newVal;
|
||||
m_pSite->Reformat();
|
||||
}
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP cScroller::get_VerticalEnabled(VARIANT_BOOL *pVal)
|
||||
{
|
||||
_ASSERTE( pVal != NULL );
|
||||
|
||||
*pVal = m_bVScroll;
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP cScroller::put_VerticalEnabled(VARIANT_BOOL newVal)
|
||||
{
|
||||
if( newVal != m_bVScroll )
|
||||
{
|
||||
m_bVScroll = newVal;
|
||||
m_pSite->Reformat();
|
||||
}
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP cScroller::CreateClient(ILayer *pChild)
|
||||
{
|
||||
CComPtr< ILayerSite > pPagerSite;
|
||||
HRESULT hRes = m_pSite->get_Child( eScrollerPager, ePositionByID, &pPagerSite );
|
||||
|
||||
_ASSERTE( SUCCEEDED( hRes ) );
|
||||
|
||||
LayerParams lp = { eScrollerClient, { 0, 0, 0, 0 }, eRenderClipped };
|
||||
|
||||
return pPagerSite->CreateChild( &lp, pChild );
|
||||
}
|
||||
|
||||
STDMETHODIMP cScroller::get_Offset(LPPOINT pVal)
|
||||
{
|
||||
_ASSERTE( pVal != NULL );
|
||||
|
||||
POINT ptTrueOff;
|
||||
m_pPager->get_Offset( &ptTrueOff );
|
||||
|
||||
pVal->x = ptTrueOff.x / m_szIncrement.cx;
|
||||
pVal->y = ptTrueOff.y / m_szIncrement.cy;
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP cScroller::put_Offset(LPPOINT newVal)
|
||||
{
|
||||
_ASSERTE( newVal != NULL );
|
||||
_ASSERTE( newVal->x >= 0 && newVal->y >= 0 );
|
||||
|
||||
POINT ptTrueOff = { newVal->x * m_szIncrement.cx, newVal->y * m_szIncrement.cy };
|
||||
|
||||
constrainOffset( &ptTrueOff );
|
||||
m_pPager->put_Offset( &ptTrueOff );
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP cScroller::ScrollTo(LPPOINT ptOffset)
|
||||
{
|
||||
_ASSERTE( ptOffset != NULL );
|
||||
_ASSERTE( ptOffset->x >= 0 && ptOffset->y >= 0 );
|
||||
|
||||
POINT ptTrueOff = { ptOffset->x * m_szIncrement.cx, ptOffset->y * m_szIncrement.cy };
|
||||
|
||||
constrainOffset( &ptTrueOff );
|
||||
m_pPager->ScrollTo( &ptTrueOff );
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP cScroller::get_Increments(LPSIZE pVal)
|
||||
{
|
||||
_ASSERTE( pVal != NULL );
|
||||
|
||||
*pVal = m_szIncrement;
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP cScroller::put_Increments(LPSIZE newVal)
|
||||
{
|
||||
_ASSERTE( newVal != NULL );
|
||||
_ASSERTE( newVal->cx > 0 && newVal->cy > 0 );
|
||||
|
||||
// Assign the new increments
|
||||
m_szIncrement = *newVal;
|
||||
|
||||
// Align the current position to the new position
|
||||
POINT ptCurrent;
|
||||
m_pPager->get_Offset( &ptCurrent );
|
||||
|
||||
ptCurrent.x = ( ptCurrent.x / newVal->cx ) * newVal->cx;
|
||||
ptCurrent.y = ( ptCurrent.y / newVal->cy ) * newVal->cy;
|
||||
|
||||
constrainOffset( &ptCurrent );
|
||||
m_pPager->put_Offset( &ptCurrent );
|
||||
m_pSite->Reformat();
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP cScroller::MouseDown( MouseState *pMS )
|
||||
{
|
||||
m_nCurrentCommand = hitTest( pMS );
|
||||
|
||||
if( m_nCurrentCommand == -1 )
|
||||
return S_OK;
|
||||
|
||||
switch( m_nCurrentCommand )
|
||||
{
|
||||
case eScrollerHThumb:
|
||||
m_nScreenStart = pMS->screen.x;
|
||||
m_nThumbStart = m_ptThumb.x;
|
||||
break;
|
||||
|
||||
case eScrollerVThumb:
|
||||
m_nScreenStart = pMS->screen.y;
|
||||
m_nThumbStart = m_ptThumb.y;
|
||||
break;
|
||||
|
||||
case eScrollerPageUp:
|
||||
case eScrollerPageDown:
|
||||
case eScrollerPageLeft:
|
||||
case eScrollerPageRight:
|
||||
m_ptMouseLast = pMS->client;
|
||||
m_pPager->put_Command( m_nCurrentCommand );
|
||||
break;
|
||||
}
|
||||
|
||||
m_pSite->Invalidate();
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP cScroller::MouseUp( MouseState *pMS )
|
||||
{
|
||||
m_nCurrentCommand = -1;
|
||||
|
||||
// Make sure there are no more commands in the pager
|
||||
m_pPager->FinishCommand();
|
||||
|
||||
m_pSite->Invalidate();
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP cScroller::MouseMove( MouseState *pMS )
|
||||
{
|
||||
if( m_nCurrentCommand == -1 )
|
||||
// No command, so nothgin to do
|
||||
return S_OK;
|
||||
|
||||
SIZE szViewport;
|
||||
get_Viewport( &szViewport );
|
||||
SIZE szScroller = { szViewport.cx - BTN_SIZE * 3, szViewport.cy - BTN_SIZE * 3 };
|
||||
|
||||
POINT ptOffset;
|
||||
m_pPager->get_Offset( &ptOffset );
|
||||
|
||||
switch( m_nCurrentCommand )
|
||||
{
|
||||
case eScrollerPageUp:
|
||||
case eScrollerPageDown:
|
||||
case eScrollerPageLeft:
|
||||
case eScrollerPageRight:
|
||||
{
|
||||
if( hitTest( pMS ) == m_nCurrentCommand )
|
||||
m_pPager->put_Command( m_nCurrentCommand );
|
||||
else
|
||||
m_pPager->FinishCommand();
|
||||
m_ptMouseLast = pMS->client;
|
||||
}
|
||||
break;
|
||||
|
||||
case eScrollerHThumb:
|
||||
{
|
||||
long nPos = m_nThumbStart + ( pMS->screen.x - m_nScreenStart );
|
||||
|
||||
// Make sure it's bigger than 0
|
||||
if( nPos < 0 )
|
||||
nPos = 0;
|
||||
|
||||
// Convert this to an actual position
|
||||
ptOffset.x = nPos * ( m_szArea.cx - szViewport.cx ) / szScroller.cx;
|
||||
|
||||
// Align to the nearest line
|
||||
ptOffset.x -= ptOffset.x % m_szIncrement.cx;
|
||||
|
||||
// Set the position, pager callback will set the thumb position
|
||||
constrainOffset( &ptOffset );
|
||||
m_pPager->put_Offset( &ptOffset );
|
||||
}
|
||||
break;
|
||||
|
||||
case eScrollerVThumb:
|
||||
{
|
||||
long nPos = m_nThumbStart + ( pMS->screen.y - m_nScreenStart );
|
||||
|
||||
// Make sure it's bigger than 0
|
||||
if( nPos < 0 )
|
||||
nPos = 0;
|
||||
|
||||
// Convert this to an actual position
|
||||
ptOffset.y = nPos * ( m_szArea.cy - szViewport.cy ) / szScroller.cy;
|
||||
|
||||
// Align to the nearest line
|
||||
ptOffset.y -= ptOffset.y % m_szIncrement.cy;
|
||||
|
||||
// Set the position, pager callback will set the thumb position
|
||||
constrainOffset( &ptOffset );
|
||||
m_pPager->put_Offset( &ptOffset );
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT cScroller::SchemaLoad( IView *pView, IUnknown *pXMLElement )
|
||||
{
|
||||
MSXML::IXMLDOMElementPtr pElement = pXMLElement;
|
||||
|
||||
_variant_t vHScroll = pElement->getAttribute( _T( "hscroll" ) ),
|
||||
vVScroll = pElement->getAttribute( _T( "vscroll" ) ),
|
||||
vAreaWidth = pElement->getAttribute( _T( "areawidth" ) ),
|
||||
vAreaHeight = pElement->getAttribute( _T( "areaheight" ) ),
|
||||
vIncrementX = pElement->getAttribute( _T( "incrementx" ) ),
|
||||
vIncrementY = pElement->getAttribute( _T( "incrementy" ) );
|
||||
|
||||
// Do the client
|
||||
MSXML::IXMLDOMElementPtr pClient = pElement->selectSingleNode( _T( "control" ) );
|
||||
if( pClient.GetInterfacePtr() != NULL )
|
||||
{
|
||||
// Recurse and load the client
|
||||
CComPtr< ILayerSite > pPager;
|
||||
m_pSite->get_Child( eScrollerPager, ePositionByID, &pPager );
|
||||
long nAssigned;
|
||||
pView->LoadControl( pPager, eScrollerClient, pClient, &nAssigned );
|
||||
}
|
||||
|
||||
// First enable the scroll bars
|
||||
if( vHScroll.vt != VT_NULL )
|
||||
{
|
||||
try
|
||||
{
|
||||
m_bHScroll = static_cast< bool >( vHScroll ) ? VARIANT_TRUE : VARIANT_FALSE;
|
||||
}
|
||||
catch( ... )
|
||||
{
|
||||
// Type conversion error
|
||||
_ASSERTE( FALSE );
|
||||
}
|
||||
}
|
||||
|
||||
if( vVScroll.vt != VT_NULL )
|
||||
{
|
||||
try
|
||||
{
|
||||
m_bVScroll = static_cast< bool >( vVScroll ) ? VARIANT_TRUE : VARIANT_FALSE;
|
||||
}
|
||||
catch( ... )
|
||||
{
|
||||
// Type conversion error
|
||||
_ASSERTE( FALSE );
|
||||
}
|
||||
}
|
||||
|
||||
// Next set the increment sizes
|
||||
if( vIncrementX.vt != VT_NULL )
|
||||
{
|
||||
try
|
||||
{
|
||||
m_szIncrement.cx = static_cast< long >( vIncrementX );
|
||||
}
|
||||
catch( ... )
|
||||
{
|
||||
// Type conversion error
|
||||
_ASSERTE( FALSE );
|
||||
}
|
||||
}
|
||||
|
||||
if( vIncrementY.vt != VT_NULL )
|
||||
{
|
||||
try
|
||||
{
|
||||
m_szIncrement.cy = static_cast< long >( vIncrementY );
|
||||
}
|
||||
catch( ... )
|
||||
{
|
||||
// Type conversion error
|
||||
_ASSERTE( FALSE );
|
||||
}
|
||||
}
|
||||
|
||||
// Last, set the area
|
||||
SIZE szArea = m_szArea;
|
||||
if( vAreaWidth.vt != VT_NULL )
|
||||
{
|
||||
try
|
||||
{
|
||||
szArea.cx = static_cast< long >( vAreaWidth );
|
||||
}
|
||||
catch( ... )
|
||||
{
|
||||
// Type conversion error
|
||||
_ASSERTE( FALSE );
|
||||
}
|
||||
}
|
||||
|
||||
if( vAreaHeight.vt != VT_NULL )
|
||||
{
|
||||
try
|
||||
{
|
||||
szArea.cy = static_cast< long >( vAreaHeight );
|
||||
}
|
||||
catch( ... )
|
||||
{
|
||||
// Type conversion error
|
||||
_ASSERTE( FALSE );
|
||||
}
|
||||
}
|
||||
|
||||
put_Area( &szArea );
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP cScroller::ResetScroller()
|
||||
{
|
||||
|
||||
POINT ptCurrent;
|
||||
ptCurrent.x = 0;
|
||||
ptCurrent.y = 0;
|
||||
constrainOffset( &ptCurrent );
|
||||
m_pPager->put_Offset( &ptCurrent );
|
||||
m_ptThumb.x =0;
|
||||
m_ptThumb.y =0;
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
139
Native/DecalControls/Scroller.h
Normal file
139
Native/DecalControls/Scroller.h
Normal file
|
|
@ -0,0 +1,139 @@
|
|||
// Scroller.h : Declaration of the cScroller
|
||||
|
||||
#ifndef __SCROLLER_H_
|
||||
#define __SCROLLER_H_
|
||||
|
||||
#include "resource.h" // main symbols
|
||||
#include "SinkImpl.h"
|
||||
#include "DecalControlsCP.h"
|
||||
|
||||
#define PAGER_CLIENT 1
|
||||
#define BUTTON_LEFT 2
|
||||
#define BUTTON_RIGHT 3
|
||||
#define BUTTON_UP 4
|
||||
#define BUTTON_DOWN 5
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// cScroller
|
||||
class ATL_NO_VTABLE cScroller :
|
||||
public CComObjectRootEx<CComMultiThreadModel>,
|
||||
public CComCoClass<cScroller, &CLSID_Scroller>,
|
||||
public IConnectionPointContainerImpl<cScroller>,
|
||||
public ILayerImpl< cScroller >,
|
||||
public ILayerRenderImpl,
|
||||
public ILayerMouseImpl,
|
||||
public IProvideClassInfo2Impl< &CLSID_Scroller, &DIID_IScrollerEvents, &LIBID_DecalControls >,
|
||||
public IControlImpl< cScroller, IScroller, &IID_IControl, &LIBID_DecalPlugins >,
|
||||
public ICommandEventsImpl< BUTTON_LEFT, cScroller >,
|
||||
public ICommandEventsImpl< BUTTON_RIGHT, cScroller >,
|
||||
public ICommandEventsImpl< BUTTON_UP, cScroller >,
|
||||
public ICommandEventsImpl< BUTTON_DOWN, cScroller >,
|
||||
public IPagerEventsImpl< PAGER_CLIENT, cScroller >,
|
||||
public ILayerSchema,
|
||||
public CProxyIScrollerEvents< cScroller >
|
||||
{
|
||||
public:
|
||||
cScroller()
|
||||
: m_nCurrentCommand( -1 )
|
||||
{
|
||||
}
|
||||
|
||||
CComPtr< IPager > m_pPager;
|
||||
|
||||
CComPtr< IImageCache > m_pHScrollBack;
|
||||
CComPtr< IImageCache > m_pVScrollBack;
|
||||
|
||||
SIZE m_szArea;
|
||||
SIZE m_szIncrement;
|
||||
SIZE m_szPage;
|
||||
POINT m_ptThumb;
|
||||
|
||||
// Members for live dragging of the thumbs
|
||||
long m_nCurrentCommand,
|
||||
m_nScreenStart,
|
||||
m_nThumbStart;
|
||||
POINT m_ptMouseLast;
|
||||
|
||||
VARIANT_BOOL m_bHScroll,
|
||||
m_bVScroll;
|
||||
|
||||
void onCreate();
|
||||
void onDestroy();
|
||||
|
||||
// Helper functions
|
||||
long hitTest( MouseState *pMS );
|
||||
void constrainOffset( LPPOINT ppt );
|
||||
|
||||
DECLARE_REGISTRY_RESOURCEID(IDR_SCROLLER)
|
||||
DECLARE_PROTECT_FINAL_CONSTRUCT()
|
||||
|
||||
BEGIN_COM_MAP(cScroller)
|
||||
COM_INTERFACE_ENTRY(ILayerRender)
|
||||
COM_INTERFACE_ENTRY(ILayerMouse)
|
||||
COM_INTERFACE_ENTRY(ILayerSchema)
|
||||
COM_INTERFACE_ENTRY(IScroller)
|
||||
COM_INTERFACE_ENTRY(IControl)
|
||||
COM_INTERFACE_ENTRY(IDispatch)
|
||||
COM_INTERFACE_ENTRY(ILayer)
|
||||
COM_INTERFACE_ENTRY(ILayerSchema)
|
||||
COM_INTERFACE_ENTRY(IProvideClassInfo)
|
||||
COM_INTERFACE_ENTRY(IProvideClassInfo2)
|
||||
COM_INTERFACE_ENTRY_IMPL(IConnectionPointContainer)
|
||||
END_COM_MAP()
|
||||
|
||||
BEGIN_CONNECTION_POINT_MAP(cScroller)
|
||||
CONNECTION_POINT_ENTRY(DIID_IScrollerEvents)
|
||||
END_CONNECTION_POINT_MAP()
|
||||
|
||||
BEGIN_SINK_MAP(cScroller)
|
||||
SINK_ENTRY_EX( PAGER_CLIENT, DIID_IPagerEvents, DISPID_CHANGE, onClientChange )
|
||||
SINK_ENTRY_EX( PAGER_CLIENT, DIID_IPagerEvents, DISPID_GETNEXTPOSITION, onClientGetNextPosition )
|
||||
SINK_ENTRY_EX( BUTTON_UP, DIID_ICommandEvents, DISPID_HIT, onButtonHit )
|
||||
SINK_ENTRY_EX( BUTTON_UP, DIID_ICommandEvents, DISPID_UNHIT, onButtonUnhit )
|
||||
SINK_ENTRY_EX( BUTTON_DOWN, DIID_ICommandEvents, DISPID_HIT, onButtonHit )
|
||||
SINK_ENTRY_EX( BUTTON_DOWN, DIID_ICommandEvents, DISPID_UNHIT, onButtonUnhit )
|
||||
SINK_ENTRY_EX( BUTTON_LEFT, DIID_ICommandEvents, DISPID_HIT, onButtonHit )
|
||||
SINK_ENTRY_EX( BUTTON_LEFT, DIID_ICommandEvents, DISPID_UNHIT, onButtonUnhit )
|
||||
SINK_ENTRY_EX( BUTTON_RIGHT, DIID_ICommandEvents, DISPID_HIT, onButtonHit )
|
||||
SINK_ENTRY_EX( BUTTON_RIGHT, DIID_ICommandEvents, DISPID_UNHIT, onButtonUnhit )
|
||||
END_SINK_MAP()
|
||||
|
||||
public:
|
||||
STDMETHOD(ResetScroller)();
|
||||
// IScroller Methods
|
||||
STDMETHOD(get_Viewport)(/*[out, retval]*/ LPSIZE pVal);
|
||||
STDMETHOD(get_Area)(/*[out, retval]*/ LPSIZE pVal);
|
||||
STDMETHOD(put_Area)(/*[in]*/ LPSIZE newVal);
|
||||
STDMETHOD(get_HorizontalEnabled)(/*[out, retval]*/ VARIANT_BOOL *pVal);
|
||||
STDMETHOD(put_HorizontalEnabled)(/*[in]*/ VARIANT_BOOL newVal);
|
||||
STDMETHOD(get_VerticalEnabled)(/*[out, retval]*/ VARIANT_BOOL *pVal);
|
||||
STDMETHOD(put_VerticalEnabled)(/*[in]*/ VARIANT_BOOL newVal);
|
||||
STDMETHOD(CreateClient)(ILayer *pChild);
|
||||
STDMETHOD(get_Offset)(/*[out, retval]*/ LPPOINT pVal);
|
||||
STDMETHOD(put_Offset)(/*[in]*/ LPPOINT newVal);
|
||||
STDMETHOD(ScrollTo)(LPPOINT ptOffset);
|
||||
STDMETHOD(get_Increments)(/*[out, retval]*/ LPSIZE pVal);
|
||||
STDMETHOD(put_Increments)(/*[in]*/ LPSIZE newVal);
|
||||
|
||||
// ILayerRender Methods
|
||||
STDMETHOD(Render)(ICanvas *pCanvas);
|
||||
STDMETHOD(Reformat)();
|
||||
|
||||
// ICommandEvents Methods
|
||||
void __stdcall onButtonHit( long nID );
|
||||
void __stdcall onButtonUnhit( long nID );
|
||||
|
||||
// IPagerEvents Methods
|
||||
void __stdcall onClientChange( long nID, long nCommand, long nX, long nY );
|
||||
VARIANT_BOOL __stdcall onClientGetNextPosition( long nID, long nCommand, long *pnX, long *pnY );
|
||||
|
||||
// ILayerMouse Methods
|
||||
STDMETHOD(MouseDown)(MouseState *pMS);
|
||||
STDMETHOD(MouseUp)(MouseState *pMS);
|
||||
STDMETHOD(MouseMove)(MouseState *pMS);
|
||||
|
||||
// ILayerSchema Methods
|
||||
STDMETHOD(SchemaLoad)(IView *pView, IUnknown *pXMLElement);
|
||||
};
|
||||
|
||||
#endif //__SCROLLER_H_
|
||||
25
Native/DecalControls/Scroller.rgs
Normal file
25
Native/DecalControls/Scroller.rgs
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
HKCR
|
||||
{
|
||||
DecalControls.Scroller.1 = s 'DecalControls Scroller'
|
||||
{
|
||||
CLSID = s '{8FC80D21-1731-4816-9AD3-B0364D5F2C27}'
|
||||
}
|
||||
DecalControls.Scroller = s 'DecalControls Scroller'
|
||||
{
|
||||
CLSID = s '{8FC80D21-1731-4816-9AD3-B0364D5F2C27}'
|
||||
CurVer = s 'DecalControls.Scroller.1'
|
||||
}
|
||||
NoRemove CLSID
|
||||
{
|
||||
ForceRemove {8FC80D21-1731-4816-9AD3-B0364D5F2C27} = s 'DecalControls Scroller'
|
||||
{
|
||||
ProgID = s 'DecalControls.Scroller.1'
|
||||
VersionIndependentProgID = s 'DecalControls.Scroller'
|
||||
InprocServer32 = s '%MODULE%'
|
||||
{
|
||||
val ThreadingModel = s 'Both'
|
||||
}
|
||||
'TypeLib' = s '{3559E08B-827E-4DFE-9D33-3567246849CC}'
|
||||
}
|
||||
}
|
||||
}
|
||||
515
Native/DecalControls/Slider.cpp
Normal file
515
Native/DecalControls/Slider.cpp
Normal file
|
|
@ -0,0 +1,515 @@
|
|||
#include "stdafx.h"// Slider.cpp : Implementation of cSlider
|
||||
#include <stdio.h>
|
||||
#include "DecalControls.h"
|
||||
#include "Slider.h"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// cSlider
|
||||
|
||||
cSlider::cSlider() : m_nTextColor(RGB(0, 0, 0)),
|
||||
m_bMouseIn(VARIANT_FALSE),
|
||||
m_bGrappled(VARIANT_FALSE),
|
||||
m_nMinimum(0),
|
||||
m_nMaximum(100),
|
||||
m_nMinSliderColor( RGB(200,0,0) ),
|
||||
m_nMaxSliderColor( RGB(0,200,0) ),
|
||||
m_nSliderPos(0),
|
||||
m_strTextLeft(NULL),
|
||||
m_strTextRight(NULL),
|
||||
m_bVertical(VARIANT_FALSE) {
|
||||
}
|
||||
|
||||
cSlider::~cSlider() {
|
||||
if (m_strTextLeft)
|
||||
free(m_strTextLeft);
|
||||
|
||||
if (m_strTextRight)
|
||||
free(m_strTextRight);
|
||||
}
|
||||
|
||||
STDMETHODIMP cSlider::get_Font(IFontCacheDisp **pVal) {
|
||||
_ASSERTE(pVal != NULL);
|
||||
|
||||
if (m_pFont.p == NULL)
|
||||
*pVal = NULL;
|
||||
else
|
||||
m_pFont->QueryInterface(pVal);
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP cSlider::putref_Font(IFontCacheDisp *newVal) {
|
||||
_ASSERTE(newVal != NULL);
|
||||
|
||||
if (m_pFont.p)
|
||||
m_pFont.Release();
|
||||
|
||||
HRESULT hRes = newVal->QueryInterface(&m_pFont);
|
||||
|
||||
_ASSERTE(SUCCEEDED(hRes));
|
||||
m_pSite->Reformat();
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP cSlider::get_TextColor(long *pVal) {
|
||||
_ASSERTE(pVal != NULL);
|
||||
|
||||
*pVal = m_nTextColor;
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP cSlider::put_TextColor(long newVal) {
|
||||
_ASSERTE((newVal & 0xFF000000L) == 0);
|
||||
|
||||
m_nTextColor = newVal;
|
||||
m_pSite->Invalidate();
|
||||
Reformat();
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
|
||||
STDMETHODIMP cSlider::get_SliderPosition(long *pVal) {
|
||||
_ASSERTE(pVal != NULL);
|
||||
|
||||
*pVal = m_nSliderPos;
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP cSlider::put_SliderPosition(long newVal) {
|
||||
if (m_nSliderPos == newVal)
|
||||
return S_OK;
|
||||
|
||||
if (newVal < m_nMinimum || newVal > m_nMaximum)
|
||||
return S_FALSE;
|
||||
|
||||
m_nSliderPos = newVal;
|
||||
Reformat();
|
||||
m_pSite->Invalidate();
|
||||
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP cSlider::get_Minimum(long *pVal) {
|
||||
_ASSERTE(pVal != NULL);
|
||||
|
||||
*pVal = m_nMinimum;
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP cSlider::put_Minimum(long newVal) {
|
||||
if (m_nMinimum == newVal)
|
||||
return S_OK;
|
||||
|
||||
m_nMinimum = newVal;
|
||||
Reformat();
|
||||
m_pSite->Invalidate();
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP cSlider::get_Maximum(long *pVal) {
|
||||
_ASSERTE(pVal != NULL);
|
||||
|
||||
*pVal = m_nMaximum;
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP cSlider::put_Maximum(long newVal) {
|
||||
if (m_nMaximum == newVal)
|
||||
return S_OK;
|
||||
|
||||
m_nMaximum = newVal;
|
||||
Reformat();
|
||||
m_pSite->Invalidate();
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP cSlider::SchemaLoad(IView *pView, IUnknown *pSchema)
|
||||
{
|
||||
// First attempt to load the font
|
||||
CComPtr< IPluginSite > pPlugin;
|
||||
m_pSite->get_PluginSite( &pPlugin );
|
||||
|
||||
pPlugin->CreateFontSchema(14, 0, pSchema, &m_pFont);
|
||||
|
||||
MSXML::IXMLDOMElementPtr pElement = pSchema;
|
||||
|
||||
_variant_t vTextColor = pElement->getAttribute(_T("textcolor")),
|
||||
vMinSliderColor = pElement->getAttribute(_T("mincolor")),
|
||||
vMaxSliderColor = pElement->getAttribute(_T("maxcolor")),
|
||||
vVertical = pElement->getAttribute(_T("vertical")),
|
||||
vDefault = pElement->getAttribute(_T("default")),
|
||||
vMaximum = pElement->getAttribute(_T("maximum")),
|
||||
vMinimum = pElement->getAttribute(_T("minimum")),
|
||||
vName = pElement->getAttribute(_T("name"));
|
||||
|
||||
// Maximum must exist
|
||||
_ASSERTE(vMaximum.vt == VT_INT);
|
||||
|
||||
if (vTextColor.vt != VT_NULL) {
|
||||
try {
|
||||
m_nTextColor = static_cast<long>(vTextColor);
|
||||
} catch(...) {
|
||||
// Type conversion error
|
||||
_ASSERTE(FALSE);
|
||||
}
|
||||
}
|
||||
|
||||
if (vMinSliderColor.vt != VT_NULL) {
|
||||
try {
|
||||
_bstr_t szWhat = vMinSliderColor.bstrVal;
|
||||
m_nMinSliderColor = wcstoul( szWhat, 0, 16 );
|
||||
} catch( ... ) {
|
||||
// Type conversion error
|
||||
_ASSERTE(FALSE);
|
||||
}
|
||||
}
|
||||
|
||||
if (vMaxSliderColor.vt != VT_NULL) {
|
||||
try {
|
||||
_bstr_t szWhat = vMaxSliderColor.bstrVal;
|
||||
m_nMaxSliderColor = wcstoul( szWhat, 0, 16 );
|
||||
} catch( ... ) {
|
||||
// Type conversion error
|
||||
_ASSERTE(FALSE);
|
||||
}
|
||||
}
|
||||
|
||||
if (vVertical.vt != VT_NULL) {
|
||||
try {
|
||||
m_bVertical = (static_cast<bool>(vVertical)) ? VARIANT_TRUE : VARIANT_FALSE;
|
||||
} catch( ... ) {
|
||||
// Type conversion error
|
||||
_ASSERTE(FALSE);
|
||||
}
|
||||
}
|
||||
|
||||
if (vMaximum.vt != VT_NULL) {
|
||||
try {
|
||||
m_nMaximum = static_cast<long>(vMaximum);
|
||||
} catch( ... ) {
|
||||
// Type conversion error
|
||||
_ASSERTE(FALSE);
|
||||
}
|
||||
}
|
||||
|
||||
if (vMinimum.vt != VT_NULL) {
|
||||
try {
|
||||
m_nMinimum = static_cast<long>(vMinimum);
|
||||
} catch( ... ) {
|
||||
// Type conversion error
|
||||
_ASSERTE(FALSE);
|
||||
}
|
||||
}
|
||||
|
||||
if (vDefault.vt != VT_NULL) {
|
||||
try {
|
||||
m_nSliderPos = static_cast<long>(vDefault);
|
||||
} catch( ... ) {
|
||||
m_nSliderPos = m_nMinimum;
|
||||
}
|
||||
}
|
||||
|
||||
/* fprintf( f, "name - %s\n", OLE2A(vName.bstrVal) );
|
||||
fprintf( f, "textcolor - %08X\n", m_nTextColor );
|
||||
fprintf( f, "mincolor - %08X\n", m_nMinSliderColor );
|
||||
fprintf( f, "maxcolor - %08X\n", m_nMaxSliderColor );
|
||||
fprintf( f, "vertical - %X\n", m_bVertical );
|
||||
fprintf( f, "maximum - %08X\n", m_nMaximum );
|
||||
fprintf( f, "minimum - %08X\n\n", m_nMinimum ); */
|
||||
|
||||
/* // it's a pain in the ass that we need set the min and max for them to work, aye? let's fix it
|
||||
RECT rc;
|
||||
m_pSite->get_Position(&rc);
|
||||
|
||||
long siteHHalf = (rc.bottom - rc.top) / 2;
|
||||
|
||||
// The background bar
|
||||
m_rcBackground.left = 0;
|
||||
m_rcBackground.top = siteHHalf - 4;
|
||||
m_rcBackground.bottom = siteHHalf + 6;
|
||||
m_rcBackground.right = rc.right - rc.left;
|
||||
|
||||
// The middle bar
|
||||
m_rcBar.top = siteHHalf;
|
||||
m_rcBar.left = 0;
|
||||
m_rcBar.bottom = siteHHalf + 3;
|
||||
m_rcBar.right = rc.right - rc.left;
|
||||
|
||||
// Ensure sane slider position
|
||||
if (m_nSliderPos < m_nMinimum)
|
||||
m_nSliderPos = m_nMinimum;
|
||||
|
||||
if (m_nSliderPos > m_nMaximum)
|
||||
m_nSliderPos = m_nMaximum;
|
||||
|
||||
long siteDiff = abs(m_rcBar.right - m_rcBar.left);
|
||||
long extentDiff = abs(m_nMaximum - m_nMinimum);
|
||||
long valDiff = m_nSliderPos - m_nMinimum;
|
||||
|
||||
if (valDiff == 0) {
|
||||
m_ptSlider.x = m_rcBar.left;
|
||||
|
||||
} else {
|
||||
long diff = (long)(((float)valDiff / (float)extentDiff) * (float)siteDiff);
|
||||
|
||||
m_ptSlider.x = m_rcBar.left + diff;
|
||||
|
||||
if (m_ptSlider.x >= m_rcBar.right - 6)
|
||||
m_ptSlider.x = m_rcBar.right - 6;
|
||||
}
|
||||
|
||||
m_ptSlider.y = siteHHalf - 5;
|
||||
*/
|
||||
|
||||
// fclose( f );
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP cSlider::Reformat() {
|
||||
USES_CONVERSION;
|
||||
|
||||
char strTemp[16];
|
||||
|
||||
if (m_strTextLeft)
|
||||
free(m_strTextLeft);
|
||||
|
||||
if (m_strTextRight)
|
||||
free(m_strTextRight);
|
||||
|
||||
_snprintf(strTemp, 15, "%i", m_nMinimum);
|
||||
m_strTextLeft = strdup(strTemp);
|
||||
|
||||
_snprintf(strTemp, 15, "%i", m_nMaximum);
|
||||
m_strTextRight = strdup(strTemp);
|
||||
|
||||
if (m_pFont.p == NULL) {
|
||||
// No font was specified, create the default font
|
||||
CComPtr<IPluginSite> pPlugin;
|
||||
m_pSite->get_PluginSite(&pPlugin);
|
||||
|
||||
BSTR bstrFontName;
|
||||
pPlugin->get_FontName(&bstrFontName);
|
||||
pPlugin->CreateFont(bstrFontName /*_bstr_t(_T("Times New Roman"))*/, 14, 0, &m_pFont);
|
||||
}
|
||||
|
||||
RECT rc;
|
||||
m_pSite->get_Position(&rc);
|
||||
|
||||
SIZE textRight;
|
||||
|
||||
m_pFont->MeasureText(_bstr_t(m_strTextRight), &textRight);
|
||||
|
||||
long siteHHalf = (rc.bottom - rc.top) / 2;
|
||||
|
||||
// The background bar
|
||||
m_rcBackground.left = 0;
|
||||
m_rcBackground.top = siteHHalf - 4;
|
||||
m_rcBackground.bottom = siteHHalf + 6;
|
||||
m_rcBackground.right = rc.right - rc.left;
|
||||
|
||||
// The middle bar
|
||||
m_rcBar.top = siteHHalf;
|
||||
m_rcBar.left = 0;
|
||||
m_rcBar.bottom = siteHHalf + 3;
|
||||
m_rcBar.right = rc.right - rc.left;
|
||||
|
||||
m_ptLeftText.x = m_rcBackground.left + 1;
|
||||
m_ptLeftText.y = m_rcBackground.bottom + 1;
|
||||
m_ptRightText.x = m_rcBackground.right - (textRight.cx + 1);
|
||||
m_ptRightText.y = m_rcBackground.bottom + 1;
|
||||
|
||||
// Ensure sane slider position
|
||||
if (m_nSliderPos < m_nMinimum)
|
||||
m_nSliderPos = m_nMinimum;
|
||||
|
||||
if (m_nSliderPos > m_nMaximum)
|
||||
m_nSliderPos = m_nMaximum;
|
||||
|
||||
long siteDiff = abs(m_rcBar.right - m_rcBar.left);
|
||||
long extentDiff = abs(m_nMaximum - m_nMinimum);
|
||||
long valDiff = m_nSliderPos - m_nMinimum;
|
||||
|
||||
if (valDiff == 0) {
|
||||
m_ptSlider.x = m_rcBar.left;
|
||||
|
||||
} else {
|
||||
long diff = (long)(((float)valDiff / (float)extentDiff) * (float)siteDiff);
|
||||
|
||||
m_ptSlider.x = m_rcBar.left + diff;
|
||||
|
||||
if (m_ptSlider.x >= m_rcBar.right - 6)
|
||||
m_ptSlider.x = m_rcBar.right - 6;
|
||||
}
|
||||
|
||||
m_ptSlider.y = siteHHalf - 5;
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP cSlider::Render(ICanvas *pCanvas)
|
||||
{
|
||||
// intensity to lose or gain for 3d effect
|
||||
#define COLOR_BAND 20
|
||||
|
||||
USES_CONVERSION;
|
||||
|
||||
CComPtr<IPluginSite> pPlugin;
|
||||
m_pSite->get_PluginSite(&pPlugin);
|
||||
|
||||
CComPtr<IIconCache> pIcon;
|
||||
SIZE szIcon = {7, 12};
|
||||
pPlugin->GetIconCache(&szIcon, &pIcon);
|
||||
|
||||
// we're averaging color differences w/bias...
|
||||
float fractional = m_nSliderPos / m_nMaximum;
|
||||
float lFraction = (1 - fractional) * 2;
|
||||
float rFraction = fractional * 2;
|
||||
|
||||
long lMinSliderRed = lFraction * (BYTE) m_nMinSliderColor;
|
||||
long lMinSliderGreen = lFraction * (BYTE) (m_nMinSliderColor >> 8);
|
||||
long lMinSliderBlue = lFraction * (BYTE) (m_nMinSliderColor >> 16);
|
||||
|
||||
long lMaxSliderRed = rFraction * (BYTE) m_nMaxSliderColor;
|
||||
long lMaxSliderGreen = rFraction * (BYTE) (m_nMaxSliderColor >> 8);
|
||||
long lMaxSliderBlue = rFraction * (BYTE) (m_nMaxSliderColor >> 16);
|
||||
|
||||
long lFillColorTop, lFillColorMiddle, lFillColorBottom;
|
||||
|
||||
long lFillColorRed = (lMinSliderRed + lMaxSliderRed) / 2,
|
||||
lFillColorGreen = (lMinSliderGreen + lMaxSliderGreen) / 2,
|
||||
lFillColorBlue = (lMinSliderBlue + lMaxSliderBlue) / 2;
|
||||
|
||||
if( m_nMinSliderColor && m_nMaxSliderColor ) // not black .. who would choose all black for both bars anyway? grr.
|
||||
{
|
||||
// find the most intense color channel to maul for our evil purposes (we're using std::max here)
|
||||
long lMax = max( max( lFillColorRed, lFillColorGreen ), lFillColorBlue );
|
||||
|
||||
// if we're dark, don't overflow
|
||||
long lOffset = lMax > (COLOR_BAND - 1) ? COLOR_BAND : 0;
|
||||
long lOffset2 = lMax > (COLOR_BAND - 1) ? 0 : COLOR_BAND;
|
||||
|
||||
// red
|
||||
if( lMax == lFillColorRed )
|
||||
{
|
||||
lFillColorTop = RGB( lFillColorRed - lOffset, lFillColorGreen, lFillColorBlue );
|
||||
lFillColorMiddle = RGB( lFillColorRed + lOffset2, lFillColorGreen, lFillColorBlue );
|
||||
lFillColorBottom = RGB( lFillColorRed - lOffset, lFillColorGreen, lFillColorBlue );
|
||||
}
|
||||
|
||||
// green
|
||||
else if( lMax == lFillColorGreen )
|
||||
{
|
||||
lFillColorTop = RGB( lFillColorRed, lFillColorGreen - lOffset, lFillColorBlue );
|
||||
lFillColorMiddle = RGB( lFillColorRed, lFillColorGreen + lOffset2, lFillColorBlue );
|
||||
lFillColorBottom = RGB( lFillColorRed, lFillColorGreen - lOffset, lFillColorBlue );
|
||||
}
|
||||
|
||||
// has to be blue
|
||||
else
|
||||
{
|
||||
lFillColorTop = RGB( lFillColorRed, lFillColorGreen, lFillColorBlue - lOffset );
|
||||
lFillColorMiddle = RGB( lFillColorRed, lFillColorGreen, lFillColorBlue + lOffset2 );
|
||||
lFillColorBottom = RGB( lFillColorRed, lFillColorGreen, lFillColorBlue - lOffset );
|
||||
}
|
||||
}
|
||||
|
||||
// someone's a GOTH
|
||||
else
|
||||
{
|
||||
lFillColorTop = 0;
|
||||
lFillColorMiddle = 0x00161616;
|
||||
lFillColorBottom = 0;
|
||||
}
|
||||
|
||||
pCanvas->Fill( &m_rcBar, lFillColorMiddle );
|
||||
|
||||
RECT topBar = {m_rcBar.left, m_rcBar.top, m_rcBar.right, m_rcBar.top + 1};
|
||||
pCanvas->Fill( &topBar, lFillColorTop );
|
||||
|
||||
RECT bottomBar = {m_rcBar.left, m_rcBar.bottom - 1, m_rcBar.right, m_rcBar.bottom};
|
||||
pCanvas->Fill( &bottomBar, lFillColorBottom );
|
||||
|
||||
pIcon->DrawIcon(&m_ptSlider, 0x06001286, 0, pCanvas);
|
||||
|
||||
m_pFont->DrawText(&m_ptLeftText, _bstr_t(m_strTextLeft), RGB(0, 0, 0), pCanvas);
|
||||
m_pFont->DrawText(&m_ptRightText, _bstr_t(m_strTextRight), RGB(0, 0, 0), pCanvas);
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP cSlider::MouseDown(struct MouseState *mouseState) {
|
||||
_ASSERTE(m_pSite != NULL);
|
||||
|
||||
POINT pt = mouseState->client;
|
||||
|
||||
if (pt.x >= (m_ptSlider.x) && (pt.x <= m_ptSlider.x + 6) &&
|
||||
pt.y >= (m_ptSlider.y) && (pt.y <= m_ptSlider.y + 12)) {
|
||||
// They hit the grapple point!
|
||||
m_ptLastMouse = mouseState->client;
|
||||
m_bGrappled = VARIANT_TRUE;
|
||||
} else {
|
||||
// The hit the bar - see if that's within the bar rect
|
||||
|
||||
if (pt.x > m_rcBar.left && pt.x < m_rcBar.right &&
|
||||
pt.y > (m_rcBar.top - 3) && pt.y < (m_rcBar.bottom + 3)) {
|
||||
|
||||
// Calcuate the new slider position
|
||||
float pixelValue = (float)((float)(m_nMaximum - m_nMinimum) / (float)(m_rcBar.right - m_rcBar.left));
|
||||
|
||||
m_nSliderPos = (pt.x - m_rcBar.left) * pixelValue;
|
||||
|
||||
Reformat();
|
||||
m_pSite->Invalidate();
|
||||
|
||||
long nID;
|
||||
m_pSite->get_ID(&nID);
|
||||
_ASSERTE(m_pSite.p != NULL);
|
||||
Fire_Change(nID, m_nSliderPos);
|
||||
}
|
||||
}
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP cSlider::MouseUp(struct MouseState *mouseState) {
|
||||
m_bGrappled = VARIANT_FALSE;
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP cSlider::MouseMove(struct MouseState *mouseState) {
|
||||
if (m_bGrappled) {
|
||||
long dx;
|
||||
POINT pt = mouseState->client;
|
||||
|
||||
dx = m_ptLastMouse.x - pt.x;
|
||||
m_ptLastMouse = pt;
|
||||
|
||||
float pixelValue = (float)((float)(m_nMaximum - m_nMinimum) / (float)(m_rcBar.right - m_rcBar.left));
|
||||
m_nSliderPos -= ((float)dx * pixelValue);
|
||||
|
||||
// I personally like being able to drag the slider
|
||||
// PAST THE EDGE OF THE SLIDE BAR without needing pixel accuracy...
|
||||
if( pt.x >= m_rcBar.right )
|
||||
m_nSliderPos = m_nMaximum;
|
||||
|
||||
Reformat();
|
||||
m_pSite->Invalidate();
|
||||
|
||||
long nID;
|
||||
m_pSite->get_ID(&nID);
|
||||
_ASSERTE(m_pSite.p != NULL);
|
||||
Fire_Change(nID, m_nSliderPos);
|
||||
}
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
96
Native/DecalControls/Slider.h
Normal file
96
Native/DecalControls/Slider.h
Normal file
|
|
@ -0,0 +1,96 @@
|
|||
// Checkbox.h : Declaration of the cCheckbox
|
||||
|
||||
#ifndef __SLIDER_H_
|
||||
#define __SLIDER_H_
|
||||
|
||||
#include "resource.h" // main symbols
|
||||
#include "DecalControlsCP.h"
|
||||
|
||||
#include "SinkImpl.h"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// cSlider
|
||||
class ATL_NO_VTABLE cSlider :
|
||||
public CComObjectRootEx<CComMultiThreadModel>,
|
||||
public CComCoClass<cSlider, &CLSID_Slider>,
|
||||
public IControlImpl< cSlider, ISlider, &IID_ISlider, &LIBID_DecalControls >,
|
||||
public ILayerMouseImpl,
|
||||
public ILayerRenderImpl,
|
||||
public ILayerImpl< cSlider >,
|
||||
public ILayerSchema,
|
||||
public IProvideClassInfo2Impl< &CLSID_Slider, &DIID_ISliderEvents, &LIBID_DecalControls >,
|
||||
public IConnectionPointContainerImpl<cSlider>,
|
||||
public CProxyISliderEvents<cSlider>
|
||||
{
|
||||
public:
|
||||
cSlider();
|
||||
~cSlider();
|
||||
|
||||
CComPtr<IFontCache> m_pFont;
|
||||
|
||||
VARIANT_BOOL m_bVertical;
|
||||
VARIANT_BOOL m_bMouseIn;
|
||||
VARIANT_BOOL m_bGrappled;
|
||||
|
||||
long m_nTextColor;
|
||||
float m_nSliderPos;
|
||||
long m_nMinimum, m_nMaximum;
|
||||
long m_nMinSliderColor, m_nMaxSliderColor;
|
||||
|
||||
char *m_strTextLeft, *m_strTextRight;
|
||||
|
||||
POINT m_ptSlider, m_ptLastMouse;
|
||||
POINT m_ptLeftText, m_ptRightText;
|
||||
RECT m_rcBar, m_rcBackground;
|
||||
|
||||
DECLARE_REGISTRY_RESOURCEID(IDR_SLIDER)
|
||||
|
||||
DECLARE_PROTECT_FINAL_CONSTRUCT()
|
||||
|
||||
BEGIN_COM_MAP(cSlider)
|
||||
COM_INTERFACE_ENTRY(ILayerRender)
|
||||
COM_INTERFACE_ENTRY(ILayerMouse)
|
||||
COM_INTERFACE_ENTRY(ILayerSchema)
|
||||
COM_INTERFACE_ENTRY(ISlider)
|
||||
COM_INTERFACE_ENTRY(IControl)
|
||||
COM_INTERFACE_ENTRY(IDispatch)
|
||||
COM_INTERFACE_ENTRY(ILayer)
|
||||
COM_INTERFACE_ENTRY(IProvideClassInfo)
|
||||
COM_INTERFACE_ENTRY(IProvideClassInfo2)
|
||||
COM_INTERFACE_ENTRY_IMPL(IConnectionPointContainer)
|
||||
END_COM_MAP()
|
||||
|
||||
BEGIN_CONNECTION_POINT_MAP(cSlider)
|
||||
CONNECTION_POINT_ENTRY(DIID_ISliderEvents)
|
||||
END_CONNECTION_POINT_MAP()
|
||||
|
||||
public:
|
||||
// ISlider Methods
|
||||
STDMETHOD(get_TextColor)(/*[out, retval]*/ long *pVal);
|
||||
STDMETHOD(put_TextColor)(/*[in]*/ long newVal);
|
||||
|
||||
STDMETHOD(get_Font)(/*[out, retval]*/ IFontCacheDisp * *pVal);
|
||||
STDMETHOD(putref_Font)(/*[in]*/ IFontCacheDisp * newVal);
|
||||
|
||||
STDMETHOD(get_SliderPosition)(/*[out, retval]*/ long *pVal);
|
||||
STDMETHOD(put_SliderPosition)(/*[in]*/ long newVal);
|
||||
|
||||
STDMETHOD(get_Minimum)(/*[out, retval]*/ long *pVal);
|
||||
STDMETHOD(put_Minimum)(/*[in]*/ long newVal);
|
||||
|
||||
STDMETHOD(get_Maximum)(/*[out, retval]*/ long *pVal);
|
||||
STDMETHOD(put_Maximum)(/*[in]*/ long newVal);
|
||||
|
||||
// ILayerSchema Methods
|
||||
STDMETHOD(SchemaLoad)(IView *pView, IUnknown *pSchema);
|
||||
|
||||
// ILayerRender Methods
|
||||
STDMETHOD(Reformat)();
|
||||
STDMETHOD(Render)(ICanvas *pCanvas);
|
||||
|
||||
// ILayerMouse Methods
|
||||
STDMETHOD(MouseDown)(struct MouseState *mouseState);
|
||||
STDMETHOD(MouseUp)(struct MouseState *mouseState);
|
||||
STDMETHOD(MouseMove)(struct MouseState *mouseState);
|
||||
};
|
||||
#endif //__SLIDER_H_
|
||||
25
Native/DecalControls/Slider.rgs
Normal file
25
Native/DecalControls/Slider.rgs
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
HKCR
|
||||
{
|
||||
DecalControls.Slider.1 = s Slider Class'
|
||||
{
|
||||
CLSID = s '{5D14557A-1268-43c6-A283-3B5B271359AA}'
|
||||
}
|
||||
DecalControls.Slider = s 'Slider Class'
|
||||
{
|
||||
CLSID = s '{5D14557A-1268-43c6-A283-3B5B271359AA}'
|
||||
CurVer = s 'DecalControls.Slider.1'
|
||||
}
|
||||
NoRemove CLSID
|
||||
{
|
||||
ForceRemove {5D14557A-1268-43c6-A283-3B5B271359AA} = s 'Slider Class'
|
||||
{
|
||||
ProgID = s 'DecalControls.StaticText.1'
|
||||
VersionIndependentProgID = s 'DecalControls.Slider'
|
||||
InprocServer32 = s '%MODULE%'
|
||||
{
|
||||
val ThreadingModel = s 'Both'
|
||||
}
|
||||
'TypeLib' = s '{1C4B007A-04DD-4DF8-BA29-2CFBD0220B89}'
|
||||
}
|
||||
}
|
||||
}
|
||||
372
Native/DecalControls/Static.cpp
Normal file
372
Native/DecalControls/Static.cpp
Normal file
|
|
@ -0,0 +1,372 @@
|
|||
// Static.cpp : Implementation of cStatic
|
||||
#include "stdafx.h"
|
||||
#include "DecalControls.h"
|
||||
#include "Static.h"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// cStatic
|
||||
|
||||
|
||||
STDMETHODIMP cStatic::get_Font(IFontCacheDisp **pVal)
|
||||
{
|
||||
_ASSERTE( pVal != NULL );
|
||||
|
||||
if( m_pFont.p == NULL )
|
||||
*pVal = NULL;
|
||||
else
|
||||
m_pFont->QueryInterface( pVal );
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP cStatic::putref_Font(IFontCacheDisp *newVal)
|
||||
{
|
||||
_ASSERTE( newVal != NULL );
|
||||
|
||||
if( m_pFont.p )
|
||||
m_pFont.Release();
|
||||
|
||||
HRESULT hRes = newVal->QueryInterface( &m_pFont );
|
||||
|
||||
_ASSERTE( SUCCEEDED( hRes ) );
|
||||
m_pSite->Invalidate();
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP cStatic::get_Text(BSTR *pVal)
|
||||
{
|
||||
_ASSERTE( pVal != NULL );
|
||||
|
||||
*pVal = OLE2BSTR( m_strText );
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP cStatic::put_Text(BSTR newVal)
|
||||
{
|
||||
_ASSERTE( newVal != NULL );
|
||||
|
||||
m_strText = newVal;
|
||||
m_pSite->Invalidate();
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP cStatic::SchemaLoad(IView *pView, IUnknown *pSchema)
|
||||
{
|
||||
CComPtr< IPluginSite > pPlugin;
|
||||
m_pSite->get_PluginSite( &pPlugin );
|
||||
|
||||
pPlugin->CreateFontSchema( 14, 0, pSchema, &m_pFont );
|
||||
|
||||
MSXML::IXMLDOMElementPtr pElement = pSchema;
|
||||
|
||||
_variant_t vText = pElement->getAttribute( _T( "text" ) ),
|
||||
vTextColor = pElement->getAttribute( _T( "textcolor" ) ),
|
||||
vWidth = pElement->getAttribute( _T( "width" ) ),
|
||||
vHeight = pElement->getAttribute( _T( "height" ) ),
|
||||
vJustify = pElement->getAttribute( _T( "justify" ) ),
|
||||
vOutline = pElement->getAttribute( _T( "outlinecolor" ) ),
|
||||
vAntialias = pElement->getAttribute( _T( "aa" ) );
|
||||
|
||||
// This is a required element
|
||||
_ASSERTE( vText.vt == VT_BSTR );
|
||||
|
||||
// Store the text, assume left justification
|
||||
m_strText = vText.bstrVal;
|
||||
m_eJustify = eFontLeft;
|
||||
|
||||
// Determine the proper justification
|
||||
if (vJustify.vt != VT_NULL)
|
||||
{
|
||||
_bstr_t bstrJustify = vJustify.bstrVal;
|
||||
if (::_wcsicmp(L"left", bstrJustify) == 0)
|
||||
{
|
||||
m_eJustify = eFontLeft;
|
||||
}
|
||||
else if (::_wcsicmp(L"right", bstrJustify) == 0)
|
||||
{
|
||||
m_eJustify = eFontRight;
|
||||
}
|
||||
else if (::_wcsicmp(L"center", bstrJustify) == 0)
|
||||
{
|
||||
m_eJustify = eFontCenter;
|
||||
}
|
||||
}
|
||||
|
||||
// Determine the color
|
||||
if( vTextColor.vt != VT_NULL )
|
||||
{
|
||||
try
|
||||
{
|
||||
m_nTextColor = static_cast< long >( vTextColor );
|
||||
}
|
||||
catch( ... )
|
||||
{
|
||||
// Type conversion error
|
||||
_ASSERTE( FALSE );
|
||||
}
|
||||
}
|
||||
|
||||
m_nOutlineColor = 0;
|
||||
m_bOutline = false;
|
||||
if( vOutline.vt != VT_NULL )
|
||||
{
|
||||
try
|
||||
{
|
||||
m_bOutline = true;
|
||||
m_nOutlineColor = static_cast< long >( vOutline );
|
||||
}
|
||||
catch( ... )
|
||||
{
|
||||
// Type conversion error
|
||||
_ASSERTE( FALSE );
|
||||
}
|
||||
}
|
||||
|
||||
m_bAA = true;
|
||||
if( vAntialias.vt != VT_NULL )
|
||||
{
|
||||
try
|
||||
{
|
||||
m_bAA = static_cast< bool >( vAntialias );
|
||||
}
|
||||
catch( ... )
|
||||
{
|
||||
// Type conversion error
|
||||
_ASSERTE( FALSE );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
// Set the width of the static (not same as text width)
|
||||
if( vWidth.vt != VT_NULL )
|
||||
{
|
||||
try
|
||||
{
|
||||
m_nWidth = static_cast< long >( vWidth );
|
||||
}
|
||||
catch( ... )
|
||||
{
|
||||
// Type conversion error
|
||||
_ASSERTE( FALSE );
|
||||
}
|
||||
}
|
||||
|
||||
// Set the height of the static (not same as text height or fontsize)
|
||||
if( vHeight.vt != VT_NULL )
|
||||
{
|
||||
try
|
||||
{
|
||||
m_nHeight = static_cast< long >( vHeight );
|
||||
}
|
||||
catch( ... )
|
||||
{
|
||||
// Type conversion error
|
||||
_ASSERTE( FALSE );
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP cStatic::Render( ICanvas *pCanvas )
|
||||
{
|
||||
if( m_pFont.p == NULL )
|
||||
{
|
||||
// Create the default font
|
||||
CComPtr< IPluginSite > pPlugin;
|
||||
m_pSite->get_PluginSite( &pPlugin );
|
||||
|
||||
BSTR bstrFontName;
|
||||
pPlugin->get_FontName(&bstrFontName);
|
||||
pPlugin->CreateFont( bstrFontName /*_bstr_t( _T( "Times New Roman" ) )*/, 14, 0, &m_pFont );
|
||||
}
|
||||
|
||||
SIZE Size;
|
||||
char *token;
|
||||
POINT ptText = { 0, 0 };
|
||||
|
||||
//_bstr_t strText= m_strText.copy();
|
||||
//_bstr_t temp=_bstr_t("");
|
||||
|
||||
// Determine control size
|
||||
RECT rcPos;
|
||||
m_pSite->get_Position(&rcPos);
|
||||
int nWidth = rcPos.right - rcPos.left;
|
||||
int nHeight = rcPos.bottom - rcPos.top;
|
||||
|
||||
// Copy the string for parsing
|
||||
std::string strText((const char *) m_strText);
|
||||
|
||||
// Determine line height
|
||||
m_pFont->MeasureText(_bstr_t(strText.data()), &Size);
|
||||
int height = Size.cy;
|
||||
|
||||
// Break it into lines (can't use strtok or we miss blank lines)
|
||||
std::vector<_bstr_t> lines;
|
||||
int nStart = 0, nEnd;
|
||||
bool bDone = false;
|
||||
while (!bDone)
|
||||
{
|
||||
// Get the next CR
|
||||
nEnd = strText.find("\n", nStart);
|
||||
if (nEnd == std::string::npos)
|
||||
{
|
||||
bDone = true;
|
||||
nEnd = strText.length();
|
||||
}
|
||||
|
||||
// Store the line
|
||||
lines.push_back(strText.substr(nStart, nEnd - nStart).data());
|
||||
|
||||
// Move one character beyond
|
||||
nStart = nEnd + 1;
|
||||
}
|
||||
|
||||
// Loop through the lines
|
||||
_bstr_t bstrSpace(" "), bstrEmpty("");
|
||||
int nIndex, nLines = lines.size();
|
||||
for (nIndex = 0, bDone = false; !bDone && (nIndex < nLines); nIndex++)
|
||||
{
|
||||
// Copy the line for parsing
|
||||
_bstr_t strLine((const char *) lines[nIndex]);
|
||||
|
||||
// Line to be built
|
||||
_bstr_t strOut = bstrEmpty;
|
||||
|
||||
// Loop through the "words" on the line
|
||||
for (token = ::strtok((char *) strLine, " "); !bDone && (token != NULL); token = ::strtok(NULL, " "))
|
||||
{
|
||||
_bstr_t bstrToken(token);
|
||||
|
||||
// Measure this token
|
||||
m_pFont->MeasureText(strOut + bstrToken, &Size);
|
||||
|
||||
// Is this line full???
|
||||
if (Size.cx > nWidth)
|
||||
{
|
||||
DrawText(&ptText, strOut, pCanvas);
|
||||
ptText.y += height;
|
||||
|
||||
// Does the next line put us over the top
|
||||
bDone = ((ptText.y + height) > nHeight) ? true : false;
|
||||
|
||||
// Clear the line
|
||||
strOut = bstrEmpty;
|
||||
}
|
||||
|
||||
// Store the token
|
||||
strOut += bstrToken + bstrSpace;
|
||||
}
|
||||
|
||||
// Draw as needed
|
||||
if (!bDone)
|
||||
{
|
||||
DrawText(&ptText, strOut, pCanvas);
|
||||
ptText.y += height;
|
||||
}
|
||||
|
||||
// Does the next line put us over the top
|
||||
bDone = ((ptText.y + height) > nHeight) ? true : false;
|
||||
}
|
||||
|
||||
/*
|
||||
if(Size.cx > nWidth)
|
||||
{
|
||||
for( token = ::strtok( (char*)strText, " " ); token !=NULL; token = ::strtok( NULL, " " ) )
|
||||
{
|
||||
m_pFont->MeasureText(temp + _bstr_t(token), &Size);
|
||||
|
||||
if(Size.cx > nWidth)
|
||||
{
|
||||
DrawText( &ptText, temp, pCanvas );
|
||||
ptText.y+=height;//14;
|
||||
if(ptText.y+height>nHeight)
|
||||
return S_OK;
|
||||
temp = _bstr_t(token) + _bstr_t(" ");
|
||||
}
|
||||
else
|
||||
temp += _bstr_t(token) + _bstr_t(" ");
|
||||
}
|
||||
|
||||
DrawText( &ptText, temp, pCanvas );
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
DrawText( &ptText, strText, pCanvas );
|
||||
}
|
||||
*/
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP cStatic::get_TextColor(long *pVal)
|
||||
{
|
||||
_ASSERTE( pVal != NULL );
|
||||
|
||||
*pVal = m_nTextColor;
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP cStatic::put_TextColor(long newVal)
|
||||
{
|
||||
_ASSERTE( ( newVal & 0xFF000000L ) == 0 );
|
||||
|
||||
m_nTextColor = newVal;
|
||||
m_pSite->Invalidate();
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
void cStatic::DrawText(LPPOINT ppt, BSTR szText, ICanvas *pCanvas)
|
||||
{
|
||||
POINT pt = *ppt;
|
||||
|
||||
RECT rcPos;
|
||||
m_pSite->get_Position(&rcPos);
|
||||
int nWidth = rcPos.right - rcPos.left;
|
||||
int nHeight = rcPos.bottom - rcPos.top;
|
||||
|
||||
// Act based on justification style
|
||||
switch (m_eJustify)
|
||||
{
|
||||
case eFontRight:
|
||||
{
|
||||
SIZE Size;
|
||||
m_pFont->MeasureText(szText, &Size);
|
||||
pt.x = nWidth - Size.cx;
|
||||
}
|
||||
break;
|
||||
|
||||
case eFontCenter:
|
||||
{
|
||||
SIZE Size;
|
||||
m_pFont->MeasureText(szText, &Size);
|
||||
pt.x = (nWidth / 2) - (Size.cx / 2);
|
||||
}
|
||||
break;
|
||||
|
||||
case eFontLeft:
|
||||
default:
|
||||
{
|
||||
// No-Op
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
long lFlags = 0;
|
||||
|
||||
if( m_bAA )
|
||||
lFlags |= eAA;
|
||||
|
||||
if( m_bOutline )
|
||||
lFlags |= eOutlined;
|
||||
|
||||
m_pFont->DrawTextEx( &pt, szText, m_nTextColor, m_nOutlineColor, lFlags, pCanvas );
|
||||
}
|
||||
78
Native/DecalControls/Static.h
Normal file
78
Native/DecalControls/Static.h
Normal file
|
|
@ -0,0 +1,78 @@
|
|||
// Static.h : Declaration of the cStatic
|
||||
|
||||
#ifndef __STATIC_H_
|
||||
#define __STATIC_H_
|
||||
|
||||
#include "resource.h" // main symbols
|
||||
#include "DecalControlsCP.h"
|
||||
|
||||
#include "SinkImpl.h"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// cStatic
|
||||
class ATL_NO_VTABLE cStatic :
|
||||
public CComObjectRootEx<CComMultiThreadModel>,
|
||||
public CComCoClass<cStatic, &CLSID_StaticText>,
|
||||
public ILayerImpl< cStatic >,
|
||||
public IControlImpl< cStatic, IStatic, &IID_IStatic, &LIBID_DecalControls >,
|
||||
public ILayerRenderImpl,
|
||||
public ILayerSchema,
|
||||
public IProvideClassInfo2Impl< &CLSID_StaticText, &DIID_IControlEvents, &LIBID_DecalControls >,
|
||||
public IConnectionPointContainerImpl<cStatic>,
|
||||
public CProxyIControlEvents< cStatic >
|
||||
{
|
||||
public:
|
||||
cStatic()
|
||||
: m_nTextColor( RGB( 0, 0, 0 ) )
|
||||
{
|
||||
}
|
||||
|
||||
void DrawText(LPPOINT ppt, BSTR szText, ICanvas *pCanvas);
|
||||
|
||||
CComPtr< IFontCache > m_pFont;
|
||||
_bstr_t m_strText;
|
||||
long m_nTextColor;
|
||||
long m_nOutlineColor;
|
||||
bool m_bAA;
|
||||
bool m_bOutline;
|
||||
//long m_nWidth;
|
||||
//long m_nHeight;
|
||||
eFontJustify m_eJustify;
|
||||
|
||||
DECLARE_REGISTRY_RESOURCEID(IDR_STATIC)
|
||||
|
||||
DECLARE_PROTECT_FINAL_CONSTRUCT()
|
||||
|
||||
BEGIN_COM_MAP(cStatic)
|
||||
COM_INTERFACE_ENTRY(ILayerRender)
|
||||
COM_INTERFACE_ENTRY(ILayer)
|
||||
COM_INTERFACE_ENTRY(ILayerSchema)
|
||||
COM_INTERFACE_ENTRY(IDispatch)
|
||||
COM_INTERFACE_ENTRY(IControl)
|
||||
COM_INTERFACE_ENTRY(IStatic)
|
||||
COM_INTERFACE_ENTRY(IProvideClassInfo)
|
||||
COM_INTERFACE_ENTRY(IProvideClassInfo2)
|
||||
COM_INTERFACE_ENTRY_IMPL(IConnectionPointContainer)
|
||||
END_COM_MAP()
|
||||
|
||||
BEGIN_CONNECTION_POINT_MAP(cStatic)
|
||||
CONNECTION_POINT_ENTRY(DIID_IControlEvents)
|
||||
END_CONNECTION_POINT_MAP()
|
||||
|
||||
public:
|
||||
// IStatic Methods
|
||||
STDMETHOD(get_Text)(/*[out, retval]*/ BSTR *pVal);
|
||||
STDMETHOD(put_Text)(/*[in]*/ BSTR newVal);
|
||||
STDMETHOD(get_Font)(/*[out, retval]*/ IFontCacheDisp * *pVal);
|
||||
STDMETHOD(putref_Font)(/*[in]*/ IFontCacheDisp * newVal);
|
||||
STDMETHOD(get_TextColor)(/*[out, retval]*/ long *pVal);
|
||||
STDMETHOD(put_TextColor)(/*[in]*/ long newVal);
|
||||
|
||||
// ILayerSchema Methods
|
||||
STDMETHOD(SchemaLoad)(IView *pView, IUnknown *pSchema);
|
||||
|
||||
// ILayerRender Methods
|
||||
STDMETHOD(Render)(ICanvas *);
|
||||
};
|
||||
|
||||
#endif //__STATIC_H_
|
||||
25
Native/DecalControls/Static.rgs
Normal file
25
Native/DecalControls/Static.rgs
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
HKCR
|
||||
{
|
||||
DecalControls.StaticText.1 = s 'StaticText Class'
|
||||
{
|
||||
CLSID = s '{4887101C-A9F9-495B-921B-EF22822CFB97}'
|
||||
}
|
||||
DecalControls.StaticText = s 'StaticText Class'
|
||||
{
|
||||
CLSID = s '{4887101C-A9F9-495B-921B-EF22822CFB97}'
|
||||
CurVer = s 'DecalControls.StaticText.1'
|
||||
}
|
||||
NoRemove CLSID
|
||||
{
|
||||
ForceRemove {4887101C-A9F9-495B-921B-EF22822CFB97} = s 'StaticText Class'
|
||||
{
|
||||
ProgID = s 'DecalControls.StaticText.1'
|
||||
VersionIndependentProgID = s 'DecalControls.StaticText'
|
||||
InprocServer32 = s '%MODULE%'
|
||||
{
|
||||
val ThreadingModel = s 'Both'
|
||||
}
|
||||
'TypeLib' = s '{1C4B007A-04DD-4DF8-BA29-2CFBD0220B89}'
|
||||
}
|
||||
}
|
||||
}
|
||||
14
Native/DecalControls/StdAfx.cpp
Normal file
14
Native/DecalControls/StdAfx.cpp
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
// stdafx.cpp : source file that includes just the standard includes
|
||||
// stdafx.pch will be the pre-compiled header
|
||||
// stdafx.obj will contain the pre-compiled type information
|
||||
|
||||
#include "stdafx.h"
|
||||
|
||||
#ifdef _ATL_STATIC_REGISTRY
|
||||
#include <statreg.h>
|
||||
#include <statreg.cpp>
|
||||
#endif
|
||||
|
||||
#include <atlimpl.cpp>
|
||||
|
||||
#include "..\Inject\SinkImpl.cpp"
|
||||
53
Native/DecalControls/StdAfx.h
Normal file
53
Native/DecalControls/StdAfx.h
Normal file
|
|
@ -0,0 +1,53 @@
|
|||
// stdafx.h : include file for standard system include files,
|
||||
// or project specific include files that are used frequently,
|
||||
// but are changed infrequently
|
||||
|
||||
#if !defined(AFX_STDAFX_H__2E05D2E0_3EAC_488F_8C1B_3CF7378ADE73__INCLUDED_)
|
||||
#define AFX_STDAFX_H__2E05D2E0_3EAC_488F_8C1B_3CF7378ADE73__INCLUDED_
|
||||
|
||||
#if _MSC_VER > 1000
|
||||
#pragma once
|
||||
#endif // _MSC_VER > 1000
|
||||
|
||||
#define STRICT
|
||||
#define _WIN32_WINDOWS 0x0410
|
||||
#define _ATL_APARTMENT_THREADED
|
||||
|
||||
// Don't use macros for min() and max()!!!
|
||||
#define NOMINMAX
|
||||
|
||||
#include <atlbase.h>
|
||||
#include <list>
|
||||
#include <vector>
|
||||
#include <algorithm>
|
||||
#include <deque>
|
||||
#include <map>
|
||||
#include <string>
|
||||
|
||||
// Keep things backward compatible
|
||||
#if defined(_MSC_VER) && _MSC_VER <= 1200
|
||||
#define min std::_cpp_min
|
||||
#define max std::_cpp_max
|
||||
#else
|
||||
using std::min;
|
||||
using std::max;
|
||||
#endif
|
||||
|
||||
//You may derive a class from CComModule and use it if you want to override
|
||||
//something, but do not change the name of _Module
|
||||
extern CComModule _Module;
|
||||
#include <atlcom.h>
|
||||
|
||||
#include "..\Inject\Inject.h"
|
||||
#import <msxml.dll>
|
||||
|
||||
#ifdef _CHECKMEM
|
||||
#define _ASSERTMEM(a) _ASSERTE(a)
|
||||
#else
|
||||
#define _ASSERTMEM(a)
|
||||
#endif
|
||||
|
||||
//{{AFX_INSERT_LOCATION}}
|
||||
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
|
||||
|
||||
#endif // !defined(AFX_STDAFX_H__2E05D2E0_3EAC_488F_8C1B_3CF7378ADE73__INCLUDED)
|
||||
222
Native/DecalControls/TextColumn.cpp
Normal file
222
Native/DecalControls/TextColumn.cpp
Normal file
|
|
@ -0,0 +1,222 @@
|
|||
// TextColumn.cpp : Implementation of cTextColumn
|
||||
#include "stdafx.h"
|
||||
#include "DecalControls.h"
|
||||
#include "TextColumn.h"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// cTextColumn
|
||||
|
||||
STDMETHODIMP cTextColumn::get_FixedWidth(VARIANT_BOOL *pVal)
|
||||
{
|
||||
if( m_nFixedWidth == -1 )
|
||||
*pVal = VARIANT_FALSE;
|
||||
else
|
||||
*pVal = VARIANT_TRUE;
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP cTextColumn::get_Width(long *pVal)
|
||||
{
|
||||
if( m_nFixedWidth == -1 )
|
||||
return E_NOTIMPL;
|
||||
|
||||
*pVal = m_nFixedWidth;
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP cTextColumn::put_Width(long newVal)
|
||||
{
|
||||
if( m_nFixedWidth == -1 )
|
||||
return E_NOTIMPL;
|
||||
|
||||
m_nFixedWidth = newVal;
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP cTextColumn::Render(ICanvas *pCanvas, LPPOINT ptCell, long nColor)
|
||||
{
|
||||
USES_CONVERSION;
|
||||
|
||||
_variant_t vText;
|
||||
m_pList->get_Data( ptCell->x, ptCell->y, 0, &vText );
|
||||
|
||||
vText.ChangeType( VT_BSTR );
|
||||
|
||||
CComPtr< IFontCache > pFont;
|
||||
BSTR bstrFontName;
|
||||
m_pSite->get_FontName(&bstrFontName);
|
||||
m_pSite->CreateFont( bstrFontName /*_bstr_t( _T( "Times New Roman" ) )*/, m_nFontSize, 0, &pFont );
|
||||
|
||||
POINT pt = { m_nTextX, m_nTextY };
|
||||
|
||||
// GKusnick: Apply justification.
|
||||
switch (m_eJustify)
|
||||
{
|
||||
case eFontRight:
|
||||
{
|
||||
SIZE Size;
|
||||
pFont->MeasureText(vText.bstrVal, &Size);
|
||||
pt.x = m_nFixedWidth - m_nTextX - Size.cx;
|
||||
}
|
||||
break;
|
||||
|
||||
case eFontCenter:
|
||||
{
|
||||
SIZE Size;
|
||||
pFont->MeasureText(vText.bstrVal, &Size);
|
||||
pt.x = (m_nFixedWidth - Size.cx)/2;
|
||||
}
|
||||
break;
|
||||
|
||||
case eFontLeft:
|
||||
default:
|
||||
{
|
||||
// No-Op
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
pFont->DrawTextEx( &pt, vText.bstrVal, nColor, 0, eAA, pCanvas );
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP cTextColumn::get_DataColumns(long *pVal)
|
||||
{
|
||||
*pVal = 1;
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP cTextColumn::Initialize(IList *newVal, IPluginSite *pSite)
|
||||
{
|
||||
m_pList = newVal;
|
||||
m_pSite = pSite;
|
||||
|
||||
// TODO: Make sure there is a row
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP cTextColumn::SchemaLoad(IUnknown *pSchema)
|
||||
{
|
||||
MSXML::IXMLDOMElementPtr pElement = pSchema;
|
||||
|
||||
_variant_t vFixedWidth = pElement->getAttribute( _T( "fixedwidth" ) );
|
||||
_variant_t vRowHeight = pElement->getAttribute( _T( "rowheight" ) );
|
||||
_variant_t vFontSize = pElement->getAttribute( _T( "fontsize" ) );
|
||||
_variant_t vTextX = pElement->getAttribute( _T( "textx" ) );
|
||||
_variant_t vTextY = pElement->getAttribute( _T( "texty" ) );
|
||||
_variant_t vJustify = pElement->getAttribute( _T( "justify" ) ); /// GKusnick: Justification option.
|
||||
|
||||
if( vFixedWidth.vt != VT_NULL )
|
||||
{
|
||||
try
|
||||
{
|
||||
m_nFixedWidth = static_cast< long >( vFixedWidth );
|
||||
}
|
||||
catch( ... )
|
||||
{
|
||||
// Type conversion error
|
||||
_ASSERTE( FALSE );
|
||||
}
|
||||
}
|
||||
|
||||
if( vRowHeight.vt != VT_NULL )
|
||||
{
|
||||
try
|
||||
{
|
||||
m_nRowHeight = static_cast< long >( vRowHeight );
|
||||
}
|
||||
catch( ... )
|
||||
{
|
||||
// Type conversion error
|
||||
_ASSERTE( FALSE );
|
||||
}
|
||||
}
|
||||
else
|
||||
m_nRowHeight = 20;
|
||||
|
||||
|
||||
if( vFontSize.vt != VT_NULL )
|
||||
{
|
||||
try
|
||||
{
|
||||
m_nFontSize = static_cast< long >( vFontSize );
|
||||
}
|
||||
catch( ... )
|
||||
{
|
||||
// Type conversion error
|
||||
_ASSERTE( FALSE );
|
||||
}
|
||||
}
|
||||
else
|
||||
m_nFontSize = 14;
|
||||
|
||||
if( vTextX.vt != VT_NULL )
|
||||
{
|
||||
try
|
||||
{
|
||||
m_nTextX = static_cast< long >( vTextX );
|
||||
}
|
||||
catch( ... )
|
||||
{
|
||||
// Type conversion error
|
||||
_ASSERTE( FALSE );
|
||||
}
|
||||
}
|
||||
else
|
||||
m_nTextX = 3;
|
||||
|
||||
if( vTextY.vt != VT_NULL )
|
||||
{
|
||||
try
|
||||
{
|
||||
m_nTextY = static_cast< long >( vTextY );
|
||||
}
|
||||
catch( ... )
|
||||
{
|
||||
// Type conversion error
|
||||
_ASSERTE( FALSE );
|
||||
}
|
||||
}
|
||||
else
|
||||
m_nTextY = 2;
|
||||
|
||||
// GKusnick: Set justification style from schema.
|
||||
m_eJustify = eFontLeft;
|
||||
if (vJustify.vt != VT_NULL)
|
||||
{
|
||||
if (::_wcsicmp(L"left", vJustify.bstrVal) == 0)
|
||||
{
|
||||
m_eJustify = eFontLeft;
|
||||
}
|
||||
else if (::_wcsicmp(L"right", vJustify.bstrVal) == 0)
|
||||
{
|
||||
m_eJustify = eFontRight;
|
||||
}
|
||||
else if (::_wcsicmp(L"center", vJustify.bstrVal) == 0)
|
||||
{
|
||||
m_eJustify = eFontCenter;
|
||||
}
|
||||
}
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP cTextColumn::get_Height(long *pVal)
|
||||
{
|
||||
*pVal = m_nRowHeight;
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP cTextColumn::Activate(LPPOINT ptCell)
|
||||
{
|
||||
// TODO: Add your implementation code here
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
52
Native/DecalControls/TextColumn.h
Normal file
52
Native/DecalControls/TextColumn.h
Normal file
|
|
@ -0,0 +1,52 @@
|
|||
// TextColumn.h : Declaration of the cTextColumn
|
||||
|
||||
#ifndef __TEXTCOLUMN_H_
|
||||
#define __TEXTCOLUMN_H_
|
||||
|
||||
#include "resource.h" // main symbols
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// cTextColumn
|
||||
class ATL_NO_VTABLE cTextColumn :
|
||||
public CComObjectRootEx<CComMultiThreadModel>,
|
||||
public CComCoClass<cTextColumn, &CLSID_TextColumn>,
|
||||
public IListColumn
|
||||
{
|
||||
public:
|
||||
cTextColumn()
|
||||
: m_nFixedWidth( -1 )
|
||||
{
|
||||
}
|
||||
|
||||
CComPtr< IList > m_pList;
|
||||
CComPtr< IPluginSite > m_pSite;
|
||||
|
||||
long m_nFixedWidth;
|
||||
long m_nRowHeight;
|
||||
long m_nFontSize;
|
||||
long m_nTextX;
|
||||
long m_nTextY;
|
||||
eFontJustify m_eJustify; // GKusnick: Justification option.
|
||||
|
||||
DECLARE_REGISTRY_RESOURCEID(IDR_TEXTCOLUMN)
|
||||
|
||||
DECLARE_PROTECT_FINAL_CONSTRUCT()
|
||||
|
||||
BEGIN_COM_MAP(cTextColumn)
|
||||
COM_INTERFACE_ENTRY(IListColumn)
|
||||
END_COM_MAP()
|
||||
|
||||
// IListColumn
|
||||
public:
|
||||
STDMETHOD(Activate)(LPPOINT ptCell);
|
||||
STDMETHOD(get_Height)(/*[out, retval]*/ long *pVal);
|
||||
STDMETHOD(SchemaLoad)(IUnknown *pSchema);
|
||||
STDMETHOD(Initialize)(/*[in]*/ IList * newVal, IPluginSite *);
|
||||
STDMETHOD(get_DataColumns)(/*[out, retval]*/ long *pVal);
|
||||
STDMETHOD(Render)(ICanvas *, LPPOINT ptCell, long nColor);
|
||||
STDMETHOD(get_Width)(/*[out, retval]*/ long *pVal);
|
||||
STDMETHOD(get_FixedWidth)(/*[out, retval]*/ VARIANT_BOOL *pVal);
|
||||
STDMETHOD(put_Width)(/*[in]*/ long newVal);
|
||||
};
|
||||
|
||||
#endif //__TEXTCOLUMN_H_
|
||||
25
Native/DecalControls/TextColumn.rgs
Normal file
25
Native/DecalControls/TextColumn.rgs
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
HKCR
|
||||
{
|
||||
DecalControls.TextColumn.1 = s 'DecalControls TextColumn'
|
||||
{
|
||||
CLSID = s '{864DEABF-D079-4B61-A8CF-081418179239}'
|
||||
}
|
||||
DecalControls.TextColumn = s 'DecalControls TextColumn'
|
||||
{
|
||||
CLSID = s '{864DEABF-D079-4B61-A8CF-081418179239}'
|
||||
CurVer = s 'DecalControls.TextColumn.1'
|
||||
}
|
||||
NoRemove CLSID
|
||||
{
|
||||
ForceRemove {864DEABF-D079-4B61-A8CF-081418179239} = s 'DecalControls TextColumn'
|
||||
{
|
||||
ProgID = s 'DecalControls.TextColumn.1'
|
||||
VersionIndependentProgID = s 'DecalControls.TextColumn'
|
||||
InprocServer32 = s '%MODULE%'
|
||||
{
|
||||
val ThreadingModel = s 'Both'
|
||||
}
|
||||
'TypeLib' = s '{3559E08B-827E-4DFE-9D33-3567246849CC}'
|
||||
}
|
||||
}
|
||||
}
|
||||
26
Native/DecalControls/progress.rgs
Normal file
26
Native/DecalControls/progress.rgs
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
HKCR
|
||||
{
|
||||
DecalControls.Progress.1 = s 'Progress Class'
|
||||
{
|
||||
CLSID = s '{FE361225-6BB7-4AE0-A10C-8A6420621680}'
|
||||
}
|
||||
DecalControls.Progress = s 'Progress Class'
|
||||
{
|
||||
CLSID = s '{FE361225-6BB7-4AE0-A10C-8A6420621680}'
|
||||
CurVer = s 'DecalControls.Progress.1'
|
||||
}
|
||||
NoRemove CLSID
|
||||
{
|
||||
ForceRemove {FE361225-6BB7-4AE0-A10C-8A6420621680} = s 'Progress Class'
|
||||
{
|
||||
ProgID = s 'DecalControls.Progress.1'
|
||||
VersionIndependentProgID = s 'DecalControls.Progress'
|
||||
ForceRemove 'Programmable'
|
||||
InprocServer32 = s '%MODULE%'
|
||||
{
|
||||
val ThreadingModel = s 'Apartment'
|
||||
}
|
||||
'TypeLib' = s '{1C4B007A-04DD-4DF8-BA29-2CFBD0220B89}'
|
||||
}
|
||||
}
|
||||
}
|
||||
35
Native/DecalControls/resource.h
Normal file
35
Native/DecalControls/resource.h
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
//{{NO_DEPENDENCIES}}
|
||||
// Microsoft Developer Studio generated include file.
|
||||
// Used by DecalControls.rc
|
||||
//
|
||||
#define IDS_PROJNAME 100
|
||||
#define IDR_EDIT 101
|
||||
#define IDR_CHOICE 102
|
||||
#define IDR_CLIENT 103
|
||||
#define IDR_BORDERLAYOUT 105
|
||||
#define IDR_PAGELAYOUT 106
|
||||
#define IDR_PUSHBUTTON 107
|
||||
#define IDR_STATIC 108
|
||||
#define IDR_CHECKBOX 109
|
||||
#define IDS_DERETHMAP_DESC 133
|
||||
#define IDR_DerethMap 134
|
||||
#define IDR_PROGRESS 136
|
||||
#define IDR_TEXTCOLUMN 201
|
||||
#define IDR_ICONCOLUMN 202
|
||||
#define IDR_LIST 203
|
||||
#define IDR_NOTEBOOK 204
|
||||
#define IDR_SCROLLER 205
|
||||
#define IDR_CHECKCOLUMN 206
|
||||
#define IDR_FIXEDLAYOUT 207
|
||||
#define IDR_SLIDER 208
|
||||
|
||||
// Next default values for new objects
|
||||
//
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
#ifndef APSTUDIO_READONLY_SYMBOLS
|
||||
#define _APS_NEXT_RESOURCE_VALUE 209
|
||||
#define _APS_NEXT_COMMAND_VALUE 32768
|
||||
#define _APS_NEXT_CONTROL_VALUE 201
|
||||
#define _APS_NEXT_SYMED_VALUE 137
|
||||
#endif
|
||||
#endif
|
||||
Loading…
Add table
Add a link
Reference in a new issue