Fixed context submenus event handlers (GAL/Windows).
This commit is contained in:
@@ -114,8 +114,8 @@ CONTEXT_MENU& CONTEXT_MENU::operator=( const CONTEXT_MENU& aMenu )
|
||||
|
||||
void CONTEXT_MENU::setupEvents()
|
||||
{
|
||||
Connect( wxEVT_MENU_HIGHLIGHT, wxEventHandler( CONTEXT_MENU::onMenuEvent ), NULL, this );
|
||||
Connect( wxEVT_COMMAND_MENU_SELECTED, wxEventHandler( CONTEXT_MENU::onMenuEvent ), NULL, this );
|
||||
Connect( wxEVT_MENU_HIGHLIGHT, wxMenuEventHandler( CONTEXT_MENU::onMenuEvent ), NULL, this );
|
||||
Connect( wxEVT_COMMAND_MENU_SELECTED, wxMenuEventHandler( CONTEXT_MENU::onMenuEvent ), NULL, this );
|
||||
}
|
||||
|
||||
|
||||
@@ -194,7 +194,7 @@ void CONTEXT_MENU::Clear()
|
||||
}
|
||||
|
||||
|
||||
void CONTEXT_MENU::onMenuEvent( wxEvent& aEvent )
|
||||
void CONTEXT_MENU::onMenuEvent( wxMenuEvent& aEvent )
|
||||
{
|
||||
OPT_TOOL_EVENT evt;
|
||||
|
||||
@@ -219,7 +219,25 @@ void CONTEXT_MENU::onMenuEvent( wxEvent& aEvent )
|
||||
}
|
||||
else
|
||||
{
|
||||
// Under Linux, every submenu can have a separate event handler, under
|
||||
// Windows all submenus are handled by the main menu.
|
||||
#ifdef __WINDOWS__
|
||||
if( !evt ) {
|
||||
// Try to find the submenu which holds the selected item
|
||||
wxMenu*menu = NULL;
|
||||
FindItem( m_selected, &menu );
|
||||
|
||||
if( menu )
|
||||
{
|
||||
menu->ProcessEvent( aEvent );
|
||||
return;
|
||||
}
|
||||
|
||||
assert( false ); // The event should be handled above
|
||||
}
|
||||
#else
|
||||
evt = m_customHandler( aEvent );
|
||||
#endif /* else __WINDOWS__ */
|
||||
|
||||
// Handling non-action menu entries (e.g. items in clarification list)
|
||||
if( !evt )
|
||||
|
||||
Reference in New Issue
Block a user