Fix compilation with wxUSE_ACCEL==0

This commit is contained in:
Artur Wieczorek
2017-10-08 10:34:19 +02:00
parent 3a362c64cf
commit f34a6253c7
5 changed files with 19 additions and 4 deletions

View File

@@ -51,10 +51,14 @@ wxMenuItem::wxMenuItem(wxMenu *pParentMenu,
text = wxGetStockLabel(GetId(), wxSTOCK_WITH_ACCELERATOR|wxSTOCK_WITH_MNEMONIC);
}
wxAcceleratorEntry *entry = wxAcceleratorEntry::Create( m_text ) ;
// use accessors for ID and Kind because they might have been changed in the base constructor
#if wxUSE_ACCEL
wxAcceleratorEntry *entry = wxAcceleratorEntry::Create( m_text ) ;
m_peer = wxMenuItemImpl::Create( this, pParentMenu, GetId(), text, entry, strHelp, GetKind(), pSubMenu );
delete entry;
#else
m_peer = wxMenuItemImpl::Create( this, pParentMenu, GetId(), text, NULL, strHelp, GetKind(), pSubMenu );
#endif // wxUSE_ACCEL/!wxUSE_ACCEL
}
wxMenuItem::~wxMenuItem()
@@ -194,9 +198,13 @@ void wxMenuItem::UpdateItemText()
text = wxGetStockLabel(GetId(), wxSTOCK_WITH_ACCELERATOR|wxSTOCK_WITH_MNEMONIC);
}
#if wxUSE_ACCEL
wxAcceleratorEntry *entry = wxAcceleratorEntry::Create( m_text ) ;
GetPeer()->SetLabel( text, entry );
delete entry ;
#else
GetPeer()->SetLabel( text, NULL );
#endif // wxUSE_ACCEL/!wxUSE_ACCEL
}
// ----------------------------------------------------------------------------