DIALOG_SHIM::DIALOG_SHIM( wxWindow* aParent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style, const wxString& name ) : wxDialog( aParent, id, title, pos, size, style, name ), KIWAY_HOLDER( 0 ), m_qmodal_loop( 0 ), m_qmodal_showing( false ), m_qmodal_parent_disabler( 0 ) { // pray that aParent is either a KIWAY_PLAYER or DIALOG_SHIM derivation. KIWAY_HOLDER* h = dynamic_cast<KIWAY_HOLDER*>( aParent ); // wxASSERT_MSG( h, wxT( "DIALOG_SHIM's parent is NULL or not derived from KIWAY_PLAYER nor DIALOG_SHIM" ) ); if( h ) SetKiway( this, &h->Kiway() ); #ifdef __WINDOWS__ // On Windows, the app top windows can be brought to the foreground // (at least temporary) in certain circumstances, // for instance when calling an external tool in Eeschema boom generation. // So set the parent KIWAY_PLAYER kicad frame (if exists) to top window // to avoid this annoying behavior KIWAY_PLAYER* parent_kiwayplayer = dynamic_cast<KIWAY_PLAYER*>( aParent ); if( parent_kiwayplayer ) Pgm().App().SetTopWindow( parent_kiwayplayer ); #endif #if DLGSHIM_USE_SETFOCUS Connect( wxEVT_INIT_DIALOG, wxInitDialogEventHandler( DIALOG_SHIM::onInit ) ); #endif }
DIALOG_SHIM::DIALOG_SHIM( wxWindow* aParent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style, const wxString& name ) : wxDialog( aParent, id, title, pos, size, style, name ), KIWAY_HOLDER( 0 ), m_qmodal_loop( 0 ), m_qmodal_showing( false ), m_qmodal_parent_disabler( 0 ) { // pray that aParent is either a KIWAY_PLAYER or DIALOG_SHIM derivation. KIWAY_HOLDER* h = dynamic_cast<KIWAY_HOLDER*>( aParent ); // wxASSERT_MSG( h, wxT( "DIALOG_SHIM's parent is NULL or not derived from KIWAY_PLAYER nor DIALOG_SHIM" ) ); if( h ) SetKiway( this, &h->Kiway() ); #if DLGSHIM_USE_SETFOCUS Connect( wxEVT_INIT_DIALOG, wxInitDialogEventHandler( DIALOG_SHIM::onInit ) ); #endif }