Professional UI Solutions
Site Map   /  Register
 
 

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.

Forums » Prof-UIS Tech Support » subscribe theme change event Collapse All
Subject Author Date
Chris Anderson Sep 14, 2007 - 7:12 PM

hi there,

I have a question about the theme change event. Our app caches system colors during the startup ( by calling g_PaintManager->GetColor()), when the theme is changed, we have to update the cache colors. From the FAQ, one approach is to derive from CExtPmBridge, and overwrite the PmBridge_OnPaintManagerChanged() method.

Normally should this be done with an existing class, like the main frame wnd, or a global class which live through the life span of the app. I guess once the object is deleted, I will lose track of the event?

Any other light weight approach, like a callback function ?

Thanks

Chris Anderson Sep 16, 2007 - 11:41 PM

it works, thank you

Technical Support Sep 15, 2007 - 11:41 AM

The CExtPaintManager::GetColor() method returns COLORREF values from its cache. So, you don’t have to code your own cache. You need the paint manager changing event for re-painting your themed windows only. Here is the class which handles the paint manager changing code:

class __PROF_UIS_API CYourClass
      : public CBaseClass1
      , public CBaseClass2
      , public CBaseClass3
      . . .
      , public CExtPmBridge
{
public:
      DECLARE_CExtPmBridge_MEMBERS( CYourClass );
      CYourClass();
      virtual ~CYourClass();
      virtual void PmBridge_OnPaintManagerChanged(
            CExtPaintManager * pGlobalPM
            );
};

IMPLEMENT_CExtPmBridge_MEMBERS( CYourClass );

CYourClass::CYourClass()
{
      PmBridge_Install();
}

CYourClass::~CYourClass()
{
      PmBridge_Uninstall();
}

void CYourClass::PmBridge_OnPaintManagerChanged(
      CExtPaintManager * pGlobalPM
      )
{
}