]> git.saurik.com Git - wxWidgets.git/blobdiff - src/msw/dialog.cpp
added common notebookbase source file
[wxWidgets.git] / src / msw / dialog.cpp
index 4b4259a099378f54778b3151a96fe46e059d6b72..4de467688938ea84d59b2636fa2d9f1fb2c1a820 100644 (file)
@@ -192,6 +192,38 @@ bool wxDialog::Create(wxWindow *parent,
     return TRUE;
 }
 
+bool wxDialog::EnableCloseButton(bool enable)
+{
+#ifndef __WXMICROWIN__
+    // 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("EnableMenuItem(SC_CLOSE)"));
+
+        return FALSE;
+    }
+
+    // update appearance immediately
+    if ( !::DrawMenuBar(GetHwnd()) )
+    {
+        wxLogLastError(_T("DrawMenuBar"));
+    }
+#endif
+    
+    return TRUE;
+}
+
 void wxDialog::SetModal(bool flag)
 {
     if ( flag )
@@ -594,6 +626,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 +652,7 @@ long wxDialog::MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam)
                 rc = FALSE;
             }
             break;
+#endif
     }
 
     if ( !processed )