X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/567da5c600dc5bc6f3e5df18129f7125b433d83f..4d94751752c081c289a1d8f159405487dbbe4e68:/src/msw/dialog.cpp diff --git a/src/msw/dialog.cpp b/src/msw/dialog.cpp index 83d0548920..8f5afe79e7 100644 --- a/src/msw/dialog.cpp +++ b/src/msw/dialog.cpp @@ -30,7 +30,7 @@ #include "wx/msw/private.h" -#if USE_COMMON_DIALOGS +#if wxUSE_COMMON_DIALOGS #include #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 }