Loading common/tool/context_menu.cpp +17 −0 Original line number Diff line number Diff line Loading @@ -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 Loading include/tool/context_menu.h +3 −6 Original line number Diff line number Diff line Loading @@ -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; Loading @@ -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
common/tool/context_menu.cpp +17 −0 Original line number Diff line number Diff line Loading @@ -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 Loading
include/tool/context_menu.h +3 −6 Original line number Diff line number Diff line Loading @@ -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; Loading @@ -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