RollupWnd1.cpp
// calculate the rectangular area of the caption at the offset

calculate the rectangular area of the caption at the offset
calculate the rectangular area of the caption at the offset
CRect CRollupWnd::CalculateCloseupButtonRect ()
{
	CRect rectWindow;
	CSize szFrameSize = GetFrameSize ();
	CSize szCaptionSize = GetCaptionSize ();
	GetWindowRect (&rectWindow);
	CRect rectCaption;
	rectCaption.left = rectWindow.right - (szCaptionSize.cx * 2 + szFrameSize.cx);
	rectCaption.top = rectWindow.top + szFrameSize.cy;
	rectCaption.right = rectCaption.left + szCaptionSize.cx;
	rectCaption.bottom = rectCaption.top + szCaptionSize.cy;
	CRect rectMenu;
	CMenu* pmnuWindow = GetMenu ();
	if (pmnuWindow != NULL)
	{
		GetMenuItemRect (GetSafeHwnd (), pmnuWindow->GetSafeHmenu (), 0, &rectMenu);
		if(rectMenu.bottom != 0)	
		{
			rectCaption.bottom = rectMenu.top - 1;
			rectCaption.top = rectCaption.bottom - szCaptionSize.cy;
		}
	}
	bool bToClient = true;
	if (bToClient)
	{
		CPoint ptTopLeft = rectCaption.TopLeft ();
		CPoint ptBottomRight = rectCaption.BottomRight ();
		ScreenToClient (&ptTopLeft);
		ScreenToClient (&ptBottomRight);
		rectCaption.left = ptTopLeft.x;
		rectCaption.top = ptTopLeft.y;
		rectCaption.right = ptBottomRight.x;
		rectCaption.bottom = ptBottomRight.y;
	}
	return rectCaption;
}
CRect CRollupWnd :: CalculateCloseupButtonRect ( ) { CRect rectWindow ; CSize szFrameSize = GetFrameSize ( ) ; CSize szCaptionSize = GetCaptionSize ( ) ; GetWindowRect ( & rectWindow ) ; CRect rectCaption ; rectCaption . left = rectWindow . right - ( szCaptionSize . cx * 2 + szFrameSize . cx ) ; rectCaption . top = rectWindow . top + szFrameSize . cy ; rectCaption . right = rectCaption . left + szCaptionSize . cx ; rectCaption . bottom = rectCaption . top + szCaptionSize . cy ; CRect rectMenu ; CMenu * pmnuWindow = GetMenu ( ) ; if ( pmnuWindow != NULL ) { GetMenuItemRect ( GetSafeHwnd ( ) , pmnuWindow -> GetSafeHmenu ( ) , 0 , & rectMenu ) ; if ( rectMenu . bottom != 0 ) { rectCaption . bottom = rectMenu . top - 1 ; rectCaption . top = rectCaption . bottom - szCaptionSize . cy ; } } bool bToClient = true ; if ( bToClient ) { CPoint ptTopLeft = rectCaption . TopLeft ( ) ; CPoint ptBottomRight = rectCaption . BottomRight ( ) ; ScreenToClient ( & ptTopLeft ) ; ScreenToClient ( & ptBottomRight ) ; rectCaption . left = ptTopLeft . x ; rectCaption . top = ptTopLeft . y ; rectCaption . right = ptBottomRight . x ; rectCaption . bottom = ptBottomRight . y ; } return rectCaption ; }
calculate the rectangular area of the caption at the offset
calculate the rectangular area of the caption at the offset
// check for partially covered up menu, and compensate
 // if it is not a child window
