Using custom WNDCLASS for wxFrame subclass (MSW)

Do you have a typical platform dependent issue you're battling with ? Ask it here. Make sure you mention your platform, compiler, and wxWidgets version.
Post Reply
pete_b
Knows some wx things
Knows some wx things
Posts: 41
Joined: Fri Jan 05, 2007 9:52 am

Using custom WNDCLASS for wxFrame subclass (MSW)

Post by pete_b » Wed Mar 13, 2019 10:03 am

Just trying to implement a derived class of wxFrame that has CS_DROPSHADOW specified in its WNDCLASS. MSW specific for now.

Is there a DRY way to do this? Looking through wx sources (3.0.4), it looks to me like I'm going to have top copy/paste an awful lot of code from wxFrame to do that. And then I have a maintenance issue.

MSWCreate is not virtual (and clearly cannot be as it is called from the ctor). AFAICS there is no way of overriding wxWindowMSW::MSWGetRegisteredClassName either.

Is there something obvious I'm missing here?

If not then I wonder if perhaps window creation could be reworked a bit do decouple window creation from the window class itself. There could be a wxWindowCreator class that has virtual functions to customize this process (template method pattern).
Then it would be trivial to do this kind of thing - just inject a new window creator that overrides wxWindowCreator::MSWGetRegisteredClassName and you avoid the issue of virtual behaviour in the ctor.

Even just being able to set a function pointer to override MSWCreate or MSWGetRegisteredClassName before calling Create would be really handy.

pete_b
Knows some wx things
Knows some wx things
Posts: 41
Joined: Fri Jan 05, 2007 9:52 am

Re: Using custom WNDCLASS for wxFrame subclass (MSW)

Post by pete_b » Wed Mar 13, 2019 1:01 pm

Just did copy and paste but the shadow looks so feeble I decided to do it a different way with a layered window.

Post Reply