add minimum window size

git-svn-id: https://svn.code.sf.net/p/vbam/code/trunk@265 a31d4220-a93d-0410-bf67-fe4944624d44
This commit is contained in:
spacy51 2008-01-06 13:50:09 +00:00
parent 4552ff988a
commit 0615013a73
1 changed files with 23 additions and 1 deletions

View File

@ -775,12 +775,34 @@ void MainWnd::OnMove(int x, int y)
}
void MainWnd::OnSizing(UINT fwSide, LPRECT pRect)
{
{ // the OnSizing event only occurs in windowed mode
CWnd::OnSizing(fwSide, pRect);
// pause sound to prevent low sound buffers
if( emulating ) {
soundPause();
}
// maintain minimal window size
RECT size = { 0, 0, theApp.sizeX, theApp.sizeY };
AdjustWindowRectEx(
&size,
WS_POPUP | WS_VISIBLE | WS_OVERLAPPEDWINDOW,
FALSE,
0 );
MENUBARINFO mbi;
mbi.cbSize = sizeof(MENUBARINFO);
this->GetMenuBarInfo( OBJID_MENU, 0, &mbi );
const LONG menuHeight = mbi.rcBar.bottom - mbi.rcBar.top + 1;
// +1 because of that white line, wherever it comes from
const LONG width = size.right - size.left;
const LONG height = size.bottom - size.top + menuHeight;
if( ( pRect->right - pRect->left ) < width ) {
pRect->right = pRect->left + width;
}
if( ( pRect->bottom - pRect->top ) < height ) {
pRect->bottom = pRect->top + height;
}
}
void MainWnd::OnSize(UINT nType, int cx, int cy)