#include "wx/msw/private.h"
-#if USE_COMMON_DIALOGS
+#if wxUSE_COMMON_DIALOGS
#include <commdlg.h>
#endif
m_modalShowing = FALSE;
SetBackgroundColour(wxSystemSettings::GetSystemColour(wxSYS_COLOUR_3DFACE));
- SetDefaultBackgroundColour(wxSystemSettings::GetSystemColour(wxSYS_COLOUR_3DFACE));
}
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)
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);
EndModal(wxID_OK);
else
{
- SetReturnCode(wxID_OK);
- this->Show(FALSE);
+ SetReturnCode(wxID_OK);
+ this->Show(FALSE);
}
}
}
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()
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)
{
this->Destroy();
}
+ else
+ event.Veto(TRUE);
}
// Destroy the window (delayed, if a managed window)
Ctl3dColorChange();
#else
SetBackgroundColour(wxSystemSettings::GetSystemColour(wxSYS_COLOUR_3DFACE));
- SetDefaultBackgroundColour(wxSystemSettings::GetSystemColour(wxSYS_COLOUR_3DFACE));
Refresh();
#endif
}