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:
@@ -219,42 +219,43 @@ void wxFrame::DoGetClientSize(int *x, int *y) const
|
|||||||
// to wxWindows)
|
// to wxWindows)
|
||||||
void wxFrame::DoSetClientSize(int width, int height)
|
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;
|
{
|
||||||
GetStatusBar()->GetClientSize(&statusX, &statusY);
|
// leave enough space for the status bar
|
||||||
actual_height += statusY;
|
height += statbar->GetSize().y;
|
||||||
}
|
}
|
||||||
#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);
|
||||||
|
event.SetEventObject(this);
|
||||||
wxSizeEvent event(wxSize(width, height), m_windowId);
|
GetEventHandler()->ProcessEvent(event);
|
||||||
event.SetEventObject( this );
|
|
||||||
GetEventHandler()->ProcessEvent(event);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxFrame::DoGetSize(int *width, int *height) const
|
void wxFrame::DoGetSize(int *width, int *height) const
|
||||||
|
Reference in New Issue
Block a user