/** * @file XTPResizeRect.cpp * * @copyright * (c) 1998-2025 Codejock Software, All Rights Reserved. * * This source file is the property of Codejock Software and must not be * redistributed by any means without the explicit written permission of * Codejock Software. * * The use of this source code is governed by the terms and conditions specified * in the Toolkit Pro license agreement. Codejock Software grants you, as a * single software developer, the limited right to use this software on one * computer only. * * Contact Information: * support@codejock.com * http://www.codejock.com * */ #include "stdafx.h" #include "Controls/Resize/XTPResizeRect.h" #include "Common/Base/Diagnostic/XTPDisableNoisyWarnings.h" #ifdef _DEBUG # undef THIS_FILE static char THIS_FILE[] = __FILE__; # define new DEBUG_NEW #endif ////////////////////////////////////////////////////////////////////// // Construction/Destruction ////////////////////////////////////////////////////////////////////// CXTPResizeRect::CXTPResizeRect() { left = top = right = bottom = 0; } ////////////////////////////////////////////////////////////////////// CXTPResizeRect::CXTPResizeRect(XTP_RESIZE l, XTP_RESIZE t, XTP_RESIZE r, XTP_RESIZE b) { left = l; top = t; right = r; bottom = b; } CXTPResizeRect& CXTPResizeRect::operator=(const RECT& rc) { left = (XTP_RESIZE)rc.left; top = (XTP_RESIZE)rc.top; right = (XTP_RESIZE)rc.right; bottom = (XTP_RESIZE)rc.bottom; return *this; } CXTPResizeRect& CXTPResizeRect::operator=(const XTP_RESIZERECT& rrc) { left = rrc.left; top = rrc.top; right = rrc.right; bottom = rrc.bottom; return *this; } CXTPResizeRect& CXTPResizeRect::operator+=(const XTP_RESIZERECT& rrc) { left += rrc.left; top += rrc.top; right += rrc.right; bottom += rrc.bottom; return *this; } CXTPResizeRect CXTPResizeRect::operator&(const XTP_RESIZERECT& rrc) { _ASSERTE(IsNormalized() && ((CXTPResizeRect&)rrc).IsNormalized()); CXTPResizeRect rrcI(__max(left, rrc.left), __max(top, rrc.top), __min(right, rrc.right), __min(bottom, rrc.bottom)); // only intersection if resulting rect is normalized return (rrcI.IsNormalized()) ? rrcI : CXTPResizeRect(0, 0, 0, 0); }