X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/a35faffd59d9228b0ba125f5cec53bdc029ec642..55c56a6d80f0ee4a4bf2add6ba1f62c02cbfc23e:/src/msw/dialog.cpp diff --git a/src/msw/dialog.cpp b/src/msw/dialog.cpp index d8ef9f1f46..874fecd083 100644 --- a/src/msw/dialog.cpp +++ b/src/msw/dialog.cpp @@ -46,19 +46,17 @@ wxWindowList wxModalDialogs; wxWindowList wxModelessWindows; // Frames and modeless dialogs extern wxList WXDLLEXPORT wxPendingDelete; -#if !USE_SHARED_LIBRARY - IMPLEMENT_DYNAMIC_CLASS(wxDialog, wxPanel) - - BEGIN_EVENT_TABLE(wxDialog, wxPanel) - EVT_SIZE(wxDialog::OnSize) - EVT_BUTTON(wxID_OK, wxDialog::OnOK) - EVT_BUTTON(wxID_APPLY, wxDialog::OnApply) - EVT_BUTTON(wxID_CANCEL, wxDialog::OnCancel) - EVT_CHAR_HOOK(wxDialog::OnCharHook) - EVT_SYS_COLOUR_CHANGED(wxDialog::OnSysColourChanged) - EVT_CLOSE(wxDialog::OnCloseWindow) - END_EVENT_TABLE() -#endif +IMPLEMENT_DYNAMIC_CLASS(wxDialog, wxPanel) + +BEGIN_EVENT_TABLE(wxDialog, wxPanel) + EVT_SIZE(wxDialog::OnSize) + EVT_BUTTON(wxID_OK, wxDialog::OnOK) + EVT_BUTTON(wxID_APPLY, wxDialog::OnApply) + EVT_BUTTON(wxID_CANCEL, wxDialog::OnCancel) + EVT_CHAR_HOOK(wxDialog::OnCharHook) + EVT_SYS_COLOUR_CHANGED(wxDialog::OnSysColourChanged) + EVT_CLOSE(wxDialog::OnCloseWindow) +END_EVENT_TABLE() wxDialog::wxDialog() { @@ -124,11 +122,11 @@ bool wxDialog::Create(wxWindow *parent, wxWindowID id, // otherwise it would look too strange) const wxChar *dlg; if ( style & wxRESIZE_BORDER ) - dlg = _T("wxResizeableDialog"); + dlg = wxT("wxResizeableDialog"); else if ( style & wxCAPTION ) - dlg = _T("wxCaptionDialog"); + dlg = wxT("wxCaptionDialog"); else - dlg = _T("wxNoCaptionDialog"); + dlg = wxT("wxNoCaptionDialog"); MSWCreate(m_windowId, parent, NULL, this, NULL, x, y, width, height, 0, // style is not used if we have dlg template @@ -173,6 +171,9 @@ wxDialog::~wxDialog() Show(FALSE); + // VZ: this is bogus and breaks focus handling - it won't be returned to the + // window which had it previosuly if we do this +#if 0 if (m_modalShowing) { // For some reason, wxWindows can activate another task altogether @@ -184,6 +185,7 @@ wxDialog::~wxDialog() if (GetParent() && GetParent()->GetHWND()) ::BringWindowToTop((HWND) GetParent()->GetHWND()); } +#endif // 0 m_modalShowing = FALSE; @@ -215,6 +217,9 @@ void wxDialog::OnCharHook(wxKeyEvent& event) cancelEvent.SetEventObject( this ); GetEventHandler()->ProcessEvent(cancelEvent); + // ensure that there is another message for this window so the + // ShowModal loop will exit and won't get stuck in GetMessage(). + ::PostMessage(GetHwnd(), WM_NULL, 0, 0); return; } } @@ -474,7 +479,9 @@ bool wxDialog::Show(bool show) if (hWndParent) ::BringWindowToTop(hWndParent); } - ShowWindow((HWND) GetHWND(), SW_HIDE); + + if ( m_hWnd ) + ShowWindow((HWND) GetHWND(), SW_HIDE); } } return TRUE;