Fix compilation with wxUSE_ACCEL==0
This commit is contained in:
@@ -25,7 +25,9 @@
|
||||
// forward declarations
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
#if wxUSE_ACCEL
|
||||
class WXDLLIMPEXP_FWD_CORE wxAcceleratorEntry;
|
||||
#endif // wxUSE_ACCEL
|
||||
class WXDLLIMPEXP_FWD_CORE wxMenuItem;
|
||||
class WXDLLIMPEXP_FWD_CORE wxMenu;
|
||||
|
||||
|
@@ -125,6 +125,8 @@ class wxComboBox;
|
||||
class wxNotebook;
|
||||
class wxTextCtrl;
|
||||
class wxSearchCtrl;
|
||||
class wxMenuItem;
|
||||
class wxAcceleratorEntry;
|
||||
|
||||
WXDLLIMPEXP_CORE wxWindowMac * wxFindWindowFromWXWidget(WXWidget inControl );
|
||||
|
||||
|
@@ -132,6 +132,7 @@ void wxMacCocoaMenuItemSetAccelerator( NSMenuItem* menuItem, wxAcceleratorEntry*
|
||||
return;
|
||||
}
|
||||
|
||||
#if wxUSE_ACCEL
|
||||
unsigned int modifiers = 0 ;
|
||||
int key = entry->GetKeyCode() ;
|
||||
if ( key )
|
||||
@@ -227,6 +228,7 @@ void wxMacCocoaMenuItemSetAccelerator( NSMenuItem* menuItem, wxAcceleratorEntry*
|
||||
[menuItem setKeyEquivalent:[NSString stringWithCharacters:&shortcut length:1]];
|
||||
[menuItem setKeyEquivalentModifierMask:modifiers];
|
||||
}
|
||||
#endif // wxUSE_ACCEL
|
||||
}
|
||||
|
||||
@interface NSMenuItem(PossibleMethods)
|
||||
|
@@ -1491,7 +1491,7 @@ bool wxWidgetCocoaImpl::performKeyEquivalent(WX_NSEvent event, WXWidget slf, voi
|
||||
|
||||
// because performKeyEquivalent is going up the entire view hierarchy, we don't have to
|
||||
// walk up the ancestors ourselves but let cocoa do it
|
||||
|
||||
#if wxUSE_ACCEL
|
||||
int command = m_wxPeer->GetAcceleratorTable()->GetCommand( wxevent );
|
||||
if (command != -1)
|
||||
{
|
||||
@@ -1508,6 +1508,7 @@ bool wxWidgetCocoaImpl::performKeyEquivalent(WX_NSEvent event, WXWidget slf, voi
|
||||
handled = handler->ProcessEvent( command_event );
|
||||
}
|
||||
}
|
||||
#endif // wxUSE_ACCEL
|
||||
|
||||
if ( !handled )
|
||||
{
|
||||
|
@@ -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
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
Reference in New Issue
Block a user