fixed wxFrame::SetClientSize() with toolbar bug

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@10384 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2001-05-30 21:05:23 +00:00
parent fdaf613add
commit 8d8bd2496e

View File

@@ -221,36 +221,37 @@ void wxFrame::DoSetClientSize(int width, int height)
{ {
HWND hWnd = GetHwnd(); HWND hWnd = GetHwnd();
RECT rect; RECT rectClient;
::GetClientRect(hWnd, &rect); ::GetClientRect(hWnd, &rectClient);
RECT rect2; RECT rectTotal;
GetWindowRect(hWnd, &rect2); ::GetWindowRect(hWnd, &rectTotal);
// Find the difference between the entire window (title bar and all) // Find the difference between the entire window (title bar and all)
// and the client area; add this to the new client size to move the // and the client area; add this to the new client size to move the
// window // window
int actual_width = rect2.right - rect2.left - rect.right + width; width += rectTotal.right - rectTotal.left - rectClient.right;
int actual_height = rect2.bottom - rect2.top - rect.bottom + height; height += rectTotal.bottom - rectTotal.top - rectClient.bottom;
#if wxUSE_STATUSBAR #if wxUSE_STATUSBAR
if ( GetStatusBar() && GetStatusBar()->IsShown()) wxStatusBar *statbar = GetStatusBar();
if ( statbar && statbar->IsShown() )
{ {
int statusX, statusY; // leave enough space for the status bar
GetStatusBar()->GetClientSize(&statusX, &statusY); height += statbar->GetSize().y;
actual_height += statusY;
} }
#endif // wxUSE_STATUSBAR #endif // wxUSE_STATUSBAR
wxPoint pt(GetClientAreaOrigin()); // note that this takes the toolbar into account
actual_width += pt.y; wxPoint pt = GetClientAreaOrigin();
actual_height += pt.x; width += pt.x;
height += pt.y;
POINT point; if ( !::MoveWindow(hWnd, rectTotal.left, rectTotal.top,
point.x = rect2.left; width, height, TRUE /* redraw */) )
point.y = rect2.top; {
wxLogLastError(_T("MoveWindow"));
MoveWindow(hWnd, point.x, point.y, actual_width, actual_height, (BOOL)TRUE); }
wxSizeEvent event(wxSize(width, height), m_windowId); wxSizeEvent event(wxSize(width, height), m_windowId);
event.SetEventObject(this); event.SetEventObject(this);