]> git.saurik.com Git - wxWidgets.git/blobdiff - src/msw/dialog.cpp
sorry... forgot to commit these 2 files
[wxWidgets.git] / src / msw / dialog.cpp
index 83d0548920eb799beab3764022dffbe99a8c031e..8f5afe79e7df0e52e4e71b00f25ec5796d54eb1f 100644 (file)
@@ -30,7 +30,7 @@
 
 #include "wx/msw/private.h"
 
-#if USE_COMMON_DIALOGS
+#if wxUSE_COMMON_DIALOGS
 #include <commdlg.h>
 #endif
 
@@ -78,7 +78,6 @@ wxDialog::wxDialog(void)
   m_modalShowing = FALSE;
 
   SetBackgroundColour(wxSystemSettings::GetSystemColour(wxSYS_COLOUR_3DFACE));
-  SetDefaultBackgroundColour(wxSystemSettings::GetSystemColour(wxSYS_COLOUR_3DFACE));
 }
 
 bool wxDialog::Create(wxWindow *parent, wxWindowID id,
@@ -89,7 +88,6 @@ bool wxDialog::Create(wxWindow *parent, wxWindowID id,
            const wxString& name)
 {
   SetBackgroundColour(wxSystemSettings::GetSystemColour(wxSYS_COLOUR_3DFACE));
-  SetDefaultBackgroundColour(wxSystemSettings::GetSystemColour(wxSYS_COLOUR_3DFACE));
   SetName(name);
   
   if (!parent)
@@ -464,27 +462,19 @@ void wxDialog::Centre(int direction)
   int x_offset,y_offset ;
   int display_width, display_height;
   int  width, height, x, y;
-  wxFrame *frame ;
-  if (direction & wxCENTER_FRAME)
+  wxWindow *parent = GetParent();
+  if ((direction & wxCENTER_FRAME) && parent)
   {
-    frame = (wxFrame*)GetParent() ;
-    if (frame)
-    {
-      frame->GetPosition(&x_offset,&y_offset) ;
-      frame->GetSize(&display_width,&display_height) ;
-    }
+      parent->GetPosition(&x_offset,&y_offset) ;
+      parent->GetSize(&display_width,&display_height) ;
   }
   else
-    frame = NULL ;
-
-  if (frame==NULL)
   {
     wxDisplaySize(&display_width, &display_height);
     x_offset = 0 ;
     y_offset = 0 ;
   }
 
-
   GetSize(&width, &height);
   GetPosition(&x, &y);
 
@@ -531,8 +521,8 @@ void wxDialog::OnOK(wxCommandEvent& event)
             EndModal(wxID_OK);
         else
         {
-        SetReturnCode(wxID_OK);
-        this->Show(FALSE);
+            SetReturnCode(wxID_OK);
+            this->Show(FALSE);
         }
   }
 }
@@ -557,7 +547,7 @@ void wxDialog::OnCancel(wxCommandEvent& event)
 
 bool wxDialog::OnClose(void)
 {
-  // Behaviour changed in 2.0: we'll send a Cancel message by default,
+    // Behaviour changed in 2.0: we'll send a Cancel message by default,
     // which may close the dialog.
     // Check for looping if the Cancel event handler calls Close()
 
@@ -568,13 +558,13 @@ bool wxDialog::OnClose(void)
 
     closing.Append(this);
 
-  wxCommandEvent cancelEvent(wxEVT_COMMAND_BUTTON_CLICKED, wxID_CANCEL);
-  cancelEvent.SetEventObject( this );
-  GetEventHandler()->ProcessEvent(cancelEvent);
+    wxCommandEvent cancelEvent(wxEVT_COMMAND_BUTTON_CLICKED, wxID_CANCEL);
+    cancelEvent.SetEventObject( this );
+    GetEventHandler()->ProcessEvent(cancelEvent);
 
     closing.DeleteObject(this);
 
-  return FALSE;
+    return FALSE;
 }
 
 void wxDialog::OnCloseWindow(wxCloseEvent& event)
@@ -584,6 +574,8 @@ void wxDialog::OnCloseWindow(wxCloseEvent& event)
     {
         this->Destroy();
     }
+    else
+        event.Veto(TRUE);
 }
 
 // Destroy the window (delayed, if a managed window)
@@ -600,7 +592,6 @@ void wxDialog::OnSysColourChanged(wxSysColourChangedEvent& event)
   Ctl3dColorChange();
 #else
   SetBackgroundColour(wxSystemSettings::GetSystemColour(wxSYS_COLOUR_3DFACE));
-  SetDefaultBackgroundColour(wxSystemSettings::GetSystemColour(wxSYS_COLOUR_3DFACE));
   Refresh();
 #endif
 }