Setting proper tool for submenus of CONTEXT_MENU class.
This commit is contained in:
parent
3b54bb1614
commit
bc766093a3
|
@ -193,6 +193,23 @@ void CONTEXT_MENU::onMenuEvent( wxEvent& aEvent )
|
|||
}
|
||||
|
||||
|
||||
void CONTEXT_MENU::setTool( TOOL_INTERACTIVE* aTool )
|
||||
{
|
||||
m_tool = aTool;
|
||||
|
||||
for( unsigned i = 0; i < GetMenuItemCount(); ++i )
|
||||
{
|
||||
wxMenuItem* item = FindItemByPosition( i );
|
||||
|
||||
if( item->IsSubMenu() )
|
||||
{
|
||||
CONTEXT_MENU* menu = static_cast<CONTEXT_MENU*>( item->GetSubMenu() );
|
||||
menu->setTool( aTool );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void CONTEXT_MENU::copyItem( const wxMenuItem* aSource, wxMenuItem* aDest ) const
|
||||
{
|
||||
assert( !aSource->IsSubMenu() ); // it does not transfer submenus
|
||||
|
|
|
@ -115,17 +115,12 @@ private:
|
|||
///> Event handler.
|
||||
void onMenuEvent( wxEvent& aEvent );
|
||||
|
||||
friend class TOOL_INTERACTIVE;
|
||||
|
||||
/**
|
||||
* Function setTool()
|
||||
* Sets a tool that is the creator of the menu.
|
||||
* @param aTool is the tool that created the menu.
|
||||
*/
|
||||
void setTool( TOOL_INTERACTIVE* aTool )
|
||||
{
|
||||
m_tool = aTool;
|
||||
}
|
||||
void setTool( TOOL_INTERACTIVE* aTool );
|
||||
|
||||
///> Flag indicating that the menu title was set up.
|
||||
bool m_titleSet;
|
||||
|
@ -147,6 +142,8 @@ private:
|
|||
|
||||
/// Custom events handler, allows to translate wxEvents to TOOL_EVENTs.
|
||||
boost::function<OPT_TOOL_EVENT(const wxEvent& aEvent)> m_customHandler;
|
||||
|
||||
friend class TOOL_INTERACTIVE;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue