/** * @file XTPResizeRect.h * * @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 * */ /** @cond */ #if !defined(__XTPRESIZERECT_H__) # define __XTPRESIZERECT_H__ /** @endcond */ # if _MSC_VER > 1000 # pragma once # endif // _MSC_VER > 1000 # include "Common/Base/Diagnostic/XTPDisableNoisyWarnings.h" /** * @brief * The XTP_RESIZE data type is defined as a float and is * used for storing single-precision floating point * x- and y- window coordinates. * @see * CXTPResizeRect, XTP_RESIZERECT, CXTPResizePoint, XTP_RESIZEPOINT */ typedef float XTP_RESIZE; /** * @brief * XTP_RESIZERECT structure is used by the CXTPResizeRect class * for defining single-precision floating point coordinates of the * upper-left and lower-right corners of a rectangle. * Example: * The following example demonstrates alternate ways to initialize * an XTP_RESIZERECT structure: *
* XTP_RESIZERECT rc1;
* rc1.left = 20;
* rc1.top = 30;
* rc1.right = 180;
* rc1.bottom = 230;
*
* XTP_RESIZERECT rc2 = {20, 30, 180, 230};
*
* @see
* CXTPResizeRect, XTP_RESIZE
*/
struct XTP_RESIZERECT
{
XTP_RESIZE left; /**< Specifies the x-coordinate of the upper-left corner of a rectangle. */
XTP_RESIZE top; /**< Specifies the y-coordinate of the upper-left corner of a rectangle. */
XTP_RESIZE right; /**< Specifies the x-coordinate of the lower-right corner of a rectangle. */
XTP_RESIZE bottom; /**< Specifies the y-coordinate of the lower-right corner of a rectangle. */
};
/**
* @brief
* CXTPResizeRect is an XTP_RESIZERECT structure derived class. The
* CXTPResizeRect class is similar to an XTP_RESIZERECT structure. CXTPResizeRect
* also includes member functions to manipulate CXTPResizeRect objects and
* XTP_RESIZERECT structures.
* @see
* XTP_RESIZERECT, CXTPResizePoint, XTP_RESIZEPOINT, XTP_RESIZE
*/
class _XTP_EXT_CLASS CXTPResizeRect : public XTP_RESIZERECT
{
public:
/**
* @brief
* Constructs a CXTPResizeRect object.
*/
CXTPResizeRect();
/**
* @brief
* Constructs a CXTPResizeRect object.
* @param rc Refers to the RECT structure with the coordinates for CXTPResizeRect.
*/
CXTPResizeRect(const RECT& rc);
/**
* @brief
* Constructs a CXTPResizeRect object.
* @param rrc Refers to the XTP_RESIZERECT structure with the coordinates for
* CXTPResizeRect.
*/
CXTPResizeRect(const XTP_RESIZERECT& rrc);
/**
* @brief
* Constructs a CXTPResizeRect object.
* @param l Specifies the left position of CXTPResizeRect.
* @param t Specifies the top of CXTPResizeRect.
* @param r Specifies the right position of CXTPResizeRect.
* @param b Specifies the bottom of CXTPResizeRect.
*/
CXTPResizeRect(XTP_RESIZE l, XTP_RESIZE t, XTP_RESIZE r, XTP_RESIZE b);
/**
* @brief
* This operator copies the dimensions of a rectangle to CXTPResizeRect.
* @param rc Refers to a source rectangle. It can be a RECT or CRect.
* @return
* A reference to a CXTPResizeRect object.
*/
CXTPResizeRect& operator=(const RECT& rc);
/**
* @brief
* This operator copies the dimensions of a rectangle to CXTPResizeRect.
* @param rrc Refers to a source rectangle. It can be a XTP_RESIZERECT or CXTPResizeRect.
* @return
* A reference to a CXTPResizeRect object.
*/
CXTPResizeRect& operator=(const XTP_RESIZERECT& rrc);
/**
* @brief
* This operator adds the specified offsets to CXTPResizeRect or inflates
* CXTPResizeRect.
* @param rrc Pointer to an XTP_RESIZERECT structure or a CXTPResizeRect object that
* contains the number of units to inflate each side of CXTPResizeRect.
* @return
* A reference to a CXTPResizeRect object.
*/
CXTPResizeRect& operator+=(const XTP_RESIZERECT& rrc);
/**
* @brief
* This operator adds the given offsets to CRect or inflates CRect.
* @param rrc Pointer to an XTP_RESIZERECT structure or a CXTPResizeRect object that
* contains the number of units to inflate each side of the return value.
* @return
* The resulting CXTPResizeRect object.
*/
CXTPResizeRect operator+(const XTP_RESIZERECT& rrc);
/**
* @brief
* This operator creates the intersection of CXTPResizeRect and a rectangle,
* and returns the resulting CXTPResizeRect.
* @param rrc Contains an XTP_RESIZERECT or a CXTPResizeRect.
* @return
* A CXTPResizeRect that is the intersection of CXTPResizeRect and 'rrc'. The
* intersection is the largest rectangle that is contained in both rectangles.
*/
CXTPResizeRect operator&(const XTP_RESIZERECT& rrc);
/**
* @brief
* This operator determines whether CXTPResizeRect is equal to a rectangle.
* @param rrc Refers to a source rectangle. It can be an XTP_RESIZERECT or a
* CXTPResizeRect.
* @return
* true if equal, otherwise false.
*/
bool operator==(const XTP_RESIZERECT& rrc);
/**
* @brief
* This operator determines whether CXTPResizeRect is not equal to a rectangle.
* @param rrc Refers to a source rectangle. It can be an XTP_RESIZERECT or a
* CXTPResizeRect.
* @return
* true if not equal, otherwise false.
*/
bool operator!=(const XTP_RESIZERECT& rrc);
/**
* @brief
* This operator converts a CXTPResizeRect to a CRect. When you use this
* function, you do not need the address-of (&) operator. This operator
* will be automatically used when you pass a CXTPResizeRect object to
* a function that expects a CRect.
*/
operator CRect();
/**
* @brief
* This member function determines if CXTPResizeRect is normalized.
* @return
* true if normalized, otherwise false.
*/
bool IsNormalized();
/**
* @brief
* This member function calculates the width of a CXTPResizeRect by subtracting
* the left value from the right value. The resulting value can be negative.
* @return
* The width of a CXTPResizeRect.
*/
XTP_RESIZE Width();
/**
* @brief
* This member function calculates the height of a CXTPResizeRect by subtracting
* the top value from the bottom value. The resulting value can be negative.
* @return
* The height of a CXTPResizeRect.
*/
XTP_RESIZE Height();
};
//////////////////////////////////////////////////////////////////////
/** @cond */
AFX_INLINE CXTPResizeRect::CXTPResizeRect(const RECT& rc)
{
(operator=)(rc);
}
AFX_INLINE CXTPResizeRect::CXTPResizeRect(const XTP_RESIZERECT& rrc)
{
(operator=)(rrc);
}
AFX_INLINE CXTPResizeRect CXTPResizeRect::operator+(const XTP_RESIZERECT& rrc)
{
return CXTPResizeRect(left + rrc.left, top + rrc.top, right + rrc.right, bottom + rrc.bottom);
}
AFX_INLINE bool CXTPResizeRect::IsNormalized()
{
return ((left <= right) && (top <= bottom));
}
AFX_INLINE bool CXTPResizeRect::operator==(const XTP_RESIZERECT& rrc)
{
return left == rrc.left && top == rrc.top && right == rrc.right && bottom == rrc.bottom;
}
AFX_INLINE bool CXTPResizeRect::operator!=(const XTP_RESIZERECT& rrc)
{
return !operator==(rrc);
}
AFX_INLINE CXTPResizeRect::operator CRect()
{
return CRect((int)left, (int)top, (int)right, (int)bottom);
}
AFX_INLINE XTP_RESIZE CXTPResizeRect::Width()
{
return right - left;
}
AFX_INLINE XTP_RESIZE CXTPResizeRect::Height()
{
return bottom - top;
}
/** @endcond */
/**
* @brief
* CXTPResizeRect constants used by the CXTPResize class for defining the
* resize attributes for a child in a resizable window.
* XTP_ATTR_RESIZE Resize.
* XTP_ATTR_REPOS Reposition.
* XTP_ATTR_HORRESIZE Horizontal resize.
* XTP_ATTR_HORREPOS Horizontal reposition.
* XTP_ATTR_VERRESIZE Vertical resize.
* XTP_ATTR_VERREPOS Vertical reposition.
* Example:
* The following example demonstrates how to use CXTPResizeRect.
* * // Set control resizing. * SetResize(ID_WIZBACK, XTP_ATTR_REPOS(1)); * SetResize(ID_WIZNEXT, XTP_ATTR_REPOS(1)); * SetResize(ID_WIZFINISH, XTP_ATTR_REPOS(1)); * SetResize(ID_WIZLINE, XTP_ANCHOR_BOTTOMLEFT, XTP_ANCHOR_BOTTOMRIGHT); ** @see * CXTPResize, CXTPResizeDialog, CXTPResizeFormView, CXTPResizeGroupBox, CXTPResizePropertyPage, * CXTPResizePropertySheet, CXTPResizePoint, CXTPResizeRect */ # define XTP_ATTR_RESIZE(x) CXTPResizeRect(0, 0, x, x) /** * @brief * CXTPResizeRect constants used by the CXTPResize class for defining the * resize attributes for a child in a resizable window. * XTP_ATTR_RESIZE Resize. * XTP_ATTR_REPOS Reposition. * XTP_ATTR_HORRESIZE Horizontal resize. * XTP_ATTR_HORREPOS Horizontal reposition. * XTP_ATTR_VERRESIZE Vertical resize. * XTP_ATTR_VERREPOS Vertical reposition. * Example: * The following example demonstrates how to use CXTPResizeRect. *
* // Set control resizing. * SetResize(ID_WIZBACK, XTP_ATTR_REPOS(1)); * SetResize(ID_WIZNEXT, XTP_ATTR_REPOS(1)); * SetResize(ID_WIZFINISH, XTP_ATTR_REPOS(1)); * SetResize(ID_WIZLINE, XTP_ANCHOR_BOTTOMLEFT, XTP_ANCHOR_BOTTOMRIGHT); ** @see * CXTPResize, CXTPResizeDialog, CXTPResizeFormView, CXTPResizeGroupBox, CXTPResizePropertyPage, * CXTPResizePropertySheet, CXTPResizePoint, CXTPResizeRect */ # define XTP_ATTR_REPOS(x) CXTPResizeRect(x, x, x, x) /** * @brief * CXTPResizeRect constants used by the CXTPResize class for defining the * resize attributes for a child in a resizable window. * XTP_ATTR_RESIZE Resize. * XTP_ATTR_REPOS Reposition. * XTP_ATTR_HORRESIZE Horizontal resize. * XTP_ATTR_HORREPOS Horizontal reposition. * XTP_ATTR_VERRESIZE Vertical resize. * XTP_ATTR_VERREPOS Vertical reposition. * Example: * The following example demonstrates how to use CXTPResizeRect. *
* // Set control resizing. * SetResize(ID_WIZBACK, XTP_ATTR_REPOS(1)); * SetResize(ID_WIZNEXT, XTP_ATTR_REPOS(1)); * SetResize(ID_WIZFINISH, XTP_ATTR_REPOS(1)); * SetResize(ID_WIZLINE, XTP_ANCHOR_BOTTOMLEFT, XTP_ANCHOR_BOTTOMRIGHT); ** @see * CXTPResize, CXTPResizeDialog, CXTPResizeFormView, CXTPResizeGroupBox, CXTPResizePropertyPage, * CXTPResizePropertySheet, CXTPResizePoint, CXTPResizeRect */ # define XTP_ATTR_HORRESIZE(x) CXTPResizeRect(0, 0, x, 0) /** * @brief * CXTPResizeRect constants used by the CXTPResize class for defining the * resize attributes for a child in a resizable window. * XTP_ATTR_RESIZE Resize. * XTP_ATTR_REPOS Reposition. * XTP_ATTR_HORRESIZE Horizontal resize. * XTP_ATTR_HORREPOS Horizontal reposition. * XTP_ATTR_VERRESIZE Vertical resize. * XTP_ATTR_VERREPOS Vertical reposition. * Example: * The following example demonstrates how to use CXTPResizeRect. *
* // Set control resizing. * SetResize(ID_WIZBACK, XTP_ATTR_REPOS(1)); * SetResize(ID_WIZNEXT, XTP_ATTR_REPOS(1)); * SetResize(ID_WIZFINISH, XTP_ATTR_REPOS(1)); * SetResize(ID_WIZLINE, XTP_ANCHOR_BOTTOMLEFT, XTP_ANCHOR_BOTTOMRIGHT); ** @see * CXTPResize, CXTPResizeDialog, CXTPResizeFormView, CXTPResizeGroupBox, CXTPResizePropertyPage, * CXTPResizePropertySheet, CXTPResizePoint, CXTPResizeRect */ # define XTP_ATTR_HORREPOS(x) CXTPResizeRect(x, 0, x, 0) /** * @brief * CXTPResizeRect constants used by the CXTPResize class for defining the * resize attributes for a child in a resizable window. * XTP_ATTR_RESIZE Resize. * XTP_ATTR_REPOS Reposition. * XTP_ATTR_HORRESIZE Horizontal resize. * XTP_ATTR_HORREPOS Horizontal reposition. * XTP_ATTR_VERRESIZE Vertical resize. * XTP_ATTR_VERREPOS Vertical reposition. * Example: * The following example demonstrates how to use CXTPResizeRect. *
* // Set control resizing. * SetResize(ID_WIZBACK, XTP_ATTR_REPOS(1)); * SetResize(ID_WIZNEXT, XTP_ATTR_REPOS(1)); * SetResize(ID_WIZFINISH, XTP_ATTR_REPOS(1)); * SetResize(ID_WIZLINE, XTP_ANCHOR_BOTTOMLEFT, XTP_ANCHOR_BOTTOMRIGHT); ** @see * CXTPResize, CXTPResizeDialog, CXTPResizeFormView, CXTPResizeGroupBox, CXTPResizePropertyPage, * CXTPResizePropertySheet, CXTPResizePoint, CXTPResizeRect */ # define XTP_ATTR_VERRESIZE(x) CXTPResizeRect(0, 0, 0, x) /** * @brief * CXTPResizeRect constants used by the CXTPResize class for defining the * resize attributes for a child in a resizable window. * XTP_ATTR_RESIZE Resize. * XTP_ATTR_REPOS Reposition. * XTP_ATTR_HORRESIZE Horizontal resize. * XTP_ATTR_HORREPOS Horizontal reposition. * XTP_ATTR_VERRESIZE Vertical resize. * XTP_ATTR_VERREPOS Vertical reposition. * Example: * The following example demonstrates how to use CXTPResizeRect. *
* // Set control resizing. * SetResize(ID_WIZBACK, XTP_ATTR_REPOS(1)); * SetResize(ID_WIZNEXT, XTP_ATTR_REPOS(1)); * SetResize(ID_WIZFINISH, XTP_ATTR_REPOS(1)); * SetResize(ID_WIZLINE, XTP_ANCHOR_BOTTOMLEFT, XTP_ANCHOR_BOTTOMRIGHT); ** @see * CXTPResize, CXTPResizeDialog, CXTPResizeFormView, CXTPResizeGroupBox, CXTPResizePropertyPage, * CXTPResizePropertySheet, CXTPResizePoint, CXTPResizeRect */ # define XTP_ATTR_VERREPOS(x) CXTPResizeRect(0, x, 0, x) # include "Common/Base/Diagnostic/XTPEnableNoisyWarnings.h" /** @cond */ #endif // !defined(__XTPRESIZERECT_H__) /** @endcond */