no real changes, just (unsuccessful) attempts to make the dialog resizing work

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@38871 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2006-04-21 13:09:19 +00:00
parent 9577d302a7
commit cb80db46e5

View File

@@ -84,35 +84,34 @@ wxFileDialogHookFunction(HWND hDlg,
WPARAM WXUNUSED(wParam), WPARAM WXUNUSED(wParam),
LPARAM lParam) LPARAM lParam)
{ {
HWND hwndDialog; switch ( iMsg )
hwndDialog = ::GetParent( hDlg );
switch (iMsg)
{ {
case WM_DESTROY: case WM_NOTIFY:
{ {
RECT dlgRect; OFNOTIFY *pNotifyCode = wx_reinterpret_cast(OFNOTIFY *, lParam);
GetWindowRect( hwndDialog, & dlgRect ); if ( pNotifyCode->hdr.code == CDN_INITDONE )
gs_rectDialog.x = dlgRect.left; {
gs_rectDialog.y = dlgRect.top; // note that we need to move the parent window: hDlg is a
gs_rectDialog.width = dlgRect.right - dlgRect.left; // child of it when OFN_EXPLORER is used
gs_rectDialog.height = dlgRect.bottom - dlgRect.top; ::SetWindowPos
(
::GetParent(hDlg),
HWND_TOP,
gs_rectDialog.x, gs_rectDialog.y,
0, 0,
SWP_NOZORDER | SWP_NOSIZE
);
}
} }
break; break;
case WM_NOTIFY: case WM_DESTROY:
{ // reuse the position used for the dialog the next time by default
OFNOTIFY * pNotifyCode; //
pNotifyCode = (LPOFNOTIFY) lParam; // NB: at least under Windows 2003 this is useless as after the
if (CDN_INITDONE == (pNotifyCode->hdr).code) // first time it's shown the dialog always remembers its size
{ // and position itself and ignores any later SetWindowPos calls
SetWindowPos( hwndDialog, HWND_TOP, wxCopyRECTToRect(wxGetWindowRect(::GetParent(hDlg)), gs_rectDialog);
gs_rectDialog.x,
gs_rectDialog.y,
gs_rectDialog.width,
gs_rectDialog.height,
SWP_NOZORDER|SWP_NOSIZE);
}
}
break; break;
} }
@@ -178,32 +177,32 @@ void wxFileDialog::SetPath(const wxString& path)
m_fileName << _T('.') << ext; m_fileName << _T('.') << ext;
} }
void wxFileDialog::DoGetPosition( int *x, int *y ) const void wxFileDialog::DoGetPosition(int *x, int *y) const
{ {
*x = gs_rectDialog.x; if ( x )
*y = gs_rectDialog.y; *x = gs_rectDialog.x;
if ( y )
*y = gs_rectDialog.y;
} }
void wxFileDialog::DoGetSize(int *width, int *height) const void wxFileDialog::DoGetSize(int *width, int *height) const
{ {
*width = gs_rectDialog.width; if ( width )
*height = gs_rectDialog.height; *width = gs_rectDialog.width;
if ( height )
*height = gs_rectDialog.height;
} }
void wxFileDialog::DoMoveWindow(int x, int y, int WXUNUSED(width), int WXUNUSED(height)) void wxFileDialog::DoMoveWindow(int x, int y, int WXUNUSED(w), int WXUNUSED(h))
{ {
m_bMovedWindow = true; m_bMovedWindow = true;
gs_rectDialog.x = x; gs_rectDialog.x = x;
gs_rectDialog.y = y; gs_rectDialog.y = y;
/* // size of the dialog can't be changed because the controls are not laid
The width and height can not be set by the programmer // out correctly then
its just not possible. But the program can get the
size of the Dlg after it has been shown, in case they need
that data.
*/
} }
// helper used below in ShowModal(): style is used to determine whether to show // helper used below in ShowModal(): style is used to determine whether to show