add window-modal dialog calls and fallback implementation

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@60614 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Stefan Csomor
2009-05-13 07:01:51 +00:00
parent f62a3b6a53
commit 94b4dd5499
2 changed files with 72 additions and 2 deletions

View File

@@ -464,6 +464,40 @@ void wxDialogBase::OnButton(wxCommandEvent& event)
}
}
// ----------------------------------------------------------------------------
// compatibility methods for supporting the modality API
// ----------------------------------------------------------------------------
wxDEFINE_EVENT( wxEVT_WINDOW_MODAL_DIALOG_CLOSED , wxWindowModalDialogEvent );
bool wxDialogBase::ShowWindowModal ()
{
ShowModal();
SendWindowModalDialogEvent ( wxEVT_WINDOW_MODAL_DIALOG_CLOSED );
return true;
}
void wxDialogBase::SendWindowModalDialogEvent ( wxEventType type )
{
wxCommandEvent event ( type, GetId());
event.SetEventObject(this);
if ( !GetEventHandler()->ProcessEvent(event) )
{
// the event is not propagated upwards to the parent automatically
// because the dialog is a top level window, so do it manually as
// in 9 cases of 10 the message must be processed by the dialog
// owner and not the dialog itself
(void)GetParent()->GetEventHandler()->ProcessEvent(event);
}
}
wxDialogModality wxDialogBase::GetModality() const
{
return IsModal() ? wxDIALOG_MODALITY_APP_MODAL : wxDIALOG_MODALITY_NONE;
}
// ----------------------------------------------------------------------------
// other event handlers
// ----------------------------------------------------------------------------