Commit 96302926 authored by jean-pierre charras's avatar jean-pierre charras

Fix an annoying behavior of new quasi modal frames on Windows (when closing...

Fix an annoying behavior of new quasi modal frames  on Windows (when closing them, the caller frame was no more on top )
parent ecbe6e08
......@@ -45,7 +45,7 @@ KIWAY_PLAYER::KIWAY_PLAYER( KIWAY* aKiway, wxWindow* aParent, FRAME_T aFrameType
EDA_BASE_FRAME( aParent, aFrameType, aTitle, aPos, aSize, aStyle, aWdoName ),
KIWAY_HOLDER( aKiway ),
m_modal( false ),
m_modal_loop( 0 )
m_modal_loop( 0 ), m_modal_resultant_parent( 0 )
{
// DBG( printf("KIWAY_EXPRESS::wxEVENT_ID:%d\n", KIWAY_EXPRESS::wxEVENT_ID );)
}
......@@ -57,7 +57,7 @@ KIWAY_PLAYER::KIWAY_PLAYER( wxWindow* aParent, wxWindowID aId, const wxString& a
EDA_BASE_FRAME( aParent, (FRAME_T) aId, aTitle, aPos, aSize, aStyle, aWdoName ),
KIWAY_HOLDER( 0 ),
m_modal( false ),
m_modal_loop( 0 )
m_modal_loop( 0 ), m_modal_resultant_parent( 0 )
{
// DBG( printf("KIWAY_EXPRESS::wxEVENT_ID:%d\n", KIWAY_EXPRESS::wxEVENT_ID );)
}
......@@ -95,6 +95,7 @@ bool KIWAY_PLAYER::ShowModal( wxString* aResult, wxWindow* aResultantFocusWindow
} clear_this( (void*&) m_modal_loop );
m_modal_resultant_parent = aResultantFocusWindow;
Show( true );
SetFocus();
......@@ -138,6 +139,16 @@ bool KIWAY_PLAYER::ShowModal( wxString* aResult, wxWindow* aResultantFocusWindow
return m_modal_ret_val;
}
bool KIWAY_PLAYER::Destroy()
{
// Needed on Windows to leave the modal parent on top with focus
#ifdef __WINDOWS__
if( m_modal_resultant_parent && GetParent() != m_modal_resultant_parent )
Reparent( m_modal_resultant_parent );
#endif
return EDA_BASE_FRAME::Destroy();
}
bool KIWAY_PLAYER::IsDismissed()
{
......
......@@ -202,6 +202,11 @@ public:
*/
virtual void KiwayMailIn( KIWAY_EXPRESS& aEvent );
/**
* Our version of Destroy() which is virtual from wxWidgets
*/
bool Destroy();
protected:
bool IsModal() { return m_modal; }
......@@ -229,6 +234,7 @@ protected:
// variables for modal behavior support, only used by a few derivatives.
bool m_modal; // true if frame is intended to be modal, not modeless
WX_EVENT_LOOP* m_modal_loop; // points to nested event_loop, NULL means not modal and dismissed
wxWindow* m_modal_resultant_parent; // the window caller in modal mode
wxString m_modal_string;
bool m_modal_ret_val; // true if a selection was made
......
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