Make it possible to subclass wxMenuBar in XRC (patch #11679).

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@63467 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Václav Slavík 2010-02-11 12:48:29 +00:00
parent e03951b772
commit 10ff14524b

View File

@ -148,7 +148,17 @@ wxMenuBarXmlHandler::wxMenuBarXmlHandler() : wxXmlResourceHandler()
wxObject *wxMenuBarXmlHandler::DoCreateResource()
{
wxMenuBar *menubar = new wxMenuBar(GetStyle());
wxMenuBar *menubar = NULL;
const int style = GetStyle();
wxASSERT_MSG(!style || !m_instance,
"cannot use <style> with pre-created menubar");
if ( m_instance )
menubar = wxDynamicCast(m_instance, wxMenuBar);
if ( !menubar )
menubar = new wxMenuBar(style);
CreateChildren(menubar);
if (m_parentAsWindow)