X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/33ac7e6f01acbac1cff0ad400d8ea7f0bfd0a62f..6dab3ba7e5201f506a841cf1442ddf0ef00b1160:/src/msw/dialog.cpp diff --git a/src/msw/dialog.cpp b/src/msw/dialog.cpp index 4b4259a099..5b2aaf7a99 100644 --- a/src/msw/dialog.cpp +++ b/src/msw/dialog.cpp @@ -192,6 +192,36 @@ bool wxDialog::Create(wxWindow *parent, return TRUE; } +bool wxDialog::EnableCloseButton(bool enable) +{ + // get system (a.k.a. window) menu + HMENU hmenu = ::GetSystemMenu(GetHwnd(), FALSE /* get it */); + if ( !hmenu ) + { + wxLogLastError(_T("GetSystemMenu")); + + return FALSE; + } + + // enabling/disabling the close item from it also automatically + // disables/enabling the close title bar button + if ( !::EnableMenuItem(hmenu, SC_CLOSE, + MF_BYCOMMAND | (enable ? MF_ENABLED : MF_GRAYED)) ) + { + wxLogLastError(_T("DeleteMenu(SC_CLOSE)")); + + return FALSE; + } + + // update appearance immediately + if ( !::DrawMenuBar(GetHwnd()) ) + { + wxLogLastError(_T("DrawMenuBar")); + } + + return TRUE; +} + void wxDialog::SetModal(bool flag) { if ( flag ) @@ -594,6 +624,7 @@ long wxDialog::MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam) processed = !Close(); break; +#ifndef __WXMICROWIN__ case WM_SETCURSOR: // we want to override the busy cursor for modal dialogs: // typically, wxBeginBusyCursor() is called and then a modal dialog @@ -619,6 +650,7 @@ long wxDialog::MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam) rc = FALSE; } break; +#endif } if ( !processed )