Commit b1a19b12 authored by Maciej Suminski's avatar Maciej Suminski

Setting proper tool for submenus of CONTEXT_MENU class.

parent 3ef78c66
......@@ -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
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment