Document board change event listener code.

This commit is contained in:
Wayne Stambaugh 2023-03-13 13:59:01 -04:00
parent 66f6168163
commit 664e5629f2
2 changed files with 14 additions and 0 deletions

View File

@ -382,8 +382,20 @@ public:
virtual void ActivateGalCanvas() override; virtual void ActivateGalCanvas() override;
/**
* Add \a aListener to post #EDA_EVT_BOARD_CHANGED command events to.
*
* @warning The caller is reponsible for removing any listeners that are no long valid.
*
* @note This only gets called when the board editor is in stand alone mode. Changing
* projects in the project manager closes the board editor when a new project is
* loaded.
*/
void AddBoardChangeListener( wxEvtHandler* aListener ); void AddBoardChangeListener( wxEvtHandler* aListener );
/**
* Remove \a aListener to from the board changed listener list.
*/
void RemoveBoardChangeListener( wxEvtHandler* aListener ); void RemoveBoardChangeListener( wxEvtHandler* aListener );
protected: protected:

View File

@ -234,6 +234,8 @@ void PCB_BASE_FRAME::SetBoard( BOARD* aBoard, PROGRESS_REPORTER* aReporter )
{ {
wxCHECK2( listener, continue ); wxCHECK2( listener, continue );
// Use the windows variant when handling event messages in case there is any special
// event handler pre and/or post processing specific to windows.
wxWindow* win = dynamic_cast<wxWindow*>( listener ); wxWindow* win = dynamic_cast<wxWindow*>( listener );
if( win ) if( win )