Forum
Please
Log In
to post a new message or reply to an existing one. If you are not registered, please
register.
NOTE: Some forums may be read-only if you are not currently subscribed to
our technical support services.
Subject |
Author |
Date |
|
Ralf Matthes
|
Mar 6, 2008 - 7:24 AM
|
Hello support team, I’d like to ask if it’s possible to use more than one paint manager at the same time? Example: Use the CExtPaintManagerStudio2008 in general and the CExtPaintManagerNativeXP for CExtButtons to have the buttons in the ’normal’ XP style. Thanks
|
|
Technical Support
|
Mar 7, 2008 - 2:54 AM
|
Yes, you can do that. Here is a ready-to-use solution. The below CExtPaintManagerCustomT template is designed to add custom paint manager capabilities to any Prof-UIS control. Just wrap a class with this template and then use SetCustomPM() : CExtPaintManagerCustomT < CExtButton > m_wndButton;
m_wndButton.SetCustomPM( RUNTIME_CLASS( CExtPaintManagerNativeXP ) ); The template itself //////////////////////////////////////////////////////////////////////////
// template CExtPaintManagerCustomT
template < class _BT >
class CExtPaintManagerCustomT : public _BT
{
public:
CExtPaintManagerCustomT(
CExtPaintManager * pCustomPM = NULL
)
: m_pCustomPM( NULL )
{
SetCustomPM( pCustomPM );
}
?CExtPaintManagerCustomT()
{
if( m_pCustomPM != NULL )
delete m_pCustomPM;
m_pCustomPM = NULL;
}
CExtPaintManager * GetCustomPM() const
{
return m_pCustomPM;
}
bool SetCustomPM(
CExtPaintManager * pCustomPM = NULL
)
{
if( m_pCustomPM != NULL )
{
if( pCustomPM == m_pCustomPM )
return false;
if( m_pCustomPM != NULL )
{
delete m_pCustomPM;
m_pCustomPM = NULL;
}
}
if( pCustomPM == NULL )
{
m_pCustomPM = new __DEFAULT_PAINT_MANAGER_CLASS;
if( ! m_pCustomPM->IsKindOf( RUNTIME_CLASS( CExtPaintManager ) ) )
{
ASSERT( FALSE );
return false;
}
}
else
{
m_pCustomPM = pCustomPM;
}
m_pCustomPM->SyncSysColors();
m_pCustomPM->InitTranslatedColors();
m_pCustomPM->InitHelperBrushes();
return true;
}
bool SetCustomPM(
CRuntimeClass * pRTCCustomPM
)
{
if( pRTCCustomPM == NULL )
return SetCustomPM( (CExtPaintManager *)NULL );
CObject * pObj = pRTCCustomPM->CreateObject();
if( pObj == NULL )
{
ASSERT( FALSE );
return false;
}
ASSERT_VALID( pObj );
CExtPaintManager * pPaintManager = DYNAMIC_DOWNCAST( CExtPaintManager, pObj );
if( pPaintManager == NULL )
{
delete pObj;
ASSERT( FALSE );
return false;
}
return SetCustomPM( pPaintManager );
}
virtual CExtPaintManager * PmBridge_GetPM() const
{
CExtPaintManager * pPM = GetCustomPM();
if( pPM != NULL )
return pPM;
else
return _BT::PmBridge_GetPM();
}
protected:
CExtPaintManager * m_pCustomPM;
};
|
|