Fix compilation with wxUSE_ACCEL==0
This commit is contained in:
@@ -25,7 +25,9 @@
|
|||||||
// forward declarations
|
// forward declarations
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
#if wxUSE_ACCEL
|
||||||
class WXDLLIMPEXP_FWD_CORE wxAcceleratorEntry;
|
class WXDLLIMPEXP_FWD_CORE wxAcceleratorEntry;
|
||||||
|
#endif // wxUSE_ACCEL
|
||||||
class WXDLLIMPEXP_FWD_CORE wxMenuItem;
|
class WXDLLIMPEXP_FWD_CORE wxMenuItem;
|
||||||
class WXDLLIMPEXP_FWD_CORE wxMenu;
|
class WXDLLIMPEXP_FWD_CORE wxMenu;
|
||||||
|
|
||||||
|
@@ -125,6 +125,8 @@ class wxComboBox;
|
|||||||
class wxNotebook;
|
class wxNotebook;
|
||||||
class wxTextCtrl;
|
class wxTextCtrl;
|
||||||
class wxSearchCtrl;
|
class wxSearchCtrl;
|
||||||
|
class wxMenuItem;
|
||||||
|
class wxAcceleratorEntry;
|
||||||
|
|
||||||
WXDLLIMPEXP_CORE wxWindowMac * wxFindWindowFromWXWidget(WXWidget inControl );
|
WXDLLIMPEXP_CORE wxWindowMac * wxFindWindowFromWXWidget(WXWidget inControl );
|
||||||
|
|
||||||
|
@@ -131,7 +131,8 @@ void wxMacCocoaMenuItemSetAccelerator( NSMenuItem* menuItem, wxAcceleratorEntry*
|
|||||||
[menuItem setKeyEquivalent:@""];
|
[menuItem setKeyEquivalent:@""];
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if wxUSE_ACCEL
|
||||||
unsigned int modifiers = 0 ;
|
unsigned int modifiers = 0 ;
|
||||||
int key = entry->GetKeyCode() ;
|
int key = entry->GetKeyCode() ;
|
||||||
if ( key )
|
if ( key )
|
||||||
@@ -227,6 +228,7 @@ void wxMacCocoaMenuItemSetAccelerator( NSMenuItem* menuItem, wxAcceleratorEntry*
|
|||||||
[menuItem setKeyEquivalent:[NSString stringWithCharacters:&shortcut length:1]];
|
[menuItem setKeyEquivalent:[NSString stringWithCharacters:&shortcut length:1]];
|
||||||
[menuItem setKeyEquivalentModifierMask:modifiers];
|
[menuItem setKeyEquivalentModifierMask:modifiers];
|
||||||
}
|
}
|
||||||
|
#endif // wxUSE_ACCEL
|
||||||
}
|
}
|
||||||
|
|
||||||
@interface NSMenuItem(PossibleMethods)
|
@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
|
// because performKeyEquivalent is going up the entire view hierarchy, we don't have to
|
||||||
// walk up the ancestors ourselves but let cocoa do it
|
// walk up the ancestors ourselves but let cocoa do it
|
||||||
|
#if wxUSE_ACCEL
|
||||||
int command = m_wxPeer->GetAcceleratorTable()->GetCommand( wxevent );
|
int command = m_wxPeer->GetAcceleratorTable()->GetCommand( wxevent );
|
||||||
if (command != -1)
|
if (command != -1)
|
||||||
{
|
{
|
||||||
@@ -1508,7 +1508,8 @@ bool wxWidgetCocoaImpl::performKeyEquivalent(WX_NSEvent event, WXWidget slf, voi
|
|||||||
handled = handler->ProcessEvent( command_event );
|
handled = handler->ProcessEvent( command_event );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif // wxUSE_ACCEL
|
||||||
|
|
||||||
if ( !handled )
|
if ( !handled )
|
||||||
{
|
{
|
||||||
wxOSX_PerformKeyEventHandlerPtr superimpl = (wxOSX_PerformKeyEventHandlerPtr) [[slf superclass] instanceMethodForSelector:(SEL)_cmd];
|
wxOSX_PerformKeyEventHandlerPtr superimpl = (wxOSX_PerformKeyEventHandlerPtr) [[slf superclass] instanceMethodForSelector:(SEL)_cmd];
|
||||||
|
@@ -51,10 +51,14 @@ wxMenuItem::wxMenuItem(wxMenu *pParentMenu,
|
|||||||
text = wxGetStockLabel(GetId(), wxSTOCK_WITH_ACCELERATOR|wxSTOCK_WITH_MNEMONIC);
|
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
|
// 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 );
|
m_peer = wxMenuItemImpl::Create( this, pParentMenu, GetId(), text, entry, strHelp, GetKind(), pSubMenu );
|
||||||
delete entry;
|
delete entry;
|
||||||
|
#else
|
||||||
|
m_peer = wxMenuItemImpl::Create( this, pParentMenu, GetId(), text, NULL, strHelp, GetKind(), pSubMenu );
|
||||||
|
#endif // wxUSE_ACCEL/!wxUSE_ACCEL
|
||||||
}
|
}
|
||||||
|
|
||||||
wxMenuItem::~wxMenuItem()
|
wxMenuItem::~wxMenuItem()
|
||||||
@@ -194,9 +198,13 @@ void wxMenuItem::UpdateItemText()
|
|||||||
text = wxGetStockLabel(GetId(), wxSTOCK_WITH_ACCELERATOR|wxSTOCK_WITH_MNEMONIC);
|
text = wxGetStockLabel(GetId(), wxSTOCK_WITH_ACCELERATOR|wxSTOCK_WITH_MNEMONIC);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if wxUSE_ACCEL
|
||||||
wxAcceleratorEntry *entry = wxAcceleratorEntry::Create( m_text ) ;
|
wxAcceleratorEntry *entry = wxAcceleratorEntry::Create( m_text ) ;
|
||||||
GetPeer()->SetLabel( text, entry );
|
GetPeer()->SetLabel( text, entry );
|
||||||
delete entry ;
|
delete entry ;
|
||||||
|
#else
|
||||||
|
GetPeer()->SetLabel( text, NULL );
|
||||||
|
#endif // wxUSE_ACCEL/!wxUSE_ACCEL
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
Reference in New Issue
Block a user