+ break;
+
+ case WM_DESTROY:
+ // reuse the position used for the dialog the next time by default
+ //
+ // NB: at least under Windows 2003 this is useless as after the
+ // first time it's shown the dialog always remembers its size
+ // and position itself and ignores any later SetWindowPos calls
+ wxCopyRECTToRect(wxGetWindowRect(::GetParent(hDlg)), gs_rectDialog);
+ break;
+ }
+
+ // do the default processing
+ return 0;
+}
+
+// ----------------------------------------------------------------------------
+// wxFileDialog
+// ----------------------------------------------------------------------------
+
+wxFileDialog::wxFileDialog(wxWindow *parent,
+ const wxString& message,
+ const wxString& defaultDir,
+ const wxString& defaultFileName,
+ const wxString& wildCard,
+ long style,
+ const wxPoint& pos,
+ const wxSize& sz,
+ const wxString& name)
+ : wxFileDialogBase(parent, message, defaultDir, defaultFileName,
+ wildCard, style, pos, sz, name)
+
+{
+ // NB: all style checks are done by wxFileDialogBase::Create
+
+ m_bMovedWindow = false;
+ m_centreDir = 0;
+
+ // Must set to zero, otherwise the wx routines won't size the window
+ // the second time you call the file dialog, because it thinks it is
+ // already at the requested size.. (when centering)
+ gs_rectDialog.x =
+ gs_rectDialog.y = 0;
+}
+
+void wxFileDialog::GetPaths(wxArrayString& paths) const
+{
+ paths.Empty();
+
+ wxString dir(m_dir);
+ if ( m_dir.Last() != _T('\\') )
+ dir += _T('\\');
+
+ size_t count = m_fileNames.GetCount();
+ for ( size_t n = 0; n < count; n++ )
+ {
+ if (wxFileName(m_fileNames[n]).IsAbsolute())
+ paths.Add(m_fileNames[n]);
+ else
+ paths.Add(dir + m_fileNames[n]);
+ }
+}
+
+void wxFileDialog::GetFilenames(wxArrayString& files) const
+{
+ files = m_fileNames;
+}
+
+void wxFileDialog::SetPath(const wxString& path)
+{
+ wxString ext;
+ wxFileName::SplitPath(path, &m_dir, &m_fileName, &ext);
+ if ( !ext.empty() )
+ m_fileName << _T('.') << ext;
+}
+
+void wxFileDialog::DoGetPosition(int *x, int *y) const
+{
+ if ( x )
+ *x = gs_rectDialog.x;
+ if ( y )
+ *y = gs_rectDialog.y;
+}
+
+void wxFileDialog::DoGetSize(int *width, int *height) const
+{
+ if ( width )
+ *width = gs_rectDialog.width;
+ if ( height )
+ *height = gs_rectDialog.height;
+}
+
+void wxFileDialog::DoMoveWindow(int x, int y, int WXUNUSED(w), int WXUNUSED(h))
+{
+ gs_rectDialog.x = x;
+ gs_rectDialog.y = y;
+
+ // our HWND is only set when we're called from MSWOnInitDone(), test if
+ // this is the case
+ HWND hwnd = GetHwnd();
+ if ( hwnd )
+ {
+ // size of the dialog can't be changed because the controls are not
+ // laid out correctly then
+ ::SetWindowPos(hwnd, HWND_TOP, x, y, 0, 0, SWP_NOZORDER | SWP_NOSIZE);
+ }
+ else // just remember that we were requested to move the window
+ {
+ m_bMovedWindow = true;