diff --git a/include/wx/msw/window.h b/include/wx/msw/window.h index 3f61afbe27..c3c1fe7c7e 100644 --- a/include/wx/msw/window.h +++ b/include/wx/msw/window.h @@ -52,7 +52,23 @@ public: const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = 0, - const wxString& name = wxPanelNameStr); + const wxString& name = wxPanelNameStr) + { + return CreateUsingMSWClass(GetMSWClassName(), + parent, id, pos, size, style, name); + } + + // Non-portable, MSW-specific Create() variant allowing to create the + // window with a custom Windows class name. This can be useful to assign a + // custom Windows class, that can be recognized from the outside of the + // application, for windows of specific type. + bool CreateUsingMSWClass(const wxChar* classname, + wxWindow *parent, + wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxPanelNameStr); // implement base class pure virtuals virtual void SetLabel(const wxString& label) wxOVERRIDE; diff --git a/src/msw/window.cpp b/src/msw/window.cpp index 7ba7d80eec..458f24083a 100644 --- a/src/msw/window.cpp +++ b/src/msw/window.cpp @@ -481,12 +481,13 @@ const wxChar *wxWindowMSW::GetMSWClassName() const } // real construction (Init() must have been called before!) -bool wxWindowMSW::Create(wxWindow *parent, - wxWindowID id, - const wxPoint& pos, - const wxSize& size, - long style, - const wxString& name) +bool wxWindowMSW::CreateUsingMSWClass(const wxChar* classname, + wxWindow *parent, + wxWindowID id, + const wxPoint& pos, + const wxSize& size, + long style, + const wxString& name) { wxCHECK_MSG( parent, false, wxT("can't create wxWindow without parent") ); @@ -512,7 +513,7 @@ bool wxWindowMSW::Create(wxWindow *parent, msflags |= WS_VISIBLE; } - if ( !MSWCreate(GetMSWClassName(), NULL, pos, size, msflags, exstyle) ) + if ( !MSWCreate(classname, NULL, pos, size, msflags, exstyle) ) return false; InheritAttributes();