Move PostCommandMenuEvent to EDA_BASE_FRAME

There is nothing PCB-frame-specific about this function,
it is equally applicable to an frame, for example
PCB_EDIT_FRAME and CVPCB_MAINFRAME, which have EDA_BASE_FRAME
as the nearest common ancestor, except KIWAY_PLAYER,
which is not really concerned with this kind of UI event method.
This commit is contained in:
John Beard 2017-01-17 13:57:53 +08:00 committed by Maciej Suminski
parent 59346a6ef1
commit 7863e70181
4 changed files with 24 additions and 17 deletions

View File

@ -631,3 +631,18 @@ void EDA_BASE_FRAME::CheckForAutoSaveFile( const wxFileName& aFileName,
wxRemoveFile( autoSaveFileName.GetFullPath() ); wxRemoveFile( autoSaveFileName.GetFullPath() );
} }
} }
bool EDA_BASE_FRAME::PostCommandMenuEvent( int evt_type )
{
if( evt_type != 0 )
{
wxCommandEvent evt( wxEVT_COMMAND_MENU_SELECTED );
evt.SetEventObject( this );
evt.SetId( evt_type );
wxPostEvent( this, evt );
return true;
}
return false;
}

View File

@ -406,6 +406,15 @@ public:
* redraws the menus and what not in current language. * redraws the menus and what not in current language.
*/ */
virtual void ShowChangedLanguage(); virtual void ShowChangedLanguage();
/**
* Function PostCommandMenuEvent
*
* Post a menu event to the frame, which can be used to trigger actions
* bound to menu items.
*/
bool PostCommandMenuEvent( int evt_type );
}; };

View File

@ -39,21 +39,6 @@ void PCB_BASE_EDIT_FRAME::SetRotationAngle( int aRotationAngle )
} }
bool PCB_BASE_EDIT_FRAME::PostCommandMenuEvent( int evt_type )
{
if( evt_type != 0 )
{
wxCommandEvent evt( wxEVT_COMMAND_MENU_SELECTED );
evt.SetEventObject( this );
evt.SetId( evt_type );
wxPostEvent( this, evt );
return true;
}
return false;
}
void PCB_BASE_EDIT_FRAME::UseGalCanvas( bool aEnable ) void PCB_BASE_EDIT_FRAME::UseGalCanvas( bool aEnable )
{ {
PCB_BASE_FRAME::UseGalCanvas( aEnable ); PCB_BASE_FRAME::UseGalCanvas( aEnable );

View File

@ -156,8 +156,6 @@ public:
*/ */
void SetRotationAngle( int aRotationAngle ); void SetRotationAngle( int aRotationAngle );
bool PostCommandMenuEvent( int evt_type );
///> @copydoc EDA_DRAW_FRAME::UseGalCanvas() ///> @copydoc EDA_DRAW_FRAME::UseGalCanvas()
void UseGalCanvas( bool aEnable ) override; void UseGalCanvas( bool aEnable ) override;